Skip to content

Compile the generated code of fixed graphs, mocks included, on every change to the sources - #1217

Open
dfed wants to merge 3 commits into
mainfrom
claude/compile-mock-shapes
Open

dfed wants to merge 3 commits into
mainfrom
claude/compile-mock-shapes

Conversation

@dfed

@dfed dfed commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Requested by Dan · project thread

Summary

A new CI job, "Compile Generated Mocks on Linux", generates eight fixed graphs and compiles each module's generated code, mocks included, the way an app's debug build compiles it (-DDEBUG, Swift 6 language mode, the macros expanded). It runs on every pull request that touches the sources.

The tests compare the generator's text, and the graph fuzzer compiles small drawn graphs. Code the compiler refuses in a shape a large app has was otherwise found only by building such an app. These graphs are the shapes where that happened:

Graph Modules What it is
lifelike-5 7 the lifelike chain of the timing check, five features
lifelike-back-edges-5 7 the same, with screens that open screens above them
M80x80-calling-mocks 3 the timing check's shape whose mocks call other modules' public mocks
app-150-mocked-features 1 one module of 150 features, each with a generated mock
unfillable-hole-under-a-shared-builder 1 a fixture: a mock whose builder leaves a value nothing can fill
sendable-builder-of-a-bare-leaf 2 a fixture: a @Sendable builder of a type with no dependencies, across a module boundary
captured-hole-fill 2 a fixture: a @Sendable builder that captures a value filled from outside
sendable-filled-call-builder-bound-apart 2 a fixture: a @Sendable builder of a filled call, bound apart, with each module in its own package

Scripts/compile-generated-mocks.py TOOL BIN_PATH DIRECTORY does the work. The four synthetic graphs come from Scripts/generate-time-check.py, so they stay the graphs that check times. A graph whose generated code once failed to compile joins as one file under Scripts/compile-generated-mocks/; // module: NAME lines split it into modules, and // module: NAME package: PACKAGE puts a module in a package of its own. The job prints a table to the run's summary and an error annotation with the compiler's first errors for each module that does not compile.

Minutes. The job took 12 minutes 41 seconds on a GitHub runner with no build cache: 4 minutes 22 seconds for the debug build of the tool, the library and the macros, and 7 minutes 20 seconds to generate and compile the first seven graphs (four at a time; the slowest compile, the lifelike chain with back edges, is about 5 minutes). The job keeps a build cache of its own, as "Check Generate Time on Linux" does, so a run after a landing on main builds less.

Generated output: unchanged

Tests

The script's --self-test runs in the job before the build: it checks the module split of a fixture file, the dependency order, and that the verdict table marks a refused module and the modules above it. All eight graphs compile with the tool built from this branch's base.

Found and not fixed

  • One more graph, a @Sendable builder that a public mock passes up, is known and does not compile until its generator fix lands. It joins as a fixture in the pull request that fixes it.
  • The job compiles on Linux only. A break that only Apple platforms' compiler reports is still found by the Xcode jobs. Left as it is: the breaks this job exists for were all in portable code.

https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo


Generated by Claude Code

…change to the sources

A new job, "Compile Generated Mocks on Linux", generates seven fixed graphs with a
debug build of the tool and compiles each module's generated code with -DDEBUG, as
an app's debug build does: the lifelike chain at five features with and without
screens that open screens above them, the calling-mocks shape, an app of 150 mocked
features, and three graphs whose generated code once failed to compile. The tests
compare the generator's text and the graph fuzzer compiles small drawn graphs, so
code the compiler refuses in a shape an app has was otherwise found only by an
app-sized build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo
@dfed dfed self-assigned this Dec 3, 2026
A fixture's module line may name the module's package; the tool and the compiler
are then given that package for the module, so a mock that calls another package's
public mock is generated and compiled as it is in an app.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo
@dfed
dfed marked this pull request as ready for review December 3, 2026 12:42
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