Skip to content

feat: Uniform collection responses and label-based worker routing#140

Merged
retr0h merged 2 commits intomainfrom
feat/uniform-collection-responses
Feb 18, 2026
Merged

feat: Uniform collection responses and label-based worker routing#140
retr0h merged 2 commits intomainfrom
feat/uniform-collection-responses

Conversation

@retr0h
Copy link
Collaborator

@retr0h retr0h commented Feb 18, 2026

  • All API endpoints now return a consistent collection shape {"results": [{"hostname": "...", ...}]} — single-host responses wrap 1 item, broadcast returns N items,
    ensuring every response includes worker hostname attribution
  • Add hierarchical label-based targeting so admins can route jobs to groups of servers using --target key:value syntax (e.g., --target group:web.dev). Workers subscribe
    to every prefix level of their dot-separated label values via pure NATS subject routing
  • Update OpenAPI specs, generated code, CLI output parsing, all 5 API handlers, architecture docs, and CLI usage docs to match

retr0h and others added 2 commits February 17, 2026 22:09
All API endpoints now return a consistent collection shape:
{"results": [{"hostname": "...", ...fields...}]}. Single-host
responses wrap 1 item; broadcast (_all) returns N items. This
eliminates the inconsistency between single-host and broadcast
response formats and ensures every response includes worker
hostname attribution.

- Update OpenAPI specs with collection wrapper schemas
- Thread worker hostname through job client return values
- Fix WriteJobResponse to serialize hostname in response body
- Update all handlers to return collection types
- Update CLI to parse collections with HOSTNAME column
- Update CLI docs with accurate output examples
- Add backlog tasks for 100% coverage and label-based routing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add label-based targeting so admins can route jobs to groups of servers
using hierarchical dot-separated labels (e.g., --target group:web.dev).
Workers subscribe to every prefix level of their label values via pure
NATS subject routing — no application-layer filtering needed.

Key changes:
- Add Labels field to worker config and WorkerInfo discovery response
- Add ParseTarget, BuildSubjectFromTarget, IsBroadcastTarget, ValidateLabel,
  and BuildLabelSubjects to subject routing layer
- Update all 5 API handlers to route label targets to broadcast path
- Update CLI flag descriptions, OpenAPI specs, and CLI usage docs
- Refactor publishAndCollect to share timeout return path and make
  BroadcastQuietPeriod configurable
- Achieve 100% test coverage on job, job/client, job/worker, api/system,
  and api/network packages
- Replace ASCII box diagrams in architecture docs with clean markdown

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Thank you for contributing to this project! 😊🕹️

@retr0h retr0h merged commit 3432c6f into main Feb 18, 2026
6 checks passed
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #140      +/-   ##
===========================================
+ Coverage   99.79%   100.00%   +0.20%     
===========================================
  Files          99        99              
  Lines        2384      2540     +156     
===========================================
+ Hits         2379      2540     +161     
+ Misses          4         0       -4     
+ Partials        1         0       -1     
Files with missing lines Coverage Δ
...ternal/api/network/network_dns_get_by_interface.go 100.00% <100.00%> (ø)
...ternal/api/network/network_dns_put_by_interface.go 100.00% <100.00%> (ø)
internal/api/network/network_ping_post.go 100.00% <100.00%> (ø)
internal/api/system/system_hostname_get.go 100.00% <100.00%> (ø)
internal/api/system/system_status_get.go 100.00% <100.00%> (ø)
internal/job/client/client.go 100.00% <100.00%> (+3.70%) ⬆️
internal/job/client/modify.go 100.00% <100.00%> (ø)
internal/job/client/query.go 100.00% <100.00%> (ø)
internal/job/client/worker.go 100.00% <100.00%> (ø)
internal/job/subjects.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 1a859fc...7ccd2fc. Read the comment docs.

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

retr0h added a commit that referenced this pull request Feb 18, 2026
100% test coverage achieved across all hand-written packages in #140.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
retr0h added a commit that referenced this pull request Feb 18, 2026
100% test coverage achieved across all hand-written packages in #140.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@retr0h retr0h deleted the feat/uniform-collection-responses branch February 18, 2026 19:27
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

Comments