Skip to content

chore(bootstrap): scaffold specta + tauri-specta + ts-rs codegen pipeline#14

Merged
mpiton merged 2 commits intomainfrom
chore/task-15-specta-tsrs
May 3, 2026
Merged

chore(bootstrap): scaffold specta + tauri-specta + ts-rs codegen pipeline#14
mpiton merged 2 commits intomainfrom
chore/task-15-specta-tsrs

Conversation

@mpiton
Copy link
Copy Markdown
Owner

@mpiton mpiton commented May 3, 2026

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

  • Dependencies (via 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)
  • Codegen script (scripts/codegen-types.ts): placeholder that warns and exits 0; Sprint 1 will populate with concrete exports
  • Types placeholder (src/shared/types/index.ts): empty export for auto-generated DTOs; intentionally ignored by knip
  • CI smoke step (.github/workflows/ci.yml): runs pnpm codegen between tsc and knip; will promote to --check once Sprint 1 emits output
  • Configuration (knip.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)
  • Documentation (CONTRIBUTING.md): new IPC type bridge codegen subsection documenting regen workflow
  • Code quality (cleanup commit): removed narration-only comments; simplified CI rationale; aligned step style

Testing

cargo fmt --check
cargo clippy -- -D warnings
cargo test --workspace
cargo deny check
pnpm exec oxlint .
pnpm exec oxfmt --check .
pnpm exec tsc -b
pnpm exec vitest run
pnpm exec knip
pnpm codegen  # verify placeholder exits 0

All green locally. Pipeline ready for Sprint 1 wiring.

Related Issues

  • Closes T15 (Sprint 0 Task 15: Setup specta + ts-rs codegen scaffold)
  • Unblocks T13, T14, T16 (Sprint 0 Task 12 CI green → merge T15 → unblock dependents)

Notes for Reviewer

  • No behavior change: placeholder codegen infrastructure only. Runtime impact zero until Sprint 1.
  • Version constraint: specta v2.0.0-rc.24 required; v1.x incompatible (pulls Tauri 1.x). Modern split proven stable in upstream; no action on RC tag.
  • Advisory: RUSTSEC-2024-0436 (paste) is transitive via specta-macros. Specta v2 stable release will drop it. Safe to ignore for now.
  • Next sprint: Sprint 1 will populate codegen script with actual exports, promote CI --check from smoke, and start wiring #[derive(specta::Type)].

Checklist

  • Tests added/updated and passing locally
  • Docs updated (CONTRIBUTING.md, inline comments)
  • No secrets, debug prints, commented-out code
  • Self-reviewed the diff
  • CI green (all checks pass locally)

Summary by CodeRabbit

  • Documentation

    • Updated contribution guidelines with information about the IPC type bridge development workflow.
  • Chores

    • Infrastructure setup for Rust-to-TypeScript type generation system (Sprint 0 placeholder).
    • Added code generation tooling and updated CI configuration.
    • Security advisory allowlist updated.

mpiton added 2 commits May 3, 2026 19:04
…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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

📝 Walkthrough

Walkthrough

This 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.

Changes

Rust↔TypeScript IPC Type Bridge Codegen Infrastructure

Layer / File(s) Summary
Rust Type-Generation Dependencies
src-tauri/Cargo.toml
Adds specta (rc.24), tauri-specta with TypeScript feature (rc.24), and ts-rs (12.0.1) with serde and uuid features to enable Rust type export.
Frontend Codegen Script & Placeholder Types
scripts/codegen-types.ts, src/shared/types/index.ts
Creates a Sprint 0 placeholder codegen script that warns and exits 0; adds an empty generated-types module.
Codegen Tooling & Scripting
package.json
Adds tsx (^4.21.0) devDependency and codegen script (tsx scripts/codegen-types.ts) to support TypeScript codegen execution.
CI & Linting Integration
.github/workflows/ci.yml, knip.json
Introduces a codegen (smoke) CI step between typecheck and knip; updates Knip config to include the codegen script as an entry point and scripts/*.ts in project globs to prevent false-positive unused-dependency warnings.
Dependency Advisory & Configuration
deny.toml
Adds RUSTSEC-2024-0436 to the RustSec advisory ignore list with rationale notes for the specta RC dependency chain.
Documentation
CONTRIBUTING.md, CHANGELOG.md
Documents the codegen regeneration workflow (command: pnpm codegen, regenerated files must be committed alongside Rust changes); lists all infrastructure additions and toolchain details in the changelog.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Specta types now flow from Rust to land,
A Bridge of Trust through TypeScript sand,
Sprint Zero wires the path ahead,
With placeholders cheering what's to be said!
The codegen waits for logic bright,

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main objective: scaffolding a Rust-to-TypeScript codegen pipeline using specta, tauri-specta, and ts-rs for IPC type bridging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/task-15-specta-tsrs

Review rate limit: 3/5 reviews remaining, refill in 12 minutes and 34 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 3, 2026

Merging this PR will not alter performance

✅ 7 untouched benchmarks


Comparing chore/task-15-specta-tsrs (d2063f3) with main (7992036)

Open in CodSpeed

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

92-100: ⚡ Quick win

Add 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 -b and add a diff check for src/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

📥 Commits

Reviewing files that changed from the base of the PR and between 7992036 and d2063f3.

⛔ Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • deny.toml
  • knip.json
  • package.json
  • scripts/codegen-types.ts
  • src-tauri/Cargo.toml
  • src/shared/types/index.ts

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 11 files

@mpiton mpiton merged commit dbd6f38 into main May 3, 2026
16 checks passed
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.

1 participant