Repository navigation
feat: uniform page length for Gradescope + confirm names pass through - #3
Merged
Merged
Conversation
Every student's exam PDF now comes out the same length so Gradescope's per-question template lines up without manual fixing. - Force exactly one transcript page per scan page (auto-shrink font to fit); dense pages no longer spill to 2-3 pages and shift structure. - Pad every exam to the batch-wide maximum with blank page pairs, so all outputs share one page count and question N lands on the same page. - Replace the 95 MB _part1/_part2 split (which broke uniformity) with a single-file lower-DPI fallback chain; oversize files are flagged in the run report instead of split. Names/SIDs are unchanged: still masked only on the copy sent to Mistral, kept visible on the Gradescope deliverable (verified end-to-end on a real exam). Tests cover fit-to-one-page, padding, single-file guard, and equal-length output across exams of different physical lengths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Check in CLAUDE.md (project instructions), FABLE_OVERVIEW.md, and FABLE_GAPS.md so the repo carries its own working context. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Implements Professor Chang's feedback from her first real batch.
Uniform page length (the fix)
Every student's exam PDF now comes out the same length so Gradescope's per-question template aligns without manual fixing. Three causes of variable length addressed:
_render_transcript_pageshrinks font to fit a single page; dense pages no longer spill to 2-3 pages and shift structure. (pdf_assembler.py)run_batchcomputes the batch max fromExamFile.page_count(no extra OCR) and threads it through. (pipeline.py,pdf_assembler.py)_part1/_part2split broke uniformity; replaced with a single-file lower-DPI fallback chain (lossless → 150 → 110 → 90). Oversize files are flagged in the run report instead of split.Names/SIDs (no change needed — verified)
The tool already keeps names/SIDs visible on the Gradescope deliverable and masks only the copy sent to Mistral. Confirmed end-to-end on a real, non-anonymized exam: the
.masked.png(API-bound) had the header blacked out; the output scan page showedNameandSIDclearly. The censoring seen earlier was the pre-anonymized test set, not the program.Test Coverage
test_transcript_forced_to_single_page— verbose transcript stays one pagetest_pads_short_exam_to_target_length— padding to a target lengthtest_size_guard_stays_single_file— tiny size ceiling never splits, downsamples insteadtest_run_batch_pads_all_outputs_to_uniform_length— two exams of different physical lengths produce equal page counts (2 × max)Verification
pytest: 63 passedmypy: clean (19 source files)ruff check: cleanNotes
🤖 Generated with Claude Code