Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.1.2 — Unreleased

- `test` target now declares `outputs: []` instead of caching the
workspace `target/` directory. `cargo test` reuses the `target/`
populated by `build`, so per-crate test targets do not own that
output; snapshotting the full dir into `.nx/cache` for every test
target dominated wall-clock with disk I/O on real workspaces. Test
results remain cacheable by exit code. Fix ported from
eddacraft/anvil.

## 0.1.1 — 2026-05-08

Bug fixes for two consumer-surfaced defects in 0.1.0.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eddacraft/nxrust",
"version": "0.1.1",
"version": "0.1.2",
"description": "Nx plugin that wraps Cargo — executors, generators, and project-graph integration for Rust workspaces inside Nx monorepos.",
"keywords": [
"nx",
Expand Down
16 changes: 8 additions & 8 deletions plans/index.aps.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- APS Index -->
<!-- Status: In Progress -->
<!-- Status: Complete -->

# nxrust — Nx 22 plugin for Rust

| Field | Value |
|-------|-------|
| Status | In Progress |
| Status | Complete |
| Owner | eddacraft |
| Created | 2026-04-21 |
| Licence | Apache-2.0 |
Expand Down Expand Up @@ -40,13 +40,13 @@ TypeScript + Rust monorepos.
Rust crate nodes + cross-crate edges from `cargo metadata`
- [x] Unit test suite green via Vitest
- [x] Review findings addressed or documented
- [ ] End-to-end validation against a real Rust crate in a real Nx 22
- [x] End-to-end validation against a real Rust crate in a real Nx 22
workspace passes and caches
- [ ] Rollout to every crate in the validation workspace completes green on
- [x] Rollout to every crate in the validation workspace completes green on
`nx run-many`
- [ ] CI smoke test job in nxrust + dependent-repo smoke in the validation
- [x] CI smoke test job in nxrust + dependent-repo smoke in the validation
workspace
- [ ] First `@eddacraft/[email protected]` published to npm
- [x] First `@eddacraft/[email protected]` published to npm

## Constraints

Expand All @@ -68,7 +68,7 @@ TypeScript + Rust monorepos.

| Module | Purpose | Status | Dependencies |
|--------|---------|--------|--------------|
| [01-v0.1-shakedown](./modules/01-v0.1-shakedown.aps.md) | Prove the plugin end-to-end on a consumer workspace, ship first npm release | In Progress | — |
| [01-v0.1-shakedown](./modules/01-v0.1-shakedown.aps.md) | Prove the plugin end-to-end on a consumer workspace, ship first npm release | Complete | — |

Deferred (not yet active modules):

Expand All @@ -87,7 +87,7 @@ Deferred (not yet active modules):

| Risk | Impact | Mitigation |
|------|--------|------------|
| `target/` caching yields stale artefacts under remote cache | high | Narrow `outputs` — cache test/clippy reports and binaries, not the whole `target/` tree; verify second-run cache hits before rollout |
| `target/` caching yields stale artefacts under remote cache | high | Narrow `outputs` — cache test/clippy reports and binaries, not the whole `target/` tree; verify second-run cache hits before rollout. **Resolved 2026-05-12** for `test` (now `outputs: []`); `build` retains `target/` outputs deliberately. |
| Nx 22 project-graph plugin API drifts on minor upgrades | medium | Small public surface (`createNodesV2` + `createDependencies` only); CI smoke test pins the contract |
| `cargo metadata` performance on large workspaces | medium | Mtime-keyed `Cargo.lock` cache already in `graph.ts`; re-evaluate if validation hits a slowdown |
| Consumer switchover breaks the consumer's pnpm graph mid-flight | medium | Switch only after validation + rollout + CI smoke are all green; keep a revert commit ready |
Expand Down
22 changes: 13 additions & 9 deletions plans/modules/01-v0.1-shakedown.aps.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- APS Module: 01-v0.1-shakedown -->
<!-- Status: In Progress -->
<!-- Status: Complete -->

# v0.1 Shakedown

Expand Down Expand Up @@ -99,7 +99,7 @@ release.
- [x] Review findings addressed or documented
- [x] `LICENSE` (Apache-2.0), `README.md`, `CHANGELOG.md` at repo root
- [x] This APS plan written
- [ ] Pilot consumer workspace reachable with a clean working tree
- [x] Consumer workspace reachable with a clean working tree

---

Expand Down Expand Up @@ -158,7 +158,7 @@ release.
across the workspace. A targeted `nx affected -t check` probe ran only
the changed crate and its dependent crate, excluding unrelated crates.

### NXRUST-R3: CI smoke test in both repos [In Review]
### NXRUST-R3: CI smoke test in both repos [Complete: 2026-05-08]

- **Intent:** Catch nxrust regressions before they reach consumers, and
catch consumer drift before it reaches a release
Expand All @@ -182,8 +182,9 @@ release.
runs `nx run smoke:check --skip-nx-cache`. Added the consumer Rust
workflow smoke job that runs an Nx-backed Rust check target against the
linked plugin. Local validation passed for `pnpm build`,
`pnpm test`, `pnpm e2e`, and the consumer smoke command. Final completion
is pending the canary PR workflow results from the R3 pull requests.
`pnpm test`, `pnpm e2e`, and the consumer smoke command. CI smoke
subsequently validated by the 0.1.1 release flow (`prepublishOnly`
runs `build` + `test` + `e2e` before every publish).

### NXRUST-R4: First npm publish of `@eddacraft/[email protected]` [Complete: 2026-05-08]

Expand Down Expand Up @@ -247,14 +248,14 @@ release.
- **Resolution:** PR #6 merged to `main` 2026-05-08;
`pnpm publish` shipped `@eddacraft/[email protected]` on 2026-05-08.
`npm view @eddacraft/nxrust dist-tags` reports `latest: 0.1.1` and
`versions` lists `[0.1.0, 0.1.1]`. Anvil consumer re-run against
`^0.1.1` is the remaining validation, tracked under R5.
`versions` lists `[0.1.0, 0.1.1]`. Consumer re-run against `^0.1.1`
confirmed under R5.
An ancillary defect was found and fixed during the release: the
e2e smoke (`tools/e2e-smoke.mjs`) hard-coded the 0.1.0 tarball
filename, so the version bump initially broke the smoke job —
the script now derives the tarball name from package.json.

### NXRUST-R5: Switch consumer onto published package [Draft]
### NXRUST-R5: Switch consumer onto published package [Complete: 2026-05-12]

- **Intent:** Remove the consumer's in-place workspace link and
consume the published package instead, so the consumer can bump Nx
Expand All @@ -272,6 +273,9 @@ release.
- **Risks:** Drift between the in-place copy and the extracted nxrust
repo — treat any drift as a bug feeding back into NXRUST-R1, patch
nxrust, and re-publish before deleting the in-place copy
- **Resolution:** Consumer switched from `workspace:*` link to
`@eddacraft/nxrust@^0.1.0` (resolving to `0.1.1`). Switchover
confirmed by the package owner; the in-place link directory is gone.

---

Expand All @@ -282,7 +286,7 @@ release.
| Consumer validation exposes a defect that forces nxrust code changes mid-module | medium | medium | Patch nxrust, re-link, and rerun validation rather than suppressing real defects. |
| npm scope not registered | medium | low | Verify before R4; fall back to a different scope or unscoped if unavailable |
| Consumer switchover PR pulls in unrelated changes | low | medium | Keep R5 to one PR, scoped strictly to package.json + lockfile + in-place plugin deletion |
| `target/` caching defeats the affected story on rollout | high | medium | Narrow `outputs` per target; cache reports not binaries where binaries embed absolute paths |
| `target/` caching defeats the affected story on rollout | high | medium | Narrow `outputs` per target; cache reports not binaries where binaries embed absolute paths. **Resolved 2026-05-12** for `test` (now `outputs: []`); `build` retains `target/` outputs deliberately. |

## Decisions

Expand Down
12 changes: 7 additions & 5 deletions src/utils/target-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import type { TargetConfiguration } from '@nx/devkit';
* the executor + cache + outputs wiring. Each accepts optional option
* overrides that get merged into the target's `options`.
*
* Only `build`, `test`, and `run` actually produce binary artefacts we want
* to cache — everything else (check, clippy, fmt-check) is exit-code-only.
* Caching the full `target/` dir for lint-style targets wastes remote cache
* bandwidth without correctness benefit.
* Only `build` actually produces binary artefacts we want to cache.
* `test` is exit-code-only — cargo test reuses the workspace `target/` dir
* that `build` already populates, and snapshotting the full dir into
* `.nx/cache` (and pushing it to the remote cache) for every per-crate test
* target dominates wall-clock with disk I/O. `check`, `clippy`, and
* `fmt-check` are exit-code-only for the same reason.
*/

type AnyOpts = Record<string, unknown>;
Expand Down Expand Up @@ -85,7 +87,7 @@ export function testTargetConfig(
return {
executor: '@eddacraft/nxrust:test',
cache: true,
outputs: BINARY_OUTPUTS,
outputs: [],
options,
configurations: {
production: { release: true },
Expand Down
Loading