Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Add OK PR run scope and a shadow test-selection planner (PRD-9548) (#6656)

Andrew Mikofalvye3fb2d3593a2
diff --git a/lint-plugins/ok-rules/README.md b/lint-plugins/ok-rules/README.md
index aa254d808..2dc31284c 100644
--- a/lint-plugins/ok-rules/README.md
+++ b/lint-plugins/ok-rules/README.md
@@ -813,7 +813,7 @@ Drop `<rule-name>.fixture.tsx` in `__fixtures__/`, pairing positive cases (must
### 5. Author the fixture-file test
-Put it at `lint-plugins/ok-rules/tests/<rule-name>.uncached.test.mjs`, not in a package. The `.uncached.test` suffix runs it in the uncached cross-package tier (`vitest.uncached.config.ts`): every agent round, CI's `lint` job, and every whole-suite `turbo run`, which names `test:uncached` beside `test`. A package's cached test tier would replay a stale pass when only the rule or `oxlint.config.ts` changed, unless that package's Turbo key hashed both. The tests in that directory check that every rule the `ok` plugin registers has one. Write it as plain JavaScript.
+Put it at `lint-plugins/ok-rules/tests/<rule-name>.uncached.test.mjs`, not in a package. The `.uncached.test` suffix runs it in the uncached cross-package tier (`vitest.uncached.config.ts`): every agent round, CI's `open-knowledge / tier-guards (uncached)` cell, and every whole-suite `turbo run`, which names `test:uncached` beside `test`. A package's cached test tier would replay a stale pass when only the rule or `oxlint.config.ts` changed, unless that package's Turbo key hashed both. The tests in that directory check that every rule the `ok` plugin registers has one. Write it as plain JavaScript.
The tier's global setup, `test-support/ok-rules-fixture-lint.ts`, runs oxlint once over every fixture with the fixture config and hands the report to the tests; a watch-mode rerun lints again. Every rule test fails when that run could not start, exited other than 1, gave no JSON report, linted a different number of files than the directory's `*.fixture.tsx` files, or reported a diagnostic on no fixture. `lintOkRulesFixture` in `test-support/read-ok-rules-config.test-helper.ts` returns one fixture's diagnostics from the report, each with its rule code, `line:column` position and message, in a fixed order. A diagnostic that names no rule (a rule that threw while linting that fixture, or a fixture oxlint could not parse) fails that fixture's test with oxlint's message, as it does the scope meta-test, which reads every fixture. oxlint also drops every other JS-plugin diagnostic on a file where a rule threw, so a rule whose scope reaches other fixtures fails their tests too. Run outside the tier, it fails and prints the command that runs the test. Assert the exact list of your rule's fire positions, filtered by its own code:
diff --git a/scripts/check-server-test-inputs.mjs b/scripts/check-server-test-inputs.mjs
index 4f8ca49fe..64f095758 100644
--- a/scripts/check-server-test-inputs.mjs
+++ b/scripts/check-server-test-inputs.mjs
@@ -189,8 +189,9 @@ function main() {
`${detail}\n\n` +
`Fix: a test that reads files outside its package's key takes the \`.uncached.test\`\n` +
`suffix. Rename each reader to <name>.uncached.test.ts, and the uncached tier runs it\n` +
- `every round, in CI's lint job, and in every whole-suite \`turbo run\` that names\n` +
- `\`test:uncached\` beside \`test\`, such as \`pnpm test\`; a --filter'ed run does not.\n` +
+ `every round, in CI's open-knowledge / tier-guards (uncached) cell, and in every\n` +
+ `whole-suite \`turbo run\` that names \`test:uncached\` beside \`test\`, such as\n` +
+ `\`pnpm test\`; a --filter'ed run does not.\n` +
`Add a matching glob to \`${TASK}\`.inputs in public/open-knowledge/turbo.json\n` +
`instead only if the whole server tier should re-run whenever that path changes.\n`,
);