test(config): hold the timeout parser to refusing rather than defaulting #277

Merged
coilysiren merged 1 commit from test/duration-config into main 2026-08-13 06:16:12 +00:00
Member

Tests only. Third gap from the coverage sweep, after #275 and #276.

Why this one

durationOrDefault decides three deadlines from configuration — the request timeout, the queue timeout, and the rate-limit notify window — through one parser, at 33.3% coverage.

The request timeout is the 180s that the inverted timeout ladder in #160 is about. It is worth knowing that the parser cannot quietly change it.

The property that matters

A malformed value is an error, not a silent fallback.

A deployment whose file says one thing while the process runs the default is the failure this repository keeps finding in other clothes — the capability doc drifting from the code, the notice naming the wrong cause, the docs claiming a Retry-After the shed path did not send. Here it would be one branch away, and it is currently on the right side of that branch.

What lands

Four groups, separated because they fail differently:

Group Property
absent empty and whitespace take the packaged default
malformed errors, and does not return the default alongside the error
non-positive 0, 0s, -1s refused — a zero deadline is not a long one
valid 1ms through 2m30s override, including padded input

The malformed group also asserts the message names the expected format, since an operator reading it is the point.

Verified by mutation

Falling back on a parse error:

"90" was accepted as 1m30s
"ninety" was accepted as 1m30s

That first line is the exact hazard, and it is a plausible typo — an operator writing seconds without a unit gets the default and no signal at all.

Relaxing the bound to allow zero:

"0" was accepted as 0s
"0s" was accepted as 0s

Coverage

durationOrDefault 33.3% → 100%. Package total 76.4% → 76.6%.

go vet, gofmt, full go test ./..., pre-commit run --files clean.


Quail (QA)

Tests only. Third gap from the coverage sweep, after https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/pulls/275 and https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/pulls/276. ## Why this one `durationOrDefault` decides **three deadlines** from configuration — the request timeout, the queue timeout, and the rate-limit notify window — through one parser, at **33.3%** coverage. The request timeout is the 180s that the inverted timeout ladder in https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/160 is about. It is worth knowing that the parser cannot quietly change it. ## The property that matters **A malformed value is an error, not a silent fallback.** A deployment whose file says one thing while the process runs the default is the failure this repository keeps finding in other clothes — the capability doc drifting from the code, the notice naming the wrong cause, the docs claiming a `Retry-After` the shed path did not send. Here it would be one branch away, and it is currently on the right side of that branch. ## What lands Four groups, separated because they fail differently: | Group | Property | | --- | --- | | absent | empty and whitespace take the packaged default | | malformed | errors, **and does not return the default alongside the error** | | non-positive | `0`, `0s`, `-1s` refused — a zero deadline is not a long one | | valid | `1ms` through `2m30s` override, including padded input | The malformed group also asserts the message names the expected format, since an operator reading it is the point. ## Verified by mutation **Falling back on a parse error:** ``` "90" was accepted as 1m30s "ninety" was accepted as 1m30s ``` That first line is the exact hazard, and it is a plausible typo — an operator writing seconds without a unit gets the default and **no signal at all**. **Relaxing the bound to allow zero:** ``` "0" was accepted as 0s "0s" was accepted as 0s ``` ## Coverage `durationOrDefault` **33.3% → 100%**. Package total 76.4% → **76.6%**. `go vet`, `gofmt`, full `go test ./...`, `pre-commit run --files` clean. --- Quail (QA)
test(config): hold the timeout parser to refusing rather than defaulting
All checks were successful
ci / test (pull_request) Successful in 27s
ci / publish-echo-image (pull_request) Has been skipped
ci / image-build (pull_request) Successful in 16s
8cd2a5819f
Third gap from the coverage sweep. durationOrDefault decides the request
timeout, the queue timeout, and the rate-limit notify window from
configuration — three deadlines through one parser, at 33% coverage.

The property worth holding is that a malformed value is an error rather
than a silent fallback. A deployment whose file says one thing while the
process runs the default is the failure this repository keeps finding in
other forms, and here it would be one branch away.

Four groups, because they fail differently: absent takes the default,
malformed errors and does not return the default alongside it, zero and
negative are refused rather than treated as no deadline, and valid units
override.

Verified by mutation. Falling back on a parse error fails with
"90" was accepted as 1m30s, which is the exact hazard: an operator
writing seconds without a unit gets the default and no signal. Relaxing
the bound to allow zero fails with "0s" was accepted as 0s.

durationOrDefault goes 33.3% to 100%.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
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!277
No description provided.