Skip to content

[codex] Add incremental cache dependency keys#289

Merged
cssbruno merged 1 commit into
mainfrom
codex/issue-259-cache-keys
Jun 11, 2026
Merged

[codex] Add incremental cache dependency keys#289
cssbruno merged 1 commit into
mainfrom
codex/issue-259-cache-keys

Conversation

@cssbruno

@cssbruno cssbruno commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #259.

  • Document the compiler cache-key model for .gwdk source, Go ABI, config/targets, addons/features, toolchain, IR, output plans, generated files, runtime secrets, and reverse dependencies.
  • Add a first implementation slice for gowdk dev incremental SPA rebuilds: changed component and layout sources now map through reverse dependencies to affected pages instead of forcing full build output rendering.
  • Expose incremental rebuild cache behavior through the opt-in timings sidecar counters from [Compiler] Add opt-in build phase timings outside deterministic build reports #258.
  • Track incremental buildgen write stats so timing counters can report files written and identical writes skipped for incremental paths too.
  • Update dev/compiler docs and tests for changed page, component, layout, config fallback, and timing counter behavior.

Verification

  • git diff --check
  • go test ./cmd/gowdk ./internal/buildgen ./internal/compiler

@cssbruno cssbruno marked this pull request as ready for review June 11, 2026 17:49
@cssbruno cssbruno force-pushed the codex/issue-259-cache-keys branch from 76aab0e to a25aec7 Compare June 11, 2026 17:58
@cssbruno cssbruno changed the base branch from codex/issue-258-build-phase-timings to main June 11, 2026 17:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread cmd/gowdk/dev_loop.go
Comment on lines +264 to +270
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread cmd/gowdk/dev_loop.go
Comment on lines +186 to +190
if key, ok := index.componentsBySource[abs]; ok {
for _, source := range index.pagesByComponent[key] {
affected[source] = true
}
plan.ComponentChanges++

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread cmd/gowdk/dev_loop.go
Comment on lines +100 to +102
if err := timings.measure("output_plan_writes", func() error {
var buildErr error
result, buildErr = buildgen.BuildIncrementalFromIR(options.Config, ir, outputDir, incrementalPlan.PageSources)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@cssbruno cssbruno merged commit 29fbcde into main Jun 11, 2026
6 checks passed
@cssbruno cssbruno deleted the codex/issue-259-cache-keys branch June 11, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler] Design hybrid incremental cache keys for AST, Go ABI, IR, and output plans

1 participant