Skip to content

feat(sdk): add domain types, typed errors, and Response wrapper#29

Merged
retr0h merged 5 commits intomainfrom
refactor/domain-types
Mar 5, 2026
Merged

feat(sdk): add domain types, typed errors, and Response wrapper#29
retr0h merged 5 commits intomainfrom
refactor/domain-types

Conversation

@retr0h
Copy link
Collaborator

@retr0h retr0h commented Mar 5, 2026

  • Add typed error hierarchy (APIError, AuthError, NotFoundError, etc.) and generic Response[T] wrapper for all service methods
  • Introduce domain types and converters for all services, replacing raw generated types in the public API
  • Update all service methods to return domain types instead of generated OpenAPI structs
  • Restructure examples into examples/osapi/ and examples/orchestration/ directories
  • Regenerate client from updated API spec (adds network interface and uptime types)

retr0h and others added 4 commits March 4, 2026 08:46
Introduce APIError, AuthError, NotFoundError, ValidationError,
ServerError, and UnexpectedStatusError types enabling errors.As()
pattern. Add generic Response[T] wrapper with RawJSON() for CLI
--json mode. Add checkError helper mapping HTTP status codes to
typed errors.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add Agent, Node, Job, Health, and Audit domain types with internal
converter functions that handle all pointer dereferencing from gen
types. Includes Collection[T] generic wrapper, shared sub-type
helpers, and comprehensive test coverage.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace gen response wrappers with Response[T] across Agent, Node,
Job, Health, and Audit services. Status-code handling and pointer
dereferencing now live inside the SDK. Health 503 treated as success
with ServiceUnavailable flag. Delete returns error only. Orchestrator
runner updated to consume domain types directly.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Align tests with Response[T] wrapper and typed error hierarchy.
Restructure examples into osapi/ and orchestration/ directories.
Regenerate client from updated API spec adding network interface
and uptime types. Add node-uptime operation docs.

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

github-actions bot commented Mar 5, 2026

Thank you for contributing to this project! 😊🕹️

Rename CpuCount to CPUCount to follow Go initialism conventions.
Replace unused http.ResponseWriter parameters with _ in test
handlers.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
@retr0h retr0h merged commit 6ad316f into main Mar 5, 2026
5 checks passed
@retr0h retr0h deleted the refactor/domain-types branch March 5, 2026 00:42
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@             Coverage Diff             @@
##             main       #29      +/-   ##
===========================================
+ Coverage   98.51%   100.00%   +1.48%     
===========================================
  Files          13        20       +7     
  Lines         674      1425     +751     
===========================================
+ Hits          664      1425     +761     
+ Misses          7         0       -7     
+ Partials        3         0       -3     
Files with missing lines Coverage Δ
pkg/orchestrator/runner.go 100.00% <100.00%> (+3.10%) ⬆️
pkg/osapi/agent.go 100.00% <100.00%> (ø)
pkg/osapi/agent_types.go 100.00% <100.00%> (ø)
pkg/osapi/audit.go 100.00% <100.00%> (ø)
pkg/osapi/audit_types.go 100.00% <100.00%> (ø)
pkg/osapi/errors.go 100.00% <100.00%> (ø)
pkg/osapi/health.go 100.00% <100.00%> (ø)
pkg/osapi/health_types.go 100.00% <100.00%> (ø)
pkg/osapi/job.go 100.00% <100.00%> (ø)
pkg/osapi/job_types.go 100.00% <100.00%> (ø)
... and 3 more

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 b583256...622f695. Read the comment docs.

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

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