e5180ab3df
Step 1+2 of the shared-metrics exporter. Config: telemetry.shared_metrics.send (default false) and .endpoint (default production), resolved by a new shared_metrics_send_config module. Precedence is HERMES_TELEMETRY_ENDPOINT > config > default; the env var exists so the live staging E2E never has to mutate a user's config. send requires enabled and never implies it — that combination is a misconfiguration the user believes is working, so it logs an ERROR once per process rather than silently doing nothing. Plaintext endpoints are refused unless the host is loopback, so a typo cannot send telemetry in clear text. Per AGENTS.md, outbound telemetry needs a user-facing opt-in, so setup_telemetry now prompts for sending as a second, separate question and force-disables send when collection is turned off. Storage: six additive nullable columns on package_outbox for send bookkeeping. The store schema version deliberately does NOT move — _ensure_schema_in_transaction raises on any version it does not recognise and has no forward-compatibility branch, so bumping it would hard-fail an older Hermes, a second profile on an older build, or a rollback, against the same file. Old readers select named columns and never SELECT *, so the additions are invisible to them. Also corrects the two places that promised telemetry is never uploaded (config_defaults comment and cli-config.yaml.example); leaving them would make them false privacy statements once sending ships. Tests: 26 covering config precedence, the enabled/send relationship, transport safety, fresh-database creation, upgrade from a pre-send database (rows preserved, version pinned, idempotent), and that the shipped export query still runs. Mutation-checked: bumping the schema version fails 5 of them.