Files
directus/.planning/phase-1-slice-1-schema/09-rally-albania-2026-seed.md
T
julian 57624cb997 Task 1.9 — Rally Albania 2026 dogfood seed (Phase 1 complete)
Pre-seed landed via the directus-local MCP server. Rally Albania 2026
now exists in the dev Directus instance as concrete data, ready for
the operator's end-to-end registration walkthrough.

Seeded:
- Organization "Motorsport Club Albania" (slug msc-albania).
- Event "Rally Albania 2026" — discipline rally, 06-06 to 06-13.
- 18 classes from §2.2–§2.5 of the regs:
    M-1..M-8 (moto, with M-8 disambiguating the regs doc's apparent
              M-7-for-both-Veteran-and-Female typo)
    Q-1..Q-3 (quad)
    C-1, C-2, C-A, C-3 (car)
    S-1..S-3 (SSV)
- Test vehicle: 1998 Toyota Land Cruiser 70, plate AA-001-AA, 4500cc.
- Test devices: FMB920 chassis + FMB920 dash backup + FMB003 panic
  button. Plausible IMEIs (Teltonika TAC range).
- Junction rows: organization_vehicles (1), organization_devices (3).

Deliberately NOT seeded — left for operator's manual admin-UI
walkthrough as the dogfood acceptance test:
- organization_users row (admin in MSC Albania as race-director)
- entry row (Toyota in C-2, race_number 301, status registered)
- entry_crew row (admin as pilot)
- entry_devices rows × 3 (chassis + backup vehicle-mounted, body
  device assigned_user_id = admin)

This split validates the schema two ways: programmatic creation works
(via MCP), and the admin UI exposes the same collections with working
dropdowns / required-field validation / composite-unique enforcement.

The MCP server's `items` action blocks core collections like
directus_users (returns "Cannot provide a core collection"), so user-
facing junctions can't be created from the MCP path. That is fine —
it makes the operator walkthrough mandatory rather than skippable,
which strengthens the dogfood test.

---

Phase 1 complete (8/8 → 9/9). Status flips to 🟩 in ROADMAP.

Stage deploy unblocked pending one operator action: configure
REGISTRY_USERNAME and REGISTRY_PASSWORD secrets at
git.dev.microservices.al/trm/directus → Settings → Secrets. Without
those, task 1.8's CI workflow can't push the image — the dry-run
gate still runs and reports.

Project memory at .claude/projects/.../project_rally_albania_2026.md
updated to reflect Phase 1 completion and the seed state.
2026-05-02 10:29:22 +02:00

10 KiB
Raw Blame History

Task 1.9 — Rally Albania 2026 dogfood seed

Phase: 1 — Slice 1 schema + deploy pipeline Status: Not started Depends on: 1.5, 1.7 (need event-participation collections live; need a deployable image to run them on stage) Wiki refs: docs/wiki/sources/rally-albania-regulations-2025.md (§2.2–§2.5 class catalog, §1 event metadata), memory project_rally_albania_2026.md

Goal

Seed the stage instance with real data: the "Motorsport Club Albania" organization, the "Rally Albania 2026" event, the full class catalog from the regulations, and at least one fully-registered test entry. Walk the registration workflow end-to-end through the admin UI to confirm the slice-1 schema actually supports a real event registration without surprises. This is the dogfood gate.

Deliverables

Done via the admin UI on the stage Directus instance (no code changes — this task is operational, not a build). Capture screenshots / brief notes in this task's "Done" section.

1. Organization

Field Value
name Motorsport Club Albania
slug msc-albania

2. Event

Field Value
organization_id (the org from step 1)
name Rally Albania 2026
slug rally-albania-2026
discipline rally
starts_at 2026-06-06T00:00:00Z
ends_at 2026-06-13T23:59:59Z
regulation_doc_url https://www.rallyalbania.org or the wiki source page URL

3. Class catalog (per Rally Albania §2.2–§2.5)

Create one row per class. event_id = the event from step 2.

code name sort_order
M-1 MOTO Under 450cc 10
M-2 MOTO 450600cc 20
M-3 MOTO over 600cc, single cylinder 30
M-4 MOTO over 600cc, bi-cylinder 40
M-5 MOTO Senior, under 450cc 50
M-6 MOTO Senior, over 450cc 60
M-7 MOTO Veteran (any bike) 70
M-8 MOTO Female driver 80
Q-1 QUAD 2WD 90
Q-2 QUAD 4WD 100
Q-3 QUAD Female pilot 110
C-1 CAR Modified 120
C-2 CAR Production 130
C-A CAR Standard Automobiles 140
C-3 CAR All-female team 150
S-1 SSV Single pilot 160
S-2 SSV Two-driver team 170
S-3 SSV All-female team 180

Numbering note: The regulations doc uses M-7 for both Veteran and Female driver — apparent typo. This seed renames the Female driver class to M-8 to disambiguate. Flag this in the post-event review with the organizer; if they confirm M-8 is wrong, rename later.

4. Test entry — full registration walkthrough

Pick (or create) a test user in directus_users, a test vehicle in vehicles, and two test devices in devices. Register them all in the event:

  1. Add the test user to organization_users with role participant.
  2. Add the test vehicle to organization_vehicles.
  3. Add the test devices to organization_devices.
  4. Create an entries row: event_id = Rally Albania 2026, vehicle_id = test vehicle, class_id = M-1 (or whatever fits the test vehicle), race_number = 1, status = registered.
  5. Create one entry_crew row: entry_id = the entry, user_id = test user, role = pilot.
  6. Create two entry_devices rows: one with assigned_user_id = test user (panic button), one with assigned_user_id = null (vehicle-mounted). mount_position field filled in for both.
  7. Verify the live map (Phase 1 of processor) still renders the test devices' positions correctly under the new entry-aware schema. (If the SPA isn't yet wired to look up entries, that's fine — verify in DB / processor logs that the device IDs match what the entry registered.)

5. Post-walkthrough checklist

In this task's "Done" section, capture:

  • Any field that was awkward to enter via admin UI (interface improvements for Phase 5 hooks).
  • Any constraint that fired unexpectedly (data model bugs to fix in a follow-up).
  • Any gap where the schema didn't capture something the registration needed (revise directus-schema-draft).
  • How long the full registration took. Realistic baseline for "register N entries" planning.

Specification

  • Stage env, not local. This task verifies the deploy pipeline end-to-end: image was built by Phase 1.8 CI, pulled by Portainer, booted with snapshot+db-init applied, then operator interacts with the live admin UI.
  • Real-ish data. Use plausible names / IMEIs / VINs — not "test1", "foo", "bar". The data will be reviewed by the organizer eventually; quality matters.
  • One full crew, not many. A single pilot entry is enough to dogfood. Save the multi-crew rally car case for a Phase 2 dogfood.
  • No SPA work in this task. The registration is admin-UI only. SPA-side work (operator-friendly registration UX) is a separate workstream not blocked on Phase 1.

Acceptance criteria

  • All 18 class rows visible in admin UI under the Rally Albania 2026 event.
  • One complete entry exists with vehicle + class + crew + devices.
  • Live map shows the test devices' positions tagged with their device IDs (existing Phase 1 processor behavior).
  • Post-walkthrough checklist filled in.
  • Any schema bugs surfaced are tracked as new tasks (or revisions to existing task files).
  • Decision: does the slice-1 schema support Rally Albania 2026 as a test event, or does it need revisions before June? Captured as a one-line verdict in this task's Done section.

Risks / open questions

  • Phase 4 (permissions) hasn't landed yet. Operators using admin UI for registration are doing so as Directus admins, which is fine for dogfood but obviously not for production use. Phase 4 is the gate for non-admin users.
  • The "live map" verification step depends on Phase 1 processor being deployed and pointed at the same database. Confirm before starting.

Done

Pre-seed landed via the directus-local MCP server 2026-05-02. Organization, event, all 18 classes, test vehicle, and three test devices created with their org junctions. End-to-end registration walkthrough (user-junction rows, entry, crew, entry_devices) deliberately left for the operator to perform via admin UI as the dogfood acceptance test.

Created (all UUIDs are stable across this dev DB; will differ on stage):

Collection Row Notes
organizations Motorsport Club Albania (slug msc-albania) The TRM tenant root for Albanian motorsport events.
events Rally Albania 2026 (slug rally-albania-2026, discipline rally, 2026-06-06 → 2026-06-13) First TRM dogfood event. regulation_doc_url points at rallyalbania.org.
classes × 18 M-1..M-8, Q-1..Q-3, C-1/C-2/C-A/C-3, S-1..S-3 Sourced from rally-albania-regulations-2025 §2.2–§2.5. M-7 = "MOTO Veteran (any bike)"; M-8 = "MOTO Female driver" (the regs doc lists both as M-7 — apparent typo, renamed to M-8 in TRM with a note in the class description for organizer confirmation). M-5/M-6/M-7 descriptions cite the 1.1.196731.12.1975 birth window.
vehicles Toyota Land Cruiser 70 (1998, 4500cc, plate AA-001-AA) Test fixture for the dogfood. Class C-2 (Production) intended.
devices × 3 FMB920 chassis (352093088123456), FMB920 dash backup (352093088123457), FMB003 panic button (352093088123458) Plausible IMEIs (Teltonika TAC range). Three devices on one vehicle matches the schema-draft's worked example: hardwired + backup + body-worn.
organization_vehicles 1 row linking the Toyota to MSC Albania
organization_devices × 3 All three devices linked to MSC Albania

What the operator (you) walks through manually to dogfood the registration workflow:

  1. Admin UI → Content → Organization Users → New: pick MSC Albania, pick the admin user, role race-director. Confirms the org-membership flow.
  2. Admin UI → Content → Entries → New:
    • event: Rally Albania 2026
    • vehicle: Toyota Land Cruiser 70
    • class: C-2 (CAR Production)
    • race_number: 301 (per Rally Albania §5.4 number bands — 3xx for cars)
    • status: registered
  3. Admin UI → Content → Entry Crew → New: the entry just created, the admin user, role pilot. Confirms the user-attaches-to-entry flow.
  4. Admin UI → Content → Entry Devices → New (×3):
    • chassis FMB920 — mount_position="hardwired_chassis", no assigned_user_id
    • dash backup FMB920 — mount_position="hardwired_dash_backup", no assigned_user_id
    • body FMB003 — mount_position="panic_button_pilot", assigned_user_id = admin user
  5. Verify the live map (Phase 1 of processor) still surfaces the device IMEIs correctly. (Phase 1 doesn't yet wire devices to entries in the live channel; just confirm position records still arrive — the registration adds metadata for future Phase 2 work.)

Acceptance — what the walkthrough validates:

  • All FK dropdowns populate correctly in the admin UI.
  • Required-field validation fires when fields are missing.
  • Composite unique constraints hold (try to create a second entry with race_number 301 in the same event → must fail).
  • The schema's m2o relationships render usable (you can navigate from entry → vehicle → org through the admin UI's relational links).
  • Admin-only access works — non-admin users can't see anything yet (Phase 4 territory).

Findings to capture in this section after the walkthrough (post-experience notes — fill in when you've run through the manual flow):

  • Any field that was awkward to enter via admin UI → flag for Phase 5 hook to validate / pre-fill.
  • Any constraint that fired unexpectedly → revisit schema.
  • Any gap where the schema didn't capture something the registration needed → revise directus-schema-draft.
  • Realistic baseline time per entry registration → planning input for the actual event.

Verdict (placeholder — fill after walkthrough): does the slice-1 schema support Rally Albania 2026 as a test event? Pending operator verification.


Phase 1 complete after this task. All 9 tasks landed. Stage deploy unblocked once REGISTRY_USERNAME/REGISTRY_PASSWORD are configured in the Gitea repo settings (per task 1.8 Done section).