chore(post-#168): architecture-test refactor — read-once + per-name regex + structural-absence-guard docs#171
Merged
Conversation
Architecture test now reads all ~190 files once into a Map and runs each per-name regex against the cached strings, dropping 3040 reads/run to 190. Preserves 16 it() blocks for per-name granular failure reporting. Adds docstring section framing the test as a tripwire (denylist; narrow scope) not a wall — references docs/investigations.md branded-Cpk-type follow-up entry to be added in T5. Refs investigations.md "Pre-existing tsc errors deferred from PR #168" (vitest worker-timeout sub-item). Co-Authored-By: ruflo <ruv@ruv.net>
Documents the denylist/CI-grep pattern used by architecture.noCrossInvestigationAggregation.test.ts (ADR-073) and scripts/check-level-boundaries.sh (ADR-074). Covers when to use, when not to use, implementation pattern (read-once cache + per-name regex), honest framing of denylist limits, and pointer to the branded-type durable-answer follow-up in investigations.md (added in T5). Refs investigations.md "Pre-existing tsc errors deferred from PR #168" (vitest worker-timeout sub-item). Co-Authored-By: ruflo <ruv@ruv.net>
…ed-Cpk follow-up entry - .claude/rules/testing.md: add line pointing to the new architecture-test docs section. - docs/investigations.md: new entry "Branded Cpk type as durable replacement for forbidden-name guard". Resolves forward references from T2's test docstring and T4's docs section. Proposes opaque-type pattern mirroring ProcessHubId from PR #168; estimated scope and promotion path included. Refs investigations.md "Pre-existing tsc errors deferred from PR #168" (vitest worker-timeout sub-item). Co-Authored-By: ruflo <ruv@ruv.net>
T2 refactored the test to read-once + per-name regex (commit 06d2638), eliminating the file-IO pattern that caused the flake under turbo concurrent load. The retry-once workaround is now redundant and removed: - docs/05-technical/implementation/testing.md: anti-pattern note no longer references the deleted feedback_pr_ready_check_retry_on_grep_test memory; updated to credit the fix commit and note no retry is needed. - Out-of-repo system cleanup (not in this commit): - Deleted ~/.claude/projects/.../memory/feedback_pr_ready_check_retry_on_grep_test.md - Removed corresponding MEMORY.md index entry (line 75) Keeps the hooks/index.test.ts known-flake line in .claude/rules/testing.md intact (different root cause — import/env time, not file IO). Co-Authored-By: ruflo <ruv@ruv.net>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the architecture-grep test flake at its algorithmic source: 16 forbidden-name checks were re-reading ~310 source files each (~5000 sync reads per run) and exceeding the 5s vitest timeout under turbo concurrent load. Now reads files once at setup and scans the in-memory cache per name.
06d2638a) —refactor(core): read-once + alternation in architecture-grep test.beforeAllpopulates aCachedFile[]once; each of 16it()blocks runs its whole-word regex against the cache. Same 16 forbidden names, same scope, per-name failure granularity preserved. Test docstring extended with "tripwire, not a wall" framing — denylist limits called out explicitly, durable answer (brandedCpktype) cross-referenced.1a9f7b46) —docs(testing): add architecture-test (structural-absence guard) section. New ~134-line section indocs/05-technical/implementation/testing.mddocumenting the pattern: when to use, when NOT, implementation (with TS code snippet matching this PR's post-refactor test + bash snippet forscripts/check-level-boundaries.sh), anti-pattern (the 3040-reads cost the original test paid), explicit limits (denylist not allowlist, substring grep, narrow scope, maintenance burden).14f9ca79) —docs(testing+investigations): add architecture-test cross-ref + branded-Cpk follow-up entry. (a).claude/rules/testing.md+1 line pointing to the new docs section. (b)docs/investigations.md+60 lines new entry "Branded Cpk type as durable replacement for forbidden-name guard" — proposes opaque-type pattern mirroringProcessHubIdfrom PR chore(post-8f): cleanup cluster — setState fix + ProcessHubId brand + Canvas decomposition + tsc hygiene #168 (packages/core/src/processHub.ts), 4–8 task estimated scope, ADR-amendment promotion path. Final-review amend tightened forward-reference numbers (~310 files / ~5000 reads) and aligned the 3-surface cross-references.9c411ab9) —chore(testing): remove retry-once workaround for architecture-grep flake. In-repo: one line intesting.md(cross-ref to deleted memory replaced with credit to fix commit). Out-of-repo: deletedfeedback_pr_ready_check_retry_on_grep_test.mdmemory + itsMEMORY.mdindex line. Preserved thehooks/index.test.tsknown-flake line in.claude/rules/testing.md(different root cause, unfixed).Performance
~5-6× faster isolated; full turbo
pnpm testcompletes architecture-grep test in 623ms (was hitting 5s timeout pre-fix). Adding name #17 doesn't change the cost curve (single cache pass, per-name regex on cached strings).What this PR explicitly does NOT do
Cpk-type future investigation indocs/investigations.mdis the durable answer, not this PR.packages/hooks/src/__tests__/index.test.tsflake. Different root cause (import/env time, not file IO) —.claude/rules/testing.mdretains its known-flake line for that test.@variscout/coreonly).Pre-existing issue surfaced during review (NOT a PR B blocker)
apps/azure/src/features/investigation/__tests__/useCanvasViewportLifecycle.test.tsthrowsDatabaseClosedError: IndexedDB API missing(9 unhandled rejections in vitest teardown). Verified pre-existing onorigin/main. Likely fix:import 'fake-indexeddb/auto'inapps/azure/src/setupTests.ts. Should be filed as a newdocs/investigations.mdentry — out of scope here.Plan:
~/.claude/plans/how-should-we-handle-generic-sonnet.md(PR B section).Test plan
pnpm --filter @variscout/core exec vitest run architecture.noCrossInvestigationAggregation— 16 tests pass in 54-58msexport const aggregateCpk = 0;triggers failure namingaggregateCpk+ file path; removal restores greenpnpm testfull turbo — architecture-grep completes in 623mspnpm --filter @variscout/core exec tsc --noEmit— 0 errorspnpm docs:check— green🤖 Generated with ruflo