feat(testing): D-8 honesty lint rules + error-only test-config severity#29
Merged
Conversation
Adds the existing-tool equivalents of SPEC-006 / D-8 Rules 3 and 4 to the testing flat-config block. Custom Rules 1 and 2 are deliberately shelved. Rule 3 (no-call-through-only) -> enable vitest/prefer-called-with at `warn`, the one documented exception to the every-rule-is-error policy (D-8 / R-8: ships non-blocking until scoping is observed and a human confirms a true positive). prefer-called-with is broader than spec Rule 3: it fires on every bare toHaveBeenCalled()/toBeCalled() except the .not form, not only the sole-assertion shape, so it stands in for Rule 3 rather than matching it. Rule 4 (no-server-import-from-consumer) -> a sibling no-restricted-imports config block (core rule, no custom code) forbidding *.server and /internals/ imports from test/story/harness files, with a *.server.test.* filename exemption via `ignores`. Chosen over import-x/no-restricted-paths because the rule keys off the import specifier shape plus a per-file exemption, not directory zones. Static import/export-from only; dynamic import() is out of scope for this cheap-win form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Promote every test-config lint severity to error, per GAIA's "everything is error, never warn" philosophy: a warn under a consumer's --max-warnings=0 is already blocking, so a "non-blocking" warn is a fiction the main consumer never sees. - vitest/prefer-called-with: warn -> error (drop the observe-before-promote rationale; it does not hold under --max-warnings=0). - playwright/expect-expect: warn -> error (a test that asserts nothing is a false green; custom expect*() helpers still count via assertFunctionPatterns). Add the changeset for the D-8 test-honesty rules + this severity change (minor). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2564c5c to
e0bb2f9
Compare
Merged
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.
D-8 test-honesty lint rules + error-only test-config severity
Rebased onto current
main(carries the #28 pnpm 11 migration + dep refresh). Ships two test-honesty rules built from stock tooling (no custom plugins) plus a severity cleanup, all in the test-related config blocks.Rules (all
error)vitest/prefer-called-with— a baretoHaveBeenCalled()/toBeCalled()proves a function ran but asserts nothing about arguments or count; require the*Withform. Exempts.not. (Stands in for D-8 Rule 3no-call-through-only; broader than the spec — fires on every bare call, not only sole-assertion ones.)no-restricted-importsin test/story/harness files — consumer tests may not import a server-only (*.server) or internal (**/internals/**) module; reach behavior through the public interface.*.server.test.*is exempt. Staticimport/export … fromonly, not dynamicimport(). (Stands in for D-8 Rule 4no-server-import-from-consumer.)playwright/expect-expectpromotedwarn→error— a Playwright test that asserts nothing is a false green. Customexpect*()helpers still count viaassertFunctionPatterns.Severity: error-only
Per GAIA's "everything is
error, neverwarn" philosophy. Awarnunder a consumer's--max-warnings=0is already blocking, so a "non-blocking" warn is a fiction the main consumer never sees. The prior "ship Rule 3 as warn to observe before promoting" rationale is dropped.GAIA blast radius (dogfooded)
Button/tests/index.test.tsx:15,useComponentRect.test.ts:57).*.serverimport in a test is in a correctly-named*.server.test.ts(exempt).playwright/expect-expect: already enforced as blocking via--max-warnings=0; GAIA passes, so 0 new.Known gap (tracked separately, not in this PR)
Rule 4 fires under ruleId
no-restricted-imports. GAIA's worthiness gate cross-checks D-8 by the frozengaia-test-honesty/*suffixes and can't attribute a genericno-restricted-imports, so its rule-4 cross-check stays inert (graceful, non-regressive). Reconciliation (retire the two suffixes, or build the custom rules) is a follow-up GAIA-side change.Verify
pnpm install/typecheck/lint/buildall green. Changeset added (minor).🤖 Generated with Claude Code