Repository navigation
fix(session): report a rejected record.set value as invalid_value - #503
Merged
Merged
Conversation
A record.set value that does not decode into the record's type was reported as `internal: engine/transport failure`, pointing at the engine instead of the caller's value. Add DbError::InvalidValue (kind Data) for a remote write whose value the record's codec rejects, map it to a new RpcError::InvalidValue, and carry it on the AimX wire as `invalid_value`. aimdb-client and the WASM bridge name it. Older clients decode the unknown code as `internal`, as before. Fixes #454 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGkDJ9KUrNCqA8p5JA2Hyo
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.
Description
If a
record.setvalue didn't decode into the record's type, the client gotinternal: engine/transport failure. That blames the engine, not the caller's value. This PR gives the rejection its own error code from the record to the client:aimdb-core: addsDbError::InvalidValue { type_name }, of kindData. Both remote-write paths intyped_record/record.rs(set_from_json,set_from_json_bytes) return it when decoding fails, where they used to return a genericRuntimeError.RpcError::InvalidValue.map_db_errmaps the newDbErrorto it.invalid_value. Older clients read an unknown code asinternal, so they keep today's behaviour.aimdb-client/ WASM bridge: both showinvalid_value: the value does not match the record's type. The CLI and MCP displayClientError::ServerErrorunchanged, so they needed no edits.The codec traits and the frame layout are unchanged. The client still doesn't get the deserializer's own message ("ideally" in #454). Sending it would mean changing the codec traits to return the error and adding a
msgfield to the frame, so I'm leaving that for a follow-up if wanted.Tests: the UDS end-to-end test
aimx_roundtrip_over_uds_production_servernow sends a value of the wrong type and checks three things: the reply code isinvalid_value, the stored value is unchanged, and the connection keeps serving calls. The wire round-trip test now includes the new code.Related Issue
Checklist
make check). I didn't run the full target. These all pass:aimdb-coretests (std+remote and alloc+remote),aimdb-clientandaimdb-mcptests,cargo checkof core forthumbv7em-none-eabihf, clippy-D warningson core and client and on the wasm adapter forwasm32-unknown-unknown, andcargo fmt --check.aimdb-core,aimdb-clientandaimdb-wasm-adapter.)Generated by Claude Code