diff_cap_lines: schema advertises '0 means unlimited' but the loader coerces 0 to the 400-line cap #1451

Closed
opened 2026-10-27 13:40:27 +00:00 by sam · 0 comments
Owner

internal/webui/config_schema.go:111 describes diff_cap_lines as 'Max diff size (lines)' with Description: '0 means unlimited.'

That is wrong. internal/infrastructure/configuration/defaults.go:188 coerces an unset/zero value at load time:

if cfg.DiffCapLines == 0 {
    cfg.DiffCapLines = defaultDiffCapLines   // 400
}

So an operator who sets diff_cap_lines = 0 to remove the cap gets 400 instead -- the number they were trying to get rid of. The '0 means unlimited' branch exists in StageDiffCap (internal/domain/workflow/steps.go:92, 'if tc.Cfg.DiffCapLines <= 0 { return nil }') but is unreachable from any loaded configuration, because defaulting has already replaced 0 by the time a task runs.

There is also an unvalidated edge: a NEGATIVE diff_cap_lines is not rejected by validate, and does reach the unlimited branch. So the only way to actually get unlimited today is a value the schema and validation both treat as nonsense.

Decide one behaviour and make all three surfaces agree (loader default, schema description, StageDiffCap):

  • keep 0 as 'unset -> 400' and fix the schema text, wiring an explicit sentinel (e.g. -1) for unlimited; or
  • make 0 genuinely mean unlimited and stop defaulting it.

Either way add validation so a negative value is either rejected or documented as the sentinel, and correct the schema Description, which is what led an operator to believe 0 removed the cap.

Close reason

Closed on GitHub; syncing bead state


Imported from beads archie-core-mp4d · GitHub #831 · type bug · priority P2 · created 2026-09-17 · closed 2026-09-26

internal/webui/config_schema.go:111 describes diff_cap_lines as 'Max diff size (lines)' with Description: '0 means unlimited.' That is wrong. internal/infrastructure/configuration/defaults.go:188 coerces an unset/zero value at load time: if cfg.DiffCapLines == 0 { cfg.DiffCapLines = defaultDiffCapLines // 400 } So an operator who sets diff_cap_lines = 0 to remove the cap gets 400 instead -- the number they were trying to get rid of. The '0 means unlimited' branch exists in StageDiffCap (internal/domain/workflow/steps.go:92, 'if tc.Cfg.DiffCapLines <= 0 { return nil }') but is unreachable from any loaded configuration, because defaulting has already replaced 0 by the time a task runs. There is also an unvalidated edge: a NEGATIVE diff_cap_lines is not rejected by validate, and does reach the unlimited branch. So the only way to actually get unlimited today is a value the schema and validation both treat as nonsense. Decide one behaviour and make all three surfaces agree (loader default, schema description, StageDiffCap): - keep 0 as 'unset -> 400' and fix the schema text, wiring an explicit sentinel (e.g. -1) for unlimited; or - make 0 genuinely mean unlimited and stop defaulting it. Either way add validation so a negative value is either rejected or documented as the sentinel, and correct the schema Description, which is what led an operator to believe 0 removed the cap. ### Close reason Closed on GitHub; syncing bead state --- _Imported from beads `archie-core-mp4d` · GitHub #831 · type bug · priority P2 · created 2026-09-17 · closed 2026-09-26_
sam added the mediumbug labels 2026-10-27 13:40:27 +00:00
sam self-assigned this 2026-10-27 13:40:27 +00:00
sam closed this issue 2026-10-27 13:40:27 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1451