The measurement
On origin/master (b854369b):
MAX_SURFACE_FILES = 217 (tools/bridge-tally-compatibility/src/lib.rs:46)
RESERVED_SURFACE_FILES = 15 (:23)
surface.files.len() = 217
headroom = 0
validate_shape rejects a surface above MAX_SURFACE_FILES, so any PR that adds a pinned file fails the gate until the cap is raised. #406 already raised it once today to make room for dependency-security-scheduled.yml, and that consumed the last of the slack.
Why this blocks more than it looks like
Thirteen of the fourteen largest production files are pinned:
| lines |
file |
|
| 6486 |
bridge-tally-protocol/src/lib.rs |
PINNED |
| 5919 |
db/tally_mirror.rs |
PINNED |
| 5441 |
tally/runtime.rs |
PINNED |
| 4684 |
commands.rs |
PINNED |
| 3872 |
tally/connection.rs |
PINNED |
| 3669 |
sync/snapshot.rs |
PINNED |
| 2740 |
bridge-tally-compatibility/src/lib.rs |
PINNED |
| 2569 |
sync/reconciliation.rs |
PINNED |
| 2488 |
agent_import.rs |
PINNED |
| 2481 |
agent_lab_import.rs |
unpinned |
| 2444 |
source_draft/catalog.rs |
PINNED |
| 2333 |
bridge-tally-core/src/master_binding.rs |
PINNED |
| 2278 |
bridge-tally-core/src/book_presence.rs |
PINNED |
| 2144 |
tally/connector.rs |
PINNED |
Decomposing any of them adds files. Adding files needs headroom. There is none.
The part that is a hole rather than an inconvenience
When a pinned file is split, the extracted part is unpinned by default and nothing warns you. The parent's hash changes, scripts/reseal.sh succeeds, --verify passes — and the moved code is now outside the sealed surface. Coverage shrinks by exactly what was extracted, silently, with every check green.
That is not hypothetical. #395 moved 8,465 lines out of two pinned files (tally_mirror.rs → tally_mirror_tests.rs, snapshot.rs → snapshot_tests.rs) and neither extracted file is pinned today. It happens to be consistent with the existing norm — 59 of 63 *_tests.rs in the tree are unpinned — so nothing was lost that the surface was meaningfully protecting. But nobody decided that; it fell out of the mechanics. The same move applied to production code would quietly move real protocol logic out of the seal.
What this issue is asking for
Two decisions, both the owner's:
- How much headroom should the cap carry, and should the cap track the count automatically rather than being raised by hand each time it binds? The current assertion
MAX - len <= RESERVED protects against an inflated cap, so raising it is deliberately friction-ful — which is defensible, but it means routine refactoring now competes with that friction.
- Should splitting a pinned file be required to pin the parts? If yes, the tooling should refuse a decomposition that drops coverage, rather than leaving it to whoever remembers. A check comparing "paths pinned before" against "paths pinned after, plus files whose content moved" would catch it.
Not asking to remove the cap
The cap is doing real work and the reserve assertion is a sensible guard against it drifting upward unnoticed. The problem is only that it currently sits exactly on the boundary, so the next legitimate change pays for it.
Found while scoping the large-file decomposition work; recording rather than working around it.
The measurement
On
origin/master(b854369b):validate_shaperejects a surface aboveMAX_SURFACE_FILES, so any PR that adds a pinned file fails the gate until the cap is raised. #406 already raised it once today to make room fordependency-security-scheduled.yml, and that consumed the last of the slack.Why this blocks more than it looks like
Thirteen of the fourteen largest production files are pinned:
bridge-tally-protocol/src/lib.rsdb/tally_mirror.rstally/runtime.rscommands.rstally/connection.rssync/snapshot.rsbridge-tally-compatibility/src/lib.rssync/reconciliation.rsagent_import.rsagent_lab_import.rssource_draft/catalog.rsbridge-tally-core/src/master_binding.rsbridge-tally-core/src/book_presence.rstally/connector.rsDecomposing any of them adds files. Adding files needs headroom. There is none.
The part that is a hole rather than an inconvenience
When a pinned file is split, the extracted part is unpinned by default and nothing warns you. The parent's hash changes,
scripts/reseal.shsucceeds,--verifypasses — and the moved code is now outside the sealed surface. Coverage shrinks by exactly what was extracted, silently, with every check green.That is not hypothetical. #395 moved 8,465 lines out of two pinned files (
tally_mirror.rs→tally_mirror_tests.rs,snapshot.rs→snapshot_tests.rs) and neither extracted file is pinned today. It happens to be consistent with the existing norm — 59 of 63*_tests.rsin the tree are unpinned — so nothing was lost that the surface was meaningfully protecting. But nobody decided that; it fell out of the mechanics. The same move applied to production code would quietly move real protocol logic out of the seal.What this issue is asking for
Two decisions, both the owner's:
MAX - len <= RESERVEDprotects against an inflated cap, so raising it is deliberately friction-ful — which is defensible, but it means routine refactoring now competes with that friction.Not asking to remove the cap
The cap is doing real work and the reserve assertion is a sensible guard against it drifting upward unnoticed. The problem is only that it currently sits exactly on the boundary, so the next legitimate change pays for it.
Found while scoping the large-file decomposition work; recording rather than working around it.