Repository navigation
ci: hold the workspace to deslop-please's architectural lints - #47
Conversation
`scripts/deslop.sh` runs deslop-please 0.2.0 once for each platform's configuration (Linux, Windows, macOS), since a run sees only the code its target compiles, and refuses any other version. CI's new `architecture` job and the release's check job run it, and the release guard counts the new job as part of the gate a tag must pass. AGENTS.md and CONTRIBUTING.md add it to the checks run before a commit: a finding is fixed at its cause, never listed in an allow file, and the pin is raised in a change of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| fi | ||
| for target in x86_64-unknown-linux-gnu x86_64-pc-windows-msvc aarch64-apple-darwin; do | ||
| echo "deslop-please --target $target" >&2 | ||
| deslop-please --target "$target" |
There was a problem hiding this comment.
This gate checks only the Rust code. The script header, AGENTS.md ("in every language of the repository"), CONTRIBUTING.md and the PR description all say it also covers TypeScript, JavaScript and Python.
deslop-please 0.2.0 turns a language on only when that language's manifest sits at the workspace root:
TypeScriptFrontend::detectlooks forpackage.json,tsconfig.json,jsconfig.jsonorpnpm-workspace.yamlat the root.PythonFrontend::detectlooks forpyproject.tomlorsetup.py, or a.pyfile or package directly in the root.
The loft root has only Cargo.toml, so all three runs skip the TS/JS and Python code.
The passing gate is itself evidence. These directories hold more source files than the wide-directory limit of 15, so each would be an error if TS/JS were read:
crates/loft-cli/yard-page-tests/unit: 35 JS filesplugins/claude/loft/tests: 18plugins/claude/loft/hooks/adapter: 18crates/loft-cli/yard-page/lib: 16
As it stands, a module cycle added to the Claude mod's adapter, or a 3,000-line yard-page module, would pass CI and the release.
Two ways to fix it:
- Also run deslop-please from each JS/TS project root (
plugins/claude/loft,crates/loft-cli/yard-page-tests;yard-pageneeds ajsconfig.jsonbefore it can be detected), and fix what those runs report. - Or change the docs and the script header to say the gate covers Rust only.
There was a problem hiding this comment.
I consider this one is nice to have to verify all code we have, not only rust
| "run: cargo install deslop-please --locked --version $version" >&2 | ||
| exit 1 | ||
| fi | ||
| for target in x86_64-unknown-linux-gnu x86_64-pc-windows-msvc aarch64-apple-darwin; do |
There was a problem hiding this comment.
Nit: findings from the Windows and macOS runs stay hidden until the Linux run is clean. Under set -eu, the script ends at the first deslop-please --target that exits non-zero, so the later targets never run.
Example: a change adds a module cycle in shared code and a shallow module behind cfg(not(unix)). The Linux run fails and the script exits. The developer fixes the cycle and pushes, and only then sees the Windows-only finding. That costs an extra CI round trip.
Fix: run every target, record each failure and exit with it at the end:
status=0
for target in ...; do
echo "deslop-please --target $target" >&2
deslop-please --target "$target" || status=1
done
exit $status| - uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: cargo-nextest@0.9.146 | ||
| tool: cargo-nextest@0.9.146,deslop-please@0.2.0 |
There was a problem hiding this comment.
Nit: the version pin is written in five places, and nothing keeps them equal. The five are version= in scripts/deslop.sh, ci.yml, this line, and the install lines in AGENTS.md and CONTRIBUTING.md. AGENTS.md names only three of them ("in the script and in both workflows").
If the pin is raised everywhere except here, CI stays green and the mismatch shows only once a release tag is pushed. Example: a later PR raises deslop.sh and ci.yml to 0.3.0 and forgets this file. develop stays green. On vX.Y.Z, the check job installs 0.2.0, deslop.sh prints needs deslop-please 0.3.0, found deslop-please 0.2.0 and exits 1. The release stops after the tag is already public.
Fix: extend crates/loft-cli/tests/release/workflow.rs to read version= from scripts/deslop.sh and assert that both workflows install deslop-please@<version>. Ideally it also asserts that the documented install lines match.
There was a problem hiding this comment.
Need to Handke releases correctly on deslop release change
| - run: rustup toolchain install | ||
| - uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: deslop-please@0.2.0 |
There was a problem hiding this comment.
Nit: CI and the release check job run a deslop-please binary that nothing verifies. taiki-e/install-action has no manifest for deslop-please: manifests/deslop-please.json returns 404, while cargo-nextest.json exists and carries checksums. So tool: deslop-please@0.2.0 falls back to cargo-binstall. cargo-binstall downloads the tarball from the deslop-please v0.2.0 GitHub release, with no checksum or signature check.
GitHub release assets can be replaced. If that tarball is replaced, every push runs the new bytes with the checkout's persisted token. ci.yml has no permissions: block, so that token has the repository's default permissions. The release check job (release.yml:34, run at :43) also runs those bytes before nextest, loft verify and the publish dry run. The version check in deslop.sh still passes, because it only compares the string the binary prints.
Fix, in both ci.yml and release.yml, either:
- download the release asset and check it against a pinned SHA-256, or
- run
cargo install deslop-please --locked --version 0.2.0from crates.io, where a published version cannot change.
Answers the review of the gate: - `scripts/deslop.sh install` installs the pinned version with `cargo install --locked` from crates.io, where a published version cannot change, in place of the install action's unverified download. CI caches the built binary until the script changes. - The version lives on one line of the script. A guard fails on a version named in a workflow or a guide, and on a workflow that runs the check without installing it through the script first. - The script runs every configuration and fails at the end, so a Windows or macOS finding shows in the same run as a Linux one. The Linux run reads every language; the Windows and macOS runs read the Rust their cfg compiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page's drawing code lay in `lib` and `views` while using `model`, and `model` used `lib`'s formatting, so the three directories used each other in a circle. `diagrams/` now holds what turns Mermaid and the specification graph into the page's own SVG: `diagrams`, `flowchart`, `flowchart-svg`, `spec-diagram`, `spec-svg` and `zoom`. `lib` uses nothing of `model` or `views` any more, and holds 12 entries where it held 16. ASSETS follows; nothing the page does changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deslop-please reads a language only where the repository root holds its manifest, and this root holds Cargo.toml alone, so the gate checks no TypeScript, JavaScript or Python. The script header, AGENTS.md and CONTRIBUTING.md now say so; a later change regroups the Yard page and the Claude plugin and turns the other languages on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
The deslop cleanup (merged into
developwith 3.0.0's library reshaping) took deslop-please's findings on this workspace from 70 errors to none. This PR keeps them there: CI and the release now fail on any new module cycle, tangle, field leak, shallow module, wide directory or long file.scripts/deslop.shruns deslop-please 0.2.0 once for each platform's configuration, and refuses any other version, printing the line that installs the pinned one.architecturejob that installs the prebuilt binary and runs the script. It builds nothing, so it needs no cache and reports in well under a minute.checkjob, and the guard that holds the release to CI's gate now counts thearchitecturejob as part of that gate.No code, command, JSON output or
spec/changes.How the gate runs
flowchart LR push["push / pull request"] --> ci{{"CI"}} ci --> rust["rust<br/>fmt · clippy · nextest · loft checks"] ci --> arch["architecture<br/>scripts/deslop.sh"] ci --> win["windows<br/>clippy"] ci --> other["plugin · page · rust-version"] tag["tag vX.Y.Z"] --> check["release: check job<br/>every step of rust + architecture"] check --> build["build"] --> package["package"] --> publish["publish"] guard["tests/release/workflow.rs"] -. "fails if check misses<br/>a step of rust or architecture" .-> checkWhat the script does
A deslop-please run sees only the code its target compiles, so
cfg(windows)or macOS-only code would be skipped by a single Linux run. deslop-please reads the source and builds nothing, so one Linux runner checks all three configurations without their standard libraries installed.flowchart TD start["scripts/deslop.sh"] --> v{"deslop-please --version<br/>= 0.2.0?"} v -- no --> refuse["exit 1: cargo install deslop-please<br/>--locked --version 0.2.0"] v -- yes --> l["--target x86_64-unknown-linux-gnu"] l --> w["--target x86_64-pc-windows-msvc"] w --> m["--target aarch64-apple-darwin"] m --> ok["exit 0"] l & w & m -- "any finding" --> fail["exit 1, naming the finding"]Each run also reads the repository's TypeScript, JavaScript and Python.
Decisions
cargo-nextestand Claude Code are pinned.spec/?spec/, which states what Loft does.rust?rustjob and fails independently of it.Test plan
scripts/deslop.shpasses ondevelopfor all three targets.loft-portsmakes it exit 1, naming the cycle (then removed).scripts/deslop.shremoved fromrelease.yml,release::workflow::the_check_job_runs_the_gate_and_the_build_waits_for_itfails with "the check job lacksscripts/deslop.sh".cargo fmt, clippy on the host and onx86_64-pc-windows-gnu, the guard and release suites,loft fmt --check,loft checkandloft reconcile --fail-on warning(the changed test's link accepted again).architecturejob passes on this PR: the prebuilt binary installs in about a second, and the three runs reportok(20 s for the job).🤖 Generated with Claude Code