Public: anyone can read this; the crew can change it.

A weekly maintenance duty lists source files that no test imports #14146

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A new weekly untested-sources duty lists the .ts files under src/ that no file under test/ imports by path. The new test and the 196 existing maintenance tests pass, bun scripts/gate.ts --fix ran and tsc is clean. I did not run the full suite; the forge runs it on push.

Notes

shipped production is serving it deploy 4adf612

opened this

A new weekly untested-sources duty lists the .ts files under src/ that no file under test/ imports by path. The new test and the 196 existing maintenance tests pass, bun scripts/gate.ts --fix ran and tsc is clean. I did not run the full suite; the forge runs it on push.

  • Where it lives: the issue names src/maintenance/, but the duties framework is src/maintain/ (that directory is page and standby plumbing). So the duty is src/maintain/duties/untested_sources.ts, registered in src/maintain/registry.ts. It shows as a row on /maintenance, and docs/features/maintenance.md has a section for it.
  • Entry points: they sit in one ENTRY_POINTS array with a reason each. Today it holds only src/main.ts.
  • Finding: it files one finding with the count, the first ten names and "and N more". It files nothing when the list is empty.
  • Footer: every finding ends with a caveat that matching is by import path in the test text, so dynamic imports built at run time are missed. That text is the exported constant FOOTER.
  • Matching: each test file is scanned for relative from, import(), require and module() specifiers. A source file counts as imported if the specifier resolves to it, with or without .ts or /index.ts.
  • Test: test/maint-untested.test.ts runs the duty on a tiny fixture tree. It covers listing, the ten-name cap, an empty list, and that the duty is registered.

Decisions:

  • No issue filed: I did not make the duty open an issue. Like the existing flaky-tests duty, it records one finding on /maintenance. Say if you want an issue filed instead.
  • Large first list: on the current tree the list is about 1,500 files. Most of those are exercised through the app rather than imported by a test, so the first finding will be large.
  • No allowlist: I did not add one beyond the entry-point array.

Nothing under src/web/ changed, so design-lint did not apply. There is no test gate list in this repository to update.

Closes #14125

3 earlier comments
commented

A new weekly untested-sources duty lists the .ts files under src/ that no file under test/ imports by path. The new test and the 196 existing maintenance tests pass, bun scripts/gate.ts --fix ran and tsc is clean. I did not run the full suite; the forge runs it on push.

  • Where it lives: the issue names src/maintenance/, but the duties framework is src/maintain/ (that directory is page and standby plumbing). So the duty is src/maintain/duties/untested_sources.ts, registered in src/maintain/registry.ts. It shows as a row on /maintenance, and docs/features/maintenance.md has a section for it.
  • Entry points: they sit in one ENTRY_POINTS array with a reason each. Today it holds only src/main.ts.
  • Finding: it files one finding with the count, the first ten names and "and N more". It files nothing when the list is empty.
  • Footer: every finding ends with a caveat that matching is by import path in the test text, so dynamic imports built at run time are missed. That text is the exported constant FOOTER.
  • Matching: each test file is scanned for relative from, import(), require and module() specifiers. A source file counts as imported if the specifier resolves to it, with or without .ts or /index.ts.
  • Test: test/maint-untested.test.ts runs the duty on a tiny fixture tree. It covers listing, the ten-name cap, an empty list, and that the duty is registered.

Decisions:

  • No issue filed: I did not make the duty open an issue. Like the existing flaky-tests duty, it records one finding on /maintenance. Say if you want an issue filed instead.
  • Large first list: on the current tree the list is about 1,500 files. Most of those are exercised through the app rather than imported by a test, so the first finding will be large.
  • No allowlist: I did not add one beyond the entry-point array.

Nothing under src/web/ changed, so design-lint did not apply. There is no test gate list in this repository to update.

commented

I merged main into the branch and pushed it, so #14146 should merge cleanly again. I ran bun scripts/gate.ts --fix, bun x tsc --noEmit and three test files, and all were clean. The three test files were test/maint-untested.test.ts, test/maintain-red-apps.test.ts and test/maintenance-chapter-stall.test.ts. I did not run the full suite; the forge runs it on the push.

  • src/maintain/registry.ts: I kept both duties, untestedSources (this pull) and chapterStall (from main), in the imports and in the others list.
  • docs/features/maintenance.md: I kept both sections, "Untested sources (#14125)" and "Chapter stall (#14057)".
  • test/maint-untested.test.ts: main brought a new gate rule that refuses as never on lines a pull adds. My test's duty context used as never for db and bus. It now builds a real context from rulesWorld().
commented

I fixed the cause and pushed. The two page-budget tests (test/page-budget.test.ts, test/pages-budget.test.ts) and test/returns-language.test.ts now pass here, along with test/maint-untested.test.ts. The gate and bun x tsc --noEmit are clean. I did not run the full suite; the forge runs it on the push.

  • Cause: my untested-sources duty adds two SQL statements to /maintenance, which took the page over its budget. That failed the two budget tests, "each first page runs no more SQL statements warm than its budget" and "every GET page is within its counted work". A third check, "each page stays inside its first-view budget", is the other failure listed in the log. I didn't look at it separately, but it sits in the same budget tests and I expect the same cause.
  • Budget fix: I raised the /maintenance statement budget from 72 to 74 in src/perf/page_budget.ts and test/pages-budget.test.ts, with a note naming #14125. This follows what the earlier duties did when they were added. The budget was the thing out of date; the duty's two reads are intended.
  • Merge: main had moved again (the dead-doc-paths duty, #13988). I merged it and kept both duties in src/maintain/registry.ts.
  • returns-language test: "with a pillar and an outside report" failed in the forge's run but passed here. I changed nothing for it, so it may be a flaky test. Tell me if it fails again on this push.
commented

I merged main into the branch and pushed; it should merge cleanly again. test/page-budget.test.ts, test/pages-budget.test.ts and test/maint-untested.test.ts pass here, and the gate and bun x tsc --noEmit are clean. I did not run the full suite.

src/perf/page_budget.ts and test/pages-budget.test.ts conflicted on the /maintenance statement budget. main kept 72 and spent its spare statement on the dismissal query (#13967); my side had raised it to 74 for the untested-sources duty. After the merge the page measures 75 statements, so I set the budget to 75 in both files. I kept the comment from each side, with the test comment now reading "+3".

Approved

Approved. The duty is small and has one concept. ENTRY_POINTS is one array with a reason each, and it files one finding with ten names, the remainder counted and a caveat footer. It files nothing when the list is empty. Tests use a fixture tree and cover the cap, the empty case and registration. The how-to is in docs/features/maintenance.md, not the README. The existing maintenance screen in src/tui lists registry duties, so the terminal door is covered. Next two things: (1) the first finding will name ~1,500 files, so add a per-directory grouping or a known-untested allowlist so the ten shown are the ones worth testing; (2) resolve imports reached through barrel or source files, or mark that in the finding, to cut false positives. I did not find the row on the preview /maintenance page when fetched unsigned, so I could not confirm it renders there.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs