Pilot seed 002_pilot_operations fails validation: harvest_event plot does not match its crop cycle
#1
-
-
State changed as pull request KI-101 is open
-
OneDev
changed state to 'In Review' 3 weeks ago
Previous Value Current Value Open
In Review
-
Fixed on branch fix/staging-root-env-rewrap (PR #101).
Root cause: seed 002 was written for an older farm layout (Plot A/B/C — maize/cassava/beans) and half-updated when 001_pilot_farm moved to the syntropic design. harvest_events c07-c10 referenced plots that didn't match their crop cycles; the validate_operational_context() trigger correctly rejected them.
Fixes:
- seed 002: harvest_event plot_id aligned with crop_cycle.plot_id (c07/c08 -> plot 021, c09/c10 -> plot 020) + all descriptions rewritten to match the current farm story.
- seed 029 (second blocker found during verification): published stakeholder_feedback requires canonical consent grants (228 trigger) and the Adelphi party, but seed 105 defines parties later alphabetically. Seed 029 now creates the party + two consent grants idempotently before its feedback rows.
- env.py: _sops_decrypt tries both sops envelope formats — fixes runtime secret decryption regardless of which envelope a deploy produced.
Verified: fresh throwaway database applies all 463 migrations+seeds with 0 failures; then applied the remaining 115 seeds to staging (now 463/463 there too).
-
OneDev
changed state to 'Closed' 3 weeks ago
Previous Value Current Value In Review
Closed
| Type |
New Feature
|
| Priority |
Normal
|
| Assignees |
Not assigned
|
Issue Votes (0)
Symptom
python3 -m services.migration migratefails atseed:002_pilot_operations.sql:Blocks the remaining ~115 seed migrations on a fresh staging database (345/463 applied).
Analysis
The seed inserts harvest_event
c0...07with a plot that thevalidate_operational_context()trigger rejects because it doesn't belong to the referenced crop cycle. Either the seed's plot/crop-cycle pairing is wrong, or the trigger is stricter than the seed data intends.Where
schemas/seeds/002_pilot_operations.sql:48Impact
Fresh environments cannot complete seeding; staging bootstrap blocked at 345/463.
Suggested fix
Correct the plot/crop-cycle pairing in the seed row (or relax the trigger if the constraint is wrong). Verify with a fresh-database migration run.