Attribute the ten sheets on the wrong page area: the selector is right, 44 sheets are missing - #25
Merged
Merged
Conversation
v0.20.0 reported ten sheets across three forms opened on the wrong page
area, lined up by INDEX. That number does not attribute what it finds: a
sheet the other side opens and this one does not shifts every sheet after
it, so a page turn missed in the MIDDLE of a run is reported as a wrong
page area on every sheet up to the next boundary.
So the two sequences are compared by ORDER as well. Over the 559 forms
pdfium lays out, nine sequences move at all and on every one of them one
side's is a SUBSEQUENCE of the other's: no sheet of the corpus is opened
on a page area pdfium does not choose at that point in the order. The ten
are the projection of 48 sheets pdfium opens that this does not — 44 of
them on those three forms — and 41 this opens that pdfium does not, all
three of those the forms whose own scripts pdfium runs.
The new count, forms where NEITHER sequence is a subsequence of the
other, is a real wrong choice and fails the test. It is nought.
3035 sheets by index same SIZE 100.00% same PAGE AREA 99.67%
by ORDER: 9 forms move, 48 sheets pdfium opens that this does not,
41 this opens that pdfium does not
opened on a page area pdfium does not CHOOSE there: 0 forms
Test and comment only: the package's non-test code changes by ten lines
of doc comment, so no layout moves. 3 088 corpus sheets, 81 750 fields
and 151 323 draws placed with none left over, x 100.00% under a wrapping
container and under a table row, all unchanged.
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.
What this settles
v0.20.0's
TestSheetsAgainstPdfiumreported ten sheets across three forms opened on the wrong page area —us-uscis__g-10556,i-956g3,i-9561 — lined up by INDEX. That number cannot attribute what it finds. A sheet the other side opens and this one does not shifts every sheet after it, so a page turn missed in the MIDDLE of a run is reported as a wrong page area on every sheet up to the next boundary. The three forms it names are exactly the three whose sheet counts disagree most.So the two sequences are now compared by ORDER as well: is every page area this opens one pdfium opens, in the same order?
Over the 559 forms pdfium lays out, nine sequences move at all, and on every one of them one side's is a subsequence of the other's. Not one form is a case where neither is.
No sheet of the corpus is opened on a page area pdfium does not choose at that point in the order. The ten are the projection of 44 missing sheets on three forms (
i-9563,i-956g9,g-105532) onto an index-aligned comparison. The 41 in the other direction aret65724e/25e andrc243, the three forms settled in #18 as the form's own scripts.The new count — forms where NEITHER sequence is a subsequence of the other — is a real wrong choice and
t.Errorfs. It is nought.What changed
TestSheetsAgainstPdfium: the order-aligned half, and a doc comment that says why the index-aligned half cannot attribute what it finds and what each half is blind to.subsequence, with a unit test of its own, including the case greedy has to get right: a repeated name where the first match is not the one a later entry needs.doc.gorecords that WHICH page area each sheet is opened on agrees with pdfium everywhere.Test and comment only. The package's non-test code changes by ten lines of doc comment, so no layout can have moved. Controls, all unchanged: 3 088 corpus sheets; 81 750 fields and 151 323 draws placed with none left over; x 100.00% under a wrapping container and under a table row, 97.69% under neither.
Gate
gofmtclean,go vetclean, exact 100% statement coverage withXFACORPUSunset,-race, 15 cross-compile targets (linux amd64/arm64/riscv64/loong64/ppc64le/s390x/mips64/386, js/wasm, wasip1/wasm, darwin arm64/amd64, windows/amd64, freebsd/amd64, android/arm64),CGO_ENABLED=0,GOWORK=off, Go 1.27.1 viaGOTOOLCHAIN.Findings, the alignment script and the traces are at
/Users/Shared/xfa-pagearea-fix/. Full write-up on #7.🤖 Generated with Claude Code