Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

54 lines
1.9 KiB
Rust

//! Metrics emitted during `build_components` must reach `/metrics`. Whether
//! they do depends on the global recorder being installed first, which only the
//! real startup path exercises: a unit test's local recorder always exists.
//!
//! One test per binary, since the recorder installs once per process.
use std::time::Duration;
#[path = "common/utils.rs"]
mod test_utils;
use test_utils::{setup_tracing, ServerHandle, DEFAULT_CONFIG};
#[tokio::test]
async fn startup_gauge_reaches_the_scrape_endpoint() {
setup_tracing();
let mut config = DEFAULT_CONFIG.clone();
config.export_prometheus = true;
// Warnings enabled but no hosts, so the emitter reports `0` during startup.
config.capture_ingestion_warnings_enabled = true;
config.capture_ingestion_warnings_kafka_hosts = String::new();
let server = ServerHandle::for_config(config).await;
let body = reqwest::Client::builder()
.timeout(Duration::from_secs(5))
.build()
.expect("http client")
.get(format!("http://{}/metrics", server.addr))
.send()
.await
.expect("scrape /metrics")
.text()
.await
.expect("read scrape body");
let line = body
.lines()
.find(|line| line.starts_with("ingestion_warnings_emitter_enabled{"))
.unwrap_or_else(|| panic!("gauge missing, startup metrics are being dropped"));
assert!(
line.contains(r#"reason="hosts_unset""#),
"gauge must name the misconfiguration: {line}"
);
assert!(line.ends_with(" 0"), "emitter is down, expected 0: {line}");
// The recorder's global labels only land if it was installed before the
// emission, so checking them also pins the ordering.
assert!(
line.contains(r#"capture_mode="events""#) && line.contains(r#"role="capture-testing""#),
"gauge must carry the recorder's global labels: {line}"
);
}