Repository navigation
impl(063): increment 4a, the store seam and plan.invalidate in the Node binding - #524
Conversation
6862814 to
8a05904
Compare
AI review (findings)Looking at the diff, I'll focus on the new Key observations: 1. Unused import at end of
use std::future::Future;at module scope (line ~368, after the closing brace of 2. In if r.is_ok() {
abort.armed = false;
}When 3. In js.expires_ms = Some(terms.expires.as_ms() as f64);All other Primary finding worth flagging: The unused import is the only defect the supplied evidence concretely supports as a CI-breaking regression. {"head": "8a05904a48bf7a679df1fd84f4f24e4912810c73", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/store.rs", "line": 368, "severity": "medium", "category": "correctness", "summary": "Unused `use std::future::Future;` at module scope will be flagged by `clippy -D warnings`, causing `make code` and `ci-gate` to fail."}]}Subject: 5e6a223...8a05904, diff digest 10ffc3f2cb34fc37dc78fd5fd4c6ab8ef29e0b270c2ae50de949b51e650d64c7, 1 call(s). An AI comment is not an approval. |
…aborted Only a call left unsettled at a timeout or cancellation aborts its host signal (AI review on #524).
|
Review note: observation 2 is fixed in the latest commit: any settlement, resolved or rejected, now disarms the abort, and only a call left unsettled at a timeout or cancellation aborts its host signal. The flagged finding (1) is a false positive. Observation 3 is not a defect. |
|
Correction to my review note above: finding 1 was right that the import is redundant. |
AI review (findings)Reviewing the diff for bugs, security problems, and inconsistencies across the Node.js store seam (spec 063 increment 4). JS/TS layer ( The types and seam wiring are consistent. Rust The
The new
Conformance scripts The JS Spec document The {"head": "5638821bcff82ea6197231f33af663d9416c37ad", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/lib.rs", "line": 881, "severity": "low", "category": "correctness", "summary": "The new `invalidate` function's doc comment inherits the trailing lines of `decide`'s doc comment because all contiguous `///` lines before the `#[napi]` attribute attach to `invalidate`, producing a misleading combined comment and stripping those lines from `decide`'s doc."}, {"path": "integrations/rustev-node/src/store.rs", "line": 253, "severity": "low", "category": "correctness", "summary": "`js.expires_ms` is set with a bare `as f64` cast (`terms.expires.as_ms() as f64`) rather than the `number()` saturation helper used for every other u64→f64 field in the same `put` method, creating an inconsistency that would silently lose precision for expiry values exceeding 2^53 ms."}]}Subject: 5e6a223...5638821, diff digest a3a2314f5fe3a54d8a37b7bcbd24a6b8110500bcc32773830c0afca242d4ba45, 1 call(s). An AI comment is not an approval. |
AI review (findings)Reviewing this PR, which implements spec 063 increment 4: the host Code paths examined:
No high-severity or medium-severity defects found. Specific checks:
One low-severity finding:
{"head": "e85ffcf6272bda69ee2716ff0a5e662a115c3275", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 135, "severity": "low", "category": "correctness", "summary": "StoreCall.traceparent is declared optional in the TypeScript interface but is never populated by storeSeam or present in StoreCallJs; host stores can never receive a traceparent for distributed tracing even when a decision context carries one."}]}Subject: 5e6a223...e85ffcf, diff digest d6ce5634a4abfdb100e58141ca421dfd9fc0120b77d4a1dcd68a3feaedc2c44e, 1 call(s). An AI comment is not an approval. |
5e6a223 to
7ee17b8
Compare
…aborted Only a call left unsettled at a timeout or cancellation aborts its host signal (AI review on #524).
e85ffcf to
e3de14f
Compare
|
Review note: the |
AI review (findings)Reviewing the diff for bugs, security problems, and inconsistencies.
{"head": "e3de14f992fece3f880f0561ea40d62c36f15d29", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": null, "severity": "low", "category": "correctness", "summary": "StoreCall declares traceparent?: string but neither StoreCallJs nor the JS base object ever populates this field, so host implementations always receive undefined for traceparent."}]}Subject: 7ee17b8...e3de14f, diff digest d6ce5634a4abfdb100e58141ca421dfd9fc0120b77d4a1dcd68a3feaedc2c44e, 1 call(s). An AI comment is not an approval. |
7ee17b8 to
3659cfb
Compare
…aborted Only a call left unsettled at a timeout or cancellation aborts its host signal (AI review on #524).
e3de14f to
26e71c9
Compare
AI review (findings)Reviewing the diff, I see one concrete gap between the TypeScript contract and the runtime implementation, and one latent asymmetry in the conformance test double. Everything else — the callback lifecycle, Finding 1 —
export interface StoreCall {
remainingMs?: number;
signal: AbortSignal;
traceparent?: string; // ← promised to callers
}The JS const method = (fn) => async (call) => {
const signal = calls.start(call.callId);
try {
return await fn(call, { remainingMs: call.remainingMs ?? undefined, signal });
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// no traceparent field
} finally { calls.end(call.callId); }
};
Finding 2 — JS conformance
const key = (a, b) => `${a}\u0000${b}`;Filtering in if (k.startsWith(key(namespace, ''))) // == `${namespace}\u0000`If a {"head": "26e71c9d505867e883a957c741b9941309867788", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 134, "severity": "medium", "category": "correctness", "summary": "StoreCall declares traceparent?: string but the storeSeam method wrapper never populates it, so host store implementations always receive undefined for traceparent regardless of the runtime trace context."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": 660, "severity": "low", "category": "correctness", "summary": "scriptedStore uses a null-byte composite key separator (key = `${ns}\\u0000${id}`) without input validation; a namespace or keyId containing \\u0000 would cause incorrect namespace filtering in invalidate(), whereas the Rust ScriptedStore uses typed tuple keys and is not affected."}]}Subject: 3659cfb...26e71c9, diff digest 70cdc792a2e954a6dabae1b567381771eb66c74862ae1590513db2c0a7b2bf24, 1 call(s). An AI comment is not an approval. |
3659cfb to
fc0df79
Compare
|
Review note: both findings on 77ea8c4 are fixed in 9e151ab. 357c3dd6ee98: |
AI review (findings)Looking at the diff, I'll review the core implementation in
The new export interface StoreCall {
remainingMs?: number;
signal: AbortSignal;
traceparent?: string;
}However, const base = { remainingMs: call.remainingMs ?? undefined, signal };No Everything else checked:
{"head": "9e151ab7e3b0340717768680b2e99365b29a39e1", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 137, "severity": "medium", "category": "correctness", "summary": "StoreCall declares `traceparent?: string` but StoreCallJs has no such field and the storeSeam method adapter never populates it; host store implementations reading call.traceparent for context propagation will always receive undefined."}]}Subject: d5593f6...9e151ab, diff digest ab05dc20cdcd8c739247fa39a3c396ab7a609660d1fa430559b15b6d8f00bc78, 1 call(s). An AI comment is not an approval. |
|
Review note: finding 8bc18d34bc07 on 9e151ab is the |
|
M1: agreed on the |
…de binding EngineOptions.store installs the host store (063 3.6) with its closed contract checked before any thread; each method is an asynchronous host callback (3.4) whose answers are bounded (safe integers, 4 MiB, four put words), anything else a StoreFailure. plan.invalidate bounds its store call by timeoutMs on the engine's clock and resolves pending, never an exception. Scripted store in both conformance runners and the three runtime.store-* cases.
…aborted Only a call left unsettled at a timeout or cancellation aborts its host signal (AI review on #524).
…ver a joined string (AI review on #524)
…store refuses an unknown put answer (AI review on #524)
9e151ab to
c68c263
Compare
|
M5: rebased onto main at df67bc5 (#519 merged); clean, with |
AI review (findings)Reviewing the diff, which adds the host-store seam (spec 063 §3.6–3.7) to the Node.js binding, the scripted-store conformance infrastructure, and the golden expected files. Contract and saturation checks (Rust seam)
The one exception is the // integrations/rustev-node/src/store.rs (invalidation_json, near end of file)
serde_json::json!({
"generation": r.generation,
"removedEntries": r.removed_entries,
"removedBytes": r.removed_bytes,
"persistent": persistent,
"complete": r.complete,
})
JS runner / Rust runner key ordering The JS runner writes invalidation JSON with Scripted-store semantics The JS and Rust scripted stores are consistent: both key entries by Abort-on-drop and timeout
No high or medium severity defects found. {"head": "c68c2634d98f513a8ee8dbb0e034973e350dad5e", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/store.rs", "line": null, "severity": "low", "category": "correctness", "summary": "invalidation_json serialises r.generation, r.removed_entries, and r.removed_bytes as raw u64 without applying number() saturation to MAX_SAFE; spec 063 §3.6.3 requires all numbers crossing the JS boundary to be safe integers, and number() exists for this purpose but is not applied to these three fields."}]}Subject: df67bc5...c68c263, diff digest ab05dc20cdcd8c739247fa39a3c396ab7a609660d1fa430559b15b6d8f00bc78, 1 call(s). An AI comment is not an approval. |
AI review (findings)Reviewing the diff for the Node.js persistent-store seam (spec 063 increment 4). Store seam wiring (Rust/JS consistency): The JS Abort on drop: JSON key ordering for conformance:
Sequential-decision wait in conformance runner: Scripted-store put logic: Both the Rust ( No security vulnerabilities or authority/ratification issues found. {"head": "10815b98a279ea8dff8f35010e5a1a3a6b9672a9", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.js", "line": 311, "severity": "low", "category": "correctness", "summary": "The storeSeam method wrapper builds `base` as `{ remainingMs, signal }` and never populates `traceparent`, so the host's StoreCall always receives `traceparent: undefined` even though the TypeScript interface declares it as an optional field the runtime may supply."}]}Subject: df67bc5...10815b9, diff digest 2d84a87369b3f56ffbf1db981ba42707e338c05002b232ea1031beab66e75f0d, 1 call(s). An AI comment is not an approval. |
|
Review note: finding fcf46e70c5c9 on 10815b9 is the |
Spec 063 increment 4, part a (3.4, 3.6): the store seam and
plan.invalidatein the Node binding, with the threeruntime.store-*conformance cases. Stacked on #519 (increment 3, which brings the shared callback machinery); review only the commits after it. Part b (host-seam tests and the Valkey-shaped double) is stacked on this one. It is split out to keep each PR under about 1,500 changed lines excluding generated files.src/store.rs.EngineOptions.storeinstalls the host store throughRuntimeBuilder::store.StoreContract: nine non-empty strings, orConfigRefusedinvalid_store_contract, before any thread.preparekeepsstore_missingandstore_contract_mismatch.src/callback.rs(3.4): non-blocking threadsafe function, one-shot reply, queue slot released when the runtime stops waiting,abandonedPendingand late-discard counting.getbytes may be at most 4 MiB (RECORD_V1), and aputanswer must be one of its four words. Anything else is aStoreFailureunder the plan'son_store_failure, never a hit. So are a throw, a full queue (host_seam_queue_full), a deadline, a cancellation and a late settlement.plan.invalidate({ principalHandle?, timeoutMs? })callsRuntime::invalidate, which invalidates the memory tiers, then the store.timeoutMs(1 to 600,000, default 30,000) bounds it on the engine's clock, passed through a task-local scoped to that call. At the timeout the host signal is aborted and the slot released.persistent: 'pending',complete: false; it is not an exception. A plan without an optimization namespace resolvesnull.gauges().seamsgainsstorewithabandonedPending;shutdown'sabandonedPendingincludes it.RuntimeStore,StoreCall,Generations,InvalidationResult,EngineOptions.store,PlanHandle.invalidate.storeargument onEngine.create, and the store installed in the runtime builder.store(src/store.rs,scriptedStoreinrun.mjs). The script declares per-decision failures, restarts (a new runtime or engine over the same store) and invalidations before a decision; the invalidation result is an output,<decision>.invalidation.json. Store cases run their requests in order, each to its end. There are no new driver steps, so the serve runner's exhaustive match is untouched. Fixtures are infixtures/store/. Three cases run onrust-apiandnativewith identical bytes, each expected record checked against its mirrored test:runtime.store-restart-hit: cold misses, then a restarted engine hits withage_ms1000 and the cold attempt as source, then an advanced generation misses withgeneration_advanced.runtime.store-failure-policy:fail_closedread failure refused, no dispatch;execute_independentandcontinue_without_cachemiss; a write failure keeps the output.runtime.store-invalidation: a failed store invalidation leaves the selection pending and unavailable; a later one completes{generation 1, removed 3}; then a miss and rewrite, then a hit.plan.invalidateon a restarted engine with entries kept, not by editing the store.Runtime::invalidate, sinceinvalidate_planhas no Node equivalent.Checks run locally on this branch:
make gate;cargo build --workspace --locked;cargo test -p rustev-node -p rustev-conformance --locked; clippy on both with-D warnings;cargo fmt --all --check; the release addon,copy-addon.mjs,tsc --noEmit --strictonindex.d.ts;node --test integrations/rustev-node/test/*.test.mjs;run.mjs native.