Repository navigation
Description
Part of #3322 (Tauri extension points for the desktop app).
Summary
Enforce ADR-082 (proposed)'s compatibility policy for the Rust half of the extension API. This PR adds two checks:
- One version.
nodespace_app_lib::EXTENSION_API_VERSION(Rust, from Add AppExtensions with Tauri-plugin support and a runtime-generic assemble() #3304) must equalEXTENSION_API_VERSIONin the TypeScript host API (from Publish the extension host API: services, ui and testing entries, version policy #3315). A Rust test and a Vitest test each read the other side's source and compare. - Fixture changes bump it. A scripts check fails when a Rust extension fixture file has changed since the merge-base with
origin/mainbut the Rust version tuple has not. This is ADR-082's rule: "the gate fails when a fixture file changes andEXTENSION_API_VERSIONdoes not". The fixture files are:app-lib/src/extensions/fixture_tests.rs;app-lib/tests/it/extension_hooks_test.rs.
Everything #3322 and #3317 build before this lands is version 1.0. The bump rule applies from here on.
Context
-
The Rust constant:
pub const EXTENSION_API_VERSION: (u32, u32) = (1, 0);inapp-lib/src/extensions/mod.rs(Add AppExtensions with Tauri-plugin support and a runtime-generic assemble() #3304). -
The TypeScript constant:
export const EXTENSION_API_VERSION = { major: 1, minor: 0 } as const;inpackages/desktop-app/src/lib/extension-api/index.ts, exposed as@nodespace/extension-api(ADR-082 §2.2, added by Publish the extension host API: services, ui and testing entries, version policy #3315). -
Why a test on each side.
test:changedruns only the tiers a diff reaches (scripts/gate-scope.ts):- a TypeScript-only change runs the frontend tier;
- a Rust change runs the Rust and scripts tiers.
So each side's test lives in the tier its own file triggers.
-
Reuse Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's diff helper. Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's
scripts/check-pro-boundary.tsalready computes files changed since the merge-base (changedFilesSinceMain). Reuse it, or move it into a small shared module both checks import. -
Not here. The frontend declaration snapshot, where a change to the host API's types must bump the version, is Publish the extension host API: services, ui and testing entries, version policy #3315's.
Scope
Rust test in app-lib/src/extensions/fixture_tests.rs: rust_and_typescript_extension_api_versions_match.
- Read
include_str!("../../../src/lib/extension-api/index.ts"). - Extract
majorandminorfrom theEXTENSION_API_VERSIONliteral, with plain string scanning. - Assert they equal the Rust tuple. The failure message says to change both constants together.
Vitest test packages/desktop-app/src/tests/plugins/extension-api-version.test.ts.
- Read
../app-lib/src/extensions/mod.rs(relative to the package root) withreadFileSync. - Extract the tuple and compare it with the imported constant.
New scripts/check-extension-api-version.ts
- Exports
FIXTURE_FILES,VERSION_FILE,parseRustVersion(src)and a purebumpFailure(changedFiles, baseVersion, headVersion). - Reads the base version with
git show <merge-base>:<VERSION_FILE>. - Has a CLI under
import.meta.main.
New scripts/check-extension-api-version.test.ts
- Fixture-level unit tests.
- A
describe("real repo")case that runs the check against the working tree.
Docs
app-lib/src/extensions/mod.rs: state the bump rule, and that the TypeScript constant moves with the Rust one.CLAUDE.md: one line in the Pro/Sync boundary section that Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299 added. A change to the extension API, or to its fixture files, bumpsEXTENSION_API_VERSIONin Rust and TypeScript together: major for a breaking change, minor for an additive one.
Out of scope
- The TypeScript declaration snapshot (Publish the extension host API: services, ui and testing entries, version policy #3315).
- The daemon extension points' fixtures (ADR-082 §4). Add them to
FIXTURE_FILESonce they exist. - Any check in nodespace-sync.
Steps
- Run the CLAUDE.md startup sequence. Self-assign at pickup; the worktree is
issue-<N>-extension-api-version-checks. - Add both equality tests.
- Add the script and its test.
- Update the docs.
- Run
bun run quality:fix, thenbun run test:changed.
Acceptance criteria
- Changing either constant alone fails the Rust test under
bun run rust:test, and the Vitest test underbun run --cwd packages/desktop-app test. - Editing a fixture file without changing the Rust tuple fails
bun test scripts/check-extension-api-version.test.ts, with a message naming the file and the rule. - Editing a fixture file together with a bump passes.
- A clean branch passes.
-
bun run scripts/check-pro-boundary.tspasses.BASELINESare lowered to the exact new counts wherever this PR removes markers, and no count rises. - No GitHub issue numbers in code comments.
Tests and verification
Mutation-check each new test: break the code path it covers, confirm the test fails, then restore.
cargo test --lib -p nodespace-app-lib -- extensions::fixture_tests --test-threads=2
bun run --cwd packages/desktop-app test src/tests/plugins/extension-api-version.test.ts
bun test scripts/check-extension-api-version.test.ts
bun run quality:scripts:check
bun run test:changed
Dependencies
- Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307, Let an app built on core supply its update source through AppExtensions #3320 and Have the app library add core's window capability at startup #3308: every Tauri extension point exists, so the initial build-out is version 1.0.
- Publish the extension host API: services, ui and testing entries, version policy #3315: the TypeScript host API and its constant.
Risks and rollback
- Noise. Any edit to a fixture file demands a bump, even a test-only refactor. The ADR accepts that; review decides major versus minor.
- Later additive work bumps the minor version on both sides. For example, Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347's
daemon_profile. - Rollback: revert.
Plan key: C2.8 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Request: add the skill-content input and its fixture to this gate's watched fixtures. Both come from #3404 (core#3369).
NODESPACE_SKILL_EXTENSIONSis part of the versioned extension API (ADR-082 §7 and §8). It names a directory whoseSKILL.mdfragment and flatreferences/*.mdare merged into the staged skill byscripts/build-skill.ts. Its accepted layout is exercised by the fixture directoryscripts/fixtures/skill-extension/:SKILL.mdreferences/fixture-guide.mdPlease list that directory, or its two files, in
FIXTURE_FILESalongside the Rust fixtures, so that a later change to the input's fixture requires anEXTENSION_API_VERSIONbump.#3404 does not bump the version. Per this issue and #3315, the initial build-out stays at 1.0, and the bump rule applies once this gate lands.
mstomar125 commentedon Oct 1, 2026
Superseded by #3414 (umbrella against the final ADR-081–085)