Skip to content

feat(config): load-config verb, partial-load rendering, demo examples#106

Merged
brandon-fryslie merged 1 commit into
mainfrom
load-config-verb-partial-render
Jun 12, 2026
Merged

feat(config): load-config verb, partial-load rendering, demo examples#106
brandon-fryslie merged 1 commit into
mainfrom
load-config-verb-partial-render

Conversation

@brandon-fryslie

Copy link
Copy Markdown
Contributor

Summary

  • VERB_LOAD_CONFIG — new click verb that stores a per-session config-file path in SessionState; the daemon reads it at the render cache-lookup boundary so the override takes effect on the next tick without a daemon restart.
  • Partial-load rendering — variable declaration failures during registerDslConfig now accumulate as loadWarnings (non-fatal advisory warnings) instead of aborting the load; segment render bodies wrap in try/catch and return a ⚠ name: … error cell for any segment that fails at render time, keeping all other segments alive. Together these make config switching graceful: a broken new config renders what it can, surfaces what it can't.
  • coerceToType for git var defaults — fixes type coercion for string defaults on number-typed git fields ("0"0), matching the live-fetch projection path.
  • examples/ directorydemo-actions.json5 and demo-variables.json5: comprehensive demo configs exercising the full surface of actions/layout/groups and all variable source kinds respectively, usable standalone via CC_CANDYBAR_CONFIG=examples/… pnpm demo.

Test plan

  • pnpm test — 1172 passing (including updated dsl-actions.test.ts cycle arity test, now asserts the ⚠ bar: cycles 3 members error cell form)
  • pnpm typecheck — clean
  • pnpm lint — clean (1 pre-existing unused-var warning in layout.ts, unrelated)
  • Manual: CC_CANDYBAR_CONFIG=examples/demo-actions.json5 pnpm demo renders and all actions function

Three coupled additions:

1. **VERB_LOAD_CONFIG** — new verb + `SESSION_CONFIG_OVERRIDE_KEY`:
   a click writes a per-session config-file path into SessionState; the
   render path reads it at the cache-lookup boundary so the next request
   uses the overridden file without restarting the daemon.

2. **Partial-load rendering** — variable declaration failures accumulate
   as `loadWarnings` (non-fatal) rather than aborting the config load;
   segment render wraps in try/catch and returns a ⚠ error cell for any
   segment that fails, keeping the rest of the bar alive. Together these
   let a config switch succeed even when the new config has broken
   variables — working segments render, broken ones show an error cell.

3. **`coerceToType` for git var defaults** — string "0" is coerced to
   number 0 for number-typed git fields, matching the behaviour of the
   live-fetch projection path.

Also adds `examples/demo-actions.json5` and `examples/demo-variables.json5`
— comprehensive demo configs exercising the full surface of each subsystem,
with `CC_CANDYBAR_CONFIG=examples/… pnpm demo` instructions inline.
@brandon-fryslie brandon-fryslie merged commit 0059a87 into main Jun 12, 2026
6 of 7 checks passed
@brandon-fryslie brandon-fryslie deleted the load-config-verb-partial-render branch June 12, 2026 08:58

@brandon-fryslie brandon-fryslie left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adversarial review

The diff introduces VERB_LOAD_CONFIG, partial-load rendering via loadWarnings accumulation, coerceToType for git-var defaults, and two demo configs. The architecture is sound: the verb handler validates its wire value at the boundary, the render-time try/catch correctly isolates broken segments, and the warning reset in reloadInto (entry.lastWarning = detectConfigCollisions(...) at line 207) fires before the new append block so stale warnings do not persist across reloads. VERBS is constructed via spread of LEAF_VERBS so the new verb is automatically dispatched. No correctness defects were found after checking callers and contracts.

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.

2 participants