diff --git a/specification/loops/dk5xvv-shared-check-imports/loop.json b/specification/loops/dk5xvv-shared-check-imports/loop.json new file mode 100644 index 00000000000..85de0fc0574 --- /dev/null +++ b/specification/loops/dk5xvv-shared-check-imports/loop.json @@ -0,0 +1,65 @@ +{ + "name": "dk5xvv-shared-check-imports", + "goal": "Prove tracked ESLint and Desktop modules resolve in both snapshots, completion configuration receives a known classification, and genuinely missing imports still fail.", + "createdAt": "2026-12-01T10:16:36.691Z", + "updatedAt": "2026-12-01T10:36:23.288Z", + "template": "bug-fix", + "templateLineage": ["bug-fix"], + "enforceOrder": true, + "regressionCommits": 1, + "steps": [ + { + "id": "spec", + "title": "Identify the failing behavior, expected behavior, and reproduction.", + "status": "complete", + "completedAt": "2026-12-01T10:18:47.764Z", + "evidence": "Saved t2m0n5 0f6472cf and h12bs4 31ba9dca receipts report pre-#629 uncertainty. Current graph resolves ESLint and Desktop paths. Completion JSON falls through as other and should report global policy changes." + }, + { + "id": "coverage", + "title": "Explain why existing standardized tests missed the bug; name the scenario, fixture, lifecycle or assertion gap and reusable test change.", + "status": "complete", + "completedAt": "2026-12-01T10:18:48.904Z", + "evidence": "Extend the classify-path example to cover the completion policy and exercise the reported ESLint and Desktop path patterns in the existing import-link cases. Existing queue removal case still validates genuine broken imports." + }, + { + "id": "red", + "title": "Strengthen the existing standardized test; commit it before repair, run it failing with loop record --phase red, and preserve the assertion.", + "status": "complete", + "completedAt": "2026-12-01T10:20:04.010Z", + "evidence": "4a98f1d32a. Classifies paths by workspace and repository rules received other where global was expected. Both import-link cases passed on current main." + }, + { + "id": "implement", + "title": "Implement the smallest repair without weakening the regression test.", + "status": "complete", + "completedAt": "2026-12-01T10:20:05.454Z", + "evidence": "Classify the completion manifest with other repository-wide policy files so its changes report the actual breadth." + }, + { + "id": "green", + "title": "Rerun the same unchanged regression test at a separate fix commit with loop record --phase green; preserve passing proof.", + "status": "complete", + "completedAt": "2026-12-01T10:36:23.288Z", + "evidence": "The unchanged focused Vitest command passed at b65f62ccd1. Its red checkpoint at 4a98f1d32a failed on other versus global for the completion manifest." + }, + { + "id": "siblings", + "title": "Run harness loop siblings to record the root cause and evaluate the same pattern across committed source.", + "status": "pending" + }, + { + "id": "verify", + "title": "Run relevant project checks and affected UI browser flows with fresh inspected screenshots and no unexpected browser errors; preserve diagnostics and keep pending until proof passes.", + "status": "pending" + } + ], + "evaluators": [ + { + "id": "check", + "title": "Run the project check script.", + "command": "bun run check --item dk5xvv", + "step": "verify" + } + ] +} diff --git a/specification/loops/dk5xvv-shared-check-imports/trace.ndjson b/specification/loops/dk5xvv-shared-check-imports/trace.ndjson new file mode 100644 index 00000000000..231cf55128e --- /dev/null +++ b/specification/loops/dk5xvv-shared-check-imports/trace.ndjson @@ -0,0 +1,6 @@ +{"event":"loop.created","timestamp":"2026-12-01T10:16:36.691Z","name":"dk5xvv-shared-check-imports","goal":"Prove tracked ESLint and Desktop modules resolve in both snapshots, completion configuration receives a known classification, and genuinely missing imports still fail.","template":"bug-fix","templateLineage":["bug-fix"]} +{"event":"step.completed","timestamp":"2026-12-01T10:18:47.764Z","loop":"dk5xvv-shared-check-imports","step":"spec","evidence":"Saved t2m0n5 0f6472cf and h12bs4 31ba9dca receipts report pre-#629 uncertainty. Current graph resolves ESLint and Desktop paths. Completion JSON falls through as other and should report global policy changes."} +{"event":"step.completed","timestamp":"2026-12-01T10:18:48.904Z","loop":"dk5xvv-shared-check-imports","step":"coverage","evidence":"Extend the classify-path example to cover the completion policy and exercise the reported ESLint and Desktop path patterns in the existing import-link cases. Existing queue removal case still validates genuine broken imports."} +{"event":"step.completed","timestamp":"2026-12-01T10:20:04.010Z","loop":"dk5xvv-shared-check-imports","step":"red","evidence":"4a98f1d32a. Classifies paths by workspace and repository rules received other where global was expected. Both import-link cases passed on current main."} +{"event":"step.completed","timestamp":"2026-12-01T10:20:05.454Z","loop":"dk5xvv-shared-check-imports","step":"implement","evidence":"Classify the completion manifest with other repository-wide policy files so its changes report the actual breadth."} +{"event":"step.completed","timestamp":"2026-12-01T10:36:23.288Z","loop":"dk5xvv-shared-check-imports","step":"green","evidence":"The unchanged focused Vitest command passed at b65f62ccd1. Its red checkpoint at 4a98f1d32a failed on other versus global for the completion manifest."} diff --git a/src/core/development-tooling/unitsConfig.ts b/src/core/development-tooling/unitsConfig.ts index 574394525ea..3fe0d0b6c67 100644 --- a/src/core/development-tooling/unitsConfig.ts +++ b/src/core/development-tooling/unitsConfig.ts @@ -41,6 +41,8 @@ export const defaultGlobalFiles = [ 'eslint.config.js', 'eslint.harness-rules.js', 'harness.audit.json', + // Completion policy can override the verification command for any module. + 'harness.completion.json', 'harness.groups.json', unitsConfigFile, 'harness.verify.json', diff --git a/test/examples/function.classify-path.test.ts b/test/examples/function.classify-path.test.ts index d5b50292219..b56b41f071b 100644 --- a/test/examples/function.classify-path.test.ts +++ b/test/examples/function.classify-path.test.ts @@ -26,6 +26,7 @@ test('Classifies paths by workspace and repository rules', () => { 'packages/web/src/lib/format.ts', 'test/unit/classify-path.test.ts', 'packages/shared/tokens.css', + 'harness.completion.json', 'README.md', 'specification/units/example.json', 'specification/bug-classes/missing-import.json', @@ -38,6 +39,7 @@ test('Classifies paths by workspace and repository rules', () => { 'source', 'test', 'global', + 'global', 'ignored', 'registry', 'registry', diff --git a/test/utils/import-links.test.ts b/test/utils/import-links.test.ts index e38269d49bf..b2941f5bf6c 100644 --- a/test/utils/import-links.test.ts +++ b/test/utils/import-links.test.ts @@ -8,6 +8,8 @@ test('a file path next to import.meta stays a file link and directory paths stay "const signing = resolve(import.meta.dirname, '../scripts/package-mac.ts');", "const output = join(import.meta.dirname, '../../.cache/evidence');", "const root = resolve(import.meta.dirname, '..');", + "const packages = resolve(import.meta.dirname, '../..');", + "const repositoryRoot = fileURLToPath(new URL('.', import.meta.url));", "const assets = join(import.meta.dirname, './assets/');", "const entitlements = join(import.meta.dirname, 'entitlements.plist');", "const mode = import.meta.env.MODE ?? 'development';", @@ -36,4 +38,24 @@ test('bundler queries and declaration files resolve to their tracked file', () = 'src/lib/icon.svg', './gone?url' ]); + const configs = [ + ['eslint.config.js', './eslint.harness-rules.js', 'eslint.harness-rules.js'], + ['eslint.harness-rules.js', './eslint.reuse-rules.js', 'eslint.reuse-rules.js'], + [ + 'packages/desktop/eslint.harness-rules.js', + '../../eslint.reuse-rules.js', + 'eslint.reuse-rules.js' + ], + [ + 'packages/desktop/scripts/package-mac.ts', + './brand-assets', + 'packages/desktop/scripts/brand-assets.ts' + ] + ]; + const files = new Set(configs.map(([, , target]) => target)); + const imports = configs.map(([from, specifier]) => { + const [reference] = scanImports(`import '${specifier}';`, 'ts'); + return resolveImport(from, reference, { ...context, files }).path; + }); + expect(imports).toEqual(configs.map(([, , target]) => target)); });