Spec 040 — Core-flow test coverage + believable seeder - #119
Merged
Conversation
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.
Closes #118
Spec: `specs/phase-9-polish/040-core-flow-test-coverage.md`
Phase 9's acceptance criterion said "every critical flow has an end-to-end test." Today the suite had none — every test was single-action. This spec ships 5 end-to-end tests + a rich seeder that fills every dashboard page with real data on `db:seed`.
Summary
Test plan
Self-review notes
Automated code-reviewer subagent errored out (not-logged-in state), so this is a manual pass through my prep questions:
Bulk-strip risk — perl regex only matched the exact 4-line signature+body pattern of the identical duplicate. Any file with a variant kept its version (would have shown up as unstripped). All 782 tests pass post-strip, so no runtime break; if any file had a subtle variant that the strip missed, it would still work (parent method inherited).
Queue boundary in end-to-end tests — Chose inline `(new Job($id))->handle()` after asserting dispatch in one test (Project+Repo flow). The rest run the job or action directly since they need to observe side-effects on the persisted state. This is what Laravel's testing docs suggest for pipeline chains: mock outbound network, exercise real container resolution + queue dispatch path where it matters, run the target job inline where the assertion needs its outcome.
`signedGitHubWebhook` sets config side-effect — Acceptable. The helper's purpose IS to make a signed webhook request the controller accepts; that requires the config value to match. Alternative (return the secret, let caller set it) is more verbose without a real benefit.
Issue threshold at 20 — Justified: `seedWorkItems()` scopes to `sync_status = synced` because unsynced repos wouldn't have issues in real usage. ~5 of ~10 seeded repos are synced (first per project + random subset), yielding ~25 issues. Threshold ≥20 gives headroom for random-seeder variance.
`forceFill(['last_seen_at' => now()->subMinutes(5)])` in agent flow test — Standard test practice. `travel()->minutes()` would advance the whole clock, which then breaks `recorded_at` on the earlier POST + the recovery POST that follows. Force-fill is targeted + doesn't drift other state.
Mixed Bus::fake usage across the 5 tests — Intentional. When a test asserts on side-effects that fire via dispatched jobs (webhook → alert opens, telemetry → offline transition), faking would suppress the observable state change. When the test only cares that dispatch happened (Project+Repo), fake is used. Documented in inline comments per test.
`DemoSeedSmokeTest` as one big method — Runs in ~250ms with 16 assertions across 6 domain slices. Splitting into 6 per-seeder tests would 6x the DB refresh cost. Not worth the split.
Deferred follow-ups (non-blocking):