feat(file): add file management API, deploy provider, and templates#228
Merged
feat(file): add file management API, deploy provider, and templates#228
Conversation
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add CreateOrUpdateObjectStore and ObjectStore to the NATSClient interface for upcoming file deploy feature. Add replace directive for local nats-client development. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add NATSObjects and NATSFileState config structs with builder functions and JetStream setup. Add file:read and file:write permissions to built-in roles. Add implementation plan for file deploy and template rendering feature. Co-Authored-By: Claude <noreply@anthropic.com>
Add OpenAPI spec for file management endpoints (upload, list, get, delete) with generated server code. Add file.deploy.execute and file.status.get operation constants, FileState struct for KV tracking, and file provider interface with Deploy/Status methods plus mocks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
File API handlers (Task 4): upload, list, get, delete endpoints with Object Store backend. Includes HTTP wiring tests and RBAC tests for all endpoints (36 tests). File deploy provider (Task 7): SHA-based idempotent file deployment with state tracking via file-state KV. Status checks for in-sync, drifted, and missing files (12 tests). Job client methods (Task 10): ModifyFileDeploy and QueryFileStatus convenience methods following existing patterns (7 tests). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Server wiring (Task 5): Add GetFileHandler to ServerManager, Object
Store handle in natsBundle, conditional file handler registration.
Template rendering (Task 8): Go text/template with TemplateContext
providing Facts, Vars, and Hostname. 12 test cases covering
substitution, conditionals, range, and error handling.
Node API endpoints (Task 11): POST /node/{hostname}/file/deploy (202)
and POST /node/{hostname}/file/status (200) with OpenAPI spec,
generated code, handlers, HTTP wiring and RBAC tests (32 tests).
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Agent wiring (Task 9): Add fileProvider to Agent struct, file category processor dispatch for deploy/status operations, startup wiring with Object Store and file-state KV handles. Graceful nil-provider handling when Object Store is not configured. 12 new agent tests. CLI commands (Task 12): File management commands (upload, list, get, delete) and node file commands (deploy, status) with flag handling, display formatting, and broadcast support. SDK calls scaffolded as TODOs pending SDK integration (Task 13). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add feature page for file management covering upload, deploy, template rendering, SHA-based idempotency, and status checking. Update docusaurus navbar, configuration reference with nats.objects and nats.file_state sections, and README features matrix. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…gaps Wire validateFileName into file get/delete handlers following the validateHostname pattern. Add 400 responses to OpenAPI spec and regenerate. Close test coverage gaps in deploy (corrupt state, invalid mode), status (invalid JSON), and template (execution error). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Wire file management end-to-end: multipart upload with force flag and content-type support, template rendering with agent facts, node file deploy/status CLI commands, and Object Store bucket creation. Standardize HTTP test naming across all API domains (ValidationHTTP for endpoints with input validation, HTTP for plain wiring, RBACHTTP for auth). Add missing ValidationHTTP + RBACHTTP tests for node disk, load, memory, OS, and uptime endpoints. Close coverage gaps in provider/facts, agent GetFacts, file list/upload/deploy handlers. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Thank you for contributing to this project! 😊🕹️ |
Rename FileProvider → Service and NewFileProvider → New to eliminate the golangci-lint type-stutter warning (file.FileProvider → file.Service). Add package comment to satisfy revive package-comments rule. Extract reusable FactsAware/FactsFunc pattern into provider package. Close remaining test coverage gaps with marshalJSON/unmarshalJSON hooks and additional edge-case tests. Remove dead validation.Struct call from PostFile handler. Standardize HTTP test method naming across all API domains (ValidationHTTP for endpoints with validation tags, HTTP for plain wiring tests). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
d4d718b to
efe59da
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #228 +/- ##
========================================
Coverage 99.98% 99.98%
========================================
Files 166 182 +16
Lines 6009 6518 +509
========================================
+ Hits 6008 6517 +509
Misses 1 1
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
delete with OpenAPI spec, validation, and RBAC
template rendering (with facts/vars/hostname), and file mode support
client file {upload,get,list,delete}andclient node file {deploy,status}FactsAware/FactsFuncpattern into provider packageAPI domains
Test plan
just go::unit— all unit tests passjust go::vet— golangci-lint cleango build ./...— compiles🤖 Generated with Claude Code