Skip to content

test: flaky CI: TestStandingOutsideWindowAlarmFails and unused gosec G703 nolint directives #186

Closed

Description

@groupsky

On 2026-11-15, the first CI run of #185 failed in two places that the change does not touch. A rerun of the failed jobs passed with no code change.

  1. test (stable): TestStandingOutsideWindowAlarmFails in internal/broker/standinguse_test.go:458 said "1 alarms went out". It passed 5 times in a row locally with -race -count=5.
  2. lint: nolintlint said the //nolint:gosec // G703 directives in internal/store/home.go (lines 63, 72, 76) and internal/store/helpers_test.go:37 are unused. The same golangci-lint v2.14.0 finds them used locally and on the rerun. So gosec's G703 result seems to change from run to run.

Run: https://github.com/code6x/nodkey/actions/runs/43744833657 (attempt 1).

Done when

  • The cause of the flaky alarm count in TestStandingOutsideWindowAlarmFails is found and fixed, and the test passes with -race -count=50.
  • The lint step no longer fails at random on the G703 directives (for example, the directives are written so that nolintlint accepts them whether or not gosec reports G703).

Activity

  1. added 2 commits that reference this issue on Nov 18, 2026
    ba59ced
    6d77e7b
  2. groupsky commented on Nov 18, 2026

    @groupsky
    ContributorAuthor

    Fixed in #221 (squash commit b1d1da9).

    • The cause of the alarm count is found and fixed, and the test passes with -race -count=50. useEnv makes a standing grant at 12:00 with a daily window 11:00-13:00. The test moves the clock to 15:00, so the window ends with no use, and the core sends a missed-window alarm from its own goroutine (watchGrants → deliverAlarms). Sometimes it went out before the test set FailAlarm: "1 alarms went out". With a pause of 100 ms after the clock jump, the old test fails every time. The broker is right; the test now waits for that alarm first (new approvaltest.Approver.WaitAlarms), and so does TestStandingOutsideWindow, which had the same race. go test -race -count=50 -run TestStandingOutsideWindow ./internal/broker/ passed with the Go of go.mod and with Go stable in run 44399960806 (jobs 135139975313 and 135139975268).
    • The lint step no longer fails at random on the G703 directives. One exclusion in .golangci.yml turns off only nolintlint's report "directive //nolint:gosec // G703: ... is unused for linter gosec". Any other unused directive, a missing reason, and every gosec finding are still reported. In the same run, the lint job ran golangci-lint 11 times (10 after golangci-lint cache clean) with 0 issues each time (job 135139975472). The flake was still there before this change: the lint step of fix(broker): clear the login of a pre-approval before the answer #219 failed on the same four directives (home.go 63, 72, 76; helpers_test.go 37) in run 44397050885, first attempt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions