fix(pipeline): preserve enriched SiteData across incremental rebuilds#730
Conversation
…#721) Paginated pages lost their pagination data after content-only incremental rebuilds because PipelineState.SiteData was never enriched with external sources or onDataFetched hook results from the initial Build(). - Add SiteData field to BuildResult so dev.go can capture enriched data - Inject enriched SiteData into PipelineState after InitPipelineState() - Update PipelineState.SiteData after full-rebuild fallback - Re-run onDataFetched hook after data file reload in BuildIncremental Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to fix dev-server incremental rebuild correctness by keeping PipelineState.SiteData aligned with the “enriched” site data produced by Build() (data files + external sources + onDataFetched hook output), so pagination and other site-data consumers don’t lose data across rebuilds.
Changes:
- Add
SiteDatatopipeline.BuildResultso callers (notablycmd/dev.go) can reuse the enriched data. - Update
cmd/dev.goto copyBuild().SiteDatainto the cachedPipelineStateat startup and after full-rebuild fallbacks. - Update
BuildIncrementalto re-runonDataFetchedafter data-directory reloads and merge returned keys back intoSiteData.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/pipeline/incremental.go | Re-runs onDataFetched and merges returned keys after reloading data files during incremental rebuilds. |
| internal/pipeline/build.go | Extends BuildResult to include the enriched SiteData produced during Build(). |
| cmd/dev.go | Copies enriched SiteData from full builds into the long-lived PipelineState used for incremental rebuilds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Review — PR #730fix(pipeline): preserve enriched SiteData across incremental rebuilds 8 reviewers dispatched. 14 raw findings deduplicated to 6. Verdict: Ready with fixes#1 [P1] Nil dereference of
|
- Add ps != nil guard on full-rebuild SiteData update (nil deref if InitPipelineState failed) - Inject SiteData into plugin runtimes after both startup and full-rebuild SiteData updates so QuickJS alloy.data stays consistent - Populate BuildResult.SiteData in BuildIncremental for contract parity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review responseAll actionable items fixed in 6342220. #1 [P1] — Fixed. Added #2 [P2] — Fixed. Added #3 [P2] — Acknowledged. Two small copies, intentionally different error semantics (see #4). Will extract a helper if a third call site appears. #4 [P2] — Acknowledged. Intentional: #5 [P2] — Downstream. #6 [P3] — Acknowledged. Pre-existing cosmetic issue, not introduced by this PR. Additionally addressed Copilot's feedback: both SiteData injection points in |
Summary
SiteDatafield toBuildResultsodev.gocan capture enriched data (external sources +onDataFetchedhooks) fromBuild()SiteDataintoPipelineStateafterInitPipelineState()at dev server startup, and after full-rebuild fallbackonDataFetchedhook after data file reload inBuildIncremental, mirroring the enrichment path inBuild()Fixes #721
Test plan
alloy dev, edit a content file unrelated to paginated pages, verify pagination data persistsonDataFetchedre-enriches the reloaded data🤖 Generated with Claude Code