feat(agent): add system facts, routes, fact references, and validation#227
Merged
feat(agent): add system facts, routes, fact references, and validation#227
Conversation
Merge split test methods into single table-driven methods following the one-suite-method-per-function convention: - metrics_test: 3 InitMeter methods → TestInitMeter - telemetry_test: 3 InitTracer methods → TestInitTracer - slog_public_test: merge PreservesTraceID into TestNewTraceHandler - target_public_test: merge CacheHit into TestValidTarget Also remove two obsolete backlog tasks superseded by the osapi-orchestrator (sdk-response-types, declarative-playbook). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add ip_or_fact custom validator so ping address fields accept @fact. prefixed references. Update OpenAPI spec, regenerate, and add comprehensive HTTP wiring tests for @fact across ping, DNS GET, and DNS PUT endpoints. 🤖 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>
- Add handler tests for @fact resolution success and failure paths - Add factref test for custom key missing from non-nil facts map - Add darwin routes test for Internet6: before IPv4 header Brings internal/agent to 100% and netinfo to 95% (remainder is factory function and mock packages). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Exercise NewDarwinProvider factory closures in netinfo (route reader, interface addrs) and ping (pinger creation) packages. Add missing listallhardwareports error test in DNS update. All modified packages now at 100% statement coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Thank you for contributing to this project! 😊🕹️ |
- Add isKnownFactKey() to reject unknown @fact keys at API validation level (e.g., @fact.primary_interface now returns 400) - Propagate fact resolution errors to KV so clients get immediate error responses instead of 30s timeouts - Remove cachedFacts nil guard so @fact references always attempt resolution (returns "facts not available" error when nil) - Normalize test names to "when" prefix convention across handler, ping, and DNS test suites - Add HTTP wiring tests for unknown fact key rejection - Truncate long exec command logs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7203d34 to
1729033
Compare
- Fix relative path to system-facts.md from exec CLI docs - Remove osapi-sdk replace directive, use published module 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The "when using default route reader" test expected an error because /proc/net/route doesn't exist on macOS. On Linux CI it succeeds. Skip error assertion for platform-dependent default reader tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
885fd30 to
2539683
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #227 +/- ##
==========================================
+ Coverage 98.94% 99.98% +1.03%
==========================================
Files 161 166 +5
Lines 5611 6009 +398
==========================================
+ Hits 5552 6008 +456
+ Misses 50 1 -49
+ Partials 9 0 -9
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Darwin DNS GET was silently falling back to the first resolver (system default) when the requested interface didn't match any scutil resolver block. Now returns an error consistent with the Ubuntu provider behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add test for interface found in scutil but missing from networksetup hardware ports (e.g., virtual tunnel interface). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <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
/proc/net/route, Darwinnetstat -rn) and primary interface detection to agent facts@fact.*reference resolution in job parameters — agents resolve@fact.interface.primary,@fact.hostname,@fact.arch,@fact.kernel,@fact.fqdn, and@fact.custom.*before executing operationsip_or_factandalphanum_or_factvalidators with known-key checking to reject invalid fact references at the API levelTest Plan
just go::unit— all 26 packages pass@fact.primary_interface→ 400)@fact.interface.primary→ pass)🤖 Generated with Claude Code