T-R9WT-model-ontogen-codegen-as-moon-task
Status: closed/done · Impact: medium · Complexity: medium
Model pumice’s ontogen code-generation pipeline (run by src-tauri/build.rs
on every cargo build) as a first-class moon task with correct inputs/outputs,
and carry pumice’s codegen-drift check into this repo’s gates — so moon’s cache
stays correct and a schema change without a regenerate fails CI.
Pumice’s build.rs invokes ontogen and writes committed generated files under
several */generated/ dirs plus src-nuxt/app/generated. Pumice already has a
just codegen-drift recipe and a manual-dispatch codegen-drift.yml workflow.
| Location | Role today |
|---|---|
apps/pumice/src-tauri/build.rs | Runs ontogen on every cargo build |
apps/pumice/**/generated/** | Committed generated .rs/.ts |
apps/pumice/scripts/codegen_drift.sh | Regenerates and diffs against HEAD |
PUMICE_SKIP_SERVER_CODEGEN | Env that disables the specta side-car in CI (disk) |
Proposed
Section titled “Proposed”A moon codegen task whose inputs are the schema/API sources and whose
outputs are the committed generated dirs, plus a codegen-drift task wired
into moon ci (see T-T2HB) that fails on stale generated files.
Approach
Section titled “Approach”- Enumerate inputs/outputs. Inputs:
src-tauri/src/schema/**,src-tauri/src/api/v1/**, and other codegen sources. Outputs: every*/generated/dir plussrc-nuxt/app/generated,app/admin/generated. - Add the moon
codegentask.cargo check/buildthat triggersbuild.rs, withinputs/outputsdeclared so moon caches and invalidates correctly. - Wire the drift gate. Add a
codegen-drifttask shelling to pumice’s existingscripts/codegen_drift.sh(or agit diff --exit-codeover the generated paths) formoon ci. - Preserve the side-car env. Keep
PUMICE_SKIP_SERVER_CODEGENsemantics so the specta side-car does not exhaust CI runner disk.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/pumice/moon.yml | edit | Add codegen + codegen-drift tasks with inputs/outputs |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: A moon
codegentask declares the schema sources asinputsand the generated dirs asoutputs; re-running with no schema change is a cache hit. - AC-2: A
codegen-drifttask fails when a generated file is stale and passes when the corpus is regenerated. - AC-3: The specta side-car’s disk behavior is preserved via
PUMICE_SKIP_SERVER_CODEGENin the CI path.
Out of scope
Section titled “Out of scope”- CI runner wiring / system deps —
T-T2HB. - Rust toolchain reconciliation —
T-P4LZ.
Dependencies
Section titled “Dependencies”T-P4LZ(hard): the crates must build under moon before codegen can be modeled as a task.
Depends on
Section titled “Depends on”T-P4LZ