feat: Pi readiness — structured logging, proxy routing, daemon verification#15
Merged
Conversation
….js level filtering Three layers of improvements for Pi readiness: ## 1. Structured logging (tracing) - New module: tracing + tracing-subscriber with env-filter - and env vars control verbosity (error/warn/info/debug/trace) - for optional file logging with 10MB rotation - All operational replaced with macros - Tracing writes to stderr (not stdout) — MCP JSON protocol on stdout stays clean - and for real-time log following and level filtering ## 2. gate.js logging levels - env var controls gate.js verbosity (default: info) - 5 levels: error (⛔), warn (⚠), info (•), debug (↓), trace (·) - 'info' level shows: startup banner, turn count, safety changes - 'debug' level shows: compression ratios, tool redirects, dedup hits, heal events - 'trace' would show every daemon command (future use) ## 3. Pi proxy routing in init - After gate.js install, prompts: 'Configure proxy routing for Pi?' - Scans Pi settings.json + env vars for API keys - Writes proxy-routes.json so auth-based routing works for Pi providers - No manual env var setting needed ## 4. Daemon service verification - After systemctl enable/launchctl load, verifies the service is actually active - Prints warning and manual recovery command if service failed silently ## 5. Binary discovery in gate.js - Checks RELIARY_BIN_PATH env var first (set by init) - Falls back to reliary-agent not found on PATH - Hardcoded paths as last resort (was the only fallback before) 92 tests pass (0 regressions).
…inary discovery ## Rust unit tests (10 new, 37 total in log.rs + init.rs) ### log.rs (4 new tests) - test_file_logger_rotation: verifies log file rotation at 10-byte threshold - test_level_value_boundary_conditions: tests empty/uppercase/leading-space inputs - test_resolve_reliary_log_levels: confirm filter string format - test_resolve_reliary_log_unexpected_values: non-standard values pass through ### init.rs (6 new tests) - test_install_pi_proxy_routes_empty: no Pi settings → 0 routes - test_install_pi_proxy_routes_from_env: env vars → proxy-routes.json written - test_install_pi_proxy_routes_from_settings: Pi settings.json → routes extracted - test_install_pi_proxy_routes_multiple_keys: 2 env vars → both in proxy-routes.json - test_inject_mcp_server_stdio: verify stdio MCP entry format - test_inject_sse_mcp_server: verify SSE MCP entry format (url-based) - test_remove_mcp_server: verify clean removal of MCP entries - test_inject_mcp_server_existing_servers: verify existing entries preserved ## gate.js tests (20 via Node.js, scripts/test_gate_levels.js) - 8 log level filtering tests (default, each level, invalid, RUST_LOG, override) - 5 binary discovery tests (env var, PATH, hardcoded, priority ordering) - 5 feature flag parsing tests (-/+/no prefix, unknown features) - 1 syntax validation test (gate.js is valid JS) - Added to CI workflow ## CI guardrails - Node.js gate.js test step added to CI - Test count threshold raised from 75 to 96
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
Three layers of Pi readiness improvements:
1. Structured logging
log.rsmodule: tracing + tracing-subscriber with env-filterRUST_LOG/RELIARY_LOGenv vars: error/warn/info/debug/traceRELIARY_LOG_FILEfor file logging with 10MB rotationeprintln!replaced with tracing macroslogs --tailandlogs --levelsupport2. Pi proxy routing
initnow prompts to configure proxy routing for Pi after gate.js installproxy-routes.json— auth-based routing works automatically3. Daemon service verification
systemctl enable/launchctl load, verifies the service is running4. gate.js improvements
RELIARY_LOGlevel filtering (default: info — quiet unless something's wrong)RELIARY_BIN_PATH→ PATH → hardcoded paths