Skip to content

test(cockpit-server): carry the corrected gate ordinals, not the pre-swap ones - #150

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/gate-ordinal-test-staleness
Sep 7, 2026
Merged

test(cockpit-server): carry the corrected gate ordinals, not the pre-swap ones#150
AdaWorldAPI merged 2 commits into
mainfrom
claude/gate-ordinal-test-staleness

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

Two dto_bridge tests assert the pre-2026-08-26 GateDecision ordinals and fail against the contract as it stands today. Test-only change; the conversion under test is correct and untouched.

Found by CI on #149 — a docs-only PR — so this is deliberately a separate PR rather than widening that one.

The failure

Run test suite (macos-latest), exit 100:

FAIL cockpit-server::bin/q2-cockpit dto_bridge::tests::default_round_trip
  dto_bridge.rs:401  assertion failed: j_bus.contains("\"gate\":2")

FAIL cockpit-server::bin/q2-cockpit dto_bridge::tests::gate_decision_string_stable
  dto_bridge.rs:368  assertion `left == right` failed
    left: 2   right: 1

Root cause

lance_graph_contract::collapse_gate::GateDecision documents the swap against itself:

"Ordinals are locked to the workspace-wide gate encoding: 0 = Flow, 1 = Hold, 2 = Block … Severity is monotone in the byte."
"History: until 2026-08-26 this type carried 1=Block, 2=Hold with a comment claiming it 'matches ndarray' — it did not (ISS-GATEDECISION-ORDINAL-COLLISION). No gate byte was ever persisted or serialized, so the swap is source-level only."

The constants confirm it: FLOW_BUNDLE.gate = 0, HOLD.gate = 1, BLOCK.gate = 2.

These tests still expect BLOCK → 1 and the default HOLD bus → 2. impl From<GateDecision> for WireGateDecision simply forwards g.gate, so the values come straight from the contract — the code is right and the assertions are stale.

Why twelve days passed with nobody noticing

Neither CI platform has ever executed these tests:

macOS reaching the test step for the first time tonight is what surfaced these. That is the same shape as this workspace's own recent finding that un-gating a suite reveals defects which could never have run — here it revealed a stale expectation rather than a broken build.

The change

  • blocked.gate 1 → 2
  • default ShaderBus "gate":2"gate":1 (and its comment, which said "gate ordinal 2")
  • adds the missing HOLD → 1 case, so all three ordinals are pinned instead of two

A comment now records the ordinal contract and the corrected history at the assertion site, so the next reader does not have to find the upstream doc-comment to know why these numbers are what they are.

Verification

rustfmt --check clean on the file. The values are read directly from the contract's own constants rather than inferred.

Not run locally, stated plainly: cargo test -p cockpit-server is not possible in this sandbox — the lance + datafusion + deno tree exhausts the disk before linking. CI is the check, and macOS now reaches the step that exercises exactly these assertions. If ubuntu is still red after this, that is the separate rusty_v8 blocker, untouched by this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected gate status ordering in serialized data.
    • Updated default bus output to reflect the corrected HOLD ordinal.

…swap ones

Upstream swapped GateDecision's ordinals on 2026-08-26 so that severity is
monotone in the byte — 0=Flow, 1=Hold, 2=Block, matching ndarray's
QualiaGateLevel — and recorded it as ISS-GATEDECISION-ORDINAL-COLLISION, noting
no gate byte was ever persisted so the change was source-level only. These two
tests still assert the old order, expecting Block at 1 and the default HOLD bus
at 2, so they fail against a contract that is now correct. The conversion under
test just forwards the contract's own field and needed no change.

Nothing caught this for twelve days because neither CI platform could reach the
test step: ubuntu still dies linking rusty_v8, and macOS died compiling
posix_fadvise until that was fixed a few hours ago. macOS getting as far as
running tests for the first time is what surfaced these.

Also adds the HOLD case the pair was missing, so all three ordinals are pinned
rather than two of them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_d69e7d02-047c-4222-a1db-dc2c39ae0bf3)

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 66 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 21707729-13a6-4c3e-94ba-db30560c817d

📥 Commits

Reviewing files that changed from the base of the PR and between 590a036 and f03d456.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • crates/cockpit-server/Cargo.toml

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: e145cd29-bb79-4a8c-9017-08810a132c7a

📥 Commits

Reviewing files that changed from the base of the PR and between 26f392a and 590a036.

📒 Files selected for processing (1)
  • crates/cockpit-server/src/dto_bridge.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The PR updates gate ordinal tests to match the corrected ordering. BLOCK now uses ordinal 2, and HOLD uses ordinal 1, including the default ShaderBus JSON assertion.

Changes

Gate ordinal test corrections

Layer / File(s) Summary
Corrected gate ordinal assertions
crates/cockpit-server/src/dto_bridge.rs
Tests now assert BLOCK as 2 and HOLD as 1. The default ShaderBus JSON assertion expects HOLD ordinal 1.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 590a0

Gate ordinal tests now assert Flow=0, Hold=1, and Block=2, including the default bus payload. This does not alter production behavior and presents no remaining merge risk.

Suggested reviewers: claude

Poem

A rabbit checks the gates with care
BLOCK hops to two in the air
HOLD rests calmly at one
The bus repeats what tests have done
Green trails sparkle everywhere

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the test changes and the corrected gate ordinals. It matches the main purpose of the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

The ordinal fix works — and the next failure is the rusty_v8 blocker's actual root cause

This PR's change is confirmed. macOS went from 31 tests run / 2 failed to 9,824 run / 9,823 passed / 1 failed. Both dto_bridge ordinal tests now pass; nextest ran 9,791 further tests before stopping.

The single remaining failure is a different, pre-existing one — and it explains the ubuntu wall too.

What is failing

FAIL (9822/10411) quarto-system-runtime tests::test_no_v8_in_workspace_lockfile
  panicked at crates/quarto-system-runtime/src/lib.rs:135:13:
  workspace Cargo.lock contains package `v8` — the V8/deno_core dependency was
  removed in bd-3e3sam51 and must not be reintroduced accidentally

Root cause: one line

crates/cockpit-server/Cargo.toml:107
deno_core.workspace = true

That pulls deno_corev8rusty_v8. It is the same root cause as the ubuntu failure, which is not a provisioning problem as I suggested on #149 — I was wrong there, and this corrects it. error: could not find native static library rusty_v8 happens because v8 is being built at all, and the repo's own guard says it should not be.

The dependency is unused

Exhaustive grep of crates/cockpit-server/ for deno_core returns two hits, neither a use:

site content
src/main.rs:6 //! - deno_core (V8 JIT) executes JS/TS cells inside the notebook — a doc-comment
src/main.rs:1572 "renderer": "quarto-core + deno_core (V8 JIT)", — a string literal in a JSON response

No use deno_core::, no build.rs, and cockpit-server is the only crate in the workspace that declares it. Introduced 2026-06-21 in 4bdd19a8 "chore(resync): re-apply Gotham GUI + notebook-query crates onto fresh upstream q2" — precisely the accidental reintroduction the guard was written to catch.

What the guard says it costs

"v8 prebuilt archives are ~100MB build-time downloads, and rusty_v8 publishes no musl prebuilts, which blocked static-musl release targets (PR quarto-dev#280). Anyone reintroducing a JS engine dependency should do so deliberately — behind a cargo feature, with the release-target implications worked through — not by accident."

Proposed patch — deliberately NOT pushed here

 crates/cockpit-server/Cargo.toml
-deno_core.workspace = true

I have not applied it, because removing it is as deliberate a decision as adding it, and it is not mine to make. The two string mentions claim the feature exists — "executes JS/TS cells inside the notebook" is stated in a doc-comment and advertised in an API response — while no code implements it. So the real question is a product one:

  • If notebook JS/TS execution is planned → the dependency should come back the way the guard asks: behind a cargo feature, with musl implications worked through. The guard test would then need a matching exemption.
  • If it is abandoned → the one-line removal above unblocks both CI platforms, and the doc-comment and the "renderer" string should change with it, since they currently describe a capability the binary does not have. That second part is a user-visible API response, which is why it needs your call rather than mine.

Either way this PR's own change stands on its own and is verified green by everything except this pre-existing blocker.


Generated by Claude Code

The workspace has a guard test banning v8, deno_core and serde_v8 from
the lockfile; a `chore(resync)` re-added deno_core and serde_v8 to
cockpit-server, which is exactly the accident the guard exists to catch.
Neither is used: no `use deno_core::`, no `serde_v8` reference in src/,
no build.rs. Removing them takes all three out of the lockfile, so the
guard passes and `cargo test --no-run` stops failing to link rusty_v8.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wrzeZAdwGYTCKoxamwQht

Copy link
Copy Markdown
Owner Author

Pushed f03d4565, removing deno_core and serde_v8 from crates/cockpit-server/Cargo.toml.

The ubuntu failure, read rather than assumed. I expected it to be an early link error; it isn't. Ubuntu passed rustfmt, custom lints and clippy, then spent 21 minutes in Test Rust code before dying at:

Compiling v8 v149.4.0
error: could not find native static library `rusty_v8`, perhaps an -L flag is missing?
error: could not compile `v8` (lib) due to 1 previous error
error: command `cargo test --no-run ... --tests --profile ci` exited with code 101

So the whole tree compiles fine on Linux right up to v8. Both platforms trace to the same single line, from opposite directions: ubuntu can't link rusty_v8 at all, macOS linked it and then failed test_no_v8_in_workspace_lockfile.

Why I pushed the fix after saying I'd hold it. I previously called this a product decision, because main.rs advertises deno_core (V8 JIT) in a doc-comment and a JSON string. On review that was the wrong call: this workspace has a test that explicitly bans v8/deno_core/serde_v8 from the lockfile, added deliberately (rusty_v8 publishes no musl prebuilts, which blocked static-musl release targets, PR quarto-dev#280). deno_core and serde_v8 were re-added to cockpit-server by a chore(resync) — an accident, which is exactly what the guard's own doc-comment says it exists to catch. Honoring the repo's standing ruling isn't a product call.

Evidence they were unused: no use deno_core::, no deno_core:: path, no serde_v8 reference anywhere in crates/cockpit-server/src/, and no build.rs. Regenerating Cargo.lock drops all three packages entirely (561 lines) — which also proves nothing else in the workspace needed them.

Verified locally: cargo test -p quarto-system-runtime --lib111 passed, 0 failed, including test_no_v8_in_workspace_lockfile. I could not build cockpit-server itself here — that pulls the lance/datafusion tree and the sandbox has 3.7 GB free — but CI had already compiled every other crate successfully before reaching v8, so that is the sound gate for this change.

Left alone deliberately: three prose mentions still advertise the engine — main.rs:6 (doc-comment), main.rs:1572 ("renderer": "quarto-core + deno_core (V8 JIT)"), and the description in Cargo.toml. Those describe a capability no code implements; they were already inaccurate before this change. Rewriting user-facing copy isn't mine to do unprompted, so I'm flagging them rather than touching them.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Green on both platforms. f03d4565:

ubuntu-latest macos-latest
tests run 10,411 10,411
passed 10,411 10,411
skipped 200 200
failed 0 0
quarto-system-runtime tests::test_no_v8_in_workspace_lockfile PASS PASS

Both runners now execute the identical suite. That is the first time either has completed it: ubuntu had never reached the test step at all — it died linking rusty_v8 — and macOS climbed 31 → 9,824 → 10,411 as each blocker fell (#147's posix_fadvise cfg, then the gate ordinals here, then the deno_core removal).

Which also means the ordinal fix this PR was opened for is now positively confirmed rather than merely unblocked: the two dto_bridge tests that asserted the pre-2026-08-26 ordinals pass against the corrected 0=Flow, 1=Hold, 2=Block.

Nothing further from me — this waits on a human merge decision, which I have no authorization to make.


Generated by Claude Code

@AdaWorldAPI
AdaWorldAPI merged commit 7c07315 into main Sep 7, 2026
5 checks passed
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.

2 participants