Skip to content

ci: hold the workspace to deslop-please's architectural lints - #47

Merged
ariloudev merged 4 commits into
developfrom
chore/deslop-gate
Dec 3, 2026
Merged

ariloudev merged 4 commits into
developfrom
chore/deslop-gate

Conversation

@ariloudev

@ariloudev ariloudev commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The deslop cleanup (merged into develop with 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.sh runs deslop-please 0.2.0 once for each platform's configuration, and refuses any other version, printing the line that installs the pinned one.
  • CI gains an architecture job that installs the prebuilt binary and runs the script. It builds nothing, so it needs no cache and reports in well under a minute.
  • The release runs the same script in its check job, and the guard that holds the release to CI's gate now counts the architecture job as part of that gate.
  • AGENTS.md and CONTRIBUTING.md add the script to the checks run before every commit, with the rule: a finding is fixed at its cause, never listed in an allow file.

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" .-> check
Loading

What 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"]
Loading

Each run also reads the repository's TypeScript, JavaScript and Python.

Decisions

Question Choice Why
Pin or take the latest release? Pin 0.2.0 A new deslop release with new lints never turns an unrelated PR red. Raising the pin is its own change, which fixes what the release reports, as cargo-nextest and Claude Code are pinned.
Allow file for existing debt? None There is no debt: the workspace reports nothing. A finding is fixed at its cause.
A Constraint in spec/? No, AGENTS.md only The other code-quality gates (clippy, the 500-line ceiling, the complexity thresholds) live in AGENTS.md and guards, not in spec/, which states what Loft does.
One job or a step of rust? Its own job It needs no build, so it answers long before the rust job and fails independently of it.

Test plan

  • scripts/deslop.sh passes on develop for all three targets.
  • A module cycle planted in loft-ports makes it exit 1, naming the cycle (then removed).
  • A stand-in reporting 0.3.0 is refused with the install line.
  • With scripts/deslop.sh removed from release.yml, release::workflow::the_check_job_runs_the_gate_and_the_build_waits_for_it fails with "the check job lacks scripts/deslop.sh".
  • cargo fmt, clippy on the host and on x86_64-pc-windows-gnu, the guard and release suites, loft fmt --check, loft check and loft reconcile --fail-on warning (the changed test's link accepted again).
  • The architecture job passes on this PR: the prebuilt binary installs in about a second, and the three runs report ok (20 s for the job).

🤖 Generated with Claude Code

`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>
Comment thread scripts/deslop.sh Outdated
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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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::detect looks for package.json, tsconfig.json, jsconfig.json or pnpm-workspace.yaml at the root.
  • PythonFrontend::detect looks for pyproject.toml or setup.py, or a .py file 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 files
  • plugins/claude/loft/tests: 18
  • plugins/claude/loft/hooks/adapter: 18
  • crates/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-page needs a jsconfig.json before 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.

@swindler swindler Dec 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I consider this one is nice to have to verify all code we have, not only rust

Comment thread scripts/deslop.sh Outdated
"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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

reduces CI runs/costs

Comment thread .github/workflows/release.yml Outdated
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest@0.9.146
tool: cargo-nextest@0.9.146,deslop-please@0.2.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Need to Handke releases correctly on deslop release change

Comment thread .github/workflows/ci.yml Outdated
- run: rustup toolchain install
- uses: taiki-e/install-action@v2
with:
tool: deslop-please@0.2.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.0 from crates.io, where a published version cannot change.

ariloudev and others added 3 commits December 3, 2026 10:44
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>
@ariloudev
ariloudev merged commit d611a42 into develop Dec 3, 2026
6 checks passed
@ariloudev
ariloudev deleted the chore/deslop-gate branch December 3, 2026 10:53
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.

2 participants