Skip to content

Keep selected invoice stdout bytes consistent with its receipt - #5973

Draft
josecarlosgonzalezroque-design wants to merge 1 commit into
CrocSwap:mainfrom
josecarlosgonzalezroque-design:fix/selected-invoice-output-bytes
Draft

josecarlosgonzalezroque-design wants to merge 1 commit into
CrocSwap:mainfrom
josecarlosgonzalezroque-design:fix/selected-invoice-output-bytes

Conversation

@josecarlosgonzalezroque-design

Copy link
Copy Markdown
Contributor

Change and mathematical scope

On Windows, export_selected_invoice.py hashes LF-terminated JSON for invoice_sha256, then print() emits CRLF. Its successful export therefore produces bytes that do not match the receipt. The old integration test used text=True, which normalized the difference away.

Use one UTF-8/LF serialization for hashing and binary stdout. The integration test now hashes the actual subprocess bytes and feeds those same bytes to the comparator. A portable regression covers LF, CRLF and UTF-16 text wrappers; the latter two fail against the original implementation. This repairs output binding, with no new mathematical or kappa claim and no changes to selected or frozen scientific inputs.

Task and overlap

Started from and refreshed canonical main de5ec2e7a6074068452f45b1a191b5c72832df4a, priority revision 8. Task portable-replay, scope key 91a9a2afec282c926282; changed from the suggested gzip audit to this demonstrated current-exporter failure. The review note records exact hashes, source heads, bounded overlap coverage and the reason for the change. Before submission on 2026-10-27, refreshed canonical main to 19fdb086ea96af9a9f87936a2b888e10af4ed810: the exporter, its tests, the selected baseline and comparator are unchanged from the tested base. A targeted PR search for export_selected_invoice updated since 2026-10-26 returned no matches. PR #5735 supplies the exporter; #5733 already uses binary stdout in a different invoice-composition command.

Validation

Windows 11 build 26300 / CPython 3.12.10:

python -B scripts/research_selected_baseline.py
python -B tests/test_research_selected_invoice.py -v
python -I -O -B tests/test_research_selected_invoice.py -v
python -B tests/test_compare_recursive_invoices.py -v
git diff --check

All 8 exporter tests pass in both modes, retaining accounting and source-corruption controls. All 10 comparator tests, the selected binding-only baseline and diff check pass. The published tree f0c2e1f1b9f43339d6e76bd56f6412644c062b40 matches the tested local tree. POSIX execution, cold scientific replay and hosted-CI success are not claimed. The initial sandbox TEMP permission failure and workspace-local remedy are documented.

Credit

Credit Ali Romman's exporter in #5735 and the retained P104/controller/invoice contributors. Prepared for josecarlosgonzalezroque-design with substantial OpenAI Codex assistance, one agent. Apache-2.0.

Open next questions

Run the raw-byte CLI regression on POSIX or another Windows Python version. The review note gives the scope and first step; no construction or frontier change follows from this repair.

Emit the same UTF-8/LF serialization that invoice_sha256 authenticates.
Keep raw subprocess bytes in the integration test and cover CRLF and UTF-16 text wrappers.

Prepared with substantial OpenAI Codex assistance; retain PR CrocSwap#5735 credit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant