The UNIQUE test reaches the constraint: restore the random source first
The forced draws were spent, so announce failed drawing its nonce and the test passed with the index non-unique. Now a fresh revision is taken and a held one refused; UNIQUE dropped → red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+9
−1
internal/docs/suite_test.go+9 −1
CI passed — run details
diff --git a/internal/docs/suite_test.go b/internal/docs/suite_test.go| index 9784972..b1903b1 100644 |
| --- a/internal/docs/suite_test.go |
| +++ b/internal/docs/suite_test.go |
| @@ -1631,7 +1631,15 @@ func TestSuiteARevisionIsNeverOneTheLogHolds(t *testing.T) { |
| } |
| // The schema holds the rule too: a second row for a revision the log |
| - // already holds is refused, whatever path writes it. |
| + // already holds is refused, whatever path writes it. The forced draws |
| + // are spent, so the real source goes back first — announce draws a |
| + // nonce, and a failed draw would pass this for the wrong reason (it |
| + // did, the first time). The presence half: a revision the log does not |
| + // hold is taken. |
| + randomSource = crand.Reader |
| + if err := announce(app.store.db, doc.ID, fresh+1, false); err != nil { |
| + t.Fatalf("suite_feed refused a revision it did not hold: %v", err) |
| + } |
| if err := announce(app.store.db, doc.ID, fresh, false); err == nil { |
| t.Errorf("suite_feed took a second row at revision %d for one document", fresh) |
| } |