chore(bootstrap): scaffold specta + tauri-specta + ts-rs codegen pipeline#14
chore(bootstrap): scaffold specta + tauri-specta + ts-rs codegen pipeline#14
Conversation
…line (task 15)
Sprint 0 placeholder for the Rust ↔ TypeScript IPC type bridge. Crates added
via cargo add (specta 2.0.0-rc.24, tauri-specta 2.0.0-rc.24 with `typescript`
feature, ts-rs 12.0.1 with `serde-compat,uuid-impl`) so Sprint 1 can wire
concrete `#[derive(specta::Type)]` + `#[derive(TS)]` exports without spending
sprint capacity on tooling. Task spec called for `cargo add specta --features
tauri` but specta v1.x's `tauri` feature pulls Tauri 1.x (lock conflict with
our Tauri 2.11); upstream specta v2 RC moved Tauri integration into the
dedicated tauri-specta crate, so this PR adopts the modern split.
Wires: tsx 4.21.0 devDep + scripts/codegen-types.ts (logs banner via
console.warn — allowed by oxlintrc no-console — exits 0), src/shared/types/
index.ts placeholder (`export {};`), `pnpm codegen` script re-added (T11/knip
removed the dead reference), CI smoke step `pnpm codegen` between `tsc -b`
and `knip`, knip.json entry/project/ignore updates so the new files don't
trip the dead-code gate, deny.toml advisory ignore for RUSTSEC-2024-0436
(paste 1.0.15 archived "no longer maintained" — pulled by specta-macros and
specta-tags; no safe upgrade until specta migrates off paste).
Domain layer remains unimported: `architecture::test_domain_layer_has_no_io_
imports` integration test stays green. All lints + `cargo deny check` pass.
/simplify pass on commit 4d70a8a: - scripts/codegen-types.ts: keep the console.warn line, drop the two comment lines that just narrated WHAT the script does and which sprint populates it (well-named identifiers + the warn message already convey this). - src/shared/types/index.ts: keep `export {};`, drop the three lines of narration comments for the same reason. - .github/workflows/ci.yml `codegen (smoke)`: collapse the 5-line inline comment narrating Sprint 0 / Sprint 1 plans into a single line that states only the non-obvious WHY (when to promote to --check). Also switch `run: pnpm codegen` to `run: pnpm run codegen` for sibling consistency with the surrounding `pnpm exec <bin>` style. - deny.toml RUSTSEC-2024-0436 block: replace the dangling "(specta-rs/specta tracking)" parenthetical with a real URL so the re-eval trigger has a clickable target. No behaviour change. All lints + cargo deny stay green.
📝 WalkthroughWalkthroughThis PR introduces Sprint 0 placeholder infrastructure for a Rust↔TypeScript IPC type bridge using Specta and tauri-specta. It adds Rust dependencies, a TypeScript codegen script, CI integration, and documentation describing the code-generation workflow and regeneration procedures. ChangesRust↔TypeScript IPC Type Bridge Codegen Infrastructure
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 12 minutes and 34 seconds. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
92-100: ⚡ Quick winAdd a generated-files cleanliness gate and run codegen before typecheck.
Right now CI only smoke-runs codegen. Once Sprint 1 writes files, this won’t fail on uncommitted generated diffs. Put codegen before
tsc -band add a diff check forsrc/shared/types/**.Proposed CI adjustment
- - name: tsc -b - run: pnpm exec tsc -b - - name: codegen (smoke) # Promote to `pnpm run codegen --check` once Sprint 1 emits real output. run: pnpm run codegen + + - name: codegen output is committed + run: git diff --exit-code -- src/shared/types + + - name: tsc -b + run: pnpm exec tsc -b🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 92 - 100, Move the codegen step to run before the TypeScript build step (so run the existing "codegen (smoke)" step prior to the "tsc -b" step) and replace the smoke run with a strict check that fails CI if generated sources changed; add a new job/step that runs a git diff check against the generated path pattern "src/shared/types/**" (fail if any changes are detected) so uncommitted generated-file diffs block the pipeline; ensure existing "knip" step remains after typecheck.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 92-100: Move the codegen step to run before the TypeScript build
step (so run the existing "codegen (smoke)" step prior to the "tsc -b" step) and
replace the smoke run with a strict check that fails CI if generated sources
changed; add a new job/step that runs a git diff check against the generated
path pattern "src/shared/types/**" (fail if any changes are detected) so
uncommitted generated-file diffs block the pipeline; ensure existing "knip" step
remains after typecheck.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 863e5bd9-ce27-48ab-9d3d-3017a1a9fa09
⛔ Files ignored due to path filters (2)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlsrc-tauri/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
.github/workflows/ci.ymlCHANGELOG.mdCONTRIBUTING.mddeny.tomlknip.jsonpackage.jsonscripts/codegen-types.tssrc-tauri/Cargo.tomlsrc/shared/types/index.ts
Summary
Sprint 0 placeholder for Rust ↔ TypeScript IPC type bridge using specta + tauri-specta + ts-rs.
No runtime usage yet; Sprint 1 will wire
#[derive(specta::Type)]annotations and export Tauri commands + domain DTOs.Closes Sprint 0 Task 15 acceptance criteria.
Why
Frontend DTOs must be type-safe mirrors of Rust backend types. Specta v2 RC split the monolithic v1 crate
(which pulled Tauri 1.x incompatible with our Tauri 2.11) into separate specta core + tauri-specta companion.
This PR establishes the scaffold so Sprint 1 can begin wiring exports without bootstrapping infrastructure.
Changes
cargo add): specta 2.0.0-rc.24, tauri-specta 2.0.0-rc.24 (typescript), ts-rs 12.0.1 (serde-compat, uuid-impl)scripts/codegen-types.ts): placeholder that warns and exits 0; Sprint 1 will populate with concrete exportssrc/shared/types/index.ts): empty export for auto-generated DTOs; intentionally ignored by knip.github/workflows/ci.yml): runspnpm codegenbetween tsc and knip; will promote to--checkonce Sprint 1 emits outputknip.json,deny.toml): added codegen script to entry/project paths; added RUSTSEC-2024-0436 (paste 1.0.15 transitive via specta-macros RC, no safe upgrade until specta stabilizes)CONTRIBUTING.md): new IPC type bridge codegen subsection documenting regen workflowTesting
All green locally. Pipeline ready for Sprint 1 wiring.
Related Issues
Notes for Reviewer
--checkfrom smoke, and start wiring#[derive(specta::Type)].Checklist
Summary by CodeRabbit
Documentation
Chores