Skip to content

chore: move every crate into its ADR-0009 directory (crates-layout PR 3) - #221

Merged
aRustyDev merged 4 commits into
mainfrom
chore/crates-layout-move
Nov 16, 2026
Merged

aRustyDev merged 4 commits into
mainfrom
chore/crates-layout-move

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

PR 3 of the crates-layout plan (.agents/plans/crates-layout/, ADR-0009): the move. Every crate goes to its ADR-0009 directory, and no package is renamed.

From To
thrust-adapters-{cloudflare,memory,oidc,postgres,selfhosted} adapters/{cloudflare,memory,oidc,postgres,selfhosted}
thrust-api, thrust-api-v1, thrust-compat-plane, thrust-plane-types api/core, api/v1, api/compat-plane, api/plane-types
thrust-contracts, thrust-ports, thrust-core core/types, core/ports, core/usecases
thrust-editor-doc / thrust-editor-worker editor/doc / spikes/editor-worker
thrust-contract-tests / thrust-oracle-fixture testing/suites/api / testing/fixtures/oracle
thrust-server, thrust-worker, thrust-edge server, worker, edge

thrust-edge (#211) was added after the plan was written. ADR-0009 had already reserved crates/edge/ for it.

Commits

  1. Renames only. 359 files, each git mv at 100 % similarity, so review and git log --follow see nothing else. The workspace does not build at this commit.
  2. Every path that names a crate's directory.
    • The root Cargo.toml, which since build: crate paths that work at any directory depth (crates-layout PR 2) #212 is the only manifest that names one.
    • The editor Worker's wrangler.toml now calls ../../../scripts/rs. It is the only crate, now three levels down, that climbs out with a relative path.
    • The 75 files that wrote crates/thrust-<x>: CI actions and workflows, the scripts, the probes, the tools and the docs. These are matched on a whole name, so thrust-api never matched inside thrust-api-v1.
    • 38 mentions in 24 files that wrote a crate path without crates/ now name the real path.
    • The zxcvbn patches are regenerated rather than hand-edited: their hunks are unchanged, and their headers name the new path at today's line numbers.
    • test_plan_ci.py now uses ADR-0009's layout for the real graph.
    • docs/src/contributing/crates.md: "Adding a crate" now starts by choosing a group.
    • ARCHITECTURE §2a is redrawn.
  3. A README.md for crates/ and for each group (ADR-0009 rule 1). That includes testing/suites/ and testing/fixtures/, so PR 4's guard can check the rule without an exception.
  4. thrust-editor-doc's description no longer begins "Spike 0006". It is product code: api-v1 and compat-plane use its sanitiser.

Evidence

Every check has a control that makes it fail (AGENTS.md rule 8).

Check Result Control
cargo metadata --no-deps before and after, every path replaced by the package it names SAME: 19 packages, 208 dependency entries (59 path), 121 targets; each package in exactly its mapped directory 11 planted differences, all reported: a dropped feature, default-features, a dependency pointed at another crate, a dependency pointed outside, a kind, a target's source file, a package in the wrong directory, a dropped dependency, a dropped member, a features table, a target-specific dependency
git grep 'crates/thrust-' -- . ':!.agents/plans' ':!CHANGELOG.md' nothing
Cargo.lock unchanged
cargo nextest run --profile ci --workspace 4,450 passed, 4 skipped
cargo test --doc --workspace, cargo clippy --workspace --all-targets -- -D warnings 3 doctests passed; clippy exit 0
scripts/contract.sh native-memory main passed=70, expected=70
scripts/mutants.sh (the contract suite's mutation controls) exit 0: 43 mutants killed, none survived; its 4 guards refuse their misconfigured runs it is itself the control that the suite can fail
every step of CI's deps and ci-scripts jobs, shell scripts under dash 44 of 44 exit 0; test_plan_ci.py passed=5,013, bad=0 one-line broken copies of today's plan-ci.py: first two segments bad=2,401; shortest prefix bad=123; no segment boundary bad=1
check-placement.sh, check-topology.sh default to crates/worker both pass both exit 1 on the old directory
deploy.yml's paths: filters every literal path is tracked (git ls-files --error-unmatch) the old crates/thrust-worker/wrangler.deploy.toml: exit 1
.cargo/mutants.toml exclude globs cargo mutants --list-files --workspace lists 81 files, none in the suite and not the edge's runtime.rs the old globs: 86 files, with the suite's 4 and runtime.rs
worker-build from each Worker's own directory, with its wrangler.toml command worker, spikes/editor-worker and edge build the editor Worker's old ../../scripts/rs: exit 127
cargo fmt --all --check clean
the book builds with mdbook 0.5.4; no page added, so SUMMARY.md is unchanged

Not run here:

On the no-segment-boundary control: the case that catches it is now crates/core/types-gone beside the crate crates/core/types. The flat crates/thrust-core-gone case went with the flat layout.

Branches alive across the move

#220 is open and touches crates/. It merges cleanly into main today. Merged after this PR, it would see:

  • 11 "file location" conflicts: files it adds under an old directory. Git proposes the right new place for each, so accepting is the fix.
  • 3 content conflicts (docs/src/testing/status.md, docs/src/testing/techniques/mutation.md, tools/compat-record/gen-acceptance.py), where both branches edit the same lines.
  • The crates/thrust- paths in its own new text.

If #220 merges first, I'll merge main into this branch and redo the same steps here.

Not edited: .agents/plans/** other than ARCHITECTURE §2a and this plan's own files (dated records), and CHANGELOG.md.

After merge, GitNexus is re-indexed from the canonical checkout of main.

Cargo.toml changed, so CI runs everything.

🤖 Generated with Claude Code

aRustyDev and others added 4 commits November 16, 2026 12:44
Each of the 19 workspace members moves with git mv, and nothing else
changes in this commit, so review and git log --follow see 359 renames
at 100 % similarity. Package names do not change.

  adapters/{cloudflare,memory,oidc,postgres,selfhosted}
  api/core (thrust-api), api/v1, api/compat-plane, api/plane-types
  core/ports, core/types (thrust-contracts), core/usecases (thrust-core)
  editor/doc, spikes/editor-worker
  testing/suites/api (thrust-contract-tests),
  testing/fixtures/oracle (thrust-oracle-fixture)
  edge, server, worker

thrust-edge (#211) arrived after the plan was written. ADR-0009 had
already reserved crates/edge/ for it.

The workspace does not build at this commit: the next one edits the
paths that name these directories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit moved the crates; this one edits what names their
directories, so the workspace builds again.

- Root Cargo.toml: members and [workspace.dependencies]. Since PR 2
  (#212) it is the only manifest that names a crate's directory.
- crates/spikes/editor-worker/wrangler.toml calls ../../../scripts/rs: it
  is the one crate now three levels down that climbs out with a relative
  path. The worker's and the edge's configs stay at ../../ (depth 2).
- Every other file that wrote crates/thrust-<x>: CI actions and workflows,
  the deploy and check scripts, the probes, tools/compat-record,
  tools/spike-0006, the docs. Matched on a whole name, so thrust-api never
  matched inside thrust-api-v1. Also the comments and docs that wrote a
  crate path without crates/ (thrust-core/tests/operator.rs): they now
  name the real path.
- The ones that fail silently when missed: deploy.yml's paths filter
  (crates/worker/wrangler.deploy.toml), .cargo/mutants.toml's exclude
  globs (the contract suite, the edge's runtime.rs) and .gitignore.
- check-deps.sh: the proof-minting guard's literal paths, including the
  regex alternation that exempts the composition roots.
- tools/measure-zxcvbn/patches: regenerated (applied to the moved tree,
  diffed, reverted). Their hunks are unchanged; their headers name
  crates/core/usecases, at today's line numbers.
- test_plan_ci.py: ADR-0009's layout is now the default for the real
  graph and the flat one only the "before" of the check that moving a
  crate changes no plan. It also checks that this repository keeps
  REAL_GRAPH's crates where ADR_0009 says.
- docs/src/contributing/crates.md: "Adding a crate" starts by choosing
  the group (or the top level, for a program); "Not part of the product
  graph" puts the editor Worker in spikes/ and says thrust-editor-doc is
  product code now, and adds crates/testing/.
- ARCHITECTURE §2a redrawn from ADR-0009, with all 19 crates and the two
  planned ones (the M4 core API, the collab root).
- The plan: thrust-edge's row in the mapping, the recount, the status.

Not edited: .agents/plans/** other than the two above (dated records)
and CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ADR-0009 rule 1: a directory under crates/ is a crate or a group, and a
group has a README.md that names its members and says what belongs in
it. One for crates/ (the groups, the programs and the names reserved for
programs), and one each for adapters/, api/, core/, editor/, spikes/
(when a spike goes here and when in probes/) and testing/ (what goes
there, and where each kind of test that is not a crate lives). The two
groups inside testing/, suites/ and fixtures/, get short ones too, so the
rule holds for every group and PR 4's guard can check it without an
exception.

plan-ci.py gives a group's README.md, inside no crate, no job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Its description began "Spike 0006". The crate is product code now:
thrust-api-v1 and thrust-compat-plane use its sanitiser, which is why
ADR-0009 puts it in editor/ and only the spike's measurement Worker in
spikes/. The description says that, and that it began as spike 0006.

This is the only change to package metadata in PR 3; the cargo metadata
comparison of the move ran before it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 50b4dba into main Nov 16, 2026
47 checks passed
@aRustyDev
aRustyDev deleted the chore/crates-layout-move branch November 16, 2026 19:27
aRustyDev added a commit that referenced this pull request Nov 16, 2026
#221 moved every crate (crates/thrust-core is crates/core/usecases, and
so on), so this branch conflicted with main.

- The 11 files this branch adds under an old directory go to the new one,
  where git's directory-rename detection put them (login_code.rs and its
  tests, magic.rs and its tests, the X12 and X13 fixtures, migration 0018,
  the memory adapter's login_codes.rs).
- The 3 content conflicts (docs/src/testing/status.md,
  docs/src/testing/techniques/mutation.md,
  tools/compat-record/gen-acceptance.py) take this branch's side, whose
  only difference from main's was main's path rewrite. Then the same
  rewrite #221 used gives those lines, and two comments this branch added
  (crates/adapters/memory/tests/login_codes.rs,
  crates/api/compat-plane/tests/common/mod.rs), the new paths.

Checks:
- No file outside .agents/plans and CHANGELOG.md names crates/thrust-.
- status.md: every one of main's 60 rows is byte-identical to main's, and
  G-42 is the only row added.
- Against main, this branch now changes the same 47 files as before the
  merge, at their new paths, with the same line counts. The 48th, the
  Cargo.lock line for thrust-edge 0.2.0, is already on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
aRustyDev added a commit that referenced this pull request Nov 16, 2026
…se tag pattern, and check both ends (#222)

release-pr has failed on main since #211: `cannot find package "thrust-edge" in workspace`. Every crate finds its previous
version from the one tag v<version>; release-plz 0.4.3 then rebuilds that tag's workspace and looks the crate up in it
(next_ver.rs, process_git_only_package), and thrust-edge is not in v0.2.0. A crate is treated as a first release only
when no tag matches its pattern.

- release-plz.toml: thrust-edge gets git_tag_name = "thrust-edge-v{{ version }}", which matches no tag. The header says
  why, and that the pattern goes once a release contains the crate.
- check-release-plz.py: a git_tag_name may only be the entry's own first-release pattern, and never on the tagger. New
  --first-release, against the highest v<major>.<minor>.<patch> tag, comparing package names (a moved crate is not new):
  - `required`: every crate the tag lacks has its pattern. Run by ci.yml's deps job, whose checkout now fetches the tags.
  - `exact`: and no crate the tag has keeps one. Run by release-plz.yml's release-pr job before release-plz. It is not
    run in deps, where from the tag of a release to the pattern's removal it would fail every pull request, and main's run
    of the release commit.
- cicd.md: "A new crate", and how it was verified.

Verified with release-plz 0.4.3 on clones of main:
- at #218: release-plz update exits 1 with the CI error on main's config; with this one it exits 0 and proposes 0.2.1
  with #211's feature in the changelog. The candidate's Cargo.lock passes cargo metadata --locked. A first release's own
  commits do not set the bump (a feature alone proposed the patch).
- at #221 (every crate moved, ADR-0009): the same error on main's config. With this one, exit 0 and nothing to propose:
  release-plz counts a crate's commits by its current directory, so #211's feature (made under crates/thrust-edge) no
  longer counts and the move is a chore. #211's feature reaches a changelog only through a release made by hand.
- then a fix(edge) commit proposes 0.2.1. With v0.2.1 tagged and a second fix: with the pattern kept, 0.2.2's section
  lists the first fix (and the move) again, and --first-release exact refuses it; with it removed, only the second fix,
  and exact passes.
- on this repository: --first-release required refuses main's release-plz.toml (thrust-edge only: the moved crates are
  found in v0.2.0 by name) and passes with this one; exact passes.
- test_check_release_plz.py: 151 passed, over generated git histories for every crate. Nine hand mutants of the checker
  (name-order or pre-release tags as the last release, exact never or always refusing, any pattern value accepted, the
  tagger's pattern allowed, no tag passing, crates compared by directory, a patterned crate still required) each fail it.
- lint-all-workflows.sh, actionlint, test-lint-all-workflows.sh, test-lint-workflow.sh, test-required-contexts.sh and
  test_plan_ci.py (5013) pass.

Not verified: actions/checkout with fetch-tags at depth 1 on the runner. Its source at the pinned commit adds
+refs/tags/*:refs/tags/* to the fetch; this pull request's deps job is the check.

Refs: #195

Co-authored-by: Claude Opus 5.5 <[email protected]>
aRustyDev added a commit that referenced this pull request Nov 16, 2026
#226)

* ci: guard ADR-0009's crate layout in the deps job (scripts/check-layout.sh)

The layout PR 3 (#221) made is kept by a check, run by CI's deps job with
its --self-test beside it. It reads the tracked files (git ls-files) and
the workspace (cargo metadata --no-deps) and refuses:

1. a workspace member outside crates/;
2. a directory under crates/ that is neither a crate nor a group; a crate
   inside another; a group with no README.md, with a file other than its
   README.md (a manifest beside it: a crate and a group at once), or whose
   README.md does not name a directory in it as `<name>/`;
3. a normal or build dependency on a crate in testing/ or spikes/;
4. a normal or build dependency of a crate in core/ on one outside core/.
   Dev-dependencies are allowed in 3 and 4: a test uses a fixture, and
   thrust-core's tests run against the memory adapters (the scope
   check-deps.sh already uses for core);
5. a stale path where nothing else would notice one: a workflow's
   paths:/paths-ignore: entry that names no tracked file (or a glob over
   a directory with none), a .cargo/mutants.toml exclude_globs or
   examine_globs entry likewise, and a .gitignore line under crates/
   that lies inside no crate. These are the three silent traps found
   while planning the move.

It exits 2, not 0, when there is nothing to check (no member, no tracked
file under crates/). Its success line counts what it read: on this tree,
19 crates, 9 groups, 23 workflow filter entries, 5 mutants.toml globs and
9 .gitignore lines.

plan-ci.py: the guard joins the deps job's guards. A group's README.md,
which ran nothing, and .gitignore, which matched no rule, now run deps,
because the guard reads them. test_plan_ci.py follows: passed=5016.

Controls: --self-test runs 23 cases on a small world. The consistent world
passes; each broken one must exit 1 with the message of the rule it breaks,
not merely fail, and an empty world must exit 2. On the real tree, a
tracked crates/stray.txt makes the check exit 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: the layout guard, and the plan's status after the move

- docs/src/testing/techniques/architecture-gates.md: check-layout.sh as
  the second architecture gate (what it reads, its rules, its control).
- docs/src/testing/running.md: the deps job's row named only check-deps
  and check-topology; it now names every guard the job runs.
- docs/src/contributing/crates.md, crates/README.md: the guard checks
  what "Adding a crate" asks for. crates/core/README.md: core/'s rule is
  on normal and build dependencies; thrust-core's dev-dependency on the
  memory adapters is allowed.
- The plan: PR 3 merged in #221, and how #220 was brought across the
  move; PR 4's choices as built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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