Skip to content

fix(runtime): seed-apply hook passes seeds + resilient read-back (loads published seed rows)#1618

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/seed-apply-hook-readback
Jun 6, 2026
Merged

fix(runtime): seed-apply hook passes seeds + resilient read-back (loads published seed rows)#1618
xuyushun441-sys merged 1 commit into
mainfrom
fix/seed-apply-hook-readback

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

Follow-up to #1611. The publish-drafts seed-apply hook fired on staging (seedApplied appeared) but loaded 0 rows. Two defects:

  1. Wrong field name: SeedLoaderRequestSchema.parse({ datasets, … }) — the field was renamed datasetsseeds in feat(spec,runtime): make seed a first-class, publish-applied metadata type #1611 but this newly-added constructor was missed (parse takes unknown, so tsc didn't flag it). → seeds: datasets.
  2. Scope-fragile read-back: read each published seed with the active org only + swallowed misses → empty list → reported success/0-rows. Workspace seeds are stored env-wide (organization_id IS NULL), so the org-scoped read found nothing. Now: try active-org read, fall back to env-wide read; if no body is readable, return success:false + diagnostics (never claim success while loading 0 rows).

Depends on / completes the staging story alongside cloud #141 (Turso remote null-where fix) which made the drafts readable in the first place.

…ient read-back

The publish-drafts seed-apply hook (applyPublishedSeeds) never actually loaded
rows on a remote-Turso staging env. Two defects:

1. Wrong field: it called SeedLoaderRequestSchema.parse({ datasets, ... }) but
   the field was renamed `datasets`→`seeds` in the same PR — this newly-added
   constructor was missed (parse takes `unknown`, so tsc didn't catch it).
   Pass `seeds: datasets`.
2. Scope-fragile read-back: it read each just-published seed with the active
   org only and swallowed misses into an empty list, then reported
   success/0-rows. A workspace seed is typically stored env-wide
   (organization_id IS NULL), so the org-scoped read found nothing. Now try the
   active-org read then fall back to an env-wide read, and if no seed body is
   readable return success:false with a diagnostic (never claim success while
   loading 0 rows).

Manually verified end-to-end on staging: drafts now publish + the object goes
live; this lands the final step — published seed rows actually load.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 6, 2026 2:03pm

Request Review

@github-actions github-actions Bot added the size/s label Jun 6, 2026
@xuyushun441-sys xuyushun441-sys merged commit 8fa71c1 into main Jun 6, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/seed-apply-hook-readback branch June 6, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants