Repository navigation
refactor(pipeline): split pipeline.zig into focused modules (#434) - #438
Conversation
pipeline.zig (3,985 lines) becomes a root that keeps `run` as the stage
orchestrator (and the owner of every resource the stages borrow) over
src/cli/pipeline/:
args_resolve.zig target + platform resolution, earlyTargetCheck,
confirmTarget
install.zig pre-install work, gateThenInstall, discovery +
hook plans, the lock write
generate.zig before/core/after generate, ASTC + --bake
prepasses, the shader re-gate
build.zig core build, packaging finalisation, bundle step
run.zig run branches, RunOutcome plumbing, --no-build
context.zig Context + HookPlans shared by the stages
watch.zig WasmRebuildCtx, collectPrebuildIgnorePaths
watch_replan.zig WatchReplan and its generations
watch_replan_tests.zig WatchReplan's tests
screenshot.zig ScreenshotProbe and its spec
export_output.zig resolveExportOutput and its spec
testing.zig testSite, shared by the rebuild tests
Moves plus import/pub fixes, except `run` itself: at ~1,310 lines it was
split into stage functions that run the same statements in the same
order (early exits carried back as an exit code, defers kept in `run`).
The public API and cli.zig's spec re-exports are unchanged; 35 named
tests before and after, identical in the test binary. The eleven new
files carrying moved platform words join the agnosticism allowlist
(58 -> 69 entries); context.zig is clean and not listed.
Claude-Session: https://claude.ai/code/session_01R2K5sJDL5Msn1uRTkybiDP
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This is a refactor with no behaviour change.
src/cli/pipeline.zigwas 3,985 lines, which is over the toolkit's 1,000-line limit. It follows theserve.zig(#436) andprovider_github.zig(#437) splits. The root re-exports the same public API (run, plus the three specscli.zigre-exports), and every module is referenced from a roottest {}block. The helpers shared by the tests live inpipeline/testing.zig.One exception to "moves only":
runrunwas a single function of about 1,310 lines, so moving it whole was not an option. It is now split into stage functions. Each one is a verbatim block of the old body and runs the same statements in the same order. The mechanical changes:return code/return 1now returns?u8(null means go on), or a smallunion { proceed / ready, exit: u8 }.runreturns that code at the same point, so the exit statuses are unchanged.deferstays declared inrun: the arena,target_dir, the reporter and itserrdefer failActiveStage,asm_bin,provider_sources,output_dir, the zig args/env andhook_site. Stages borrow them throughpipeline/context.zig(Context). The watched serve'sdefer watch_replan.deinit(...)still fires afterfinishServeis evaluated and beforerun's own defers.hook_plans = .{ ... }literal is now the namedHookPlansstruct. The fields and the order they are evaluated in are unchanged.cxunder their old names.&hook_sitebecamehook_site, and&parsed_argsbecameparsed_args(a pointer now).generate_out/build_outare still computed right before their stage runs.generate.zig) had to becomepub fn install, becausegateThenInstalllives in another file now.File map
src/cli/pipeline.zigok,run(stale gate, parse, upgrade, feed/reporter setup, asm resolve, install call, hook site, ios/android handoff, zig env/args, stage calls),test {}pipeline/args_resolve.zigresolve(the NAME half of target resolution, platform/backend derivation),TargetRefusal,TargetVerdict,confirmTarget,EarlyVerdict,earlyTargetCheck+ 2 testspipeline/install.zigpreInstall(compatibility,.prebuild, Python/SDL2 wiring),gateThenInstall,AssemblerInstaller,discoverAndPlan(discovery, ownership, plans, #378 gate, bundle check, plugin-core compat, lock write) + 1 testpipeline/generate.zigrun(before/core/after generate, ASTC and--bakeprepasses, fingerprints, emsdk activation),beforeGenerate+ 1 testpipeline/build.zigrun(before/core/after build, docker/progress/capturedzig build, SDL2 DLL staging,labelle buildfinalisation),bundleSteppipeline/run.ziglaunch(run hooks, wasm export/serve +--watchwiring, iOS/Android deploys, docker/host launches),serveNoBuild,noteRunSharesStdout,crossTargetLaunchSkipped+ 1 test,runOutcome,runOptionEnvpipeline/context.zigContext,HookPlanspipeline/watch.zigWasmRebuildCtx+ its 3 tests,collectPrebuildIgnorePaths,CollectPrebuildIgnorePathsSpecpipeline/watch_replan.zigWatchReplan,Generation,Installerpipeline/watch_replan_tests.zigWatchReplantests and theTwoStagefixture (they left the struct becauseWatchReplanplus its tests was about 1,060 lines)pipeline/screenshot.zigscreenshot_suffixes,FileStamp,ScreenshotProbe,ScreenshotProbeSpecpipeline/export_output.zigresolveExportOutputand its path helpers,ResolveExportOutputSpecpipeline/testing.zigtestSite(wasWasmRebuildCtx.testSite)The largest file is 812 lines.
Agnosticism guard allowlist delta
context.zig:args_resolve,build,export_output,generate,install,run,screenshot,testing,watch,watch_replanandwatch_replan_tests. Each one carries moved platform words (the legacy target/backend sites,wasm serve, bgfx#57, fixture"wasm"/"bgfx"tags).cli/pipeline.zig. The root is still dirty (its module doc,.wasm, the ios/android handoff), and the stale-entry test that names it is unchanged.context.zig.Tests: same named-test set
zig build test --summary all)test "…"decls from pipelineThe test names were pulled from both test binaries (the
builtin.test_functionsstrings) and diffed after stripping the namespace path, which the move changes. The two sets match: 1,084 entries each. The only differences are five compiler-numbered__struct_Nids on anonymous test fixtures. The +1 in the total is the new unnamedtest {}aggregator inpipeline.zig, so none of the moved tests were dropped by lazy analysis.Verification
Each command's exit code was checked on its own:
zig fmt --check(new and changed files): 0zig build: 0zig build -Dtarget=x86_64-windows: 0zig build test(includes the guard): 0zig build test-provider-dispatch: 0test/provider_dispatch_e2e.py(25 invocations),provider_github_e2e.py(70),provider_config_e2e.py(21),provider_hooks_e2e.py(43),provider_targets_e2e.py(40),plugin_compat_e2e.py: all 0Closes #434
https://claude.ai/code/session_01R2K5sJDL5Msn1uRTkybiDP
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.