fix(test): unblock pre-push by removing booking-series time-bomb#336
Merged
Conversation
8 av 17 tester i src/app/api/booking-series/route.test.ts failade på både main och staging — klassiskt time-bomb-test. validBody hade hårdkodat firstBookingDate: "2026-05-01" sedan 2026-02-17 (commit f9b47c4). När dagens datum passerade 2026-05-01 började route:s schema-validering returnera 400 istället för 201: firstBookingDate: dateSchema.refine( (val) => new Date(val) >= today, "Startdatum kan inte vara i det förflutna." ) Production-koden är korrekt — schemat ska avvisa förflutna datum. Det var testet som bröt mot principen "tester ska inte time-bomba". Fix: byt till dynamiskt datum (Date.now() + 30 dagar) så testet alltid skickar ett framtida datum. Resultat: 17/17 GREEN i booking-series-suiten. Hela testsuiten 4443/4443 GREEN. Pre-push-hooken kan nu användas utan --no-verify för alla framtida pushes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Markerar Pre-existing booking-series-fail som FIXAD 2026-05-14 + dokumenterar root cause (time-bomb-test) inline för historik - Lägger till ny backlog-rad: audit alla hårdkodade framtida datum i tester (src/**/*.test.ts + e2e/**) för att hitta fler latenta time-bombs innan de exploderar - Föreslår ev. ESLint-regel eller pre-commit-check som varnar för hårdkodade datum-strängar i .test.ts-filer Effort på den befintliga raden var 2-4h — faktisk fix var 10 min (1-rads ändring). Backlog-skattning hade aldrig analyserat rotorsak. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixar 8 pre-existing fails i
booking-series/route.test.tssom blockerat pre-push-hooken sedan 2026-05-02 (dagen efter time-bomb-datumet2026-05-01).Root cause (5 Whys): Test-fixture hade hårdkodat
firstBookingDate: "2026-05-01"(commitf9b47c43d, 2026-02-17). När dagens datum passerade 2026-05-01 började route:s schema-validering returnera 400 istället för 201:Production-koden är korrekt — schemat ska avvisa förflutna datum. Det var testet som bröt principen "tester ska inte time-bomba".
Commits
ffdbccef fix(test): use dynamic future date in booking-series tests— 1-rads test-fix34a9bc2d docs(backlog): add hardcoded future date audit follow-up— markerar gamla raden fixad, lägger time-bomb-audit som follow-upTest-resultat
booking-series/route.test.ts--no-verify)Effort
Backlog uppskattade detta som "2-4h" (S67-0, 2026-05-08). Faktisk fix: 10 min (1-rads ändring). 24x överskattning eftersom rotorsaken inte analyserats — symptomet "8 tester failar" doldes bakom
--no-verify-vana.Follow-up (i samma PR i backlog.md)
src/**/*.test.ts+e2e/**efter mer hårdkodade datum-strängar, ev. ESLint-regel som varnar.Test plan
npx vitest run src/app/api/booking-series/route.test.ts→ 17/17npx vitest run(hela suiten) → 4443/4443git pushutan--no-verifypasserar pre-push-hooken🤖 Generated with Claude Code