formwork-subject-census

command
v0.19.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

formwork-subject-census — a name-anchored rule must still be able to SEE its subject. An anchor that matches no call anywhere in the rule's scope is a gate that reports OK because it has gone blind, not because the invariant holds.

Usage: go run -C tools/formwork-subject-census . <repo-root>

Product enforcement is formwork type:command (.formwork/rules/call-anchor-sees-a-subject.yaml) with origin on this file. Exit 0 = every live anchor resolves, 1 = offenders listed, 2 = usage/env error.

The hole this closes, and the half that was already closed

Six formwork rule types select their subject by NAME, skip whatever the name does not match, and then report nothing — so an empty anchor set is indistinguishable from full compliance (#10517, #15714). The ENGINE closes three of them: formwork's internal/rules/anchor.go AnchorProbe is wired into go/call-order-in-func, go/per-func-count-relation and dart/method-delegates, and emits a scope-wide verdict when the anchor matches nothing. formwork-anchor-census closes the one gap the engine left there, by making per-func-count-relation's optional `require_symbol:` mandatory.

go/call-confined-to-func-name and go/guard-precedes-call carry NO probe. Verified by execution on develop: renaming `LockSQL` and `InsertOrAdoptActive` in the real tree — an ordinary refactor — left page-metrics-lock-sql-confined, page-metrics-advisory-after-page-row and extraction-dispatch-requires-entitlement reporting OK on a whole-tree run, with rules_matching_no_files: 0 confirming they had scanned and simply seen nothing. The last of those three is the entitlement gate on extraction dispatch, retired in total silence.

Why the question is "is there a CALL", not "is there a declaration"

Both analyzers match their anchor against a call SELECTOR — the text at the call site (goast/analyzers.go: `call.selector`). So the faithful question is whether any in-scope call still matches, and asking it on the call plane removes a whole false-positive class that a declaration search cannot avoid: `MethodFunc` and `.GenerateContent` are declared in chi and the genai SDK, outside the repo, where no declaration index reaches — but their call sites are right here in the tree, so on the call plane they resolve as live and need no module resolution at all.

A dead anchor cannot distinguish "renamed" from "feature deleted", and does not need to: in both cases the rule now guards nothing, and both cures — re- anchor it, or retire it — are named in the rule's cure text.

What is deliberately NOT flagged

The BAN IDIOM. A call-confined arm whose `allowed_func` can match no func name at all ("this helper must have no callers anywhere") is satisfied PRECISELY by the symbol matching nothing — zero calls is its compliant end state, not its blind spot. Flagging those would fire on 4 of the 31 call-confined arms in the corpus for being correct. This is the same reason the engine takes per-func-count-relation's require_symbol as an author declaration rather than inferring it.

GATE-TREE-SCOPED arms, on the rationale formwork-vacuity-census's detectorWitnesses already applies: a rule whose whole subject is the gate tree can only ever be witnessed by gate sources, and calling that vacuous would condemn every gate-about-a-gate rule in the corpus.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL