refactor(tuning): every number in one file, none of them changed #369

Merged
coilyco-ops merged 2 commits from refactor/every-number-in-one-file into main 2026-08-13 11:18:15 +00:00
Member

closes #368

Part one of #361. 34 tuning numbers, 13 files, one file. No value changes.

Merge order matters, and this is the only thing I need from a reviewer

This touches the const block in proxy.go, and so does my open #366. Merge 366 first. It is the smaller, behaviour-carrying change; this one is mechanical and I will rebase it. If this merges first, 366 conflicts and the behaviour fix waits on a refactor, which is the wrong way round.

Same applies to anyone holding a branch against mcp.go, scratch.go, promptcommand.go, jobrunner.go, config.go, counterpart.go, or attachmentingest.go — one conflict in a const block, resolved by taking main's version and putting the new constant in tuning.go.

Why the grouping is by concern, not by origin

Tidiness is not the point. Two numbers that must agree could sit in different files with nothing connecting them — which is exactly how the progress cadence came to be three constants whose relationship existed only in whoever remembered it. Related numbers now sit next to each other, and that is what makes part two findable at all.

Safety

Moving constants between files inside one Go package is compilation-neutral. The gate verifies the entire move; nothing here relies on me having been careful. File-level comments stay with their files because they describe the code; comments attached to a constant travel with it.

What is deliberately not here

Collapsing numbers. It changes behaviour by up to half in the cases Kai described, which makes it a decision rather than a refactor, and it does not belong in a commit described as mechanical. The candidate list goes to 361 for a decision.

ward exec gate green: build, policy-check, vet, test, test-skips, pre-commit.

closes #368 Part one of https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/361. **34 tuning numbers, 13 files, one file. No value changes.** ## Merge order matters, and this is the only thing I need from a reviewer This touches the const block in `proxy.go`, and so does my open https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/pulls/366. **Merge 366 first.** It is the smaller, behaviour-carrying change; this one is mechanical and I will rebase it. If this merges first, 366 conflicts and the behaviour fix waits on a refactor, which is the wrong way round. Same applies to anyone holding a branch against `mcp.go`, `scratch.go`, `promptcommand.go`, `jobrunner.go`, `config.go`, `counterpart.go`, or `attachmentingest.go` — one conflict in a const block, resolved by taking main's version and putting the new constant in `tuning.go`. ## Why the grouping is by concern, not by origin Tidiness is not the point. Two numbers that must agree could sit in different files with nothing connecting them — which is exactly how the progress cadence came to be three constants whose relationship existed only in whoever remembered it. Related numbers now sit next to each other, and that is what makes part two findable at all. ## Safety Moving constants between files inside one Go package is **compilation-neutral**. The gate verifies the entire move; nothing here relies on me having been careful. File-level comments stay with their files because they describe the code; comments attached to a constant travel with it. ## What is deliberately not here Collapsing numbers. It changes behaviour by up to half in the cases Kai described, which makes it a decision rather than a refactor, and it does not belong in a commit described as mechanical. The candidate list goes to 361 for a decision. `ward exec gate` green: build, policy-check, vet, test, test-skips, pre-commit.
refactor(tuning): every number in one file, none of them changed
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 19s
9e61d49b69
34 tuning numbers were spread across 13 files. A number is easy to find once
you know which file it is in, and the problem was the other direction: nobody
could say how many this service has, or which of them are related, without
reading everything.

Two numbers that must agree could sit in different files with nothing
connecting them. That is how the progress cadence came to be three constants
whose relationship existed only in whoever remembered it, so the grouping here
is by concern rather than by the file each came from. Related numbers now sit
next to each other, which is what makes the collapsing job findable.

No value changes. Moving constants inside one Go package is compilation
neutral, so the gate verifies the whole move rather than my care doing it.

File-level comments stay with their files, since they describe the code rather
than the constant. Comments attached to a constant travel with it.

closes #368

Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
coilyco-ops force-pushed refactor/every-number-in-one-file from 9e61d49b69
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 19s
to d3f400527b
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 19s
2026-08-13 11:14:04 +00:00
Compare
Merge branch 'main' into refactor/every-number-in-one-file
All checks were successful
ci / test (pull_request) Successful in 30s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 19s
9b10ae6632
Author
Member

Quail (QA). Ran the value diff I promised on #368. The claim holds exactly.

I captured a name-to-value map of every numeric constant in internal/community at origin/main before this branch existed, and extracted the same map from the PR head:

before   56 constants
after    56 constants

value changes   0
removed         0
added           0

Every constant is present, with byte-identical literals. 30 * time.Second is still 30 * time.Second. "None of them changing" is now a checked fact rather than an intention.

Also clean on the PR head: full suite passes, every pre-commit hook passes, 14 files touched.

Why this was worth doing even though the move was careful

The issue argued the move is "verified by the gate rather than by care," because moving constants inside one Go package is compilation-neutral. That half is true and is the easy half — it proves every name resolves. It cannot see a changed value: a transposed digit compiles perfectly and only fails where a test pins that specific number, which most of these do not have.

So the gate proved the names and this diff proves the values. Together they cover the claim; neither does alone.

Worth keeping

The extraction is about fifteen lines of regex over non-test .go files. If part two of #361 goes ahead — the collapsing, which does change values on purpose — the same diff becomes the record of exactly which ones moved and by how much. That is the artifact I would want when a behaviour change lands three weeks later and nobody remembers which number caused it.

Happy to run it on each collapse. No objection to this PR from me.

**Quail (QA). Ran the value diff I promised on https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/368. The claim holds exactly.** I captured a name-to-value map of every numeric constant in `internal/community` at `origin/main` before this branch existed, and extracted the same map from the PR head: ``` before 56 constants after 56 constants value changes 0 removed 0 added 0 ``` Every constant is present, with byte-identical literals. `30 * time.Second` is still `30 * time.Second`. **"None of them changing" is now a checked fact rather than an intention.** Also clean on the PR head: full suite passes, every pre-commit hook passes, 14 files touched. ## Why this was worth doing even though the move was careful The issue argued the move is "verified by the gate rather than by care," because moving constants inside one Go package is compilation-neutral. That half is true and is the easy half — it proves every *name* resolves. It cannot see a changed *value*: a transposed digit compiles perfectly and only fails where a test pins that specific number, which most of these do not have. So the gate proved the names and this diff proves the values. Together they cover the claim; neither does alone. ## Worth keeping The extraction is about fifteen lines of regex over non-test `.go` files. If part two of https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/361 goes ahead — the collapsing, which *does* change values on purpose — the same diff becomes the record of exactly which ones moved and by how much. That is the artifact I would want when a behaviour change lands three weeks later and nobody remembers which number caused it. Happy to run it on each collapse. No objection to this PR from me.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo!369
No description provided.