Skip to content

ci(ffi): the moq export gates exporter merges - #788

Merged
kixelated merged 3 commits into
mainfrom
quest/m0/ffi-moq-gate
Nov 14, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m0/ffi-moq-gate

Conversation

@kixelated

@kixelated kixelated commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Closes the quest quest/m0/ffi-moq-gate.md.

Problem

The exporter's check on its first consumer, just ffi moq, ran only nightly (about 13m40s), so an exporter change could merge while it broke moq's export. The ts module already gates on just ts moq.

Approach

  • New just ffi moq-c: the same stand-in facade and export as just ffi moq, built in debug as a staticlib only (cargo rustc --crate-type staticlib, which skips the cdylib link) with the Kotlin and Dart glue, under the same -D recursion_depth_exceeding_limit the nightly denies. It then compiles, links, and runs ffi/moq/moq.c against it.
  • sh/dispatch.sh's test_ffi runs it before just ffi test, as test_ts runs just ts moq.
  • The export step moved into a private moq-write recipe, which both moq-export and moq-c use.
  • The other languages' ffi/moq/moq.*, the Python glue, and the release build stay nightly.

Departure from the quest's plan: the plan recommended compiling the header and moq.c without linking. I link and run, because a compile-only step misses breaks the gate should catch. Measured below: a renamed glue symbol passes cargo check and cc -fsyntax-only but fails the link. On a warm cache that costs about 10s of link plus the debug build.

Gate cost

Measured on nixos, the queue runner's host, which also runs CI and other agents. Wall times are noisy; CPU (user+sys) is beside them.

wall CPU load
ffi module before: just ffi check + just ffi test, warm 1.8s + 138s 0.9s + 423s ~21
just ffi moq-c, warm, export unchanged 34s 28s ~9
just ffi moq-c, warm, repeated at high load 73s 45s ~23
just ffi moq-c, cold target, mbx store warm (the runner after a pin bump) 93s 71s ~23
just ffi moq-c, true cold (no mbx hit): debug build of moq's tree ~62-72s / ~270-290s CPU, plus export and link ~100s ~320s ~23

Step breakdown, warm: export 17-25s wall / 12-16s CPU, glue rebuild 7-44s wall / 5-43s CPU (incremental, depending on how much the export changed), link 10-16s wall / 10-15s CPU, run 0.1s. So the warm gate's ffi module grows by roughly 35-75s wall (+25-50%) and 25-65s CPU. The nightly Gate job (17 min today, 60-min timeout) gains the cold figure.

A cheaper variant, cargo check of the glue plus cc -fsyntax-only on moq.c (export 17s + 0.7s + 0.1s warm), would save the link and the debug codegen, about 10-40s, but it misses link and runtime breaks (see Validation).

Validation

  • just ffi moq-c at main's moq pin ffcb7cd prints ok. just ci passes before and after merging main (kixel-ai/rust2#736); its ffi module ran moq-c.
  • Injected exporter breaks, each reverted:
    • glue emits moq_buf_freed for moq_buf_free: moq-c fails at link, undefined reference to 'moq_buf_free'. cargo check and cc -fsyntax-only both pass this.
    • glue's object _eq returns the negation: moq-c fails at run time, moq/moq.c:310, :421, :545.

Impact

  • Public API: none. Wire: none.
  • New recipe just ffi moq-c, documented in ffi/README.md's Tests.
  • quest/m0/ffi-test-builds.md notes that moq-c should take its unchanged-file skip: the export rewrites the glue each run, which forces the rebuild above.

Alternatives

  • Compile-only (the plan's recommendation): faster, but blind to link and ABI breaks, as measured above.
  • A release build, as the nightly does: slower codegen on every exporter change for no extra coverage of the C path.

Follow-ups

None.

Caused by

No single PR: the nightly-only check is as old as just ffi moq.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort

(Written by Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 707145f

  • Base: origin/main at a7db266

  • Reviewer: Codex, gpt-6.1-sol, high effort

  • Session: 01a1d7bd-4259-75b2-945c-a5de5d22bafd, round 1

  • Score: 9/10, No actionable defects were found; the new C-only gate preserves the existing export path, but builds and tests were not run, as instructed.

  • Findings: none

Summary by CodeRabbit

  • Tests
    • Added a debug-mode check that builds the MoQ C interface and runs its C test before the FFI test suite.
  • Documentation
    • Updated guidance for the MoQ C check and its role in continuous integration.

Quest-Claim: 2c34cd962363b39b
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The FFI targets add a debug MoQ C check. The test_ffi flow runs it before the existing FFI tests. The documentation describes the check, and the proposed export-gate document is removed.

Changes: MoQ C FFI check

Layer / File(s) Summary
Generate, build, and run the C check
ffi/justfile, sh/dispatch.sh, ffi/README.md, quest/m0/ffi-test-builds.md, quest/m0/ffi-moq-gate.md
moq-write generates the facade without building. moq-c builds a debug static library with Kotlin and Dart features, then compiles and runs moq/moq.c. test_ffi runs this check before just ffi test. The README and build notes describe the check; the proposed export-gate document and its related link are removed. moq-export now uses moq-write and retains its existing release build steps.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant test_ffi
  participant moq-c
  participant moq-write
  participant Exporter
  participant RustBuild
  participant moq_c_test
  test_ffi->>moq-c: Run the debug C check
  moq-c->>moq-write: Generate the facade
  moq-write->>Exporter: Write target/export/moq from the stand-in facade
  moq-c->>RustBuild: Build debug static library with Kotlin and Dart features
  RustBuild-->>moq-c: Return static library and native library list
  moq-c->>moq_c_test: Compile and run moq/moq.c
Loading
Merge Risk: Minimal · up to 70714

This change adds a CI check that builds, links, and runs the MoQ C test before the FFI tests. It should catch exporter breaks earlier. No merge-blocking risk was found; the cost is about 35 to 75 seconds of extra CI time.

Architecture risk: Low · up to 70714

The change affects 3 systems.

Changed systems: sh, ffi, quest

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — sh (service) was modified; 1 changed file maps to changed impact.
  • observed — ffi (service) was modified; 2 changed files map to changed impact.
  • observed — quest (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in ffi/README.md: The Tests command list adds just ffi moq-c, described as a debug export that runs only moq/moq.c.
  • observed — Modified behavior in ffi/justfile: Adds moq-c, which generates the export through moq-write, builds a debug static library with Kotlin and Dart features, records rustc’s native static-library list, and compiles and runs moq/moq.c. The earlier moq-export build used release mode and Python plus Kotlin/Dart features; the new C check instead builds debug mode without Python.
  • observed — Modified behavior in ffi/justfile: Adds private moq-write, which invokes the exporter to write target/export/moq from the stand-in facade without building it. moq-export now depends on this target rather than invoking standin directly.
  • observed — Modified behavior in ffi/justfile: moq-export changes its prerequisite from standin checkout to moq-write checkout; its existing build steps continue below.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a CI gate for the MoQ FFI export. The changeset adds just ffi moq-c, a debug build and C compile-and-run check, and wires it into sh/dispatch.sh. The title is short and…
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.
Full details: Title check

Explanation

The title names the change: a CI gate for the MoQ FFI export. The changeset adds just ffi moq-c, a debug build and C compile-and-run check, and wires it into sh/dispatch.sh. The title is short and specific. Its wording is awkward, though: it reads as 'the moq export gates exporter merges', which a reader may parse as a claim about merge behavior rather than a new gate. The title does not mention the C check or the moq-c recipe, but it still points at the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 4
  • Waived: $1.00 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5269c30d-1980-4d84-9d0c-584e0b36a70e
Commits

Reviewing files that changed from the base of the PR and between a7db266 and 707145f.

Files selected for processing: 5

  • ffi/README.md
  • ffi/justfile
  • quest/m0/ffi-moq-gate.md
  • quest/m0/ffi-test-builds.md
  • sh/dispatch.sh
Files with no reviewable changes: 1

  • quest/m0/ffi-moq-gate.md

Limit details: You’ve used all 10 included reviews currently available.

@kixelated kixelated changed the title The moq export gates exporter merges ci(ffi): the moq export gates exporter merges Nov 14, 2026
@kixelated
kixelated marked this pull request as ready for review November 14, 2026 01:48
@kixelated
kixelated enabled auto-merge November 14, 2026 01:49

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed the whole PR: a C-only moq export check added to just ci's ffi module.

  • just ffi moq-c: exports the stand-in facade, builds it in debug as a staticlib with the Kotlin and Dart glue under the same -D recursion_depth_exceeding_limit, then links and runs ffi/moq/moq.c against it.
  • moq-write split: the export step is now a private recipe shared by moq-export and moq-c. moq-export's behavior is unchanged.
  • Gate wiring: sh/dispatch.sh's test_ffi runs moq-c before just ffi test, as test_ts does with just ts moq. The script runs under set -euo pipefail, so a failure stops the module.
  • Quest bookkeeping: quest/m0/ffi-moq-gate.md is closed and its only cross-reference in quest/m0/ffi-test-builds.md is removed. That quest now also notes that moq-c should take the unchanged-file skip.

I checked that the nightly Windows and macOS jobs call just ffi test and moq-cpp directly, not through dispatch. So moq-c's Unix-only cc and libmoq.a link never runs there.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 8aa3f43 Nov 14, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/ffi-moq-gate branch November 14, 2026 02:34
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