Tail callbacks + first-time achievements + persistent SEEN BEFORE (roadmap #1) #26
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/tail-callback"
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?
Implements roadmap #1 (zero-API delight) end-to-end — the log-time callbacks and their persistent surfaces — from
docs/plan-tail-callback-achievements.md. Zero AeroDataBox calls.1 · Tail callback (at log time)
Logging a flight on a registration you've flown before fires a FIDS toast — ✈ SEEN BEFORE · LN-FGI — your 2nd flight · last flown Apr 23 2026; a new airframe gets ✈ NEW AIRCRAFT. Works on both save intents (survives navigation on "Save").
2 · First-time achievements
src/lib/achievements.ts— pure core deriving firsts (airport / country / airline / aircraft), flight + distance milestones, and the longest-flight record. Derived, never stored at insert — so bulk imports, out-of-order entry, edits, and post-hoc enrichment all attribute "firsts" to the chronologically earliest flight, not the first-inserted one. Full unit suite (order-independence, tie-breaking, null distances, domestic dedup) — 15 tests.getAchievements()server query + a server-only projection loader (kept out of client-imported modules per §8).createFlightalso returns the firsts the new flight earned → celebrated in a toast + the add-another banner./achievementsFIDS page (Overview / Milestones / Records / Firsts timeline) + header nav link.3 · Persistent "seen before"
getFlightreturnstailHistory {total, ordinal}; the flight detail page shows a ✈ Seen before · Nth of M badge and links the tail to its fleet page.How it stays clean
TailCallback/ achievement types are exported type-only, soflights.tsstays within the client-bundle rule (§8); the db-touching projection lives in_achievements-internal.ts.ordinal()moved toflight-display.ts(de-dupes call sites).Verification
pnpm typecheck✅ ·pnpm lint✅ ·pnpm test67 passed (was 52) ✅/achievements,/flights/new,/fleet/$tailall serve 200; SQL semantics for tail history + callback validated against a real DB.Supersedes the original Part-1-only description; the tail callback + achievements ship together as one delight bundle.
Part 2 of the delight bundle, plus the persistent counterparts to the log-time tail callback. Achievements (derived, never stored — correct under import/edit/reorder): - src/lib/achievements.ts: pure core (firsts per airport/country/airline/ aircraft, flight + distance milestones, longest-flight record), with a full unit-test suite incl. order-independence and tie-breaking. - getAchievements() server query + a server-only loader that projects flights into the pure shape (kept out of client-imported modules per §8). - createFlight now also returns the firsts the new flight earned; the log screen celebrates them in a toast + add-another banner. - New /achievements FIDS page (overview / milestones / records / firsts timeline) + header nav link. Persistent "seen before": - getFlight returns tailHistory {total, ordinal}; flight detail shows a "✈ Seen before · Nth of M" badge and links the tail to its fleet page. - fleet aircraft hero shows a "Seen N×" badge for airframes flown >1. Shared `ordinal()` helper moved to flight-display.ts (de-dupes new.tsx).Add SEEN BEFORE / NEW AIRCRAFT tail callback at log time (roadmap #1)to Tail callbacks + first-time achievements + persistent SEEN BEFORE (roadmap #1)