Skip to content

feat(file): add staleness detection for file deployments#346

Merged
retr0h merged 7 commits intomainfrom
feat/file-staleness-detection
Apr 3, 2026
Merged

feat(file): add staleness detection for file deployments#346
retr0h merged 7 commits intomainfrom
feat/file-staleness-detection

Conversation

@retr0h
Copy link
Copy Markdown
Collaborator

@retr0h retr0h commented Apr 3, 2026

Summary

  • Add GET /file/stale controller-only endpoint that detects deployments where the source object has been re-uploaded with new content since the last deploy
  • Compares file-state KV SHA-256 hashes against current object store content — no agent involvement
  • Covers all meta providers: service unit files, CA certificates, cron scripts, and direct file deployments
  • New osapi client file stale CLI command with table output and --json support
  • SDK File.Stale() method with full test coverage

Test plan

  • Handler tests: empty KV, stale entry, in-sync entry, undeployed skip, deleted object, errors
  • RBAC HTTP tests: 401, 403, 200
  • SDK tests: success, errors, nil body, transport error, type conversions
  • Build clean, lint clean

🤖 Generated with Claude Code

retr0h and others added 3 commits April 2, 2026 17:51
Add GET /file/stale endpoint with StaleDeployment and
StaleDeploymentsResponse schemas. Regenerate server, SDK client,
and docs.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add SDK types (StaleDeployment, StaleList) and File.Stale() method
that calls GET /file/stale to list deployments out of sync with
the object store. Includes conversion functions, export_test.go
bridges, and full test coverage (200, 401, 403, 500, nil body,
transport error).

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add `osapi client file stale` command that lists deployments where the
source object has been updated since the file was last deployed. Wire
the file-state KV through the controller setup and handler chain so
the stale endpoint can compare deployed SHAs against current object
store content. Add staleness detection section to file-management
feature docs and a stale CLI reference page.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
retr0h and others added 2 commits April 2, 2026 18:10
Add Stale() method to SDK file doc page, usage example, and
examples/sdk/client/file.go.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Derive provider name from deployment path (service, certificate,
cron, or file). Show PROVIDER column in CLI instead of PATH for
cleaner output. Path remains in JSON response for programmatic use.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff            @@
##             main     #346    +/-   ##
========================================
  Coverage   99.91%   99.91%            
========================================
  Files         440      441     +1     
  Lines       21377    21496   +119     
========================================
+ Hits        21358    21477   +119     
  Misses         11       11            
  Partials        8        8            
Files with missing lines Coverage Δ
internal/controller/api/file/file.go 100.00% <100.00%> (ø)
internal/controller/api/file/file_stale.go 100.00% <100.00%> (ø)
internal/controller/api/file/handler.go 100.00% <100.00%> (ø)
pkg/sdk/client/file.go 100.00% <100.00%> (ø)
pkg/sdk/client/file_types.go 100.00% <100.00%> (ø)

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 3e8e8ad...aa6cc76. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

retr0h and others added 2 commits April 2, 2026 18:46
Add test cases for certificate, cron, and file (default) provider
paths, plus short key fallback in extractHostname. All stale
handler functions now at 100% coverage.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
@retr0h retr0h merged commit a5028b2 into main Apr 3, 2026
11 checks passed
@retr0h retr0h deleted the feat/file-staleness-detection branch April 3, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant