feat(seed): local dev seed wired across every surface - #21
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (6)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a local-only D1 seeding system with shared reset statements, SQL generation from JSON fixtures, a local seed CLI, npm wiring, coverage tests, and supporting planning/design docs. ChangesLocal Seed Data Implementation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Dev
participant SeedCLI
participant Builder
participant Wrangler
Dev->>SeedCLI: npm run seed
SeedCLI->>SeedCLI: reject --remote
SeedCLI->>SeedCLI: load fixtures/dev/*.json
SeedCLI->>Builder: buildSeedStatements(fixtures)
Builder-->>SeedCLI: SQL statements
SeedCLI->>Wrangler: d1 execute canopy --local
Wrangler-->>Dev: local D1 seeded
Related issues: None found. Related PRs: None found. Suggested labels: documentation, tooling, tests Suggested reviewers: None identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
canopy | 5a6d016 | Commit Preview URL Branch Preview URL |
Jul 07 2026, 02:26 AM |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/superpowers/specs/2026-07-06-local-seed-data-design.md (1)
122-124: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winClarify that
identity_tasksis seeded explicitly.The loader writes
identity_tasksfromfixtures/dev/identity.json; it does not infer that row from the unmapped-login event. Reword this so the spec doesn’t imply an automatic generation step that the implementation doesn’t have.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/specs/2026-07-06-local-seed-data-design.md` around lines 122 - 124, The spec text is implying that the `identity_tasks` row is generated from the unmapped-login event, but the loader actually seeds it explicitly from `fixtures/dev/identity.json`. Reword the affected passage to state that the staged doc version, ADR draft, milestone proposal, and one explicitly seeded `identity_tasks` row are present so Triage’s Review and Maintenance surfaces both have something to act on. Keep the wording aligned with the loader behavior and the `identity_tasks`/`fixtures/dev/identity.json` symbols so it is clear no inference step exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/superpowers/plans/2026-07-06-local-seed-data.md`:
- Around line 115-120: The seed data mapping is using the wrong field for
roadmap state values: update the fixture generation in the local seed data
script to read and emit milestones.status instead of phase. Keep the
human-readable phase labels separate, and ensure the code that builds the INSERT
statements for the roadmap entries uses the status field so the seeded values
match done, in_progress, and upcoming.
---
Nitpick comments:
In `@docs/superpowers/specs/2026-07-06-local-seed-data-design.md`:
- Around line 122-124: The spec text is implying that the `identity_tasks` row
is generated from the unmapped-login event, but the loader actually seeds it
explicitly from `fixtures/dev/identity.json`. Reword the affected passage to
state that the staged doc version, ADR draft, milestone proposal, and one
explicitly seeded `identity_tasks` row are present so Triage’s Review and
Maintenance surfaces both have something to act on. Keep the wording aligned
with the loader behavior and the `identity_tasks`/`fixtures/dev/identity.json`
symbols so it is clear no inference step exists.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c9cbf00d-93e7-4add-8304-99ab734d5d8d
📒 Files selected for processing (18)
docs/superpowers/plans/2026-07-06-local-seed-data.mddocs/superpowers/specs/2026-07-06-local-seed-data-design.mdfixtures/dev/adrs.jsonfixtures/dev/docs.jsonfixtures/dev/events.jsonfixtures/dev/feed.jsonfixtures/dev/identity.jsonfixtures/dev/roadmap.jsonfixtures/dev/triage.jsonpackage.jsonscripts/seed-dev.mjsscripts/seed/build.d.mtsscripts/seed/build.mjsscripts/seed/reset.d.mtsscripts/seed/reset.mjstest/apply-migrations.tstest/seed-build.test.tstest/seed-coverage.test.ts
| `${num(f.id)}, ${q(f.author)}, ${q(f.summary)}, ${q(f.body)}, ${jsonLit(f.artifacts)}, ${q(f.created_at)})` | ||
| ); | ||
| for (const t of f.tags ?? []) { | ||
| s.push(`INSERT INTO entry_tags (tag, entry_type, entry_id) VALUES (${q(t)}, 'feed', ${q(String(f.id))})`); | ||
| } | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use status here, not phase.
The values you list (done / in_progress / upcoming) are milestones.status; phase in the fixture is the human label (Now, Weeks 3-4, Next). This mismatch will confuse anyone updating the roadmap seed or validating the coverage matrix.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/superpowers/plans/2026-07-06-local-seed-data.md` around lines 115 - 120,
The seed data mapping is using the wrong field for roadmap state values: update
the fixture generation in the local seed data script to read and emit
milestones.status instead of phase. Keep the human-readable phase labels
separate, and ensure the code that builds the INSERT statements for the roadmap
entries uses the status field so the seeded values match done, in_progress, and
upcoming.
Builder emits the 0018 structured columns (pr_summaries title/what/why/impact, issue_summaries title/next_step) from structured fixture objects; event fixtures carry PR base.ref and issue milestone title/due_on. Greatly expanded every surface's fixtures (11 docs across both spaces, 14 feed entries, 6 ADRs, 5 triage + 3 milestone proposals, 7 roadmap milestones across phases, 13 events, 2 identity tasks). Coverage guard asserts the structured DTO fields and the wider dataset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
Restores a local dev seed that lights up every Canopy surface — My Work, Feed, Docs, Roadmap, Triage, Search — against the current schema. The old
scripts/seed-dev.sqlhad rotted: itINSERTs intofocus(dropped in0014) so it aborts outright, and it never touched the tables My Work and Roadmap now read from (events,people,plan,milestone_progress,pr_summaries,issue_summaries,identity_tasks).How it works
Plain JSON fixtures under
fixtures/dev/are the source of truth.npm run seedresets local D1 and loads them; the app's existing D1 read paths run unchanged, and FTS5 triggers auto-index on insert (so Search needs no direct seeding). It pairs with the pre-existingDEV_LOGINtoggle — flipDEV_LOGIN=AndresL230in.dev.vars, runnpm run seed, and every surface has data as that user.scripts/seed/build.mjs— pure, dependency-free SQL builder (buildSeedStatements,targetsRemote), unit-tested.scripts/seed/reset.mjs— the canonical data-table reset, now imported bytest/apply-migrations.tstoo, so the harness and the seed share one truncation list (no silent drift when a migration adds a table).fixtures/dev/*.json— docs (incl. a staged version), feed, ADRs, triage, roadmap (plan + phase + progress), events (subjectAndresL230), an unmapped-login identity task.scripts/seed-dev.mjs— local-only CLI loader; refuses--remoteand hardcodes--local, so it is structurally unable to touch prod. Never imported by the worker.test/seed-coverage.test.ts— a guard that runs the real builder against Miniflare D1 and asserts every surface returns data (My Work activity + to-dos, roadmap progress, search hits, all four triage queues, feed tag join).Verification
npm run typecheckclean.wrangler devE2E confirmed/roadmap,/me/dashboard(person=Andres, 2 PRs + 2 to-dos),/search, and/proposalsall render seeded data.Notes
.dev.varsis git-ignored; theDEV_LOGIN=AndresL230change is local only and not in this PR.build-prod-seed.mjs/seed-prod.sql) and the separate pre-existing issue that a nested.claude/worktreescheckout pollutes barenpm testcollection.Design:
docs/superpowers/specs/2026-07-06-local-seed-data-design.md· Plan:docs/superpowers/plans/2026-07-06-local-seed-data.md🤖 Generated with Claude Code
Summary by CodeRabbit
npm run seed) that generates and applies ordered SQL to local D1.