Skip to content

Commit 8dee8a5

Browse files
authored
ci: promote maintainability guardrail to blocking (#77)
1 parent 3351072 commit 8dee8a5

3 files changed

Lines changed: 44 additions & 83 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,12 @@ jobs:
5151
- run: cargo fmt --all -- --check
5252

5353
maintainability:
54-
name: maintainability (advisory)
54+
name: maintainability
5555
runs-on: ubuntu-latest
5656
steps:
5757
- uses: actions/checkout@v6
58-
- name: Run maintainability guardrail (non-blocking)
59-
run: |
60-
./scripts/check-maintainability.sh || {
61-
echo "::warning::Maintainability guardrail detected a new oversized Rust source file or growth in an existing hotspot."
62-
}
58+
- name: Run maintainability guardrail
59+
run: ./scripts/check-maintainability.sh
6360

6461
clippy:
6562
name: clippy

docs/architecture/cleanup-plan.md

Lines changed: 26 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
# Cleanup Rollout Plan
22

3-
This document is the working plan for finishing the Surge maintainability
4-
cleanup after the first refactor wave. It tracks what has already landed, what
5-
is in flight, and what still needs to be split before the file-size baseline
6-
can be retired.
7-
8-
## Objectives
9-
10-
- Keep `main` green throughout the cleanup campaign.
11-
- Land one scoped PR at a time from a fresh worktree.
12-
- Use GitHub `Squash and merge` for every cleanup PR.
13-
- Delete the local branch and remove the local worktree after each merge.
14-
- Wait for the merged-`main` CI run to finish green before starting the next PR.
15-
- Reduce oversized Rust source files below the `600` production-line target so
16-
[`maintainability-baseline.txt`](./maintainability-baseline.txt) can be
17-
removed.
3+
This document records the first Surge maintainability cleanup wave. The campaign
4+
is complete: the oversized Rust source backlog is gone, the baseline ledger is
5+
empty, and the maintainability guardrail is now blocking in CI.
6+
7+
## Final Status
8+
9+
- `main` stayed green throughout the campaign.
10+
- Each cleanup PR landed as one scoped branch and merged with GitHub `Squash and merge`.
11+
- The Rust source backlog is below the `600` production-line target.
12+
- [`maintainability-baseline.txt`](./maintainability-baseline.txt) is empty and
13+
available only for future reviewed exceptions.
14+
- The maintainability check is now blocking rather than advisory.
1815

1916
## Completed Phases
2017

21-
These PRs are already merged:
18+
These PRs landed during the campaign:
2219

2320
- `#51` `ci: add maintainability guardrails`
2421
- `#52` `refactor(cli): split install selection and manifest resolution helpers`
@@ -44,57 +41,20 @@ These PRs are already merged:
4441
- `#72` `refactor(installer-ui): split app rendering helpers`
4542
- `#74` `refactor(core): split delta module helpers`
4643
- `#75` `refactor(cli): split remote install helpers`
44+
- `#76` `refactor(cli): split install root orchestration`
4745

48-
## Active Phase
49-
50-
### `refactor/cli-install-root-phase-2`
51-
52-
Current goal:
53-
54-
- split [`crates/surge-cli/src/commands/install/mod.rs`](../../crates/surge-cli/src/commands/install/mod.rs)
55-
into:
56-
- `install/mod.rs`
57-
- `install/local.rs`
58-
- `install/runtime.rs`
59-
- `install/progress.rs`
60-
61-
Current checkpoint:
62-
63-
- the local workflow, runtime helpers, and progress helpers have been extracted into leaf modules
64-
- the root module now owns type definitions, install selection, and high-level orchestration only
65-
- targeted compile of `surge-cli` passes
66-
- focused `surge-cli` install tests pass
67-
- focused `surge-cli` clippy passes
68-
- the final maintainability baseline entry has been removed
69-
- the full pre-push suite is the remaining branch gate
70-
71-
Exit criteria:
72-
73-
- `cargo test -p surge-cli commands::install::` passes
74-
- `cargo clippy -p surge-cli --all-targets --all-features -- -D warnings -W clippy::pedantic` passes
75-
- `./scripts/check-maintainability.sh` reports the file below the target so the
76-
install baseline entry can be removed
77-
- the full pre-push suite passes
78-
- the PR is merged with squash, local cleanup is done, and merged-`main` CI is green
79-
80-
## Remaining First-Wave PRs
81-
82-
These are the remaining planned PRs after the current install-root split lands.
83-
84-
### 1. `refactor/maintainability-phase-2`
85-
86-
- switch maintainability enforcement from advisory-only to blocking for the
87-
remaining Rust source tree
88-
- remove stale baseline entries that have been burned down
89-
- keep any still-deferred files explicitly listed until they are actually split
46+
## Ongoing Rules
9047

91-
## Remaining Second-Wave File Splits
48+
Future maintainability work should continue using the same rollout rules:
9249

93-
No second-wave file splits remain once the current branch lands.
50+
- keep `main` green throughout the change
51+
- land one scoped PR at a time from a fresh worktree
52+
- use GitHub `Squash and merge`
53+
- wait for the merged-`main` CI run to finish green before starting the next PR
9454

9555
## Execution Rules
9656

97-
Every cleanup PR follows the same loop:
57+
When a future hotspot needs a focused cleanup PR, follow the same loop:
9858

9959
1. Pull the latest `main`.
10060
2. Create a fresh branch and worktree for one scoped PR only.
@@ -107,7 +67,7 @@ Every cleanup PR follows the same loop:
10767
9. Pull the squashed result back onto local `main`.
10868
10. Delete the merged local branch and remove the temporary worktree.
10969
11. Wait for the merged-`main` CI run to finish green.
110-
12. Start the next PR from a new clean worktree.
70+
12. Start the next PR from a new clean worktree if more cleanup remains.
11171

11272
## Validation Gates
11373

@@ -135,12 +95,11 @@ During active development, run focused checks first:
13595

13696
## Completion Criteria
13797

138-
The cleanup campaign is complete when all of the following are true:
98+
The first-wave campaign closed because all of the following are now true:
13999

140100
- no Rust source file in `crates/*/src` exceeds `600` production lines unless
141101
it is explicitly accepted debt
142-
- [`maintainability-baseline.txt`](./maintainability-baseline.txt) is empty or removed
102+
- [`maintainability-baseline.txt`](./maintainability-baseline.txt) is empty
143103
- the maintainability check is blocking rather than advisory
144-
- the module roots for install, restore, pack, update, shortcuts, manifest, delta, and
145-
FFI surfaces are orchestration-first rather than monolithic
146-
- each merged PR has been cleaned up locally with no stale worktrees left behind
104+
- the module roots for install, restore, pack, update, shortcuts, manifest,
105+
delta, and FFI surfaces are orchestration-first rather than monolithic

docs/architecture/maintainability.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Maintainability Guardrails
22

33
This document describes the module boundaries and file-size guardrails for the
4-
ongoing Surge refactor campaign. The goal is to stop large multi-purpose source
5-
files from growing further while the existing hotspots are split incrementally.
4+
Surge Rust source tree. The goal is to keep large multi-purpose source files
5+
from growing back into hotspots after the first refactor wave burned down the
6+
initial backlog.
67

78
## Module Boundaries
89

@@ -53,17 +54,21 @@ files from growing further while the existing hotspots are split incrementally.
5354
source file, move them into a colocated `tests/` tree next to the module.
5455
- `#[allow(clippy::too_many_lines)]` is temporary debt and should not be added
5556
to new code as a substitute for decomposition.
57+
- Existing `clippy::too_many_lines` allowances are separate lint debt. They do
58+
not override the file-size guardrail or justify growing a source file past the
59+
`600`-line target.
5660

57-
## Advisory Guardrail
61+
## Blocking Guardrail
5862

59-
- `./scripts/check-maintainability.sh` enforces the `600`-line target in
60-
advisory mode during the refactor campaign.
63+
- `./scripts/check-maintainability.sh` is a blocking local and CI check.
6164
- The script uses [`maintainability-baseline.txt`](./maintainability-baseline.txt)
62-
to record the current oversized-file debt. CI warns when:
63-
- a new Rust source file crosses the threshold
64-
- an already oversized file grows beyond its recorded baseline
65-
- Once the current hotspots are split, the guardrail can move from advisory to
66-
blocking.
65+
only for explicitly accepted temporary exceptions.
66+
- The baseline ledger is currently empty. Any Rust source file in `crates/*/src`
67+
that crosses the threshold now fails immediately unless a reviewed baseline
68+
entry is added in the same change.
69+
- If a temporary baseline entry is ever needed again, it must record the
70+
current measured production-line count and be removed in the PR that brings
71+
the file back under the target.
6772

6873
## Review Heuristics
6974

0 commit comments

Comments
 (0)