Trim History rows past a blank line in StatusTableTrimmer #1520

Closed
opened 2026-11-02 23:50:12 +00:00 by jared · 2 comments
Owner

Problem

The History table in docs/implementation-status/os-sdlc.md holds 371 rows, but the leaf states a 15-row cap enforced by the trim hook. A blank line inside the table (line 115) ends the table region for StatusTableTrimmer, so the hook counts only the 14 rows above it and never trims.

Observed

Document#continues_table? returns false for a blank line, so body_end stops at the first blank line after the separator. The 357 rows after the blank line lie outside the table region and pass through untouched. The 14 rows above the blank line are under the cap, so the file is byte-identical after the hook.

ruby -e 'require "./lib/status_table_trimmer"; StatusTableTrimmer.new(ARGV[0]).call' <copy of os-sdlc.md>
grep -cE '^\| 20' <copy>   # 371 before and after

The hook itself is wired: .claude/settings.json line 9 runs bin/trim-status-table.rb on PostToolUse Edit|Write. The other leaves trim to 15 when run through the same class. os-adr, os-aidd-lint, os-backlog, os, os-me, and os-sdlc-system-model hold 16, 16, 28, 19, 18, and 35 rows, because the hook has not run on them since the rows were added (edits by Bash and merges do not fire it).

Reproduce

cp docs/implementation-status/os-sdlc.md /tmp/t.md
ruby -e 'require "./lib/status_table_trimmer"; StatusTableTrimmer.new(ARGV[0]).call' /tmp/t.md
grep -cE '^\| 20' /tmp/t.md

Approach

Extend the table region in StatusTableTrimmer::Document through blank lines up to the next heading or the end of file, so a stray blank line inside the table does not hide rows.

Required work:

  1. Let Document#continues_table? or trailing_index pass over blank lines that precede a further table row — check: present blank in lib/status_table_trimmer.rb

Orchestrator work: run the hook once on docs/implementation-status/os-sdlc.md after the fix and commit the trimmed leaf; old rows stay in git history.

Rejected: delete line 115 by hand only — the defect returns when any later edit adds a blank line in the table.

Acceptance criteria

  1. Given a History table with a blank line between rows and more than 15 rows in total, when the trimmer runs, then only the last 15 rows remain.
  2. Given a History table with no blank lines and 15 or fewer rows, when the trimmer runs, then the file is byte-identical.
  3. Given prose after the table under a later heading, when the trimmer runs, then the prose is unchanged.

Owner sketch

class StatusTableTrimmer::Document
  def body_end
  end
end

Origin

  • Trigger: a user asked why the os-sdlc leaf holds about 370 History rows despite the 15-row cap.
  • Improvised this session: none
  • Chain: 371 rows ← blank line at docs/implementation-status/os-sdlc.md:115 ends the table region ← lib/status_table_trimmer.rb:88-93 continues_table? treats a blank line as the table end (DESIGN: ADR-0073)
  • Root candidate: none found; searched StatusTableTrimmer, status_table_trimmer, trim-status-table, History cap, blank line
  • VERDICT: CREATE
  • Where: lib/status_table_trimmer.rb StatusTableTrimmer::Document#continues_table?
  • Session: d077e084-9195-4803-b761-6ce01eca0249
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/d077e084-9195-4803-b761-6ce01eca0249.jsonl
## Problem The History table in `docs/implementation-status/os-sdlc.md` holds 371 rows, but the leaf states a 15-row cap enforced by the trim hook. A blank line inside the table (line 115) ends the table region for `StatusTableTrimmer`, so the hook counts only the 14 rows above it and never trims. ## Observed `Document#continues_table?` returns false for a blank line, so `body_end` stops at the first blank line after the separator. The 357 rows after the blank line lie outside the table region and pass through untouched. The 14 rows above the blank line are under the cap, so the file is byte-identical after the hook. ``` ruby -e 'require "./lib/status_table_trimmer"; StatusTableTrimmer.new(ARGV[0]).call' <copy of os-sdlc.md> grep -cE '^\| 20' <copy> # 371 before and after ``` The hook itself is wired: `.claude/settings.json` line 9 runs `bin/trim-status-table.rb` on PostToolUse `Edit|Write`. The other leaves trim to 15 when run through the same class. os-adr, os-aidd-lint, os-backlog, os, os-me, and os-sdlc-system-model hold 16, 16, 28, 19, 18, and 35 rows, because the hook has not run on them since the rows were added (edits by Bash and merges do not fire it). ## Reproduce ``` cp docs/implementation-status/os-sdlc.md /tmp/t.md ruby -e 'require "./lib/status_table_trimmer"; StatusTableTrimmer.new(ARGV[0]).call' /tmp/t.md grep -cE '^\| 20' /tmp/t.md ``` ## Approach Extend the table region in `StatusTableTrimmer::Document` through blank lines up to the next heading or the end of file, so a stray blank line inside the table does not hide rows. Required work: 1. Let `Document#continues_table?` or `trailing_index` pass over blank lines that precede a further table row — check: present `blank` in `lib/status_table_trimmer.rb` Orchestrator work: run the hook once on `docs/implementation-status/os-sdlc.md` after the fix and commit the trimmed leaf; old rows stay in git history. Rejected: delete line 115 by hand only — the defect returns when any later edit adds a blank line in the table. ## Acceptance criteria 1. Given a History table with a blank line between rows and more than 15 rows in total, when the trimmer runs, then only the last 15 rows remain. 2. Given a History table with no blank lines and 15 or fewer rows, when the trimmer runs, then the file is byte-identical. 3. Given prose after the table under a later heading, when the trimmer runs, then the prose is unchanged. ## Owner sketch ```ruby class StatusTableTrimmer::Document def body_end end end ``` ## Origin - Trigger: a user asked why the os-sdlc leaf holds about 370 History rows despite the 15-row cap. - Improvised this session: none - Chain: 371 rows ← blank line at `docs/implementation-status/os-sdlc.md:115` ends the table region ← `lib/status_table_trimmer.rb:88-93` `continues_table?` treats a blank line as the table end (DESIGN: ADR-0073) - Root candidate: none found; searched StatusTableTrimmer, status_table_trimmer, trim-status-table, History cap, blank line - VERDICT: CREATE - Where: `lib/status_table_trimmer.rb` `StatusTableTrimmer::Document#continues_table?` - Session: d077e084-9195-4803-b761-6ce01eca0249 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/d077e084-9195-4803-b761-6ce01eca0249.jsonl
Author
Owner

Work started on branch ticket-1520. Deviation: /os-sdlc:implement cannot open this ticket because .sdlc/project.yaml has no target that covers the repo-root lib/ and tests/ (implementation-open refuses without --target). Implemented test-first outside the Runner; verification is suite + lint + one design audit.

Work started on branch `ticket-1520`. Deviation: /os-sdlc:implement cannot open this ticket because .sdlc/project.yaml has no target that covers the repo-root lib/ and tests/ (implementation-open refuses without --target). Implemented test-first outside the Runner; verification is suite + lint + one design audit.
Author
Owner

Resolution

Done: StatusTableTrimmer continues a History table through blank lines that precede another table row; a blank line before a heading or prose still ends it. Orchestrator work done: os-sdlc leaf trimmed to 15 rows.

Evidence: main 4ec17364. Three new tests in tests/trim_status_table_test.rb (red before, 11 runs 0 failures after). Design audit: no must-fix; both should-fix items (stale comment, repeated blank/row checks) fixed. Built outside the Runner: no target covers repo-root lib/.

Follow-ups: #1530 add an os-sdlc target for the repo-root lib/ and tests/.

## Resolution **Done:** StatusTableTrimmer continues a History table through blank lines that precede another table row; a blank line before a heading or prose still ends it. Orchestrator work done: os-sdlc leaf trimmed to 15 rows. **Evidence:** main 4ec17364. Three new tests in tests/trim_status_table_test.rb (red before, 11 runs 0 failures after). Design audit: no must-fix; both should-fix items (stale comment, repeated blank/row checks) fixed. Built outside the Runner: no target covers repo-root lib/. **Follow-ups:** #1530 add an os-sdlc target for the repo-root lib/ and tests/.
jared closed this issue 2026-11-03 15:45:28 +00:00
Sign in to join this conversation.
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
jared/cc-os#1520
No description provided.