Skip to content

fix: raise gavel timeouts and stop deferring telemetry.InitTracer in test setup - #2158

Closed
adityathebe wants to merge 3 commits into
mainfrom
gavel-sandbox-timeouts
Closed

adityathebe wants to merge 3 commits into
mainfrom
gavel-sandbox-timeouts

Conversation

@adityathebe

@adityathebe adityathebe commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

gavel's sandbox lint and test runs on duty kept failing on timeouts. Once the timeouts were raised, golangci-lint reported two real bugs in the test setup. This raises the timeouts in .gavel.yaml and fixes the bugs; gavel's lint now passes on this branch.

Opus 5.5 Medium

Timeouts. gavel's substrate sandbox has 2 CPUs and no Go module or build cache, so every run downloads all modules and compiles from scratch. golangci-lint hit the 5m per-linter default, and later a 15m limit; the test run hit the 20m overall default. .gavel.yaml now sets timeout: 45m and lintTimeout: 40m. A lint run on this branch took 22m39s.

InitTracer. tests/setup/common.go and tests/setup/template.go had defer telemetry.InitTracer(). That defers the call to InitTracer itself, so the tracer only started when SetupDB or SetupTemplate returned, and the shutdown function it returns was discarded (staticcheck SA9010). Both now call telemetry.InitTracer() at the start of setup. The shutdown function is still not called, because the tracer has to outlive setup for the tests that use the returned context.

duty's CI didn't catch this because it pins golangci-lint v2.11.3; gavel downloads v2.15.0. On ./tests/setup/...:

Code v2.15.0 v2.11.3
before the fix 2 × SA9010 0 issues
after the fix 0 issues not run

Verification: go build ./tests/setup/ and the golangci-lint runs above. gavel's sandbox lint run on 4f0072c succeeded with 0 violations. duty's tests were not run locally.

Summary by CodeRabbit

  • Chores
    • Automated test and lint checks now have longer time limits.
    • Test environment initialization timing has been adjusted. These changes affect development and validation workflows; no end-user functionality has changed.

Gavel's substrate sandbox has 2 CPUs and no Go module or build cache, so each run downloads ~460 MB of modules and compiles from scratch. golangci-lint hit the 5m per-linter default and the test run hit the 20m global default. Raise them to 15m and 45m.
A lint run in gavel's sandbox (2 CPUs, no Go module or build cache) hit the 15m per-linter limit before golangci-lint finished. 40m still fits under the 45m overall timeout and the job's 1h limit.
defer telemetry.InitTracer() deferred the call to InitTracer itself, so the tracer only started when SetupDB or SetupTemplate returned and the shutdown function it returns was discarded. golangci-lint v2.15.0 reports this as staticcheck SA9010 and fails gavel's lint run.

Call it at the start of setup instead. The shutdown function is still not called: the tracer must outlive setup for the tests that use the returned context.
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Benchstat (Other)

Base: df64468cc1c03beb89ee6d5adbfa2ddab682af4c
Head: 4f0072cc318b022815350a2571a03d42fa693cfa

✅ No significant performance changes detected

Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/bench
cpu: AMD EPYC 7763 64-Core Processor                
                                                       │ bench-base.txt │           bench-head.txt           │
                                                       │     sec/op     │    sec/op     vs base              │
InsertionForRowsWithAliases/external_users.aliases-4       1.074m ± 59%   1.068m ± 27%       ~ (p=0.240 n=6)
InsertionForRowsWithAliases/config_items.external_id-4     1.255m ± 12%   1.261m ±  7%       ~ (p=1.000 n=6)
InsertionOfConfigsWithProperties-4                         3.964m ±  3%   3.969m ± 11%       ~ (p=0.699 n=6)
UpdateOfConfigsWithProperties-4                            7.360m ± 15%   7.246m ±  7%       ~ (p=0.699 n=6)
ResourceSelectorConfigs/name-4                             207.2µ ±  4%   208.9µ ±  2%       ~ (p=0.394 n=6)
ResourceSelectorConfigs/name_and_type-4                    229.4µ ±  2%   231.9µ ±  4%       ~ (p=0.589 n=6)
ResourceSelectorConfigs/tags-4                             29.19m ±  5%   29.54m ±  3%       ~ (p=0.132 n=6)
ResourceSelectorQueryBuild/name-4                          45.21µ ±  1%   44.88µ ±  1%  -0.71% (p=0.041 n=6)
ResourceSelectorQueryBuild/name_and_type-4                 65.60µ ±  1%   65.84µ ±  7%       ~ (p=0.310 n=6)
ResourceSelectorQueryBuild/tags-4                          17.23µ ±  2%   17.28µ ±  3%       ~ (p=0.937 n=6)
geomean                                                    555.3µ         556.2µ        +0.15%

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Benchstat (Scoped reads)

Base: df64468cc1c03beb89ee6d5adbfa2ddab682af4c
Head: 4f0072cc318b022815350a2571a03d42fa693cfa

✅ 1 improvement(s)
Benchmark Base Head Change p-value
ScopedReads/Sample-15000/config_summary-4 426.5m 420.0m -1.53% 0.002
Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/bench
cpu: AMD EPYC 7763 64-Core Processor                
                                                │ bench-base.txt │          bench-head.txt           │
                                                │     sec/op     │   sec/op     vs base              │
ScopedReads/Sample-15000/catalog_changes-4           67.38m ± 4%   69.33m ± 1%  +2.89% (p=0.041 n=6)
ScopedReads/Sample-15000/config_changes-4            67.30m ± 1%   67.31m ± 1%       ~ (p=0.937 n=6)
ScopedReads/Sample-15000/config_detail-4             62.48m ± 2%   62.93m ± 2%       ~ (p=0.310 n=6)
ScopedReads/Sample-15000/config_names-4              64.11m ± 1%   63.52m ± 2%       ~ (p=0.180 n=6)
ScopedReads/Sample-15000/config_summary-4            426.5m ± 1%   420.0m ± 0%  -1.53% (p=0.002 n=6)
ScopedReads/Sample-15000/configs-4                   62.85m ± 1%   62.32m ± 2%       ~ (p=0.485 n=6)
ScopedReads/Sample-15000/analysis_types-4            3.875m ± 1%   3.833m ± 1%  -1.08% (p=0.009 n=6)
ScopedReads/Sample-15000/analyzer_types-4            3.715m ± 3%   3.708m ± 7%       ~ (p=0.937 n=6)
ScopedReads/Sample-15000/change_types-4              5.194m ± 1%   5.173m ± 4%       ~ (p=0.394 n=6)
ScopedReads/Sample-15000/config_classes-4            62.97m ± 2%   63.61m ± 1%       ~ (p=0.240 n=6)
ScopedReads/Sample-15000/config_types-4              62.78m ± 3%   62.51m ± 1%       ~ (p=0.937 n=6)
ScopedReads/Sample-15000/queries/Count-4             62.20m ± 1%   62.70m ± 0%       ~ (p=0.240 n=6)
ScopedReads/Sample-15000/queries/PointAllowed-4      267.7µ ± 3%   272.2µ ± 5%       ~ (p=0.065 n=6)
ScopedReads/Sample-15000/queries/PointDenied-4       267.8µ ± 1%   266.6µ ± 2%       ~ (p=0.699 n=6)
geomean                                              18.70m        18.72m       +0.09%

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Gavel configuration now sets test and lint timeouts. SetupDB and SetupTemplate now initialize telemetry directly instead of deferring initialization.

Changes

Gavel timeout configuration

Layer / File(s) Summary
Set test and lint timeouts
.gavel.yaml
The configuration sets a 45-minute test timeout and a 40-minute lint timeout. Comments describe sandbox constraints and timeout rationale.

Test setup telemetry

Layer / File(s) Summary
Initialize telemetry in setup
tests/setup/common.go, tests/setup/template.go
SetupDB and SetupTemplate now call telemetry.InitTracer() directly instead of deferring the call.

Suggested reviewers: moshloop, yashmehrotra

Change: Bug fix

Merge Risk: Minimal · up to 4f007

This change raises the test and lint timeouts for the resource-limited sandbox and starts the tracer at the beginning of test setup. No concrete regression has been identified, so it is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names both changes in the PR: raising the gavel timeouts in .gavel.yaml and no longer deferring telemetry.InitTracer in the test setup code. The title matches the changeset and the objective…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names both changes in the PR: raising the gavel timeouts in .gavel.yaml and no longer deferring telemetry.InitTracer in the test setup code. The title matches the changeset and the objectives. It is specific and uses a conventional prefix. It does not cover every detail, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 698e6ddb-9bda-43ce-85d0-9b7af7c190fb
Commits

Reviewing files that changed from the base of the PR and between df64468 and 4f0072c.

Files selected for processing: 3

  • .gavel.yaml
  • tests/setup/common.go
  • tests/setup/template.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

Copy link
Copy Markdown

Gavel results

Gavel exited with code .

View full results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant