Skip to content

feat(core): add direct JSON byte paths for remote access#203

Merged
lxsaah merged 1 commit into
aimdb-dev:mainfrom
thaodt:feat/direct-json-byte
Jul 23, 2026
Merged

feat(core): add direct JSON byte paths for remote access#203
lxsaah merged 1 commit into
aimdb-dev:mainfrom
thaodt:feat/direct-json-byte

Conversation

@thaodt

@thaodt thaodt commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds a compatibility-preserving direct JSON byte path to AimDB's type-erased remote-access stack.

  • Adds defaulted byte methods to RemoteSerialize, JsonCodec<T>, JsonRecordAccess and JsonBufferReader.
  • Keeps existing custom codec and reader impls source-compatible through serde_json::Value fallbacks.
  • Overrides the built-in serde path with direct serde_json::to_vec and serde_json::from_slice.
  • Routes state-record record.get and subscription events through owned JSON Payloads without materializing an intermediate record serde_json::Value.
  • Preserves the existing AimX v2 schema, authorization, lag handling, cancellation, backpressure, error behavior, ring drain cursor semantics and no-producer-override write safety.
  • Keeps metadata, graph, query, admin, aggregate drain, record.set and write wrapper handling on the existing tree path. Inbound wire handling does not use hand-written JSON offset extraction.
  • Adds semantic-equivalence, compatibility, allocation and criterion benchmark coverage.

Performance

The focused benchmarks measure the in-memory typed-record-to-AimX-envelope boundary. They do not include connector queues, scheduler wakeups, syscalls or physical wire time.

Validation

  • make check
  • cargo test -p aimdb-bench
  • cargo bench -p aimdb-bench --bench b0_alloc_remote_json
  • cargo bench -p aimdb-bench --bench b1_b2_remote_json

The full repository gate covers formatting, linting, host tests, valid feature combinations, no_std + alloc, Cortex-M, WASM, dependency policy, README drift, codegen drift and production simulation checks.

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 have updated the documentation accordingly.

@thaodt
thaodt requested a review from lxsaah as a code owner July 23, 2026 09:20

@lxsaah lxsaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Non-blocking follow-up: converting the shared drain_values to try_recv_json_bytes would give record.drain the direct path via RawValue (already used by the envelope) and drop the re-serialization in record.get’s ring fallback as well. We should think of a follow-up issue here! Thanks!!

@lxsaah
lxsaah merged commit bdb6640 into aimdb-dev:main Jul 23, 2026
8 checks passed
lxsaah added a commit that referenced this pull request Jul 24, 2026
Reconcile main's direct-JSON-byte remote path (#192/#203) with design-048's
SubUpdate.skipped loss-signal design:

- Subscribe path keeps design-048's SubUpdate/skipped contract (the merged
  Session::subscribe trait yields BoxStream<SubUpdate>); stream.rs stays on
  the (Value, u64) design.
- dispatch.rs combines both: SubUpdate subscribe + wildcard fan-in + WI1
  hello() version gate, plus main's DispatchReply / record.get fast path.
  Restored the futures_util::StreamExt import main had dropped.
- aimdb-bench/Cargo.toml unions both bench sets (fanout_encode + remote_json);
  remote_json.rs updated for Outbound::Event's new `topic` field.

main's direct-JSON-bytes optimization in the live subscribe path is
superseded here and left as the documented follow-up (design 048, "removing
the intermediate serde_json::Value").

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[FEAT] Add direct JSON byte paths for type-erased remote access

2 participants