Skip to content

fix(ctl,api): probe genie-api and HA from [services.*] config - #105

Closed
kiannidev wants to merge 2 commits into
GeniePod:mainfrom
kiannidev:fix/103-configured-service-http-probes
Closed

fix(ctl,api): probe genie-api and HA from [services.*] config#105
kiannidev wants to merge 2 commits into
GeniePod:mainfrom
kiannidev:fix/103-configured-service-http-probes

Conversation

@kiannidev

@kiannidev kiannidev commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add [services.api] to geniepod.toml (default http://127.0.0.1:3080/api/status) with backward-compatible serde default for existing configs
  • Add service_http_probe() in genie-common to parse http:// service URLs into (host:port, path)
  • Update genie-ctl health, diag, and support-bundle to probe genie-api and Home Assistant from configured URLs (skip HA when not configured)
  • Update genie-api dashboard service targets to use [services.api].url instead of a hardcoded latency URL

Fixes #103

Real Behavior Proof

  • I have built and run the affected code locally (or noted why I could not).
  • I have verified the change end-to-end on Jetson hardware OR explained the equivalent verification path I used.

What I ran

cargo fmt --all
cargo test -p genie-common -p genie-ctl -p genie-api

What I observed

All 58 unit tests in the three touched crates passed on x86_64 Linux:

  • genie-common: service_http_probe, [services.api] default, TOML backward compatibility without [services.api]
  • genie-ctl: existing tests pass after health/diag/support-bundle probe changes
  • genie-api: dashboard target tests pass with config-driven api latency URL

No Jetson hardware in this dev environment; changes are config/HTTP-probe plumbing only.

Test plan

  • cargo fmt --all -- --check
  • cargo test -p genie-common -p genie-ctl -p genie-api
  • Maintainer: verify genie-ctl health with custom [services.homeassistant].url when HA is enabled

@ai-hpc ai-hpc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substance of the PR is good — this is exactly the right fix for #103. Some structural observations on the code, then two commit-metadata issues that have to be sorted before merge.

Code is on track

  • service_http_probe(url, default_port) in genie-common is the right primitive: parses http://... into (host:port, path), handles missing-port via the default_port arg, supports [ipv6]:port notation, falls back to / when no path is present. Four unit tests cover the main shapes (explicit host+port+path, missing port, the canonical genie-api /api/status, and IPv6). Right scope — no reqwest / hyper dep added.
  • [services.api] with #[serde(default = "defaults::api_service_endpoint")] keeps existing geniepod.toml files working without an explicit section. The services_config_deserializes_without_explicit_api_section test pins that backward-compat invariant so a future refactor can't quietly drop it. api_service_endpoint defaults to http://127.0.0.1:3080/api/status which matches the existing hardcoded value, so behavior is byte-identical when the section is absent. Right call.
  • Config::api_service() accessor + alias map updates in manages_service_alias / lookup_service_unit_for_alias extend the existing pattern symmetrically. Adding "api" | "genie-api" next to the "core" / "llm" aliases is the kind of consistency that pays off when someone later does genie-ctl restart api.
  • configured_http_probes(&config) in genie-ctl returns Vec<(&'static str, String, u16)> — Home Assistant is skipped when homeassistant_service() returns None. The previous code always probed 127.0.0.1:8123 even on installs without HA configured, which produced spurious [DOWN] Home Assistant lines in genie-ctl health and noise in support-bundle. This PR fixes that too.
  • Dashboard side: dashboard_service_targets in genie-api now reads config.services.api.url and .systemd_unit instead of hardcoding. Same shape as how core / llm / homeassistant already worked. Clean.

Worth flagging, not blocking:

  • The default_port arg on service_http_probe is only used when the URL omits a port. Operators who put http://homeassistant.local/api/ in config get the right port via the arg. Operators who put http://nonsense.example/ get :8123 slapped on, which is correct for HA but weird-looking. Not a real problem since HA's port is the only realistic case for the default-port path.
  • cmd_support_bundle does its own service_http_probe for the API security URL separately from the probe-list — could be DRY'd, but the current shape keeps the api_security JSON field next to the existing actuation / connectivity sections, which is the right output structure. Fine.

Blocker 1: commit carries Co-authored-by: Cursor <cursoragent@cursor.com>

Co-authored-by: Cursor <cursoragent@cursor.com>

Same project norm that landed in #91 (Contribution / PR body checklist CI rule against AI-attribution footers in PR bodies) and CONTRIBUTING.md "Commit hygiene" (no Co-Authored-By: Claude / Copilot / other AI-assistant trailers on commits). The CI body check doesn't scan commit messages, but the norm explicitly covers commit trailers. Using Cursor or any other AI tooling to draft the work is welcome — credit in git log / git shortlog stays with the human contributor.

Blocker 2: commit author email is a personal Gmail, not a GitHub-noreply

Author: bohdansolovie <bohdansolovie@gmail.com>

That email goes into git log permanently on a public AGPL repo, and anyone cloning the project gets it indexed by every code-search / mirror site. The standard fix is to set git config user.email to a GitHub noreply form like <numeric-id>+<username>@users.noreply.github.com and re-amend. (You can find the noreply for any GitHub account at https://github.com/settings/emails.)

Separately, the commit author (bohdansolovie) and the PR submitter (kiannidev / kpdev) are different GitHub accounts. That's unusual — if you're collaborating with someone and want them credited as the commit author, that's fine, but the maintainer side has to know which identity actually pushed the code. If the bohdansolovie identity is a stale machine config that should have been kiannidev, the amend is the moment to fix it.

Suggested fix path

One amend covers both:

git config user.email "<your-noreply>"   # if not already set
git commit --amend --reset-author
# remove the `Co-authored-by: Cursor <cursoragent@cursor.com>` line
# from the message in the editor that opens
git push --force-with-lease

Once that pushes:

  • The PR body checklist will re-run (passing — it didn't block before).
  • The cargo / clippy / test / aarch64 / no-default-features jobs that needed first-time-contributor approval will now run on the new commit head — I just approved them on the current head, so the same approval should carry over (or I'll re-approve if needed).
  • The substance of the review above stands, so once CI clears + the commit metadata is clean, this is a quick re-approve and merge.

Cross-references

  • Same Cursor-trailer pattern previously flagged on @galuis116's PR #92 (norm note) and enforced via closure on PR #96 when it recurred. The contributor's clean follow-up on PR #98 is a good template for the amend+force-push path.
  • CONTRIBUTING.md "Commit hygiene" section covers both the AI-trailer rule and the implicit human-authored expectation.

Add [services.api] with a backward-compatible default, parse service URLs
via service_http_probe(), and use configured endpoints in genie-ctl health,
diag, support bundle, and genie-api dashboard targets.

Fixes GeniePod#103
@kiannidev
kiannidev force-pushed the fix/103-configured-service-http-probes branch from db5f64e to 8d9663d Compare May 19, 2026 00:32
@kiannidev
kiannidev requested a review from ai-hpc May 19, 2026 00:34
@ai-hpc

ai-hpc commented May 19, 2026

Copy link
Copy Markdown
Contributor

Closing this one.

The substance — config-driven probes for genie-api and Home Assistant — is genuinely useful and would have been welcome, but commit hygiene didn't make it across the line in two rounds:

Original head: commit authored as bohdansolovie <bohdansolovie@gmail.com> (a different GitHub account from the PR submitter kiannidev), with Co-authored-by: Cursor <cursoragent@cursor.com> trailer. Both flagged in the first review (#105 (review) CHANGES_REQUESTED).

Current head after force-push: account mismatch and Cursor trailer are resolved (good — you read the review). But the substantive commit (8d9663d) is still authored under kiannidev@gmail.com (personal Gmail) rather than the GitHub-noreply form 156195510+kiannidev@users.noreply.github.com that you used on the merge commit ae1414a. So the email norm still lands in git log on this PR's mainline commit, on a public AGPL repo where every clone/mirror picks it up.

This is the third PR in this stretch that ran into the same commit-author-email norm without resolution (#92 was the first cycle, @galuis116; #96 was the close-and-redo cycle; #98 was the clean resubmit; #102 was the soft-flag-pass for andriypolanski). For #105 the issue is single-vector now (just email), but it's also the third revision opportunity to land it cleanly, and the maintainer-side patience for repeat litigation on the same norm has a limit.

PR #102 (@andriypolanski) merged the parallel genie-ctl half of the same idea cleanly into Config::core_http_addr(). If you want to land the dashboard + Home Assistant half on top of that work:

  1. git config user.email "156195510+kiannidev@users.noreply.github.com"
  2. Rebase a clean branch onto current main (your service_http_probe helper could likely just call Config::core_http_addr() for the genie-core target and parse only the Home Assistant URL, which is now a smaller diff).
  3. Open a fresh PR — no need to revive this one.

The service_http_probe() URL parser with IPv6 handling, the backward-compatible [services.api] serde default, the symmetric alias-map extension, and the four targeted unit tests are all reusable as-is. Sorry to take this hard line.

@ai-hpc ai-hpc closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

genie-ctl status/diag and support bundle hardcode Home Assistant + genie-api URLs — ignore [services.*] config

2 participants