Keep the whole startup error when it contains "): " #376

Merged
clawbot merged 1 commits from issue-320-startup-error-whole into next 2026-10-14 01:34:39 +02:00
Collaborator

Fixes #320.

What was wrong: cleanStartupError in internal/cli/app.go cut every startup error at its last "): " to drop the annotations fx adds (function names with file and line). The blob_size_limit message contains (... size spread): itself, so info, snapshot create and snapshot list printed only need at least N bytes, without naming the setting.

What changed: it now calls dig.RootCause, from the library fx is built on. That unwraps fx's own error layers and returns the error the failing function returned, whole, so a config error reads as it does from database delete. An error fx did not wrap comes back unchanged.

go.uber.org/dig was already in the build through fx; go.mod now lists it as a direct requirement.

Test: TestCleanStartupError starts a real fx app on a config with chunk_size: 10MB and blob_size_limit: 30MB and expects the full config message.

Judgement call: the old table fed plain strings that only looked like fx output. The fix rightly leaves such a string whole, so those cases were replaced by the real-app test; the plain-error case stays as its own test.

Judgement call: the test sets chunk_size itself so the expected byte count does not depend on the default.

Partly verified: go.mod was edited by hand into the form go mod tidy gives; tidy itself was not run.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/320. **What was wrong:** `cleanStartupError` in `internal/cli/app.go` cut every startup error at its last `"): "` to drop the annotations fx adds (function names with file and line). The `blob_size_limit` message contains `(... size spread): ` itself, so `info`, `snapshot create` and `snapshot list` printed only `need at least N bytes`, without naming the setting. **What changed:** it now calls `dig.RootCause`, from the library fx is built on. That unwraps fx's own error layers and returns the error the failing function returned, whole, so a config error reads as it does from `database delete`. An error fx did not wrap comes back unchanged. `go.uber.org/dig` was already in the build through fx; `go.mod` now lists it as a direct requirement. **Test:** `TestCleanStartupError` starts a real fx app on a config with `chunk_size: 10MB` and `blob_size_limit: 30MB` and expects the full config message. Judgement call: the old table fed plain strings that only looked like fx output. The fix rightly leaves such a string whole, so those cases were replaced by the real-app test; the plain-error case stays as its own test. Judgement call: the test sets `chunk_size` itself so the expected byte count does not depend on the default. Partly verified: `go.mod` was edited by hand into the form `go mod tidy` gives; tidy itself was not run. Model: opus-5-5
clawbot self-assigned this 2026-10-14 00:52:56 +02:00
clawbot added 1 commit 2026-10-14 00:52:56 +02:00
A startup error was cut at its last "): " to drop the annotations fx
adds, so the blob_size_limit message, which itself contains
"(... size spread): ", lost everything but "need at least N bytes".
cleanStartupError now uses dig.RootCause, from the library fx is built
on, which removes exactly those annotations and returns the error
underneath unchanged.

The test starts a real fx app on a config whose blob_size_limit is below
the minimum. The old cases fed it plain strings that only looked like fx
output; such an error is now rightly left whole, so they are replaced.

go.uber.org/dig, already required through fx, becomes a direct
requirement in go.mod.

Model: opus-5-5
clawbot added the needs-review label 2026-10-14 00:53:04 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit dd3667c8e9 into next 2026-10-14 01:34:39 +02:00
clawbot deleted branch issue-320-startup-error-whole 2026-10-14 01:34:40 +02:00
Sign in to join this conversation.