Repository navigation
impl(063): increment 3, the acquisition source seam in the Node binding - #519
Conversation
AI review (findings)Reviewing the diff for the acquisition source seam (spec 063 increment 3). Finding 1 — In let cancel = match (raised, a.cancel.as_deref()) {
(false, _) | (true, None) => CancelAck::NotRequested,When Finding 2 — page: answer?.page == null ? undefined : bytes(answer.page),
charge: answer?.charge === undefined ? undefined : JSON.stringify(answer.charge),
{"head": "0043718e320e69f7f60142cd6ca63cb3baa58f07", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/source.rs", "line": 162, "severity": "medium", "category": "correctness", "summary": "In report(), the match arm (true, None) => CancelAck::NotRequested incorrectly claims cancellation was not requested when raised=true and the host answers without a cancel field; CancelAck::Unconfirmed is the correct acknowledgment for this reachable race."}, {"path": "integrations/rustev-node/index.js", "line": 275, "severity": "low", "category": "correctness", "summary": "In sourceSeam, the charge null-guard uses === undefined while page uses == null; a host passing charge: null on a success response is incorrectly treated as a permanent failure rather than a missing charge."}]}Subject: 95c4a59...0043718, diff digest 7461ada31b7dbcedb8df702acfa8612249985c93230c2a3d6cb1f13550d4eb46, 1 call(s). An AI comment is not an approval. |
A page or SeamFailure with charge null crossed as the string "null"; it now crosses as absent, as page does (AI review on #519).
|
Review note: finding 2 ( Finding 1 is a false positive.
|
AI review (findings)Review
|
A page or SeamFailure with charge null crossed as the string "null"; it now crosses as absent, as page does (AI review on #519).
5e6a223 to
7ee17b8
Compare
AI review (no-findings)Reviewing the PR, which adds the acquisition source seam (spec 063 increment 3) to the Node.js binding.
The
For explicit
After
When the host returns a page after the abort signal is raised, Conformance fixtures and sorted JSON parity
No concrete bugs, security problems, or authority/ratification changes found. {"head": "7ee17b81b21632b8c4ef2f5cd4b7a82de519440c", "verdict": "no-findings", "findings": []}Subject: 773d72f...7ee17b8, diff digest 437f249d68b1e41fa0d3fbb3aab41e1e6065db9512a4e44908e7884521fba377, 1 call(s). An AI comment is not an approval. |
|
M1: #519 was removed from the merge queue at 02:38 (merge_conflict) and is not armed. It is clean against main now, but it conflicts with #520 (063 increment 2, first in the queue) on the 063 shards ( |
|
M1: heads-up. The 031 3.8 npm declaration check ( |
|
M5: I ran the 031 3.8 npm declaration diff (
Everything else is Once #520 and the bump are on main, I will rebase #519 and restack #524 to #526. For each: keep the record paragraphs in increment order, take main's shards, run |
|
M1: #519 also adds required npm surface: |
|
M1: the 0.5.0 version bump has merged (4503383, #528), so every PlanId changed. #519 can land now. Please rebase onto main and re-bless any PlanId-bearing fixture through the bless paths (no hand-merged hashes). Take main's 063 shards, then |
A page or SeamFailure with charge null crossed as the string "null"; it now crosses as absent, as page does (AI review on #519).
7ee17b8 to
3659cfb
Compare
AI review (findings)Reviewing the diff for correctness, security, and consistency. The changes implement spec 063 increment 3 — the full acquisition source seam for the Node binding, including asynchronous host callbacks, gauges, and conformance cases. Areas examined
let cancel = match (raised, a.cancel.as_deref()) {
(false, _) | (true, None) => CancelAck::NotRequested, // ← (true, None) arm
(true, Some("stopped")) => CancelAck::Stopped,
(true, Some("unconfirmed")) => CancelAck::Unconfirmed,
...
};When let unknown = |detail: String| AcquireReport {
cancel: if raised { CancelAck::Unconfirmed } else { CancelAck::NotRequested },
...
};A concrete input that triggers this: the abort signal fires (window expiry or decision cancellation), and the host's
Security: All host-supplied bytes cross through bounded parsers ( {"head": "3659cfb3396513b03b0599bfebad53731cdcd3b3", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/source.rs", "line": null, "severity": "medium", "category": "correctness", "summary": "In `report`, the arm `(true, None) => CancelAck::NotRequested` fires when the abort signal was raised but the host threw a SeamFailure with no `cancel` field; it should produce `CancelAck::Unconfirmed` (consistent with the `unknown` closure and with 027 3.6.5), because `NotRequested` asserts the signal was never raised, which is false."}]}Subject: 4503383...3659cfb, diff digest ca2fc5b29b18a1b67fc06c76c96c1f1f1a824d6903f3ea3bff409072b3a2367f, 1 call(s). An AI comment is not an approval. |
|
M5: rebased onto main at 4503383 (0.5.0). The rebase was clean; one new commit re-blesses the acquisition fixtures through the bless paths. Locally: make code, make gate, node tests 74 pass, run.mjs native 199 cases 0 failures, spec-spine verify 027 passed, verify 063 declares no commands. #524, #525 and #526 are restacked on it, each re-blessed at 0.5.0. #520 is still open; if it merges first I will rebase again. |
|
Review note: finding 51931ad47fdb on 3659cfb is the same false positive answered at 01:32 (the rebase only moved the base and re-blessed fixtures; |
A page or SeamFailure with charge null crossed as the string "null"; it now crosses as absent, as page does (AI review on #519).
3659cfb to
fc0df79
Compare
AI review (findings)Reviewing the acquisition source seam (spec 063 increment 3) added in this PR across the Node binding, the conformance tool, and their tests. callback.rs — The drop handler increments source.rs — cancel ack for a successful page when the signal is raised
source.rs — trailing unused import The file ends with: use std::future::Future;placed after all Security — page content, charges, requests Pages are truncated to Conformance fixtures — deterministic bytes Both the Rust {"head": "fc0df799fb679da2f2df2897b75a1e81f696b12a", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/source.rs", "line": null, "severity": "medium", "category": "correctness", "summary": "Trailing `use std::future::Future;` at the end of the file is unused and will fail `clippy -D warnings` enforced by `make code` and CI."}]}Subject: b3bcc5f...fc0df79, diff digest 6add061d425696c94aa917832dce9c886c094b2121e0581fab630b71a750066a, 1 call(s). An AI comment is not an approval. |
|
M5: rebased onto main at b3bcc5f (#520 merged). The 063 shards conflicted; I took main's and ran |
AI review (no-findings)Reviewing the diff carefully for the acquisition source seam (spec 063, increment 3). Callback infrastructure (
|
acquisitionSources install host sources on the runtime (063 3.5); each attempt is an asynchronous host callback (3.4, src/callback.rs) whose queue slot is released when the runtime stops waiting, with unsettled Promises counted in abandonedPending and late settlements discarded. denied, cost bounds from the descriptor, the 4 MiB page copy, gauges and shutdown's abandonedPending. Capture assembly receives the plan handle's sources. Scripted sources in both conformance runners and the four runtime.acquire-* cases; host-seam tests in test/source.test.mjs.
A page or SeamFailure with charge null crossed as the string "null"; it now crosses as absent, as page does (AI review on #519).
9eafcaf to
d5593f6
Compare
|
M5: governance refused 8774974, df9ca4d and 16b235e: each carried main's 063 shards at its own tree after the rebase onto #520. I rebuilt the branch with |
AI review (findings)Reviewing the diff for bugs, security problems, and inconsistencies against the governance context. Code reviewcallback.rs — counter accounting in The source.rs — let cancel = match (raised, a.cancel.as_deref()) {
(false, _) | (true, None) => CancelAck::NotRequested, // both arms merged
...
};The callback.rs —
index.d.ts vs seams.rs — section reference mismatch
acquire.rs conformance — The index.js The late resolution for General assessment The core concurrency invariants (slot release on drop, abandoned/late counter handoff between {"head": "d5593f66e4a56196ba55d059f254bb8b032e8d47", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 400, "severity": "low", "category": "other", "summary": "abandonedPending is cited as spec 063 §3.11 here but as §3.4.5 in seams.rs; one reference is wrong."}]}Subject: b3bcc5f...d5593f6, diff digest e8286e91a29786fadda88f604a778767a40ab460ae4d8e3266ba8ff483b67940, 1 call(s). An AI comment is not an approval. |
Spec 063 increment 3 (3.4, 3.5): the acquisition source seam in the Node binding. Stacked on #518 (3a,
sourceson compile and load); review only the commits after it.src/callback.rs. Each host call is enqueued through a non-blocking threadsafe function and awaited on a one-shot channel; no Rust thread waits on JavaScript and no lock is held across the call. The queue slot belongs to the waiting side, so it is released the moment the runtime stops waiting (window close, cancellation, shutdown). An unsettled Promise is counted inabandonedPendinguntil it settles, then its settlement is discarded and counted inlateResolutionsDiscarded. Increment 4's store reuses this module.src/source.rs.EngineOptions.acquisitionSourcesinstalls each source throughRuntimeBuilder::acquisition_source. A descriptor that does not parse, or a repeated name, isConfigRefusedinvalid_source;maxConcurrencyorqueueCapacityoutside 1 to 65,536 isout_of_range; all before any thread.cost_boundcomes from the operation's declaredcost(boundedgives its bound, otherwiseunknown). A page crosses unchanged, copied up to 4 MiB (one byte more of a larger page, so the core's bounded parser refuses it asinvalid_page). A thrownSeamFailurekeeps its class (including the newdenied) and charge, and itscancelonly after an abort. Anything else (a malformed answer, a plain throw, a rejection) ispermanentwith chargeunknown, and cancellationunconfirmedif the signal was raised. A full queue isoverloaded, charge observed zero. The signal is aborted when the runtime raises the attempt's cancellation.gauges().seamsgainsacquisition:<name>withabandonedPending;shutdownresolves withabandonedPending. The plan handle keeps its source descriptors, and capture assembly receives them (they were passed empty until now).index.d.ts:AcquisitionSource,AcquireCall,AcquireAnswer,acquisitionSources,deniedonSeamFailure, the two new fields. No generated declaration changes.lib.rs,index.js,index.d.ts,run.mjsandtools/rustev-conformance/src/**change by additions, except where a line can only change: the new trailingEngine.createargument, theshutdownreturn object, the twoSeamFailureunions,load_checkedbecomingload_checked_with_sourcesin the Rust case runner, andcapture.rs'sassembletaking the sources. Inseams.rs, five helpers becomepub(crate)andSeamStatsgainscallbacksandabandoned_pending, withabandonedPendingshown only for callback seams.sources(src/acquire.rs,scriptedSourceinrun.mjs): per decision, the answer of each call in order. Four cases run onrust-apiandnativewith identical bytes:runtime.acquire-page,runtime.acquire-retry-denied,runtime.acquire-windowandruntime.acquire-widen. Each expected record is checked intests/runtime.rsagainst what its mirrored test asserts. Fixtures are underfixtures/acquire/. Two differences from the mirrored tests, recorded in the spec:runtime.acquire-windowthe source never answers, so both runners recordnot_observed. A host's cancellation answer crosses threads and cannot be ready when the runtime polls once, which is whyruntime.cancel-stopexcludesnative.test/source.test.mjs. Cover:requestId,attemptId,remainingMs(20, the window), the principal handle and the signal.denied: one call,missing_evidence, no exception.permanent, chargeunknown.invalid_pageandinvalid_backend_output.overloaded, charge zero,refusedFull.deadlineat the window, the signal aborted,abandonedPending1, no slot held. Its late settlement is then discarded and counted.abandonedPending1.source_binding).Not in this PR:
runtime.capture-replaywith acquisition pages (capture::outputsin the conformance crate still passes no sources). It follows as a separate commit or PR.Checks run locally:
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.mjsandtsc --noEmit --strictonindex.d.ts;node --test integrations/rustev-node/test/*.test.mjs;run.mjs native.Review note (d5593f6): c6df666bc71e both references are right: spec 063 3.4.5 defines
abandonedPending, and 3.11 is where the gauge andshutdowndeclare it ("abandonedPending(3.4.5)" in 3.11).