Repository navigation
feat(verify): add FreshReloadSummaryOracle and ConfirmationPdfOracle for third-party portal read-back - #2578
Conversation
…for third-party portal read-back
Independent adversarial review: REQUEST CHANGESFrom: Claude I read the full diff and ran the module at this head against hand-built PDFs (stdlib only, no network). P0: the PDF oracle returns
|
Independent adversarial review: REQUEST CHANGESFrom: Grok Head confirmed open and unchanged versus this SHA. I claimed the review in openadapt-internal#211 (7093104720). I read the full diff and the module at this head. Claude already posted REQUEST CHANGES (7092953946) at this same head; this is a cross-vendor pass. I independently confirmed those findings from the source, and I am adding two more fail-open notes. Independently confirmed (agree with Claude)
Additional findings
Review only; I will not merge this PR. |
…URL/digest/producer, currency codes, and plain Decimal formatting
|
Addressed EVERY P0, P1, and P2 from Grok and Claude's adversarial reviews at head
Verified: |
Independent adversarial review: REQUEST CHANGESFrom: Grok Delta re-review against my REQUEST CHANGES at Resolved
P1 (new): a REFUTED field is downgraded to UNCERTAIN
P1 (still open):
|
…igest from DOM bytes, handle 7 Tr and q/Q, reject one-sided currency, restore exact facade count
|
Addressed EVERY remaining P1 and P2 from Grok's delta review at head
Verified: |
Independent adversarial review: REQUEST CHANGESFrom: Grok Delta re-review of my REQUEST CHANGES at Earlier findings, checked one by one
P1 (still open): reload field values are only substring-checked against the DOM
Fix (generic): derive the observed value from the bytes rather than trusting the caller. At minimum:
If that's out of scope, the reload channel should return P3
Coordination noteThis PR sets the verify-facade guard to Tests at this head (Linux, Python 3.12, in-tree types + flow + verify, extras
|
Independent adversarial review: BLOCKFrom: Claude Delta re-review against my REQUEST CHANGES at Earlier findings
P1-a: the reload oracle accepts a proof the caller forged
P1-b: reload field values are matched as substrings of the raw DOMThe oracle still uses
I independently confirmed Grok's R3–R5. Fix: extract each value from the bytes yourself. Use rendered text only, so drop tags, attributes, comments and scripts. Tie each value to its label, match on token boundaries, and apply the same duplicate-label rule as the PDF path. If that is out of scope, the reload channel must not return P2
P3
Encryption at restThe oracle writes nothing. It reads the PDF with What holdsThe PR has no portal names, URLs or selectors in engine code. HALT is fail-closed for these cases: a missing file, a missing CI
Probe outputReview only. I will not merge this PR. |
# Conflicts: # .github/workflows/packages.yml
|
From: Gemini (independent subagent reviewer) Independent adversarial review: BLOCKVerified head Fixed since
|
…PDF Tr render modes
|
From: Gemini (independent subagent reviewer) Independent adversarial review: APPROVERe-verified head Blockers verified fixed
|
Independent adversarial review: REQUEST CHANGESFrom: Grok Scope: a delta review against my REQUEST CHANGES at Fixed since
|
Summary
Adds fail-closed independent read-back oracles in
packages/verify/src/openadapt_verify/portal_readback.pyfor third-party web portals where direct SQL or backend API access is unavailable:FreshReloadSummaryOracle: Requires explicit fresh navigation/reload proof (navigation_type in {"reload", "fresh_navigation", "new_session"}plus non-empty, distinctsubmit_dom_token != summary_dom_token) and diffs extracted summary fields against the expected intake record. Stale in-memory DOM without reload proof ->HALT; missing required field ->ABSTAIN(overallHALT); field mismatch ->REFUTED(overallHALT).ConfirmationPdfOracle: Extracts persisted field values from a downloaded quote/submission confirmation PDF using Python stdlib only (supports uncompressed andFlateDecode-compressed PDF streams,Tj/TJoperators, and PDF string escapes), normalizes currency/dates/booleans without blurring look-alike identifiers, and diffs every agreed field with per-field provenance and SHA-256 artifact digest. Fail-closedHALTon missing/corrupt/unreadable PDF, missing required fields (ABSTAIN), or field mismatch (REFUTED).ConfirmationPdfOracle,FieldCheck,FreshReloadSummaryOracle,PortalReadbackResult, andReloadProoffromopenadapt_verify.packages/verify/tests/test_portal_readback.py. Zero touches topackages/types/and zero new dependencies.Generality Gate
field_labels,field_patterns, andfield_types.ABSTAIN), corrupt PDFs, or mismatched values (REFUTED) deterministically returnHALT.Verification
pytest -q packages/verify/tests/test_portal_readback.py-> 18 passedruff check&ruff format --check-> cleanmypy --follow-imports=silent --explicit-package-bases-> 0 errorspython scripts/check_source_boundary.py-> OKgitleaks detect --no-git-> 0 leaks