Repository navigation
fix: report no-op block/unblock honestly and guard the tombstone lift (#209) - #279
Conversation
…#209) removeBlock and removeTombstone returned true and republished their file even when they filtered nothing, and unblockMemory lifted the value tombstone whenever the row existed regardless of whether a block entry was removed. A no-op unblock of a never-blocked row withdrew the rejection still guarding a blocked identical copy, letting the value be re-ingested. Both removals now return false and skip the rewrite when nothing was filtered; unblockMemory lifts the tombstone only after an actual un-block. Whether unblocking one real copy should lift a shared rejection is explicitly undecided by the ticket, so that behavior is pinned unchanged.
WhollyMindless
left a comment
There was a problem hiding this comment.
Reviewed 05b5276c07d4cb842140435c10d2606b5f1fcc25. Approve for #209's scoped no-op fix. I filed the issue; the bot authored the implementation. This review independently checks that implementation, rather than claiming independent authorship of the finding.
Windows / Bun 1.4.4, isolated checkout:
viewer-unblock-noop,viewer, andtombstones: 56 pass, 267 assertions.- Same new regression file with only the three changed production files restored from
0fe0f61: 3 fail, each observingtruewhere no change should returnfalse. Restored the reviewed source afterward; checkout is clean. - The no-op checks run inside the existing store locks, before
writeAtomic; the tests verify unchanged file identity for unknown block/tombstone selectors, not only a returned Boolean. - Direct and HTTP no-op unblock of never-blocked A leave identical-content B blocked and its value rejection present. A genuine unblock still removes the block and shared rejection, preserving the policy explicitly excluded from this ticket's scope.
The incremental main merge brings already-reviewed #278 and the release version; no additional #209 logic is hidden in that merge. No blocking finding. These focused tests and source tracing do not constitute a new full-suite or concurrent-writer stress run. Merge timing remains the maintainer's decision.
There was a problem hiding this comment.
APPROVE — head 05b5276c07d4cb842140435c10d2606b5f1fcc25, diff key 8fd8198d7c7932c95aebd133cd1944838cdb582b233c6065eabc761d000d28b6.
Contract (#209, authored by WhollyMindless — trusted; spec anchor a1101cf8f00adeea = recomputed hash, frozen): verbatim criteria from "Proposed scope":
- "Make removeBlock/removeTombstone accurately report no-op outcomes and skip needless rewrites" — met.
src/store/blocklist.ts:87andsrc/store/tombstones/tombstone.ts:400returnfalseonkept.length === lines.lengthbeforewriteAtomic. Evidence:test/viewer-unblock-noop.test.ts:75-76(removeBlock(unknown ts)→false,fileIdentity(blocklistFile())byte-identical),:89-94(removeTombstone(unknown ch)→false,/api/unreject→{unrejected:false},fileIdentity(rejectedFile())unchanged). - "unblock should not lift a value rejection when the requested row was not unblocked" — met.
src/viewer/mutate.ts:281if (!removed) return false;before the load/lift. Evidence:test/viewer-unblock-noop.test.ts:98-115— rows A/B identical content,blockMemory(B);unblockMemory(A)→false,/api/unblock→{unblocked:false},blockedEntries()1,tombstones()1. - "Test a stale/direct API call on never-blocked A while identical-content B remains blocked, plus valid unblock behavior" — met. Same file: real HTTP
POST /api/unblockand/api/unreject(no mocks); valid path:120-122unblockMemory(B)→true, counts → 0. The open question the ticket explicitly does not decide (deliberate unblock of one copy lifting the shared rejection) is pinned, not changed — correct scope.
Differential (red at merge-base): test/viewer-unblock-noop.test.ts copied onto 67e23ee (merge-base with main) → 0 pass, 3 fail, Expected: false Received: true at :75/:89/:112 — the reported no-ops-true defect. On this head → green.
Commands run (measured, at head): bun run typecheck clean; bun run lint 0 errors (130 infos), format clean 224 files; bun run test 961 ran / 19 skip / 0 fail; bun run test:e2e 30 / 0 (src/ changed).
Test integrity: file is purely additive (+124/-0); no skips, no weakened assertions; fileIdentity pins the no-rewrite claim.
Final gate re-check (verbatim): gh pr view 279 --json headRefOid → 05b5276c07d4cb842140435c10d2606b5f1fcc25; gh pr checks → lint pass, test pass, test-windows pass, smoke pass.
No findings. Human merges.
|
🎉 This PR is included in version 0.15.21 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #209
What
removeBlockandremoveTombstonereturnedtrueand republished their file even when they filtered nothing, andunblockMemorylifted the value tombstone whenever the row existed regardless of whether a block entry was removed. A no-op unblock of a never-blocked row therefore withdrew the rejection that still guarded a blocked identical copy, letting the value be re-ingested.src/store/blocklist.ts—removeBlockreturnsfalseand skips the rewrite when nothing was filtered.src/store/tombstones/tombstone.ts—removeTombstonereturnsfalseand skips the rewrite for an unknownch.src/viewer/mutate.ts—unblockMemoryreturns earlyfalsewhenremoveBlockremoved nothing, so the tombstone lift only follows an actual un-block.Acceptance criteria and evidence
Ticket criteria (from the body's "Proposed scope"):
test/viewer-unblock-noop.test.ts: unknown-tsremoveBlockreturnsfalseandfileIdentity(blocklistFile())is byte-identical before/after (no rename happened); unknown-chremoveTombstonereturnsfalse,fileIdentity(rejectedFile())unchanged, and/api/unrejectreturns{unrejected: false}.blockMemory(B):unblockMemory(A)returnsfalse,/api/unblockreturns{unblocked: false}, B stays blocked, tombstone count stays 1.unblockMemory(B)returnstrue, blocklist and tombstone counts drop to 0.Proof (measured)
0fe0f61768774b50dda8378fd075a5d042d4f89d→ 0 pass, 3 fail (each no-op returnedtrue, the reported defect). On this branch → 3 pass, 17 expect() calls.bun run typecheck— clean.bun run lint— clean (biome lint+biome format, 223 files checked).bun run test— 940 pass, 19 skip, 0 fail (959 tests, 91 files).bun run test:e2e— 30 pass, 0 fail (src/ changed).Deliberately not changed
Whether deliberately unblocking one real copy should lift a shared value rejection: the ticket explicitly does not decide this, so the pre-existing behavior (unblocking a real copy lifts the shared rejection) is preserved and pinned by the third test, not changed.
Note: the ticket cites
src/blocklist.tsandsrc/tombstones.ts; those files moved tosrc/store/blocklist.tsandsrc/store/tombstones/tombstone.tssincebf9f4d2. Same code, same defects, reproduced at0fe0f61.