Files
member-console/scripts/deadcode-testonly.txt
cgalo5758 abb438bc71 Check a form declaration through named rule groups
CheckInvariants ran every rule of a form declaration in one function
that gocognit scored 139. It now keeps its signature and its problem
recorder and calls checkKindAndFamily, checkFamilyScope (which calls
checkRowsScope), checkRoutes and checkWayOut, then the no-fields rule,
then per field the no-name rule, checkFieldOrder, checkFieldStructure
(which calls checkFieldPlacement and checkFieldWidth) and
checkFieldCopy (which calls checkEscapeHatch and checkFieldDashes), and
finally checkFormDashes. Each takes the recorder as addFunc. Every
message and condition is unchanged and the rules run in the order they
did; the two checkbox conditions became one, and the Select-or-Radio
test is one local. The exclusion rule for CheckInvariants is deleted.
Measured scores: CheckInvariants 5, checkFieldStructure 17,
checkFamilyScope 13, checkFieldCopy 13, checkWayOut 8, checkRowsScope 7,
checkRoutes 7, checkFieldDashes 6, checkKindAndFamily 5, checkFieldWidth
5, checkEscapeHatch 4, checkFieldOrder 3, checkFieldPlacement 3,
checkFormDashes 3.

Three things differ from the parent, none visible in a registered form:
- The two dash checks range over ordered slices. Their maps gave a
  field's problems in map order, so the slices' order is one of the
  orders the maps could give, and the registry test's failures now come
  out in a fixed order. Each test is still strings.Contains(value, "—").
- The escape hatch's keys are checked in sorted order. A field with two
  refused keys gave its two problems in map order; they now come out in
  key order. No registered form carries a refused key.
- ownedAttrs and its message "the field %q escape hatch carries %q,
  which the part owns" are deleted. A key reached that branch only after
  the data-/hx- prefix test, and no key of the map has either prefix, so
  no input reached it; the prefix rule already refuses all of them. The
  escape hatch's comment says why the hatch is narrow.

The "steps wider than a half" branch of the width rule stays; no control
reaches it today.

scripts/deadcode-testonly.txt gains 13 entries for the new helpers,
which only CheckInvariants calls and only tests call CheckInvariants.
TestInvariantsEscapeHatchProblemsComeInKeyOrder is new: it checks, 20
times, that a field whose escape hatch carries style and class gets two
problems with the class one first.

No output change. Shown so:
- go test over ./internal/forms, ./internal/server and
  ./internal/integrations/... gives 2144 test names and results at the
  parent, 2145 here; the only difference is the new test. None fail,
  one is skipped on each side. No golden file changed, so the message
  golden, the HTML goldens and the parse goldens read the same text.
- The new test fails at the parent in 3 of 3 runs, because a two-key map
  ranges from the key written first most of the time, and passes here in
  20 runs of 20 iterations each.
- invariants.go's string literals are equal apart from the 21 attribute
  names and the message of the deleted map, and the import paths "maps"
  and "slices".
- 20 break records (16 on the new side, 15 on the old; four dash and
  way-out records are written once per side because their text moved,
  and the sorted-keys record is new side only) are all caught by the
  existing message golden, and the sorted-keys one by the new test.
- go run . lint prints the same line (91 routes, 53 URL refs), the lint
  snapshot gains and loses nothing, and scripts/deadcode.sh is clean.

Not probed: the 46 messages' words beyond what the equal literal set
shows; the deleted branch, which no input reached.
2026-10-11 17:01:12 -05:00

63 lines
3.8 KiB
Plaintext

# Production functions that only tests reach, one per line:
#
# <package path>.<Func> # reason (owner)
#
# The package path is relative to the module path, as in
# internal/domains.WithEvidenceLookup. A method is <package path>.<Type>.<Method>.
# An entry ending in .* covers a whole package and names it a test-support
# package: scripts/sqlc-unused counts a query call from it as a test use. A
# function that is reachable from a program, or that no longer exists, fails
# scripts/deadcode.sh, so an entry leaves with the code it covers. The owner
# is the issue or step of #166 that removes the entry; "permanent" marks
# entries no change removes.
# Test-support packages, by design.
internal/integration/transporttest.* # fake transport for the integration contract's tests (permanent)
internal/stripetest.* # Stripe backend mock and its fixtures (permanent)
internal/integrations/discourse/discoursetest.* # fake Discourse server (permanent)
internal/testkit.* # helpers every test package shares (permanent)
internal/testkit/dbtest.* # helpers every database test shares (permanent)
internal/testkit/htmltest.* # HTML parsing and selection every render test shares (permanent)
internal/testkit/golden.* # golden files and the normaliser every golden test shares (permanent)
internal/testkit/replay.* # replaying and recording the Temporal histories every workflow package keeps (permanent)
internal/testkit/world.* # the builder every fixture shares (permanent)
internal/testkit/authtest.* # signed-in sessions every handler test shares (permanent)
internal/integrations/fedwiki/fedwikitest.* # FedWiki's fixtures, shared by its three packages' tests (permanent)
test/e2e/browsertest.* # browser session helpers for the walkthroughs (permanent)
# By design.
internal/domains.WithEvidenceLookup # the test seam for DNS lookups (permanent)
internal/forms.FamilyFor # the form registry's checks, which tests run over every registered form (permanent)
internal/forms.CheckInvariants # same (permanent)
internal/forms.isFormMethod # same (permanent)
internal/forms.isSentence # same (permanent)
internal/forms.contentWords # same (permanent)
internal/forms.hintRestatesLabel # same (permanent)
internal/forms.checkKindAndFamily # same (permanent)
internal/forms.checkFamilyScope # same (permanent)
internal/forms.checkRowsScope # same (permanent)
internal/forms.checkRoutes # same (permanent)
internal/forms.checkWayOut # same (permanent)
internal/forms.checkFieldOrder # same (permanent)
internal/forms.checkFieldStructure # same (permanent)
internal/forms.checkFieldPlacement # same (permanent)
internal/forms.checkFieldWidth # same (permanent)
internal/forms.checkFieldCopy # same (permanent)
internal/forms.checkEscapeHatch # same (permanent)
internal/forms.checkFieldDashes # same (permanent)
internal/forms.checkFormDashes # same (permanent)
internal/forms.All # same (permanent)
internal/forms.ActionTriggers # same (permanent)
internal/forms.Routes # same (permanent)
internal/lint.Routes # the route table the forms registry test reads (permanent)
internal/lint.Route.IsMutation # same (permanent)
# Owned: removed by the step or issue named in the parentheses.
internal/httplimit.IsTooLarge # no production caller yet (#146)
internal/integrations/fedwiki/workflows.DeleteWorkflowID # superseded by generation-suffixed ids and still built by tests (#165)
internal/integrations/fedwiki/workflows.SetStatusWorkflowID # same (#165)
internal/integrations/fedwiki/workflows.SwapWorkflowID # same (#165)
internal/server.MemberDomainsHandler.startClaimVerification # a copy of FedWiki's claim glue whose test helpers 14 server test files share (#165)
internal/server.MemberDomainsHandler.claimErrorMessage # same (#165)
internal/workflows/desiredstate.DeliveryStates # a reader with no page yet (#171)