Skip to content

Improve watch dependency coverage and simplify settings rebuilds - #329

Merged
bcomnes merged 5 commits into
feat/incremental-global-datafrom
feat/incremental-global-data-watch-optimizations
Sep 16, 2026
Merged

bcomnes merged 5 commits into
feat/incremental-global-datafrom
feat/incremental-global-data-watch-optimizations

Conversation

@bcomnes

@bcomnes bcomnes commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #326. Keep watch dependency coverage and routing improvements separate from the incremental global-data feature.

Changes

  • Use one settings-input set for global-vars, Markdown settings, esbuild settings, and their tracked imports. Any settings-input change resets retained global data and triggers a full rebuild, including rediscovery and restarting esbuild. No Markdown-only selection or fine-grained settings routing.
  • Target ordinary page and helper edits using known consumers, instead of the retained-state full-rebuild fallback in Add incremental global-data state and docs navigation indexing #326.
  • Union shared page, layout, template, and generated-page consumers before selecting rebuild scope.
  • Recognize browser-only imported helpers and let esbuild rebundle without resetting the retained index or rendering pages.
  • Fall back conservatively when server dependency analysis fails, without treating Markdown/HTML source files as JavaScript modules.
  • Observe known imported inputs with non-processed extensions, including JSON, and filter unrelated events after dependency maps are ready. The existing import tracker discovers these dependencies; this fixes watcher integration rather than adding a JSON parser or analyzer.
  • Retain focused planner, shared-settings, and native imported-JSON tests. A settings regression test verifies that a Markdown settings edit rerenders an unrelated, unsubscribed template.

The global-data API, worker state lifecycle, and documentation index are unchanged. No custom dependency analyzer or re-export workaround is added; the upstream limitation remains tracked by #328 and two test TODOs.

Validation

  • Full Node suite after simplifying settings rebuilds: 354 passed, 0 failed, 2 TODOs.
  • ESLint, TypeScript, and diff whitespace checks passed.
  • Documentation-site build passed.

The browser suite was not rerun. See #326 for the two previously observed documentation-navigation timeouts.

Review this PR against #326, not master. Created and submitted using gh stack.

@coveralls

coveralls commented Sep 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 35044789684

Coverage increased (+0.1%) to 95.451%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (117 of 120 lines covered, 97.5%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
index.js 70 67 95.71%
Total (3 files) 120 117 97.5%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 10303
Covered Lines: 9941
Line Coverage: 96.49%
Relevant Branches: 3172
Covered Branches: 2921
Branch Coverage: 92.09%
Branches in Coverage %: Yes
Coverage Strength: 455.96 hits per line

💛 - Coveralls

@bcomnes bcomnes changed the title Optimize incremental global-data watch dependency routing Improve watch dependency coverage and simplify settings rebuilds Sep 15, 2026
@bcomnes
bcomnes force-pushed the feat/incremental-global-data-watch-optimizations branch 2 times, most recently from cbad527 to 5eb0ad6 Compare September 15, 2026 20:33
@bcomnes
bcomnes requested a lite review from Copilot September 15, 2026 21:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two moderate issues remain in watcher reset and browser dependency recovery handling.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Improves watch dependency tracking and rebuild routing, including settings, browser, JSON dependencies, targeted rebuilds, tests, and documentation.

Changes:

  • Unifies settings dependency tracking and reset behavior.
  • Expands targeted and conservative rebuild handling.
  • Adds planner, watcher, and imported-JSON coverage.
File summaries
File Summary Findings
test-cases/incremental-global-data/index.test.js Incremental and imported-JSON tests. None
test-cases/incremental-global-data/helpers.js Native watcher test support. None
lib/watch-plan.test.js Planner regression coverage. None
lib/watch-plan.js Rebuild scope and reset planning. None
index.js Dependency tracking, event filtering, and rebuild execution. Moderate (3 votes): preserve full plans for reset-triggering bundle inputs. Moderate (1 vote): mark failed browser analysis for conservative recovery.
docs/implementation/README.md Watch behavior documentation. None
docs/data/README.md Tracked-input and reset documentation. Nit (1 vote): document tracked imports as reset triggers.
Review details

Suppressed comments (2)

docs/data/README.md:437

  • The producer dependency map includes the global.data entry and every tracked static import, and changes to any of those paths reset the retained index. This note currently says only global.data.* resets it, so an imported producer helper is described as an individual-entry update even though editing it emits a reset; please name the tracked imports here.
  Changes to `global.data.*` or settings inputs reset the saved index.

index.js:859

  • When find() fails for a browser entry, this catch leaves dependencyAnalysisFailed false. A later change to an imported non-processed file such as JSON is then absent from esbuildDepPaths and is removed by #filterWatchEvents, so the browser bundle remains stale instead of taking the documented conservative recovery path. Mark the analysis as failed here so subsequent events bypass filtering and trigger recovery.
      } catch {
        // Unknown browser helpers still take the conservative reset path.
      }
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread index.js Outdated
@bcomnes
bcomnes force-pushed the feat/incremental-global-data-watch-optimizations branch from 5635d04 to 03f251f Compare September 16, 2026 01:37
@bcomnes
bcomnes merged commit 77eac16 into master Sep 16, 2026
10 checks passed
@bcomnes
bcomnes deleted the feat/incremental-global-data-watch-optimizations branch September 16, 2026 02:37
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.

3 participants