Repository navigation
test: Rule #2 source-scanning guards (typed errors, fetch timeouts, empty catch) - #98
Merged
Merged
Conversation
…, empty catch) Ratchet baselines for plain throw new Error( and fetch( without a timeout; exact guard for uncommented empty catch blocks. Documented in docs/TESTING.md 6.1. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
8 tasks done
… guard baselines After merging main: the typed-error guard caught a plain Error added in history report --since. The fetch-timeout baseline drops from 78 to 24 call sites now that fetchWithTimeout is on main. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What does this PR do?
Adds three source-scanning test guards for SSOT Rule #2, with no new dependency. The repo has no linter; these checks run inside
pnpm test, in the style ofreadme-cli-sync.test.ts.rule2-typed-errors-guardthrow new Error(is added insrc/commands,src/exchangesorsrc/bot(it should be a typedPerpError)rule2-fetch-timeout-guardfetch(call withoutAbortSignal/signalis added anywhere insrc/rule2-silent-catch-guardcatchhas no comment explaining whysrc/__tests__/helpers/strip-source.ts) blanks comments and string text before scanning, so prose never matches. It has its own tests.BASELINE.docs/TESTING.md§6.1 documents the guards.No production code changes. The existing violations are not fixed here.
Rejected guards:
catch { return <default> }(23 sites) and.catch(() => undefined)(5 sites) are mostly legitimate probes (isX()→ false, cache miss → null). Without type information a guard could not tell them from a swallowed failure, so it would be noise.Merge order — please read
Because the ratchets fail when a count changes in either direction, any other PR that adds or removes a plain
Erroror an un-timedfetchwill makepnpm testfail on main after both are merged. Merge this PR last among the open fix PRs (#76, #84, #94–#97, the fetch-timeout and path branches), then update the baselines once from the printed map.fix/fetch-timeoutsin particular lowers the fetch count.Checklist
pnpm testpasses (338 files / 7271 tests; 12 new)tsc --noEmitandtypecheck:testpassTesting standard (docs/TESTING.md §7)
/* signal */comment did not bypass it; a raised baseline failed with "lower this baseline". All probes were reverted.test.skip/.onlyNot independently reviewed yet.
🤖 Generated with Claude Code