Evidence schema cannot represent multi-parent provenance #108
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Severity: MEDIUM - blocking schema work, cheapest before Phase 2 data volume
The problem
Two schema gaps will require table-rebuild migrations on SQLite, and are far cheaper to fix before
the evidence table holds tens of thousands of rows.
1.
derived_fromis a single FK, but constraints have two parents.backend/app/models/models.py:303-305models provenance as one nullable FK. But the constraintpropagation engine (#19) derives a range from two anchors — "between photo 12 (June 1987) and
photo 20 (September 1987)". That is unrepresentable, and the constraint explanation UI (#20)
depends on exactly that chain being navigable.
docs/circa-spec.md:401specifies multi-parentprovenance as JSON "source evidence ids".
2.
EvidenceSourcelacksevent_anchor. The spec lists it (circa-spec.md:392) and #28 needsit.
Also absent versus the spec:
source_subtype(e.g.polaroid_sx70,birthday_anchor),is_hard_constraint,cleared_by_decision_id, and any CHECK enforcingdate_low <= date_high.Recommendation
evidence_derivation(evidence_id, source_evidence_id)link table rather than the spec'sJSON column — cleanly queryable, and the explanation UI needs to traverse it.
event_anchortoEvidenceSourcein the same migration.source_subtype; it feeds the format-rule work.date_low <= date_highCHECK.is_hard_constraintcan stay folded intoreliability=hardif that is a deliberatesimplification — but document that, since the spec disagrees.
Note the unused enum members that already exist (DuplicateType, the extra job types, audit types)
are reasonable forward provisioning. The gaps are the problem, not the surplus.
Done when
event_anchorexists as a sourceReferences
backend/app/models/models.py:77-84,303-305docs/circa-spec.md:392,401Blocks: #19, #20, #28.