fix(pdf-import): tag chapters by the studyset tree root #832
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!832
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/832/head"
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?
Creating a card in a sub-studyset failed its chapter auto-tag with a
UNIQUE violation on (root_studyset_id, kind, name).
Tags are pooled per inheritance tree: listForTree and the unique index
are both keyed by root_studyset_id. The import screen passed the
studyset the PDF lives in instead, so for a PDF in a sub-studyset the
lookup matched nothing (no tag has a sub-studyset as its root),
find-or-create degraded into create-always, and the insert collided
with the chapter tag already in the tree. Resolve the root with
rootStudysetIdOf, memoised per session, in the bloc and in the
screen's chapter-suggestion lookup.
The collision then surfaced raw instead of taking the bloc's
raced-with-a-concurrent-create retry: TagRepository classified
duplicates with
on SqliteException, but the local database runsbehind drift's remote layer (background isolate on native, web worker
on web), so the exception arrives wrapped in a DriftRemoteException
that clause can't catch and fell through to UnknownTagException.
Classify on the rendered text instead - DriftRemoteException.toString
delegates to its cause, and the constraint text lives in
explanation,which only toString includes.