From 912e8e1191b8f40d990aeb4323be372fb9b7f9a4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:27:16 +0100 Subject: [PATCH 1/6] Add to the technical principles that a function keeps a copy of its input and a limit counts every entry --- docs/reading-cost.md | 10 ++++++++++ principles/technical-principles.md | 2 ++ 2 files changed, 12 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 086697c5..aa79ff19 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3805,3 +3805,13 @@ Read most (opens and searches): - `bin/run-tests` 1 - `ci.sh` 1 - `todo.md` 1 + +## Reading cost, chunk b54e19271a0f, finished 2026-11-27T19:26:50Z + +40918 new input tokens before the first commit. + +Read most (opens and searches): + +- `skills/larv-review/SKILL.md` 5 +- `agents/stability-reviewer.md` 4 +- `README.md` 1 diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 50bcdedd..da2e4d2e 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -46,6 +46,8 @@ - A cast (`x as Foo`) asserts what the compiler could not check and stops it checking — so when the type later changes, nothing tells you. Derive the real type instead: infer it, name the return type, or parse the input once into a typed shape. Where a value genuinely arrives untyped (HTTP body, `JSON.parse`, DB row), the boundary owes a **type guard validating the fields it claims**; past that boundary everything is typed. `as unknown as T` and non-null `!` are the same defect wearing a hat. BANNED: `const user = body as User` — one rename and it is a silent lie. GOOD: `function isUser(v: unknown): v is User` checking each field, then `if (!isUser(body)) return { error: … }`. - DTOs, enums, and value objects are pure data — no logic. They stand in for the structs/records a language lacks. - Don't loosen a type when refactoring. A function that returned a concrete type keeps returning it when its implementation changes, never `object`, `array`, `mixed` or `any`; introduce a DTO or value object instead. BANNED: `totals(): Totals` becomes `totals(): array` once it reads from two sources. GOOD: `totals(): Totals` stays, and a new `SourceTotals` value object holds what each source returns. + - A function that keeps an argument keeps a copy the caller's later change cannot reach. BANNED: `this.bytes = bytes.slice()`, since on a Node `Buffer` `slice()` shares the storage, and the same for `subarray`, or `this.rows = rows`, which keeps the caller's array. GOOD: `new Uint8Array(bytes)` and `[...rows]`. + - A limit counts what the code allocates, every entry and every cell, not only the bytes it prints. BANNED: a table limit that sums the bytes of the cells, so a million records of a thousand empty columns add a billion entries that count zero, and the program runs out of memory before it reports the limit. GOOD: the count includes each entry, empty or not, and the check runs before the allocation. * Always use explicit state machines. * Most, if not all, code should have automated tests, and each test earns its keep. - A valuable test checks behaviour through the unit's interface, fails when that behaviour breaks, and still passes after a refactor that keeps that behaviour. -- 2.52.0 From 3023e68815929667dc2e5bc387f21f8f6cf66835 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:27:35 +0100 Subject: [PATCH 2/6] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 101d88e808bda4efc3bc4e6eac73937edf9dcf0e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:32:08 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20copy=20each?= =?UTF-8?q?=20row=20and=20say=20which=20sizes=20copy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- principles/technical-principles.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/principles/technical-principles.md b/principles/technical-principles.md index da2e4d2e..6053f99e 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -46,8 +46,8 @@ - A cast (`x as Foo`) asserts what the compiler could not check and stops it checking — so when the type later changes, nothing tells you. Derive the real type instead: infer it, name the return type, or parse the input once into a typed shape. Where a value genuinely arrives untyped (HTTP body, `JSON.parse`, DB row), the boundary owes a **type guard validating the fields it claims**; past that boundary everything is typed. `as unknown as T` and non-null `!` are the same defect wearing a hat. BANNED: `const user = body as User` — one rename and it is a silent lie. GOOD: `function isUser(v: unknown): v is User` checking each field, then `if (!isUser(body)) return { error: … }`. - DTOs, enums, and value objects are pure data — no logic. They stand in for the structs/records a language lacks. - Don't loosen a type when refactoring. A function that returned a concrete type keeps returning it when its implementation changes, never `object`, `array`, `mixed` or `any`; introduce a DTO or value object instead. BANNED: `totals(): Totals` becomes `totals(): array` once it reads from two sources. GOOD: `totals(): Totals` stays, and a new `SourceTotals` value object holds what each source returns. - - A function that keeps an argument keeps a copy the caller's later change cannot reach. BANNED: `this.bytes = bytes.slice()`, since on a Node `Buffer` `slice()` shares the storage, and the same for `subarray`, or `this.rows = rows`, which keeps the caller's array. GOOD: `new Uint8Array(bytes)` and `[...rows]`. - - A limit counts what the code allocates, every entry and every cell, not only the bytes it prints. BANNED: a table limit that sums the bytes of the cells, so a million records of a thousand empty columns add a billion entries that count zero, and the program runs out of memory before it reports the limit. GOOD: the count includes each entry, empty or not, and the check runs before the allocation. + - A function that keeps an argument after it returns keeps its own copy, so a change the caller makes later doesn't reach it. BANNED: `this.rows = rows`, which keeps the caller's array. BANNED: `this.bytes = bytes.slice()`, since on a Node `Buffer` `slice()` shares the storage, as `subarray()` does on every typed array. GOOD: `this.rows = [...rows]`, copying each row too where a row is an object the caller can change, and `this.bytes = new Uint8Array(bytes)` for a typed array, which copies it. + - A size limit counts every cell the code allocates, empty ones too, not only the bytes of its output, and the check runs before the allocation. BANNED: a limit on a returned table that sums the bytes of its cells, so a million rows of a thousand empty cells make a billion cells that add zero bytes, and the program runs out of memory before it reports the limit. GOOD: the limit counts each cell, empty or not, before the code allocates it. * Always use explicit state machines. * Most, if not all, code should have automated tests, and each test earns its keep. - A valuable test checks behaviour through the unit's interface, fails when that behaviour breaks, and still passes after a refactor that keeps that behaviour. -- 2.52.0 From ba73042ae14b7cbe9f1f004be7b826a4196804d9 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:32:16 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1=20(0=20misread);=20fixed=20in?= =?UTF-8?q?=20the=20stability=20round's=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 96fd01eda19b8076117dcc87c6a3573f0e753fb8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:32:58 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Answer=20prose=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 541ad8988d98de9f13aa15f75d878bb2bbf5c79e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 27 Nov 2026 20:33:09 +0100 Subject: [PATCH 6/6] Finish item 553 in the plan --- CHANGELOG.md | 1 + todo.md | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebdb0b02..aa12e9a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Technical principles: a function keeps a copy of an argument it retains, and a size limit counts every cell the code allocates, empty ones too. - larv-review's security pass and stability-reviewer now check that the doc beside a new secret or token names what the credential can reach, such as the other repositories its owning account can use, not only what the change uses it for. - `chunk-pr` and `chunk-preflight` find a Gitea pull request however many newer ones exist, so `chunk-pr clean` and `chunk-pr merge` no longer miss an old one. - task-bench leaves out of a fix a change Haiku makes to a Rust test kept in a file of its own, `#[cfg(test)] mod name;` and the file it names, and plants no bug in that file. diff --git a/todo.md b/todo.md index 45616d27..2a1ade2f 100644 --- a/todo.md +++ b/todo.md @@ -14,7 +14,6 @@ |---|---|---|---|---|---|---|---|---|---|---|---| | 477 | 0.17.0 | | question | **Rewrite `## Goals` and `## Audience` for a setup others install and run apart from their own `~/.claude`.** | 1 | 1 | 2 | 2 | 2 | | 0.0 | | 478 | 0.17.0 | | question | **Name the project, its repo and its two commands, today proposed as `do-release` and `do-epic`.** | 1 | 1 | 2 | 2 | 1 | | 0.0 | -| 553 | 0.17.0 | | | **Add to the technical principles that a function keeps a copy of what its caller passes, and that a limit counts every entry the code retains, empty ones too.** | 1 | 1 | 2 | 2 | 1 | 1.1 by 2 | 0.9 | | 545 | 0.17.0 | | | **Have chunk-preflight name each next-release item with no `Touches:` list while others wait, and have loop-claude launch a subagent that writes the lists before it starts the next chunk.** | 3 | 2 | 3 | 6 | 6 | 1.1 by 4 | 0.6 | | 544 | 0.17.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or `node --test` finds by a name `is_test` does not know.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | | 480 | 0.18.0 | | owner | **Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, code health by 3 | 2.4 | @@ -115,19 +114,6 @@ Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release Part of the standalone-install plan lilleman approved on 2026-11-20. Later items say `do-release` and `do-epic` for the names this item picks. The names set the install folders, such as `~/.config/do-release/`, so items 482, 485 and 496, and every item they block, wait for them. -### 553. Add to the technical principles that a function keeps a copy of what its caller passes, and that a limit counts every entry the code retains, empty ones too. - -An outside reviewer (CodeRabbit) found two faults on a client project's PR that neither stability-reviewer's two rounds nor the tests raised. - -1. A function that keeps a caller's bytes made its copy with `Uint8Array.slice()`. On a Node `Buffer`, `slice()` shares the storage, so changing the Buffer after the call changed later results. The same PR had earlier kept a caller's array by reference. Where a function keeps an argument, it keeps a copy that the caller's later change cannot reach: `[...array]`, `new Uint8Array(bytes)`, never `slice` or `subarray` of a typed array. -2. A limit on a returned table counted bytes, so a record of a thousand null or empty columns, repeated a million times, added a billion entries that counted zero, and the program ran out of memory before it returned the limit error. A limit counts what the code allocates, every entry and every cell, not only the bytes of what it prints. - -Add both to `technical-principles.md` as one bullet each, with a BANNED and a GOOD example, in the section that holds the input rules. Check `stability-reviewer`'s agent text names the principles file's input rules, so a reviewer reads them. - -Touches: - -- `principles/technical-principles.md` - ### 545. Have chunk-preflight name each next-release item with no `Touches:` list while others wait, and have loop-claude launch a subagent that writes the lists before it starts the next chunk. In fejkdata on 2026-11-27 the loop ran one chunk for hours beside seven waiting items, because five items of the next release (one filed by the reading-cost report, four older) had no `Touches:` list, and `chunk-preflight` says only "No item may start a chunk beside item X's: its detail has no `Touches:` list". Nothing makes a session write the lists, and `rank_todo.py --check` refuses only a list it cannot read. -- 2.52.0