Repository navigation
test(threading): the read-failure safety property had no executing test - #1162
Merged
Merged
Conversation
@sprint-review, on the source-regex block in threadUserState.test.js: all five tests were `expect(CONTROLLER_SRC).toMatch(...)`, and their clearest proof was that one asserted the literal shape of a catch block — a reformat turns it red while the behaviour is intact, and a behavioural regression walks past it. Checking what that block was the only cover for turned up a real gap rather than a redundancy: nothing anywhere executed a failing ledger read. That is the safety direction. A collapsed thread hides history invisibly; an expanded one is noisy and one click from fixed. So a DB error must expand. Converts it in threadStateReadContract.test.js, which runs the real handler: force the migration_records query to reject, assert every root comes back expanded, and assert the caller sees a payload rather than an error. The CONTROL is load-bearing. An "everything expanded" assertion also passes from a read broken badly enough to return junk, so the control seeds the same ledger row WITHOUT the failure and asserts those roots collapse. Only the injected failure flips them. Probed both directions before trusting it: flipping the catch to cutoffUnknown: false kills the test (1 failed), and reformatting the catch across three lines kills nothing. That is the inverse of what the regex did. Keeps one textual assertion, and it is the exception that shows the rule: `not.toMatch(/backfillPending/)` claims code is ABSENT, which no execution can demonstrate — a dead branch that never runs is invisible to a behavioural test and still sitting there for the next reader to revive. Co-Authored-By: Claude Opus 5 <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.
@sprint-review's read of the source-regex block in
threadUserState.test.js(57150): all five tests wereexpect(CONTROLLER_SRC).toMatch(...). Their clearest proof was the one asserting the literal shape of a catch block — reformat it and the test goes red while the behaviour is intact; regress the behaviour and it stays green.Checking what that block was the only cover for turned up a gap rather than a redundancy: nothing anywhere executed a failing ledger read. That is the safety direction. A collapsed thread hides history invisibly; an expanded one is noisy and one click from fixed. So a DB error must expand.
What this does
Converts it in
threadStateReadContract.test.js, which runs the real handler: force themigration_recordsquery to reject, assert every root comes back expanded, assert the caller sees a payload rather than an error.The CONTROL is load-bearing. "Everything expanded" also passes from a read broken badly enough to return junk, so the control seeds the same ledger row without the failure and asserts those roots collapse. Only the injected failure flips them.
Probe
Ran both directions before trusting it:
cutoffUnknown: false(behaviour flipped)the ledger query throwing renders every root EXPANDEDThat is the inverse of what the regex did.
One textual assertion stays
not.toMatch(/backfillPending/)— the exception that shows the rule. It claims code is absent, which no execution can demonstrate: a dead branch that never runs is invisible to a behavioural test and still sitting there for the next reader to revive.npx jest __tests__/unit/models/thread __tests__/unit/controllers/thread→ 10 suites, 143 passed.🤖 Generated with Claude Code