[codex] Add incremental cache dependency keys#289
Conversation
76aab0e to
a25aec7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76aab0ea9d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| refs, err := view.ComponentReferences(page.Blocks.ViewBody) | ||
| if err != nil { | ||
| return seen | ||
| } | ||
| for _, ref := range refs { | ||
| if component, ok := resolveComponentRef(page.Package, page.Uses, ref, components); ok { | ||
| collectComponentDependencies(component, components, seen) |
There was a problem hiding this comment.
Rebuild pages for layout-only component dependencies
When a changed component is only referenced from a layout, the incremental path still handles the change but pagesByComponent has no affected pages because dependencies are collected only from each page's own ViewBody. For example, a page with layout root and a same-package layout containing <Brand /><slot /> renders Brand into the page, but editing brand.cmp.gwdk leaves PageSources empty and the existing HTML stays stale until a full rebuild. Include component references from the resolved layout chain when building the reverse component index, or fall back to a full build when a changed component has no known affected pages.
Useful? React with 👍 / 👎.
| if key, ok := index.componentsBySource[abs]; ok { | ||
| for _, source := range index.pagesByComponent[key] { | ||
| affected[source] = true | ||
| } | ||
| plan.ComponentChanges++ |
There was a problem hiding this comment.
Keep component file assets in component incremental rebuilds
When a changed .cmp.gwdk file declares or edits asset metadata, this new component-change branch now takes the incremental path instead of the previous full build fallback, but BuildIncrementalFromIR only plans scoped JS/runtime assets and does not include planComponentFileAssets. The next manifest rewrite therefore drops component file assets (and newly declared assets are not copied), so pages depending on manifest-mapped component assets break until a full rebuild. Either include component file assets in incremental buildgen or fall back for component asset metadata changes.
Useful? React with 👍 / 👎.
| if err := timings.measure("output_plan_writes", func() error { | ||
| var buildErr error | ||
| result, buildErr = buildgen.BuildIncrementalFromIR(options.Config, ir, outputDir, incrementalPlan.PageSources) |
There was a problem hiding this comment.
Preserve contract validation for incremental component/layout edits
For component or layout edits that contain g:command/g:query references, this new incremental path now skips the full build's linkIRContractReferences and compiler.ValidateContractReferences phase before writing outputs. A changed component/layout can therefore reference a missing or non-web contract and still refresh the dev output, whereas the same edit previously fell back to the full build and surfaced the validation error. Run the contract-link/validation step here for non-page dependency rebuilds, or keep those edits on the full build path.
Useful? React with 👍 / 👎.
Summary
Closes #259.
.gwdksource, Go ABI, config/targets, addons/features, toolchain, IR, output plans, generated files, runtime secrets, and reverse dependencies.gowdk devincremental SPA rebuilds: changed component and layout sources now map through reverse dependencies to affected pages instead of forcing full build output rendering.Verification
git diff --checkgo test ./cmd/gowdk ./internal/buildgen ./internal/compiler