feat(codegen): ts-rs pilot + RPC output-validation drift guard#513
Open
beruro wants to merge 1 commit into
Open
feat(codegen): ts-rs pilot + RPC output-validation drift guard#513beruro wants to merge 1 commit into
beruro wants to merge 1 commit into
Conversation
- ts-rs (optional, feature-gated) on transport + session-persistence; .cargo/config.toml sets TS_RS_LARGE_INT=number so i64/u64 emit `number` matching the existing hand-written Zod contract. Zero production impact (feature off by default; verified cargo check -p transport builds clean). - derive TS on AgentEvent/TextChunk/ToolEvent/ToolEventType + CacheStats; align transport event serde to camelCase and serialize structs directly in both adapters so the emitted wire == the generated TS type. - invoke.ts: configurable output-validation mode (off/warn/throw) + drift ring buffer (window.__orgiiRpcOutputDrift); default preserves dev-warn / prod-off; adds unit tests. - generated bindings committed under crates/*/bindings/.
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
First slice of a batched split of a large local working tree. Introduces ts-rs codegen (feature-gated, zero production impact) and hardens the typed-invoke output validation into a drift guard — the P0 "cross-end contract drift" mitigation.
transport+session-persistence;.cargo/config.tomlsetsTS_RS_LARGE_INT=numbersoi64/u64emitnumber(matches the existing hand-written Zod).#[derive(TS)]on the transport events +CacheStats; transport events' serde aligned to camelCase and both adapters serialize the structs directly (wire == generated type).invoke.ts:off/warn/throwoutput-validation modes +__orgiiRpcOutputDriftobservability; default preserves dev-warn / prod-off. Unit tests added.crates/*/bindings/.Notes
cargo check -p transport).develop.Test plan
cargo test -p transport --features ts-rs(regenerates bindings; 9 tests pass)cargo check -p transport(feature off — ts-rs not linked)pnpm exec vitest run src/api/tauri/rpc(35 tests incl. new outputValidation)