Skip to content

refactor(core)!: split AnyRecord into capability traits (036 W2)#142

Open
lxsaah wants to merge 2 commits into
refactor/036-w1-data-plane-de-anyfrom
refactor/036-w2-anyrecord-split
Open

refactor(core)!: split AnyRecord into capability traits (036 W2)#142
lxsaah wants to merge 2 commits into
refactor/036-w1-data-plane-de-anyfrom
refactor/036-w2-anyrecord-split

Conversation

@lxsaah

@lxsaah lxsaah commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements W2 from 036-followup-refactoring.md (034 §3.8): splits the ~22-method AnyRecord god-trait by consumer, stacked on the W1 branch (#141) in the same breaking window.

  • AnyRecord (6 methods) — storage/lifecycle only: validate, as_any(_mut), drain_config_errors, set_writable_erased, plus the cfg-gated json_access() accessor so the remote-access gate lives in one place for consumers.
  • RecordIntrospect (supertrait) — graph/metadata introspection: connector links, has_*, record_origin, buffer_info, transform_input_keys, collect_metadata. Consumed by the builder's dependency-graph construction, route collection, and list_records.
  • JsonRecordAccess (cfg remote-access) — latest_json / subscribe_json / set_from_json, reached via json_access(). The runtime .with_remote_access() checks stay inside the methods → no behavior change. (The 036 sketch said json-serialize; the code gate is and stays remote-access.)
  • RecordMetricsReset (supertrait) — the cfg-gated, no-op-default profiling/metrics resets.

Supertrait wiring keeps every dyn AnyRecord call site compiling unchanged; only the four JSON call sites (builder try_latest_as_json/set_record_from_json, AimX dispatch drain, remote::stream) switch to the accessor. Registry storage stays Vec<Box<dyn AnyRecord>>. Also drops the dead outbound_connector_urls (cfg std) — zero callers in-tree and in aimdb-pro.

Acceptance (036 W2): AnyRecord ≤ ~8 methods ✓ (6); no behavior change ✓ (bodies and error messages moved verbatim; session smoke tests unmodified); rustdoc per trait names its consumer ✓.

Notes for review

Test plan

  • make build / make test — full CI feature matrix (incl. --no-default-features --features alloc{,profiling,metrics,connector-session}, thumbv7em, wasm) ✅
  • make clippy (-D warnings, all combos) + make fmt-check
  • aimdb-pro cargo check against the new core ✅

🤖 Generated with Claude Code

lxsaah and others added 2 commits June 12, 2026 06:12
AnyRecord carried ~22 methods spanning four concerns; every remote-access
or profiling change churned the core storage contract. Split by consumer:

- AnyRecord (6 methods): storage/lifecycle only — validate, as_any(_mut),
  drain_config_errors, set_writable_erased, plus the cfg-gated
  json_access() accessor so the remote-access gate lives in one place.
- RecordIntrospect (supertrait): graph/metadata introspection consumed by
  the builder's dependency-graph construction, route collection, and
  list_records.
- JsonRecordAccess (cfg remote-access): latest_json / subscribe_json /
  set_from_json, reached via json_access(); the runtime
  .with_remote_access() checks stay inside the methods, so behavior is
  unchanged. Gate is `remote-access` (the 036 sketch said json-serialize).
- RecordMetricsReset (supertrait): the cfg-gated no-op-default resets.

Supertrait wiring keeps every dyn AnyRecord call site compiling unchanged;
only the four JSON call sites switch to the accessor. Registry storage
stays Vec<Box<dyn AnyRecord>>. Drops the dead outbound_connector_urls
(cfg std) — zero callers in-tree and in aimdb-pro.

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

1 participant