fix(pdf-import): stable lesson ids across re-imports (P0 data-loss) #76
No reviewers
Labels
No labels
backend
bug
completed
documentation
duplicate
enhancement
feature
frontend
good first issue
help wanted
in-progress
invalid
performance
phase-1
Phase1
Phase2
Phase3
planning
question
refactor
security
test
testing
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Kalle/ATM!76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/pdf-reimport-stable-lesson-ids"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan
Fix the P0 data-loss bug where re-importing the same PDF minted fresh
randomUUID()lesson ids — replacing (not updating) the document's lessons and orphaning every user reference to them (explored/progress/share records) on every re-upload — and make blackbox 16b green on the testing deployment.Outcome
pdf-<docHash>-<number>via newstablePdfLessonId()/isStablePdfLessonId()insrc/lib/pdf-import-reconcile.ts. A re-import updates the document's lessons in place.pdf-process-smart/route.tsdrops its per-importrandomUUID()and refuses (logged error, lesson skipped) to persist any id that does not validate as stable — a guard against future regression to non-deterministic ids.Impact on release goals
[x].Blackbox
python3 scripts/blackbox_test.py --base http://127.0.0.1:3210(real Next dev + real FastAPI + real pdfplumber extraction) → 47/48 green, incl. 16a–16e (non-destruction and identity stability).python3 scripts/blackbox_test.py --target testing(pre-deploy baseline) → 46/48: 16b + 16e RED as expected — the currently deployed code destroys identity; both go green once this merges and deploys. This is the P0 this PR fixes.tsc --noEmitclean.Six-perspectives check
Risk
Checklist
dev(d8b4b57)test:RED →fix:implementation →docs:bookkeeping)This PR was created by an AI agent (OpenHands) on behalf of the ATM team.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.