Skip to content

fix(session): report a rejected record.set value as invalid_value - #503

Merged
lxsaah merged 1 commit into
mainfrom
claude/vigilant-planck-ezn02w
Nov 25, 2026
Merged

lxsaah merged 1 commit into
mainfrom
claude/vigilant-planck-ezn02w

Conversation

@lxsaah

@lxsaah lxsaah commented Nov 25, 2026

Copy link
Copy Markdown
Member

Description

If a record.set value didn't decode into the record's type, the client got internal: 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: adds DbError::InvalidValue { type_name }, of kind Data. Both remote-write paths in typed_record/record.rs (set_from_json, set_from_json_bytes) return it when decoding fails, where they used to return a generic RuntimeError.
  • Session: adds RpcError::InvalidValue. map_db_err maps the new DbError to it.
  • AimX wire: the new error goes out as the code invalid_value. Older clients read an unknown code as internal, so they keep today's behaviour.
  • aimdb-client / WASM bridge: both show invalid_value: the value does not match the record's type. The CLI and MCP display ClientError::ServerError unchanged, 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 msg field 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_server now sends a value of the wrong type and checks three things: the reply code is invalid_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

  • I have read the CONTRIBUTING.md document.
  • My code follows the project's coding standards.
  • I have added tests to cover my changes.
  • All new and existing tests passed (make check). I didn't run the full target. These all pass: aimdb-core tests (std+remote and alloc+remote), aimdb-client and aimdb-mcp tests, cargo check of core for thumbv7em-none-eabihf, clippy -D warnings on core and client and on the wasm adapter for wasm32-unknown-unknown, and cargo fmt --check.
  • I have updated the documentation accordingly. (Changelogs for aimdb-core, aimdb-client and aimdb-wasm-adapter.)

Generated by Claude Code

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
@lxsaah
lxsaah merged commit e1821cd into main Nov 25, 2026
10 checks passed
@lxsaah
lxsaah deleted the claude/vigilant-planck-ezn02w branch November 25, 2026 21:09
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.

[BUG] record.set reports a rejected value as internal: engine/transport failure

2 participants