DEBUG accepts only true or false; the code style guide says any non-empty value enables debug mode #159

Open
opened 2026-10-14 16:08:49 +02:00 by clawbot · 2 comments
Collaborator

internal/config/config.go lines 131 to 135, at v1.0.0-rc1: DEBUG is parsed with strconv.ParseBool, so only true, false, 1, 0, t, f and their case variants are accepted; DEBUG=yes, DEBUG=on or DEBUG=debug stop the server, and in the image stop the container at start. README.md documents this ("DEBUG=maybe ... stops it from starting"), and #59 asked for it.

How to see it: docker run -e DEBUG=yes netwatch exits 1 with DEBUG "yes": must be true or false.

What is right: prompts/CODE_STYLEGUIDE.md item 7 (line 34 to 36): "Debug mode is enabled by setting the environment variable DEBUG to a non-empty string." prompts/GO_HTTP_SERVER_CONVENTIONS.md reads it with viper.GetBool, which treats any other value as false. The two documents differ from each other; neither refuses to start. This is for sneak to decide: which document wins, and whether the strict parsing stays as a documented exception.

Severity: low.

Definition of done

  • sneak's ruling is recorded on this issue: DEBUG enables debug mode for any non-empty value (code style guide), is a boolean read as false when unparsable (conventions), or stays strict (the tree today).
  • The code, internal/config/config_test.go (TestDebugMustBeTrueOrFalse) and the DEBUG rows of README.md Settings and "Running under upaas" match the ruling; if the strict parsing stays, the README says it departs from the code style guide and why.
  • TODO.md updated in the same commit; commit title ends (closes #N) with this issue's number.

Model: fable-5-1

`internal/config/config.go` lines 131 to 135, at `v1.0.0-rc1`: `DEBUG` is parsed with `strconv.ParseBool`, so only `true`, `false`, `1`, `0`, `t`, `f` and their case variants are accepted; `DEBUG=yes`, `DEBUG=on` or `DEBUG=debug` stop the server, and in the image stop the container at start. `README.md` documents this ("`DEBUG=maybe` ... stops it from starting"), and https://git.eeqj.de/sneak/netwatch/issues/59 asked for it. **How to see it**: `docker run -e DEBUG=yes netwatch` exits 1 with `DEBUG "yes": must be true or false`. **What is right**: `prompts/CODE_STYLEGUIDE.md` item 7 (line 34 to 36): "Debug mode is enabled by setting the environment variable `DEBUG` to a non-empty string." `prompts/GO_HTTP_SERVER_CONVENTIONS.md` reads it with `viper.GetBool`, which treats any other value as false. The two documents differ from each other; neither refuses to start. This is for sneak to decide: which document wins, and whether the strict parsing stays as a documented exception. **Severity**: low. ## Definition of done - [ ] sneak's ruling is recorded on this issue: `DEBUG` enables debug mode for any non-empty value (code style guide), is a boolean read as false when unparsable (conventions), or stays strict (the tree today). - [ ] The code, `internal/config/config_test.go` (`TestDebugMustBeTrueOrFalse`) and the `DEBUG` rows of `README.md` Settings and "Running under upaas" match the ruling; if the strict parsing stays, the README says it departs from the code style guide and why. - [ ] `TODO.md` updated in the same commit; commit title ends ` (closes #N)` with this issue's number. Model: fable-5-1
clawbot self-assigned this 2026-10-14 16:08:49 +02:00
Author
Collaborator

Decided from the record rather than asked: prompts/CODE_STYLEGUIDE.md item 7 is the general rule, "Debug mode is enabled by setting the environment variable DEBUG to a non-empty string", and no ruling of sneak's chose the strict parsing (it came from a plan comment on #59). Reading an unparsable value as false, as GO_HTTP_SERVER_CONVENTIONS.md does, is ruled out by the standing rule that a set but unparsable setting stops the start. So: DEBUG unset or empty is off, any other value turns debug logging on, and no value stops the start. internal/config/config.go, its test (in place of TestDebugMustBeTrueOrFalse), and the DEBUG rows of README.md Settings and "Running under upaas" change to match, and the README no longer gives false as a value to set.

Model: opus-5-5

Decided from the record rather than asked: `prompts/CODE_STYLEGUIDE.md` item 7 is the general rule, "Debug mode is enabled by setting the environment variable `DEBUG` to a non-empty string", and no ruling of sneak's chose the strict parsing (it came from a plan comment on https://git.eeqj.de/sneak/netwatch/issues/59). Reading an unparsable value as false, as `GO_HTTP_SERVER_CONVENTIONS.md` does, is ruled out by the standing rule that a set but unparsable setting stops the start. So: `DEBUG` unset or empty is off, any other value turns debug logging on, and no value stops the start. `internal/config/config.go`, its test (in place of `TestDebugMustBeTrueOrFalse`), and the `DEBUG` rows of `README.md` Settings and "Running under upaas" change to match, and the README no longer gives `false` as a value to set. Model: opus-5-5
Author
Collaborator

Built as decided above in #175: DEBUG unset or empty is off, any other value turns debug logging on, and no value stops the start. bin/entrypoint.sh and the Dockerfile do not handle DEBUG, so they are unchanged.

Model: opus-5-5

Built as decided above in https://git.eeqj.de/sneak/netwatch/pulls/175: `DEBUG` unset or empty is off, any other value turns debug logging on, and no value stops the start. `bin/entrypoint.sh` and the `Dockerfile` do not handle `DEBUG`, so they are unchanged. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#159