T-UBPG-sdf-ontogen-backend-skeleton
Status: closed/done · Impact: high · Complexity: large
Make SDF’s Rust↔TS contract generated rather than hand-kept: ontogen emits the Axum HTTP transport (browser mode), Tauri IPC transport (desktop), MCP tool registry (agents), and the typed TS client from one set of Rust schema structs — the D-0017-ontogen-shared-codegen-convergence convergence event, drift-gated from day one.
| Location | Role today |
|---|---|
apps/sdf/src-tauri/src/ | scaffold shell, hand-written commands only |
apps/pumice/src-tauri/build.rs | the in-repo ontogen Pipeline precedent (paths, ClientsConfig, write_if_changed) |
apps/pumice/scripts/codegen_drift.sh | drift-gate protocol precedent (exit 0/1/2) |
Cargo.toml | workspace pins ontogen/ontogen-macros/markdown-store at rev 0c3a989 |
apps/sdlc/lib/model/entities/ | substrate entity schemas (markdown-contract/zod) — upstream truth for mirrored shapes |
Proposed
Section titled “Proposed”apps/sdf/src-tauri/build.rs runs an ontogen Pipeline over SDF’s schema
structs (app-local entities first: registered projects, app settings;
substrate read-model mirrors as needed by later phases). Generated
committed surfaces: HTTP + IPC transports, MCP registry, TS
transport.ts/types.ts. UI code targets the generated Transport
interface; desktop binds IPC, browser binds HTTP. Two gates: codegen
drift (pumice protocol as a moon task) and a schema-parity check
asserting mirrored substrate shapes match the SDLC entity schemas.
Approach
Section titled “Approach”- Bump/align the workspace ontogen rev if needed (origin/main is v0.4.0; coordinate with pumice/platform-core — accepted cost per D-0018).
- Define
src-tauri/src/schema/*.rsentities; wire thebuild.rsPipeline (dtos → store → api → servers HTTP/IPC/MCP → clients HttpTauriIpcSplit and AdminRegistry),write_if_changedeverywhere. - Swap
T-6S37’s data access to the generatedTransportseam (createIpcTransport()underwindow.__TAURI__,createHttpTransport()otherwise); keep@sdlc/dashboard-clientsolely for the upstream/api/statesource until Phase 5 re-homes it. - Add
sdf:codegen-driftmoon task (touch build.rs → cargo check → git diff —exit-code over generated paths); wire into sdf-ci.yml. - Parity gate v0: script comparing ontogen-emitted JSON schemas for
mirrored substrate entities against
apps/sdlc/lib/model/entities/*schemas; CI-fails on mismatch; document the reconciliation contract. - Naming hygiene: NamingConfig overrides for plural-tantum nouns (pumice precedent).
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/sdf/src-tauri/build.rs | modify | ontogen Pipeline |
apps/sdf/src-tauri/src/schema/ | new | entity structs |
apps/sdf/src-tauri/src/api/ | new | generated transports (committed) |
apps/sdf/src-nuxt/app/generated/ | new | transport.ts, types.ts (committed) |
apps/sdf/scripts/codegen_drift.sh | new | drift gate |
apps/sdf/moon.yml | modify | codegen-drift task |
Cargo.toml | modify | ontogen rev bump if required |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: one
cargo buildregenerates all transports + TS client;sdf:codegen-driftmoon task exits 0 clean / 1 on drift. - AC-2: the active-work view works identically in desktop (IPC) and browser (HTTP) through the generated Transport interface.
- AC-3: MCP registry exposes SDF’s ops; a smoke test lists tools and round-trips one call.
- AC-4: parity gate exists, runs in CI, and fails on a seeded mismatch (negative test) while passing on main.
Out of scope
Section titled “Out of scope”- Full single-source contract convergence (follow-up under D-0017).
- New panels/views (
T-0DLC).
Dependencies
Section titled “Dependencies”T-WDXJ(hard). Stacks afterT-QT7Xin PR order.
Discovery context
Section titled “Discovery context”- Phase 4 of D-0018-sdf-control-plane-app; patterns from agentpants (canonical-API + generated transports) and pumice build.rs.
Depends on
Section titled “Depends on”T-WDXJ