Skip to content

feat(demon-client): emit DEFAULT_CONFIG value facts from the config generator#301

Draft
ryanontheinside wants to merge 1 commit into
mainfrom
ryan/feat/config-contract-numeric-facts
Draft

feat(demon-client): emit DEFAULT_CONFIG value facts from the config generator#301
ryanontheinside wants to merge 1 commit into
mainfrom
ryan/feat/config-contract-numeric-facts

Conversation

@ryanontheinside

Copy link
Copy Markdown
Collaborator

genConfigTypes.mjs now projects DEFAULT_CONFIG's VALUES, not just its keys, so downstream C++/JS hosts consume the defaults instead of re-declaring them (rtmg-vst plan section 7.3: kill the 4-way copy of param defaults across VST, M4L, webui, and the SDK).

What

  • configContract.gen.hpp gains demon::config::defaults: typed constexpr constants (bool/double/const char* by runtime type) for the engine scalars, prompts a/b/blend, every control default, and the top-level seed/swap_source_mode, plus two constexpr POD tables (the ordered controls values and the channel_ranges min/max/reverse rows) for consumers that iterate the fact set.
  • New types/configDefaults.gen.json: exactly JSON.stringify(serializeConfig(DEFAULT_CONFIG)) + newline, one machine-readable artifact for JS/TS consumers, also usable downstream as a byte-exact serialization fixture (rtmg-vst's existing fixture was already byte-identical to it).
  • configContractDrift.test.ts byte-guards the new artifact and asserts the new coverage: a typed constant and a table row for every control, every channel_ranges row with its numeric facts, and artifact == serializeConfig(DEFAULT_CONFIG).

The existing key/enum constant surface is unchanged (purely additive header), so current consumers of the vendored copy keep compiling.

Cross-repo merge order

Companion PR: daydreamlive/rtmg-vst#133 vendors these artifacts and makes the VST/M4L hosts consume the generated facts.

  1. This PR merges first. It changes nothing for existing consumers, and rtmg-vst's contract-drift CI only runs when rtmg-vst's vendored copies change.
  2. rtmg-vst#133 merges after: its contract-drift job regenerates these artifacts from DEMON main and byte-compares the vendored copies, so it can only go green once this PR is on main.

Verification

  • demos/realtime_motion_graph_web/web: unit suite 70/70 (including the extended configContractDrift.test.ts), tsc --noEmit clean.
  • pytest tests/unit/test_wire_contract.py tests/unit/test_client_sdk.py: 19 passed.
  • Committed artifacts regenerated from the built bundle (npm ci && npm run build && npm run gen:config).

…enerator

genConfigTypes.mjs now projects DEFAULT_CONFIG's VALUES, not just its keys:

- configContract.gen.hpp gains demon::config::defaults: typed constexpr
  constants (bool/double/const char* by runtime type) for engine scalars,
  prompts a/b/blend, every control default, and the top-level
  seed/swap_source_mode, plus two constexpr POD tables (the ordered controls
  values and the channel_ranges min/max/reverse rows) for consumers that
  iterate the fact set.
- new types/configDefaults.gen.json: exactly
  JSON.stringify(serializeConfig(DEFAULT_CONFIG)) + newline, one
  machine-readable artifact for JS/TS consumers, which downstream repos can
  also use as a byte-exact serialization fixture.

The existing key/enum constant surface is unchanged (additive header), so
C++ consumers of the vendored copy keep compiling; they can now consume the
default VALUES instead of re-declaring them (rtmg-vst vendors both artifacts
next to the existing .gen.hpp contracts).

configContractDrift.test.ts byte-guards the new artifact and asserts the new
coverage: a typed constant + table row for every control, every
channel_ranges row with its numeric facts, and artifact ==
serializeConfig(DEFAULT_CONFIG).
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.

1 participant