Verify the effective date Bridge writes on Payment, Receipt and Contra - #482
Merged
Merged
Conversation
#469) Fetch EFFECTIVEDATE in the import verification read. A returned value that differs from the written date is an effective_date diff in verify_import and the amendment compare-and-swap; an absent or empty one is reported as not_observed, never refused. Journal is out of scope, and the public voucher tools neither fetch nor return it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
lamemustafa
added a commit
that referenced
this pull request
Sep 17, 2026
…ation.rs (#484) Moves the import read-back verification family, `parse_import_vouchers` through `render_proof_markdown` (18 functions, 606 lines), out of `src-tauri/src/agent_import.rs` into `agent_import_verification.rs`, declared as `agent_import::verification`. Regenerated on 2481ed0 by script, so it carries #482's effective-date verification. Only two kinds of edit are made to the moved code: `pub(super)` on the 17 functions reached from outside the module, and its two `super::` paths rewritten to `super::super::`. With those undone and both sides run through rustfmt, the block is byte-identical to master's. Unformatted, the only other difference is rustfmt rewrapping `parse_import_vouchers` and `verify_batch`, whose signatures the prefix pushed past 100 columns. `effective_date_not_observed`, `VerificationCandidates` and `VerificationFingerprint` stay private. The parent imports the functions explicitly: - 13 reached from production code: 8 from Server methods in agent_import.rs (build, verify, persist, pre-import mark), 4 of which the posting path (agent_import_post.rs) also calls; 5 from the amendment compare-and-swap (agent_import_amend.rs). - 4 reached only from sibling test modules, under `#[cfg(test)]`: batch_duplicate_sets, duplicates, observed_fingerprint, observed_voucher_identity. The new file is pinned in the compatibility surface (267 -> 268 pins) and MAX_SURFACE_FILES rises by one with a named reason. Co-authored-by: t <dev@example.invalid> 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.
Closes #469.
Outcome
verify_importand the amendment compare-and-swap now check theEFFECTIVEDATEBridge writes on Payment, Receipt and Contra. Before this change, a voucher whose effective date Tally rewrote, or an operator later edited, still reportedposted_verified, and an amendment would silently overwrite that edit.Change
EFFECTIVEDATEto itsFETCH.PARTYLEDGERNAMEstays out, because Record that bank vouchers return EFFECTIVEDATE but not the written party #467's live read returned a bank ledger there, not the written counterparty. A test pins both halves.parse_import_verification_rowsemitseffective_date, and import verification is its only caller. The public voucher tools keepparse_agent_rowsandparse_agent_changed_rows, whose rows don't carry the field; a test asserts that on the capture.EFFECTIVEDATEis now a claimed voucher scalar, so a voucher carrying it twice refuses (agent_read_protocol_invalid). This also applies to the public tools. No committed capture those tools parse repeats it: the review grepped every fixture.DATE. A malformed one refuses the read (voucher_effective_date_invalid→import_verification_export_invalid).effective_datediff.verify_importreports it asposted_divergent, and an amendment asbook_voucher_diverged, because the compare-and-swap reusesvoucher_diffs."not_observed": ["effective_date"]instead, on every matched verification status and on an admitted amendment row. A Journal is written without the element, so it is neither compared nor flagged.TALLY_PROTOCOL_REFERENCE.md§9.8, beside the limit paragraph it closes. Record that bank vouchers return EFFECTIVEDATE but not the written party #467's correction said "verify_importstill does not fetch it"; that sentence now points to this change. The original "Two written elements are not verified" paragraph gains a note that it predates both corrections.Measured
Evidence the element comes back.
EFFECTIVEDATE TYPE="Date", equal toDATE, on a Bridge-built Receipt, Payment and Contra, from the exact §9.8 request withEFFECTIVEDATEandPARTYLEDGERNAMEappended. That capture is not committed; the bank-import lane holds it.native-three-vouchers.utf16le.xmlalready carriesEFFECTIVEDATEon two of its three vouchers. The new tests read it directly:Some, Some, None.Tests.
parse_import_vouchers: reads the capture's effective dates, and maps an invalid one toimport_verification_export_invalid.posted_verifiedplusnot_observed;posted_verifiedwith no caveat;posted_divergentwith["effective_date"];matching_content_observedandposted_not_effectiverows also carrynot_observed.book_voucher_divergedwith["effective_date"];not_observed.EFFECTIVEDATEand notPARTYLEDGERNAME.Mutation. I disabled each of these 12 controls in turn, and a named test failed every time:
FETCHentry;not_observedbank-type rule, and its reporting in verify and amend;At first 3 survived: the scalar claim, which parser verification uses, and (after a pattern fix) empty-as-absent. The tests that now catch them were added for those.
Suites. On master
d84e2070,cargo test --workspacegave 1,636 passed, 0 failed, 10 ignored;cargo fmt --checkand clippy (-D warnings -A clippy::pedantic) were clean. After the final rebase ontoc299b4a5(#480 changed onlysync/reconciliation.rs), the targetedagent_import,effective_dateandvoucher_parsetests pass. The seal is current at 266 pins, with pin paths equal to master's.Not measured
EFFECTIVEDATE. Those paths now reportnot_observedon bank vouchers; no test drives a full import through the simulator with the element present.Review
A Sonnet subagent reviewed the change against the issue and ran 201 targeted tests.
DATEdoes. This is deliberate: accepting it as "not observed" would hide a corrupted response.not_observedonmatching_content_observedandposted_not_effectivewas untested. Both existing tests now assert it.🤖 Generated with Claude Code