Repository navigation
refactor(layering): R83 forbids package exports that publish test support - #3645
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Size Report
Startup median (7 runs, lower is better):
|
|
At 4fffafe, five open P2 review threads still apply and should be fixed before merge; they are listed below. The Repo Guards, Coverage, Typecheck and Lint checks were still queued when I looked, so CI has not shown an outcome yet. The next step is to fix those threads and answer the ownership question below. Not blocking, and you can take or leave these: Could R83 measure its offender set at the merge-base through On the open threads, the six cubic-dev-ai threads still apply: five at P2 and one at P3. The P2 ones cover wildcard exports (#3645 (comment)), the skipped listed entries (#3645 (comment)), the types-only test fixture (#3645 (comment)), the single resolved target (#3645 (comment)) and the I did not run check:layering or the new tests, and I did not confirm that the list matches the tracked manifests. I also did not check whether the new consumer ban fires on current production code, or reproduce the planted |
4fffafe to
b962458
Compare
|
Addressed in b962458.
|
|
The PR is ready. The earlier gaps are fixed at b962458: export targets are now judged across every condition and expanded Not blocking: you can take or leave two cleanups. First, Of the earlier inline threads, all seven are fixed at this head, so the author can resolve them. The P2 threads cover wildcard expansion (#3645 (comment)), the deleted burn-down file (#3645 (comment)), every export condition being judged (#3645 (comment)), the import-site check (#3645 (comment)) and Both Smoke Tests jobs are still queued or running, and none has failed. The diff only touches |
b962458 to
d9bdf9d
Compare
|
The PR is ready at d9bdf9d. Since the earlier review at b962458, the delta only touches scripts/layering/platform-package-policy.ts, and it looks right: Not blocking: the narrowed |
Every exports target of every workspace package except test-kit must be a production module: not a fixture, fake, mock, harness, __tests__ or testing/ entry, judged by key and by target. Today's 122 offenders are a shrink-only burn-down list; a new offender and a stale entry both fail. The consumer-side ban (production source importing a test-only export or test-kit) moves into the R11 import walk and replaces TEST_ONLY_FIXTURE_SUBPATHS, the ./testing/ namespace check and R13's ANDROID_TEST_ONLY_SUBPATHS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…production predicate R83's offender set is now a merge-base ratchet measured through mergeBaseRatchets (no hand-kept list to append to), wildcard exports are expanded against the tracked package files, and the consumer ban judges every export condition. isProductionSourceFile in tracked-sources owns production versus test support for the layering scans, R11's test-only import ban and R13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r test-host rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d9bdf9d to
0cb9ab0
Compare
|
What
R83
package-export-surfacemeasures its offenders against the merge-base and keeps no list: 99 test-only exports at head against 99 at the merge-base (daemon 80, capture-kit 6, and 13 across eight other packages). R11's devDependency support for test-file imports (what lets the daemon's@agent-device/proxydependency flip todevDependencies) is carried by #3659, the next layer in this stack.No workspace package except
@agent-device/test-kitmay publish test support inexports. A package's tests live beside the module they test; fixtures one package uses stay inside it; fixtures shared across packages go totest-kit.<package> <export key>) is measured at the merge-base throughmergeBaseRatchetsand at head by the same function. An offender at head that the merge-base did not publish fails; a cleanup needs no edit, and nothing sits above what main holds. The check's output reports99 test-only export(s) remain against 99 at the merge-base.types,import,default, nested), expanding*patterns against the tracked package files. It flags fixtures (*.fixtures.ts,*.fixture.ts,*-fixture*.ts,fixtures.ts),__tests__/,testing/,test/,*.test.*/*.spec.*, and keys or paths withfixture(s),fake(s),mock(s),stub(s),harness,test-support,test-host. Production names that merely mention test (./test-command,./session-test-*,./android-clipboard-support) are pinned as accepted.isProductionSourceFileintracked-sources.tsowns "is this production source": TypeScript under rootsrc/or a packagesrc/, minus__tests__/andtest/trees,*.test.*/*.spec.*,*.fixtures.*and test-kit. The layering scans, the eager-closure reader, R11's consumer ban and R13 all call it;isTestSupportFile,isTestConsumerFileand R13'sisProductionSource/isNonProductionConsumerare deleted. It has its own table test. Side effect: fixtures and test-kit leave the layering scans (1880 → 1800 files), sotest-kitleavesUNRANKED_ZONESand the gateway fixtures row leavesROOT_MODULE_ZONES.vi.mockscan) and checks all condition targets: production source may not import a test-only export or@agent-device/test-kit.test/andscripts/are not production sources.TEST_ONLY_FIXTURE_SUBPATHS, the./testing/namespace check and R13'sANDROID_TEST_ONLY_SUBPATHS(R13 leaves test-only subpaths to R83 and filters them from its exact-export comparison).Seed at head (99, re-measured at the merge-base after the daemon test relocations)
./testing/*, incl../testing/server/daemon-runtimeand./testing/daemon-command-registry)#3647 and #3650 drop only production
replay-port/session-journalexports (session-test-*,session-event-*), none of them R83 offenders, so the seed is unaffected.Evidence
package-export-surface.test.tsplants 22 test-support shapes and 7 look-alike production shapes; fixtures intypesonly, indefaultonly and in a nested condition; string-valued and missingexports; wildcards with and without a matching fixture file; ratchet growth, cleanup, moved file, renamed key and a brand-new package; and the consumer ban at root and package sites (including.spec, fixtures files,scripts/)../*→./src/*.tspluspackages/kernel/src/planted.fixtures.ts;check:layeringnamed it under R83. Reverted.pnpm check:quick,check:layering(361 node tests),check:fallow,check:gate-manifest,check:affected --run, repo-widepnpm format.package-boundaries.test.ts) edit in the same PR that drops the export.🤖 Generated with Claude Code