Files
member-console/scripts/deadcode-testonly.txt
T
cgalo5758 1f0c697387 Check the shell through the HTML query helper
internal/testkit/htmltest parses rendered HTML and selects from it with CSS
selectors (Parse and ParseIn, One, All, Count, None, Text, Texts, Attr,
HasClass, HTML, Before, InOrder), on golang.org/x/net/html and
github.com/andybalholm/cascadia, which joins go.mod as a direct requirement
(BSD-2-Clause, pure Go, depending only on x/net). A page, which opens with a
doctype or an html element, parses as a whole document, so the attributes of
its html and body elements are kept; any other body parses as a fragment, a
table row under a tbody, an option under a select and anything else under a
body. Both parse with scripting off, so what a noscript holds is elements
that selectors reach, as a browser without JavaScript renders it. Its own
tests: the fragment context for tr and option, the attributes of html and
body, the content of noscript, One's failure message naming the selector,
None, Text, selection by attribute and role, Before, and InOrder. The import
guard gets a row for it, and scripts/deadcode-testonly.txt an entry.

harness_test.go gains the shell assertions both surfaces share, exported for
server_test: the top bar, the account menu, the Identity and Access handoff,
the drawer and the rail's account block. member_nav_test.go and
operator_sidebar_render_test.go select regions by landmark and ARIA
(nav.navbar[aria-label=Account], aside#app-rail, the account group's
aria-labelledby list) and controls by attribute
([data-form="shell.confirm"], the button posting to /logout) instead of
regionBetween, topBarRegion, railRegion and sidebarRegion, read aria-current
on each member rail entry and on both surface switches, check order through
InOrder, and keep a class assertion only where the class is the fact.
sidebarSections selects the entry list instead of slicing the rail string,
and sidebarLinkActive reads the link node instead of matching a regular
expression. The page subtests of TestShellAccountMenu and
TestShellMemberRail call named functions (checkAccountMenuPage,
checkMemberRail); every test and subtest name is unchanged.

Each ban and each count keeps the region the old one covered, or a wider
one; a check that an element is present looks where the element belongs,
such as the trigger and the Get help order in the bar and the entries in the
rail, which is narrower than the body the old strings searched and stricter.
A bar, a rail or a page the old tests searched as a string is searched as
markup (Node.HTML) where the old string covered the element's own tag, the
html and body start tags, or an attribute: the rail's d-lg-none count,
app-rail-signout, d-none d-lg-flex, the identity tooltip, the operator
rail's nav-link count and its ps-4, group and /logout bans, text-danger,
navbar-collapse, the handoff explanation, mt-2 pt-2 border-top, and the
bar's bans over everything before the rail. Counts that were page-wide stay
page-wide: the account menu (any tag), the Get help item, the Operator panel
switch, the dismiss control, the hx-post="/logout" controls (counted as
markup, so data-hx-post counts), the bans on href="/logout" (markup, so any
attribute ending in href counts) and the account-console links; those inside
the rail are counted over the whole rail before they are placed in the
account group: the group's name and email spans, its list, the Identity and
Access, Sign out and Get help entries. The Dashboard link count and the
Operator link ban also run over the page's markup, the drawer's two lists
are counted by class prefix as well, and nothing before the account group
reads Sign out. Where the old tests pinned an element's class as an exact
string, the new ones compare its class token set exactly (AssertClassSet),
which ignores token order only; the checks that were prefixes or regular
expressions stay HasClass or class selectors, and an active operator entry
must still carry nav-link. aria-current appears on the active rail entry and
nowhere else in the member rail, and on neither surface switch nor the
account group's entries. Sign out, Get help and the account group's name and
email stay plain text, the trigger's one child is its label span, the menu
header's children are the line break and the email span, and the line break
follows the name. The closing </main> check stays a text check, since a
parser closes the element anyway.

One weakening is general: a markup change that alters no asserted fact no
longer fails, such as an attribute added to an element the old tests matched
as a whole markup string (a data attribute on Sign out, say), a wrapper, or
a decorative child the comments do not exclude. No specific fact is kept
weaker.

The four gocognit exclusions of TestShellAccountMenu, TestShellMemberRail,
TestShellRailAccountBlock and TestOperatorShellTopBarAndDrawer are gone; the
lint reports nothing in their place.

124 breaks: 118 failed the old and the new shell tests (the template and
code changes that move, drop or mislabel each asserted element; an untitled
Get help item in the bar, the drawer's header and the rail; a Log out title
on the brand link; an extra class on Sign out, on the email span, on the
switch's li and on the page title; a missing class on the rail or on an
account entry's li; a button among the rail's entries; a surface label, a
Get help link or a danger Dashboard link between the bar and the rail; a
logout button in the drawer's header or a logout form among its entries; the
tooltip on the li or on the account trigger; an Operator panel label for a
member without the role; a noscript holding a second main, a Dashboard link
or a Sign out link to /logout; a data-hx-post Sign out in the content or the
menu, and a data-href to /logout; aria-current on a surface switch or on
Identity and Access; an active Billing entry without nav-link; a second
account-console link or Identity and Access item; an element inside Sign
out, the trigger, the menu header or the group's name; a class on the rail's
own tag, on the html or body tag, or a second element where the old string
counted one: the account menu, Get help, the Operator panel switch, a plain
Sign out, the group's name and email, its list; a Sign out button before the
account group on either surface; a Dashboard or an Operator link with a
decorative child in the content; a third nav list; a bar without its navbar
class), and 6 on the helper's own tests have no old side. The names and
results of internal/server equal the parent's; new tests:
TestParseKeepsRowsAndOptionsThatABodyContextDrops,
TestParseKeepsTheAttributesOfHtmlAndBody, TestParseSelectsInsideNoscript,
TestOneFailureNamesTheSelector,
TestNoneFailureNamesTheSelectorAndQuotesTheMatch,
TestTextCollapsesWhitespaceAndSelectsInDocumentOrder,
TestSelectionByAttributeAndRole, TestBeforeHoldsWhatPrecedesTheMatch and
TestInOrder in htmltest, and the guard's htmltest subtest.
2026-10-08 00:52:30 -05:00

48 lines
3.0 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. 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)
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.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/entitlements.RuleChangeCommit # the tests' entry point to the rule-change commit (#166 step 5)
internal/entitlements.DrainObligation # the tests' entry point to the obligation drain (#166 step 5)
internal/httplimit.IsTooLarge # no production caller yet (#146)
internal/integration.LifecycleAnswerKind.String # no production caller (#166 step 6)
internal/integration.LifecycleAnswer.Accepted # no production caller (#166 step 6)
internal/integration.LatestGenerations # no production caller (#166 step 6)
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)