Skip to content

docs: merge the Compact JavaScript guides into one verified assembly - #1181

Closed
oduameh wants to merge 2 commits into
mainfrom
docs/compact-js-implementation
Closed

docs: merge the Compact JavaScript guides into one verified assembly#1181
oduameh wants to merge 2 commits into
mainfrom
docs/compact-js-implementation

Conversation

@oduameh

@oduameh oduameh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Intent

Slice 1 of the guides consolidation: merge the two Compact JavaScript pages, which already declared themselves halves of one document, into a single modular assembly at the existing /guides/compact-javascript-runtime URL. One page deletion, one redirect, no other guide touched. Subsequent slices (funding, deploy/operate, wallet connect) will follow as separate PRs once this shape is agreed.

Retired URL Redirects to
/guides/use-compact-javascript-implementation /guides/compact-javascript-runtime (direct, no chain; the retired page had zero inbound doc links)

What changed

  • docs/guides/compact-javascript-runtime.mdx becomes the assembly: three explanatory sections (compilation pipeline, generated module structure, the Contract class and circuits), a generated-export reference table, and three procedures (importing and implementing witnesses, calling circuits, unit testing), each ending in a Vitest verification that was actually executed.
  • docs/guides/use-compact-javascript-implementation.mdx deleted; its content lives in the procedures, and its "why this matters" section is condensed into the lead.
  • src/theme/Navbar/Logo/index.tsx: the retired route is removed from the Compact-logo route list.
  • vercel.json: the redirect above.

Why the content changed, not just moved

Every generated-code excerpt is now pasted from a fresh compile of the example-bboard contract (Compact compiler 0.31.1, runtime 0.16.0), which surfaced real staleness in the old pages:

  • The version guard excerpt said checkRuntimeVersion('0.15.0'); the compiler emits 0.16.0, matching the support matrix. Executed evidence: mismatch throws Version mismatch: compiled code expects 0.15.0, runtime is 0.16.0.
  • The old unit-test examples hand-built a CircuitContext (originalState / transactionContext: {}); the generated wrappers validate for currentQueryContext and reject such objects, so those examples could never run. The procedures now use the real createConstructorContext / createCircuitContext API.
  • The descriptor excerpts used numbering the compiler does not emit; all excerpts are now verbatim (elisions marked).
  • "The compiler emits a ZK circuit for each exported circuit" was false for the page's own example: exported pure circuits get no circuit (Compiling 2 circuits: for a contract exporting three). Reworded.

Verification

  • The three published test files are byte-identical to the workspace files that ran: 10 tests passing (2 + 2 + 6), offline and deterministic, output pasted unedited.
  • SME review (claims table, mechanical diff of every excerpt against the compiled fixture, tsc pass on the witnesses snippet): approve with corrections, all applied.
  • Fact-check across the page's ~110 claims: 2 refuted claims corrected pre-ship (the two wording fixes above), 0 shipped.
  • Vale: 0 errors. Full local build: green, retired route absent from output, no broken links or anchors attributable to changed pages.

Flag for Compact codeowners (not fixable in this repo's docs PR)

docs/compact/test-and-debug.mdx carries the same broken testing pattern this PR removes: hand-built contexts, result.newLedgerState / newContext result fields that do not exist, and an assert message ("Board is occupied") that does not match the contract ("Attempted to post to an occupied board"). That file is owned by mn-codeowners-compact; happy to open an upstream issue.

Fold use-compact-javascript-implementation.mdx into
compact-javascript-runtime.mdx as a modular assembly. Every generated-code
excerpt is pasted from a fresh Compact 0.31.1 compile of the example-bboard
contract (fixing the stale 0.15.0 runtime version and descriptor numbering),
and the unit-test examples are rewritten against the real compact-runtime
0.16.0 context API because the previous hand-built context objects cannot
run. All three Verification test files execute (10 tests passing). Redirect
added for the retired slug; navbar Compact-logo route list updated.
@oduameh
oduameh requested review from a team as code owners August 5, 2026 14:32
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
midnight-wiki Ready Ready Preview Aug 7, 2026 11:12am

Request Review

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 14
🔗 Unique 11
✅ Successful 6
⏳ Timeouts 0
🔀 Redirected 1
👻 Excluded 0
❓ Unknown 0
🚫 Errors 8
⛔ Unsupported 0

Errors per input

Errors in docs/guides/compact-javascript-runtime.mdx

  • [ERROR] error: (at 605:3) | Cannot resolve root-relative link '/api-reference/compact-runtime': To resolve root-relative links in local files, provide a root dir
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/compact/test-and-debug (at 603:3) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/examples/dapps/bboard (at 602:3) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/getting-started/installation (at 21:7) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/guides/security-best-practices (at 604:3) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/relnotes/support-matrix (at 24:116) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/relnotes/support-matrix (at 606:3) | File not found. Check if file exists and path is correct
  • [ERROR] file:///home/runner/work/midnight-docs/midnight-docs/docs/relnotes/support-matrix (at 62:240) | File not found. Check if file exists and path is correct

Redirects per input

Redirects in docs/guides/compact-javascript-runtime.mdx

Full Github Actions output

Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
Comment thread docs/guides/compact-javascript-runtime.mdx
@oduameh

oduameh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Verification evidence for this slice. SME review (mechanical diff of every excerpt against a fresh Compact 0.31.1 compile of example-bboard, tsc pass on the witnesses snippet, runtime API probes): approve with corrections, all applied; the two corrections are the pure-circuit wording and the contract/ output path now in the PR description. Fact-check across the page's ~110 claims: 2 refuted claims corrected pre-ship, 0 shipped. QE gate: PASS on every gate after a from-scratch rebuild; the three published Vitest files are byte-identical to the executed workspace files (10/10 passing, offline), the retired slug has zero references in source and build output, and a first-match simulation over all 299 redirect rules confirms the new redirect is direct with no chain. Pre-existing broken links on unchanged pages (counter-tutorial link in compact/test-and-debug, a wrong-depth link in examples/dapps/bboard) are recorded in the QE report and untouched here.

@oduameh

oduameh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Closing for now: we are taking a broader look at the guides section to shape assemblies around user journeys before landing individual merges. Branch retained; the verified content and fixtures will feed the next iteration.

@oduameh oduameh closed this Aug 7, 2026
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