feat(server): add config instance Device API endpoints#79
Open
ben-miru wants to merge 7 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Define ConfigInstanceResponse, ContentField, ParameterResponse, and ParameterListResponse as standalone Serialize structs in the new server/responses module for the device API config instance endpoints. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add serde_yml workspace dependency for YAML config parsing. Implement config_instance service module with get, get_response, get_raw_content, get_parameter, and list_parameters functions. Add ConfigInstanceNotFoundErr, ParameterNotFoundErr, and ContentParseErr error types to ServiceErr. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add four handler functions: get_config_instance (with ?expand=content), get_config_instance_content (raw file download with Content-Type and Content-Disposition headers), get_config_instance_parameter (single parameter lookup by dot-separated key), and list_config_instance_parameters (with ?prefix= filtering). Register all routes under /config_instances/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add comprehensive service-layer tests for get, get_response, get_raw_content, infer_format, get_parameter, and list_parameters. Add handler integration tests for all four config instance routes including content download, parameter lookup, prefix filtering, and error cases. Add .covgate for the new service module. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…points Resolve import linter findings (merge sibling imports under common parent), cargo fmt reformatting, and suppress field-by-field-assert lint on array element assertions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds four new HTTP endpoints to the agent's device-facing API (Unix socket) so on-device applications can access config instance data without reading files directly from disk:
GET /v0.2/config_instances/{id}— returns config instance metadata (JSON). Supports?expand=contentto include the raw file content inline with format detection.GET /v0.2/config_instances/{id}/content— returns the raw config file with appropriateContent-Type(application/jsonorapplication/x-yaml) andContent-Dispositionheaders.GET /v0.2/config_instances/{id}/parameters/{key}— returns a single parameter by dot-separated key path (e.g.network.connection_timeout_ms), with the value in its native JSON type.GET /v0.2/config_instances/{id}/parameters— lists all leaf parameters flattened into dot-separated key paths. Supports?prefix=filtering.Implementation approach
Serializestructs inagent/src/server/responses/rather than modifying the auto-generatedlibs/device-api/models (which are sourced from the OpenAPI repo).agent/src/services/config_instance/reads from the existingCfgInsts(metadata) andCfgInstContent(raw content) caches — no backend fallback needed since content is synced during deployment sync.serde_yml(maintained fork of the deprecatedserde_yaml), converting toserde_json::Valuefor uniform traversal.Test plan
./scripts/test.sh— all 1390 tests pass./scripts/lint.sh— all lints pass (import ordering, fmt, clippy, machete, audit)?expand=contentincludes content field with format and data?prefix=filters correctly🤖 Generated with Claude Code