Repository navigation
fix(palace): explain derives withdrawals from the masked statement - #488
Merged
Merged
Conversation
Explain carries the retraction twice: on the statement, and as the
RetractedBy transaction that palace-kg-explain renders as
"- Withdrawn: txN". The statement is masked for an as-of view but the
RetractedBy was loaded from the raw st.TRet, so the two disagreed and the
tool printed a self-contradicting block:
- Status: live
- Withdrawn: tx2 at 2026-01-01 00:00:02
for a statement retracted at tx2 while the view asked about tx1. Read the
retraction off ex.Statement.TRet instead, so it comes from the same masked
copy the status does.
The list reads (About, Match, Conflicts, textSearch) and Explain's own
statement were already masked; this was the one field left reading the
unmasked row.
TestKGAsOfMasksLaterRetraction now asserts RetractedBy is nil under the
as-of view and still set under the now view. Reverting the one-line change
makes it fail with "as-of tx1: RetractedBy = tx2, a retraction that had
not happened yet".
Signed-off-by: pi <dimetron@me.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #488 +/- ##
==========================================
- Coverage 92.23% 92.22% -0.01%
==========================================
Files 426 426
Lines 57744 57744
==========================================
- Hits 53258 53255 -3
- Misses 4480 4483 +3
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
One field in
Explainstill reads the unmasked row, sopalace-kg-explaincontradicts itself under an as-of view.Phase 2 (#487) added
View.maskand wired it into the list reads and intoExplanation.Statement. But the withdrawal is derived a few lines later from the rawst.TRet:palace-kg-explainrenders both fields, so asking about the past prints:for a statement retracted at tx2 while the view asked about tx1. Reproduced on
mainat891ccc2. Phase 2'sTestKGAsOfMasksLaterRetractionassertsex.Statement.TRetbut notex.RetractedBy, which is why it passes.Fix
Read the retraction off
ex.Statement.TRet, the same masked copy the status comes from, so the two cannot disagree. One line.Verification
The existing
TestKGAsOfMasksLaterRetractiongains the assertion that was missing:RetractedByis nil under the as-of view. It also pins the now view, so the fix cannot hide a real retraction.Guard seen failing. With the one line reverted:
Restored, it passes.
go test ./internal/palace/→ok(7.0s),go vetclean,golangci-lint run ./internal/palace/...→0 issues,go test ./internal/cli -run TestMemoryKG→ok.Branched from current
main(891ccc2), so no conflict with feat(palace): Tiramemsu port phase 2 — graphs, query languages, paths, rules, saved answers, vectors, bundles, crypto-shredding #487.Relation to #486
#486 carried the whole as-of mask, branched before #487 merged. Phase 2 landed that independently, so #486 was duplicate and conflicting; it is now closed, and this is the only delta left from it.
Same pattern as the review that found this: masking was applied to the row and to the list reads, but not to the field derived from the row.