Skip to content

fix(tools): name the clean, not the build, when .next cannot go - #458

Merged
G1NG4R merged 2 commits into
mainfrom
fix/323-bundle-size-names-the-clean
Oct 17, 2026
Merged

G1NG4R merged 2 commits into
mainfrom
fix/323-bundle-size-names-the-clean

Conversation

@G1NG4R

@G1NG4R G1NG4R commented Oct 17, 2026

Copy link
Copy Markdown
Owner

The second half of #323's acceptance: "and if the build genuinely fails, the
script says so for the right reason."

rm -rf .next && npm run build reported the build's reason for both failures.
make dev runs its container as root, so what it leaves in .next/dev is
root-owned, rm cannot unlink it, and the run ended on npm run build failed
for a build that had never started — two hundred lines of Permission denied
above a message pointing at the wrong half. Four sightings, a quarter of an hour
each.

What changed

  • The clean and the build are two commands, because they fail for two reasons.
  • When the clean fails: the real rm line is shown, the message says the build
    never started, and the escape hatch is spelled out (a container of the same
    origin, not sudo).
  • When the clean succeeds and the build fails: unchanged.

Both directions reproduced by hand against the real script:

  ✗ could not remove …/web/.next — the build never started
    rm: cannot remove '.next/dev/chunk.js': Permission denied
  ✗ npm run build failed — run it yourself to see why

The broken case, in selftest

bundle-size.sh was not in the fixture's copy list, so it had no coverage at
all. One refuses case now holds it: an unwritable directory is the same
refusal rm gives on root-owned files, without needing a container to make one.

Two traps avoided and noted in the source: the fixture's mode is restored
before the trap runs, because cleanup is itself rm -rf "$tmp" and would
otherwise fail on it — the same bug class this PR fixes; and the case is skipped
as root, where the mode bits are ignored and it would go red for a missing
package.json instead.

Verified red without the fix: rejected, but not for 'the build never started'.

What this does not do

#323 stays open. Its first clause — make dev then make bundle-size with
nothing deleted by hand — needs the decision the issue names and does not make:
run the dev container as node the way the production image already does, or
move the dev build output out of .next.

make check green; make check-tools green with the new case.

G1NG4R and others added 2 commits October 17, 2026 04:04
e2e on main ran 38:30 and green, a new maximum, and the deploy landed
8.5 minutes after the old 1800 s witness rail would have expired. With
the rail where it was this morning the measurement would have been lost
the way #439 was. The lesson is not the band but distrust of it: a
sampled upper bound was overtaken twice in one night.

The swap itself: 2359 x 200 per path, zero non-200, offset +15.8 s with
the identity read ten times rather than once. #453 gains a fifth data
point and the loop's next unit, I1, is written up with the three
decisions it waits on.

Co-Authored-By: Claude Code <noreply@anthropic.com>
`rm -rf .next && npm run build` reported the build's reason for both
failures. `make dev` runs its container as root, so what it leaves in
.next/dev is root-owned, rm cannot unlink it, and the run ended on "npm
run build failed" for a build that had never started -- two hundred
lines of Permission denied above a message pointing at the wrong half.

The two commands are separate now, the real rm error is shown, and the
escape hatch is spelled out. selftest gets the broken case: an
unwritable directory is the same refusal without needing a container,
skipped as root because root ignores the mode bits. Verified red without
the fix.

This is the second half of #323's acceptance; the first half still needs
a decision between running the dev container as node and moving the dev
build output out of .next, so the issue stays open.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@G1NG4R
G1NG4R merged commit d0bdd76 into main Oct 17, 2026
13 checks passed
@G1NG4R
G1NG4R deleted the fix/323-bundle-size-names-the-clean branch October 17, 2026 04:13
G1NG4R added a commit that referenced this pull request Oct 17, 2026
Backlog only — no code. The measurements around #458, including one swap
that
got away and the rule that follows from it.

## What it carries

- **The `f0e5998` swap is unobserved, and the cause was my scheduling.**
The
witness was armed while `e2e` attempt 1 was running; that attempt
**failed**,
so `deploy` was gated off and its 2700 s rail burned down on a window
where no
swap could occur. It expired at 03:46:06. The rerun's `deploy` began at
**03:46:26** — twenty seconds later. A second witness started at 03:51
and
  measured what was already over.
- **The rule: one witness per `e2e` attempt**, re-armed until the target
sha is
actually serving. It worked immediately on the next swap — armed
04:13:34,
twelve seconds after `e2e` began, and the swap came in clean: **934 ×
200 per
  path, zero non-200**, offset **+15.8 s**.
- **`v0.47.3` is the night's first release**, because `fix` is a
releasing type
where the six preceding `chore` and `docs` merges correctly produced
none.
- **`p95` read 241.2 ms**, measured five minutes after the restart. That
is the
#452 shape, and the entry says so **without claiming a second reading**:
both
of my reads returned the same `measuredAt`, so this is explained by
precedent
  and arithmetic, not disproven by a fresh measurement.
- **Two tooling errors of my own, same family**: a `kill` that returned
0 while
the witness kept sampling (I had killed the wrapper, not the witness — a
return code is not proof), and `printf '--- …'`, whose format string
begins
with a dash and is read as an option. The second is why the coverage
figure
  for #453's sixth data point is derived rather than read.

Tally: 6 drops in roughly 41 430 requests, thirteen swap runs in a row
without
one. A fifth no-deploy window was **discarded** rather than counted — it
had no
deploy ahead of it and was stopped so the next witness could not run
beside it.

`make check` green.

Co-authored-by: Claude Code <noreply@anthropic.com>
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