Repository navigation
feat!: add partial configuration patches and patch events - #122
Open
google-labs-stitch[bot] wants to merge 10 commits into
Open
google-labs-stitch[bot] wants to merge 10 commits into
google-labs-stitch[bot] wants to merge 10 commits into
Conversation
- Define Copy and Default patch structs for ProcessorConfig and stages - Derive optional camelCase Wasm types and TypeScript declarations - Add Processor::patch_config and Tunelet.patchConfig methods - Add ControlEvent::Patch and track pitch bounds in event preflight - Export all ten patch types from src/lib.rs and src/index.ts - Document patch controls in README.md and check them in verify-pack
Contributor
|
Review: Preferred over #64, #66, and #72 for partial configuration updates (18x faster Wasm patchConfig, strict atomic event validation, non-breaking in TS). Please refine before merge:
|
This was referenced Nov 25, 2026
- Decode patch events in EventKeys and decode_control_event. - Pass the active configuration to decode_events. - Keep SyncInitInput and patch types in scripts/verify-pack.mjs.
- Extract pub(crate) validate_* helpers for all stage fields. - Call the shared helpers from *Config::validate and *ConfigPatch. - Share PitchConfigPatch::validate_fields in validate and apply_to. - Align PunchConfigPatch rustdoc terms with PunchConfig.
- Add #[non_exhaustive] to ControlEvent for the 0.4.0 release. BREAKING CHANGE: ControlEvent adds Patch and is #[non_exhaustive].
Contributor
Author
|
Addressed both items and merged
|
Contributor
- Merge main 0.3.4 with ControlActivity and the Wasm scripts. - Export ControlActivity next to the configuration patches. - Check patchConfig, ControlActivity and patch events in verify-pack.
Contributor
Author
|
Addressed in
|
Contributor
|
Round 3 review: Core patch logic, atomic sequential validation, and #61 alignment look solid, but one TypeScript issue needs a fix before 0.4.0:
|
- Add humanize and flex_tune to CorrectionConfigPatch - Share validate_humanize and validate_flex_tune in src/resynthesis.rs - Pass the active configuration to decode_events in Float32 Wasm calls - Normalize patch and ControlEvent JSDoc links in normalize-jsdoc.mjs - Keep patchConfig in the TypeScript table and rules in README.md - Check patchConfig JSDoc and Float32 patch events in verify-pack.mjs
- Add `| undefined` to all optional `tsify` types on patch structs. - Check `undefined` patch fields in `scripts/verify-pack.mjs`. - Document `undefined` patch fields in `README.md`.
Contributor
Author
|
Addressed in
|
Contributor
|
Review: Core patch validation, atomic sequential preflight, and
|
- Reuse the validation helpers from main in all patch types - Combine ControlEvent::Patch and ControlEvent::Parameter in events - Decode patch and parameter events in the Wasm event decoder - Document patch and scalar parameter controls in README.md - Check patch, parameter and telemetry types in verify-pack.mjs
- Add #[non_exhaustive] to ProcessorConfigPatch in src/config.rs - Add #[non_exhaustive] to all nine stage and sub-stage patch types
- Remove the redundant export list of patch types from src/index.ts
Contributor
Author
|
Addressed in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change adds partial configuration patch types,
Processor::patch_config,Tunelet.patchConfig, andControlEvent::Patchso Rust and WebAssembly callers can update selected fields without a full configuration copy.Copy,Default, and#[non_exhaustive]patch structs (ProcessorConfigPatch,PunchConfigPatch,WarmConfigPatch,ResynthesisConfigPatch,PitchConfigPatch,CorrectionConfigPatchincludinghumanizeandflex_tune,FormantConfigPatch,HarmonyConfigPatch,AlienConfigPatch, andReverbConfigPatch), export them fromsrc/lib.rs, and re-export their generated TypeScript interfaces fromsrc/index.tsviaexport * from "../pkg/tunelet.js".pub(crate) fn validate_*range and finiteness helpers across*Config::validateand*ConfigPatch::validate.#[serde(default, rename_all = "camelCase")]and#[tsify(optional, type = "... | undefined")]) on all ten patch structs forexactOptionalPropertyTypes: truecompatibility, and normalize patch andControlEventJSDoc comments inscripts/normalize-jsdoc.mjs.Processor::patch_configandTunelet.patchConfigto merge supplied fields onto a stack copy ofProcessorConfig, validate touched stages and pitch frequency order (min_frequency_hz < max_frequency_hz), and apply the result throughProcessor::apply_config.ControlEvent::Patch(ProcessorConfigPatch)alongsideControlEvent::Parameter(ParameterControl)on#[non_exhaustive] ControlEvent, register"patch"in the cachedEventKeysWasm event decoder acrossi16andFloat32process*calls, and advance the stackProcessorConfigcopy inValidatedEvents::new/validate_in_sequenceso block preflight validates single-bound pitch patches against active or earlier-event bounds before any state, output buffer, or drain changes.config(),setConfig(),defaultConfig(),Processor::apply_config,Resynthesis::apply_config, and all existingControlEventvariants unchanged so fixed-point PCM andFloat32output stay bit-exact.patchConfig,ProcessorConfigPatch, andControlEvent::PatchalongsideControlEvent::ParameterinREADME.mdand rustdoc, and extendscripts/verify-pack.mjswith runtime and--exactOptionalPropertyTypesundefinedcoverage across all ten*ConfigPatchinterfaces.Verification
cargo fmt --check,cargo clippy --locked --lib -- -D warnings,RUSTFLAGS="-D warnings" cargo build --locked --release,RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps,cargo package --locked, and MSRV1.88builds.npm run check:wasm,npm run verify:pack, andnpm run verify:pack -- --ignore-scripts.#[non_exhaustive]patch construction viaDefault::default(), identicalError::InvalidConfigresults across sharedvalidate_*helpers, bit-identical PCM,Float32, feedback, telemetry, formant envelope, and drain output acrosspatch_config/ControlEvent::Patch/ControlEvent::Parameterandset_config/ControlEvent::Configure, empty{}drain cancellation,undefinedpatch property preservation, and atomic preflight rejection on invalid fields and unordered pitch bounds.config() + setConfig(cfg): 383 Wasm-to-JS calls, 8 UTF-8malloccalls (37.576 usmedian)setConfig(cachedConfig): 251 Wasm-to-JS calls, 8 UTF-8malloccalls (21.773 usmedian)patchConfig({ outputGain: 0.9 }): 20 Wasm-to-JS calls, 0 UTF-8malloccalls (2.070 usmedian)patchConfig({ resynthesis: { dryMix: 0.2 } }): 66 Wasm-to-JS calls, 0 UTF-8malloccalls (6.124 usmedian)ControlEvent::Patch({ resynthesis: { dryMix: 0.2 } }): 89 Wasm-to-JS calls, 0 UTF-8malloccalls (9.205 usmedian) vs 209 calls and 7malloccalls (19.397 usmedian) forControlEvent::ResynthesisAutomated PR initiated by user @byteland-app via Stitch Loop.