FIX : Incorrect value mapping when filling multi-page PDFs in FireForm.#240
Open
Aryama-srivastav wants to merge 2 commits intofireform-core:mainfrom
Open
FIX : Incorrect value mapping when filling multi-page PDFs in FireForm.#240Aryama-srivastav wants to merge 2 commits intofireform-core:mainfrom
Aryama-srivastav wants to merge 2 commits intofireform-core:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a bug in FireForm’s PDF filling flow where multi-page PDFs incorrectly restarted the answer index on each page, causing field/value misalignment (Issue #238).
Changes:
- Move the answer cursor initialization outside the per-page loop to keep assignment sequential across pages.
- Add a regression test to validate value indexing across multiple pages.
- Update the sample input text used for local/manual runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/filler.py |
Ensures the answer index (i) is initialized once and incremented across all pages. |
src/test/test_filler_multi_page.py |
Adds a multi-page regression test using dummy PDF/page/annotation objects and monkeypatching. |
src/inputs/input.txt |
Updates the sample input content (now includes a dated form-style example). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
Description
This PR fixes incorrect value mapping when filling multi-page PDFs in FireForm.
Previously, the field-value index was reset inside the per-page loop in [filler.py], which caused page 2+ to restart from the first extracted value. As a result, multi-page forms could repeat early values and misalign later fields.
This change makes multi-page assignment sequential and stable:
Fixes #238
Type of change
Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Ran:
python -m pytest [test_filler_multi_page.py] -q
Verified output:
. [100%]
1 passed in 3.21s
Verified behavior:
Test Configuration:
Firmware version: N/A
Hardware: Local development machine (Windows)
Python: 3.13
Shell: PowerShell
Checklist:
My code follows the style guidelines of this project: