feat(marquette): add typed test-run admission decisions#3198
Conversation
Adds the @vizejs/marquette/test-run/admission entry with admitTestRun and TestRunCandidate, reaching decision parity with the native implementation: a cleanly validated record whose canonical fingerprint is named by the admission id, exact candidate binding on application, environment, contract fingerprint, source revision, release, and artifact fingerprint, an unexpired record at the supplied instant (fail-closed on a malformed instant), an accepted independent verification, and zero skipped tests, with identical VIZE_MARQUETTE_14x codes, paths, messages, and ordering. Both host families can now reach the same test-run:<sha256> decision for the same record, which the release-bound test-run evidence item of the assurance roadmap needs before any deployment profile can consume the check.
📝 WalkthroughWalkthroughAdds ChangesTest-run admission
Sequence Diagram(s)sequenceDiagram
participant Caller
participant admitTestRun
participant testRunFingerprint
participant Diagnostics
Caller->>admitTestRun: evidence, candidate, admissionId, now
admitTestRun->>testRunFingerprint: compute canonical evidence fingerprint
testRunFingerprint-->>admitTestRun: fingerprint
admitTestRun->>Diagnostics: collect and sort validation failures
Diagnostics-->>Caller: MarquetteDiagnostic[]
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)npm/marquette/package.jsonTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
vize
@vizejs/fresco
@vizejs/musea-mcp-server
oxlint-plugin-vize
@vizejs/rspack-plugin
@vizejs/unplugin
@vizejs/vite-plugin
@vizejs/vite-plugin-musea
@vizejs/musea-nuxt
@vizejs/nuxt
@vizeui/core
commit: |
PR BenchmarkBase:
Raw run timesCompile SFC
Lint
Format
Type check (1T)
Type check (max)
|
Detailed Test ReportCommit: Area Summary
Test InventoryTotal tracked cases: 9466 across 1464 files.
Files
Comment truncated at 64000 characters. Open the workflow run for the full job log. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@npm/marquette/README.md`:
- Around line 102-106: Make the admission example self-contained by defining a
minimal TestRunCandidate fixture for candidate and an explicit UTC timestamp
with millisecond precision for now before the admitTestRun call. Keep the
existing validation, admission ID, and rejection flow unchanged.
In `@npm/marquette/src/test-run-admission.ts`:
- Around line 127-141: Extract the repeated diagnostic comparator from this
sorting call and validateTestRunEvidence into a shared sortDiagnostics helper in
test-run-validate-rules.ts or validate.ts. Update both callers to reuse the
helper while preserving ordering by path, then code, then message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 51dea696-c265-40e1-addc-527de75f6cf6
📒 Files selected for processing (6)
npm/marquette/README.mdnpm/marquette/package.jsonnpm/marquette/scripts/check-size.mjsnpm/marquette/src/test-run-admission.test.tsnpm/marquette/src/test-run-admission.tsnpm/marquette/vite.config.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (25)
- GitHub Check: Normalize titles and assignees
- GitHub Check: tool-benchmark
- GitHub Check: pr-benchmark
- GitHub Check: cargo-semver-checks (vize_atelier_sfc)
- GitHub Check: cargo-semver-checks (vize_atelier_ssr)
- GitHub Check: cargo-semver-checks (vize_atelier_vapor)
- GitHub Check: cargo-semver-checks (vize_croquis)
- GitHub Check: cargo-semver-checks (vize_atelier_core)
- GitHub Check: vue-parity
- GitHub Check: cargo-semver-checks (vize_atelier_dom)
- GitHub Check: test-js-packages
- GitHub Check: cargo-semver-checks (vize_musea)
- GitHub Check: coverage
- GitHub Check: clippy-and-test
- GitHub Check: build-js-packages
- GitHub Check: editor-extensions
- GitHub Check: test-scripts
- GitHub Check: check-vize-apps
- GitHub Check: cargo-semver-checks (vize_fresco)
- GitHub Check: security-audit
- GitHub Check: check-js
- GitHub Check: miri
- GitHub Check: Publish preview packages
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (1)
npm/**
⚙️ CodeRabbit configuration file
npm/**: Check package boundaries, peer/optional dependency behavior, ESM/CJS compatibility, and whether published files stay usable from a consumer project rather than only inside the monorepo.
Files:
npm/marquette/scripts/check-size.mjsnpm/marquette/package.jsonnpm/marquette/vite.config.tsnpm/marquette/README.mdnpm/marquette/src/test-run-admission.tsnpm/marquette/src/test-run-admission.test.ts
🔇 Additional comments (5)
npm/marquette/vite.config.ts (1)
20-20: LGTM!npm/marquette/package.json (1)
54-58: LGTM!npm/marquette/scripts/check-size.mjs (1)
25-29: LGTM!npm/marquette/src/test-run-admission.ts (1)
1-126: LGTM!npm/marquette/src/test-run-admission.test.ts (1)
1-106: LGTM!
| import { admitTestRun } from "@vizejs/marquette/test-run/admission"; | ||
|
|
||
| const diagnostics = validateTestRunEvidence(evidence); | ||
| const admissionId = await testRunAdmissionId(evidence); // test-run:<sha256> | ||
| const rejections = await admitTestRun(evidence, candidate, admissionId, now); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the admission example self-contained.
The new call introduces candidate and now without defining them. Add a minimal TestRunCandidate fixture and an explicit millisecond-precision UTC timestamp, or clearly mark them as placeholders so consumers do not copy a non-compiling example.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@npm/marquette/README.md` around lines 102 - 106, Make the admission example
self-contained by defining a minimal TestRunCandidate fixture for candidate and
an explicit UTC timestamp with millisecond precision for now before the
admitTestRun call. Keep the existing validation, admission ID, and rejection
flow unchanged.
| diagnostics.sort((left, right) => | ||
| left.path !== right.path | ||
| ? left.path < right.path | ||
| ? -1 | ||
| : 1 | ||
| : left.code !== right.code | ||
| ? left.code < right.code | ||
| ? -1 | ||
| : 1 | ||
| : left.message < right.message | ||
| ? -1 | ||
| : left.message > right.message | ||
| ? 1 | ||
| : 0, | ||
| ); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Extract shared diagnostic sorting logic.
This sorting implementation is identical to the one in validateTestRunEvidence (as seen in test-run-validate.ts). Consider extracting it into a shared helper function (e.g., sortDiagnostics) within test-run-validate-rules.ts or validate.ts to DRY up the codebase.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@npm/marquette/src/test-run-admission.ts` around lines 127 - 141, Extract the
repeated diagnostic comparator from this sorting call and
validateTestRunEvidence into a shared sortDiagnostics helper in
test-run-validate-rules.ts or validate.ts. Update both callers to reuse the
helper while preserving ordering by path, then code, then message.
Tool BenchmarkMeasured: 2026-07-21T10:50:07.153Z
Fairness notes:
Commands: gh workflow run tool-benchmark.yml --ref <branch> -f file_count=3000 -f check_file_count=500 -f vite_file_count=1000 -f nuxt_file_count=250 -f large_blocks=300 -f runs=3 -f warmups=1 -f commit_results=true
node bench/generate.mjs 3000
node bench/compare-tools.mjs --input bench/__in__ --vize-bin target/release/vize --runs 3 --warmups 1 --check-file-count 500 --vite-file-count 1000 --nuxt-file-count 250 --large-blocks 300 --runner-label "blacksmith-32vcpu-ubuntu-2404" --out tool-benchmark-summary.md --json tool-benchmark-results.json --doc performance-blacksmith.mdVariant details and raw run timesSFC compile
Large SFC compile
Large SFC type check
Lint
Format
Type check
Vite build (end-to-end)
Nuxt SPA build (end-to-end)
|
Summary
Follow-up to #3196, and the enabler for the open 'release-bound, independently observed test-run evidence' item in #3145: TypeScript hosts could build and validate test-run records but could not reproduce the Rust admission decision —
@vizejs/marquette/test-run/canonicalstopped at admission-id construction/parsing.Adds the lazy
@vizejs/marquette/test-run/admissionentry:admitTestRun(evidence, candidate, admissionId, now)— empty result admits; any diagnostic rejects. Requires a cleanly validated record, a canonical fingerprint matching the admission id (a tampered record can never reuse an id), exact candidate binding on all six facts, an unexpired record at the supplied millisecond-UTC instant (fail-closed on a malformed instant), an accepted independent verification, and zero skipped tests.TestRunCandidate— the exact six-field candidate a gate promotes.VIZE_MARQUETTE_141–148), paths, messages, and sort order are byte-identical tovize_marquette::admit_test_run, so both host families reach the same decision for the same record. Async only because fingerprinting uses Web Crypto.Tests
Six scenarios mirroring the Rust admission suite over the shared
tests/fixtures/test-run-evidence/fixtures, asserting exact diagnostic-code vectors: exact-candidate admission, malformed id, tampered-record id reuse, per-binding mismatches, expiry and malformed-instant fail-closed, and skipped-test rejection. Package gates: 27 tests green, lint/type clean, 1.4 KiB gzip against a 2 KiB budget.Part of #3145
Need help on this PR? Tag
/codesmithwith what you need. Autofix is enabled.Summary by CodeRabbit
New Features
Bug Fixes