Skip to content

feat: add configurable automatic update checks#1941

Merged
yottahmd merged 5 commits intomainfrom
upgradeflag
Apr 1, 2026
Merged

feat: add configurable automatic update checks#1941
yottahmd merged 5 commits intomainfrom
upgradeflag

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented Apr 1, 2026

Summary

  • add a check_updates config/env toggle for automatic web UI update checks, defaulting to enabled
  • skip the background update checker and hide stale cached update banners when automatic checks are disabled
  • downgrade automatic update-check retry failures to debug logging and add config, schema, and backoff test coverage

Testing

  • go test ./internal/cmn/config ./internal/cmn/backoff ./internal/upgrade ./internal/service/frontend ./internal/cmd -count=1
  • go test ./internal/cmn/schema -count=1
  • make fmt

Summary by CodeRabbit

Release Notes

  • New Features
    • Added check_updates boolean server configuration option (defaults to enabled) for controlling automatic update checks
    • Configure via YAML files, the DAGU_CHECK_UPDATES environment variable, or server configuration settings
    • Updated JSON schema and configuration validation to support the new setting

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 1, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e492c76-c57c-4250-bb25-93b76bee2d40

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces configurable control over automatic update checks via a new CheckUpdates server configuration flag, adds a retry failure log level context helper for diagnostic logging control, and threads context.Context through upgrade cache checking logic.

Changes

Cohort / File(s) Summary
Retry Infrastructure
internal/cmn/backoff/retry.go, internal/cmn/backoff/retry_test.go
Introduced WithRetryFailureLogLevel helper to control log level for terminal retry outcomes via context. Added logRetryFailure function to route failure messages to Debug/Info/Warn/Error based on context-stored level (defaulting to Warn). New test suite verifies logging suppression/emission based on configured level.
Configuration
internal/cmn/config/config.go, internal/cmn/config/definition.go, internal/cmn/config/key_hints.go, internal/cmn/config/loader.go
Added CheckUpdates boolean field (default true) to server configuration struct. Integrated into Viper loader with environment variable binding (CHECK_UPDATES). Added legacy key mapping for backward compatibility (checkupdatescheck_updates).
Configuration Tests
internal/cmn/config/loader_test.go
Extended existing tests to cover CheckUpdates field in YAML and environment variable scenarios. Added dedicated TestLoad_CheckUpdates test suite validating default behavior, YAML overrides, and environment variable overrides.
Schema
internal/cmn/schema/config.schema.json, internal/cmn/schema/config_schema_test.go
Updated JSON schema to include check_updates boolean property (default true) controlling web UI automatic update checks. Added schema validation test for new property.
Frontend Server
internal/service/frontend/server.go
Conditional initialization of upgrade cache store and UpdateChecker based on CheckUpdates flag. Introduced runAutomaticUpdateCheck helper that threads context with retry failure log level set to debug for diagnostic purposes.
Upgrade Cache
internal/upgrade/cache.go, internal/upgrade/upgrade_test.go
Updated CheckAndUpdateCache function signature to accept context.Context parameter, enabling caller-controlled cancellation and deadline threading. Updated test call sites to pass context.Background().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding a configurable feature to control automatic update checks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch upgradeflag

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/cmn/backoff/retry_test.go (1)

209-209: Use assert.Contains for consistency with other assertions in this test.

Lines 180 and 194 use assert.Contains and assert.NotContains, but this line uses assert.True(t, strings.Contains(...)). Using assert.Contains directly would be more consistent and provides better failure messages.

♻️ Suggested refactor for consistency
-		assert.True(t, strings.Contains(buf.String(), "Retry attempts exhausted"))
+		assert.Contains(t, buf.String(), "Retry attempts exhausted")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/cmn/backoff/retry_test.go` at line 209, Replace the indirect string
containment check that uses assert.True(t, strings.Contains(...)) with the
direct assertion helper assert.Contains to match the other assertions in the
test; specifically change the assertion that inspects buf.String() for "Retry
attempts exhausted" to use assert.Contains(t, buf.String(), "Retry attempts
exhausted") so failure messages are consistent and clearer (replace the call
site where assert.True and strings.Contains are used).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/cmn/backoff/retry_test.go`:
- Line 209: Replace the indirect string containment check that uses
assert.True(t, strings.Contains(...)) with the direct assertion helper
assert.Contains to match the other assertions in the test; specifically change
the assertion that inspects buf.String() for "Retry attempts exhausted" to use
assert.Contains(t, buf.String(), "Retry attempts exhausted") so failure messages
are consistent and clearer (replace the call site where assert.True and
strings.Contains are used).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7cf6e230-6fde-4126-8ef3-e4046514fd6c

📥 Commits

Reviewing files that changed from the base of the PR and between 61c3781 and fd68bdf.

📒 Files selected for processing (12)
  • internal/cmn/backoff/retry.go
  • internal/cmn/backoff/retry_test.go
  • internal/cmn/config/config.go
  • internal/cmn/config/definition.go
  • internal/cmn/config/key_hints.go
  • internal/cmn/config/loader.go
  • internal/cmn/config/loader_test.go
  • internal/cmn/schema/config.schema.json
  • internal/cmn/schema/config_schema_test.go
  • internal/service/frontend/server.go
  • internal/upgrade/cache.go
  • internal/upgrade/upgrade_test.go

@yottahmd yottahmd merged commit b6c214f into main Apr 1, 2026
5 checks passed
@yottahmd yottahmd deleted the upgradeflag branch April 1, 2026 13:25
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.64%. Comparing base (e18998e) to head (7c4a8db).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/cmn/backoff/retry.go 68.00% 7 Missing and 1 partial ⚠️
internal/core/spec/schema.go 86.66% 1 Missing and 1 partial ⚠️
internal/upgrade/cache.go 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1941      +/-   ##
==========================================
+ Coverage   68.60%   68.64%   +0.03%     
==========================================
  Files         462      462              
  Lines       58322    58359      +37     
==========================================
+ Hits        40013    40061      +48     
+ Misses      14618    14607      -11     
  Partials     3691     3691              
Files with missing lines Coverage Δ
internal/cmn/config/config.go 72.68% <ø> (ø)
internal/cmn/config/key_hints.go 45.45% <ø> (ø)
internal/cmn/config/loader.go 82.01% <100.00%> (+0.03%) ⬆️
internal/upgrade/cache.go 50.00% <50.00%> (ø)
internal/core/spec/schema.go 83.78% <86.66%> (+0.20%) ⬆️
internal/cmn/backoff/retry.go 82.50% <68.00%> (-7.34%) ⬇️

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e18998e...7c4a8db. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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