headroom/docs/platform-feature-matrix.json

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

330 lines
9.7 KiB
JSON
Raw Permalink Normal View History

fix: harden persistent install startup (#1851) ## Description Hardens persistent install startup and proxy compression behavior for issue #1843. Repeated `headroom install start` / scheduled ensure calls no longer spawn duplicate runtimes by default, and `/v1/compress` now fails open on compression timeout instead of returning a 503. The PR also adds a machine-readable platform feature matrix and app-level stabilization tests for health, compression functionality, timeout behavior, and matrix evidence. Refs #1843 ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [x] Performance improvement - [ ] Code refactoring (no functional changes) ## Changes Made - Wrapped direct persistent deployment starts with the existing profile-local runtime start lock. - Made `headroom install start` idempotent when the deployment is already healthy. - Added wedged-runtime handling: if a PID is running but `/readyz` does not recover inside the grace window, stop it before starting again. - Kept `install agent ensure` inside the already-held lock while delegating to the shared start helper. - Changed `/v1/compress` timeout behavior from `503 compression_timeout` to fail-open `200` with original messages, `compression_skipped: true`, and `skip_reason: compression_timeout`. - Added `tests/test_platform_stabilization_functional.py` covering real FastAPI health/compression routes, successful compression metrics, timeout fail-open speed, and a real JSON tool payload that reduces tokens. - Added `docs/platform-feature-matrix.json` and `docs/platform-stabilization.md` for Linux/macOS/Windows hardening coverage and known gaps. - Strengthened matrix tests so cited local test/workflow paths must exist. ## Testing - [x] Unit tests pass (`pytest`) - [x] Linting passes (`ruff check .`) - [x] Type checking passes (`mypy headroom`) - [x] New tests added for new functionality - [x] Manual testing performed ### Test Output ```text # Clean source tree without copied Rust extension: functional module is skipped locally, as CI copies _core from the built wheel. > python -m pytest tests/test_install tests/test_cli/test_install_cli.py tests/test_platform_feature_matrix.py tests/test_platform_stabilization_functional.py -q collected 120 items / 1 skipped 119 passed, 2 skipped in 17.08s > python -m ruff check headroom/proxy/handlers/openai.py tests/test_platform_stabilization_functional.py tests/test_platform_feature_matrix.py All checks passed! # Local Windows compiled-core proof: > python -m maturin build --profile ci --out dist-local Built wheel for abi3 Python >= 3.10 to dist-local\headroom_ai-0.29.0-cp310-abi3-win_amd64.whl # Copied _core.pyd from the wheel into headroom/ for local route execution, then: > python -m pytest tests/test_platform_stabilization_functional.py -q collected 4 items 4 passed in 6.71s > python -m pytest tests/test_install tests/test_cli/test_install_cli.py tests/test_platform_feature_matrix.py -q collected 120 items 119 passed, 1 skipped in 17.16s Commit hooks: Sync plugin versions.....................................................Passed check for merge conflicts................................................Passed ruff.....................................................................Passed ruff-format..............................................................Passed mypy.....................................................................Passed ``` ## Real Behavior Proof - Environment: Windows 11, PowerShell, Python 3.13.13, worktree `C:\git\headroom-stabilization` on branch `jd/cross-platform-stabilization`. - Exact command / steps: built the Windows wheel with `maturin`, extracted `_core.pyd`, ran the new FastAPI route tests and install/matrix tests listed above, then removed generated artifacts before committing. - Observed result: direct start paths now no-op when healthy, skip spawning when the start lock is contended, and stop a wedged runtime before restart. `/v1/compress` now returns original messages quickly on timeout instead of a 503. The real JSON tool-payload smoke test returns `tokens_before > tokens_after`, `tokens_saved > 0`, `compression_ratio < 1.0`, and non-empty transforms through the public route. - Not tested: full native Windows persistent process e2e remains blocked by the upstream CRT/wheel issue already documented in workflows and in the matrix. No real OS service was installed locally; service manager behavior is covered by argument-level unit tests. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] I have updated the CHANGELOG.md if applicable ## Screenshots (if applicable) N/A ## Additional Notes CHANGELOG is not updated because this is an unreleased hardening/test/documentation pass. The platform matrix intentionally records partial/blocked Windows/macOS e2e gaps instead of claiming full coverage where the repo cannot currently run it.
2026-07-10 04:40:34 +00:00
{
"schema_version": 1,
"updated": "2026-07-06",
"source_issues": [
"https://github.com/headroomlabs-ai/headroom/issues/1843"
],
"status_values": [
"covered",
"partial",
"gap",
"blocked"
],
"platforms": [
"linux",
"macos",
"windows"
],
"features": [
{
"id": "install_apply_python",
"name": "Persistent Python install applies and starts",
"risk": "install",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_cli/test_install_cli.py",
"tests/test_install/test_supervisors.py",
".github/workflows/install-native-e2e.yml"
]
},
"macos": {
"status": "covered",
"tests": [
"tests/test_install/test_supervisors.py",
".github/workflows/install-native-e2e.yml"
]
},
"windows": {
"status": "partial",
"tests": [
"tests/test_install/test_supervisors.py",
"tests/test_install/test_runtime.py",
".github/workflows/ci.yml#windows-native-wrapper"
],
"gap": "Native install smoke workflow is source-level until Windows wheel CRT conflicts are resolved."
}
}
},
{
"id": "install_windows_service",
"name": "Windows service install uses sc.exe safely",
"risk": "install",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_install/test_supervisors.py"
]
},
"macos": {
"status": "covered",
"tests": [
"tests/test_install/test_supervisors.py"
]
},
"windows": {
"status": "covered",
"tests": [
"tests/test_install/test_supervisors.py"
]
}
}
},
{
"id": "single_instance_start",
"name": "Persistent runtime start is single-instance by default",
"risk": "runtime",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_cli/test_install_cli.py",
"tests/test_install/test_runtime.py"
]
},
"macos": {
"status": "covered",
"tests": [
"tests/test_cli/test_install_cli.py",
"tests/test_install/test_runtime.py"
]
},
"windows": {
"status": "covered",
"tests": [
"tests/test_cli/test_install_cli.py",
"tests/test_install/test_runtime.py"
]
}
}
},
{
"id": "compression_fail_open",
"name": "Slow or saturated compression fails open",
"risk": "performance",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_kompress_request_nonblocking.py",
"tests/test_proxy_compression_executor.py",
"tests/test_openai_codex_ws_lifecycle.py"
]
},
"macos": {
"status": "partial",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_kompress_request_nonblocking.py",
"tests/test_proxy_compression_executor.py"
],
"gap": "Native workflow coverage should add focused performance-gate tests without full model downloads."
},
"windows": {
"status": "partial",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_kompress_request_nonblocking.py",
"tests/test_proxy_compression_executor.py"
],
"gap": "Source-level tests validate fail-open semantics; full native proxy e2e waits on Windows wheel availability."
}
}
},
{
"id": "proxy_functional_smoke",
"name": "Proxy health and /v1/compress work through the app surface",
"risk": "proxy",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_ccr_row_drop_store_bridge.py"
]
},
"macos": {
"status": "partial",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_ccr_row_drop_store_bridge.py"
],
"gap": "FastAPI route coverage exists; native persistent proxy process smoke should be added."
},
"windows": {
"status": "partial",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_ccr_row_drop_store_bridge.py"
],
"gap": "FastAPI route coverage exists; native persistent proxy process smoke waits on Windows wheel availability."
}
}
},
{
"id": "ccr_persistence",
"name": "CCR survives restart when persistent storage is enabled",
"risk": "cache",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"crates/headroom-core/tests/ccr_backends.rs",
"tests/test_storage_backends.py"
]
},
"macos": {
"status": "partial",
"tests": [
"crates/headroom-core/tests/ccr_backends.rs",
"tests/test_storage_backends.py"
],
"gap": "Rust backend tests run in the Rust workflow; native macOS restart e2e is not yet present."
},
"windows": {
"status": "partial",
"tests": [
"crates/headroom-core/tests/ccr_backends.rs",
"tests/test_storage_backends.py"
],
"gap": "Windows restart e2e is blocked by the native wheel CRT conflict."
}
}
},
{
"id": "init_cli",
"name": "headroom init configures supported agents",
"risk": "install",
"platforms": {
"linux": {
"status": "covered",
"tests": [
".github/workflows/init-native-e2e.yml"
]
},
"macos": {
"status": "covered",
"tests": [
".github/workflows/init-native-e2e.yml"
]
},
"windows": {
"status": "blocked",
"tests": [
".github/workflows/init-native-e2e.yml"
],
"gap": "Matrix entry is intentionally excluded until Windows wheel CRT conflicts are resolved."
}
}
},
{
"id": "wrap_prepare_only",
"name": "headroom wrap prepare-only mutates config safely",
"risk": "install",
"platforms": {
"linux": {
"status": "covered",
"tests": [
".github/workflows/wrap-native-e2e.yml"
]
},
"macos": {
"status": "covered",
"tests": [
".github/workflows/wrap-native-e2e.yml"
]
},
"windows": {
"status": "blocked",
"tests": [
".github/workflows/wrap-native-e2e.yml"
],
"gap": "Matrix entry is intentionally excluded until Windows wheel CRT conflicts are resolved."
}
}
},
{
"id": "toin_skip_recommendations",
"name": "TOIN skip-compression recommendations are exposed",
"risk": "cache",
"platforms": {
"linux": {
"status": "covered",
"tests": [
"tests/test_toin.py",
"tests/test_proxy_ccr.py",
"tests/test_compression_policy_toin_gate.py"
]
},
"macos": {
"status": "partial",
"tests": [
"tests/test_toin.py",
"tests/test_compression_policy_toin_gate.py"
],
"gap": "Native end-to-end verification of served recommendations is still needed."
},
"windows": {
"status": "partial",
"tests": [
"tests/test_toin.py",
"tests/test_compression_policy_toin_gate.py"
],
"gap": "Native end-to-end verification is blocked by Windows wheel availability."
}
}
}
],
"sanity_tests": [
{
"id": "cli_help",
"description": "Every public CLI command renders help without importing optional heavy runtimes.",
"tests": [
"tests/test_cli"
]
},
{
"id": "install_paths",
"description": "Install paths resolve under the active user profile and never require administrator paths for user scope.",
"tests": [
"tests/test_install/test_paths.py"
]
},
{
"id": "runtime_selection",
"description": "Python, Docker, service, and task runtime commands are generated deterministically for each platform.",
"tests": [
"tests/test_install/test_runtime.py",
"tests/test_install/test_supervisors.py"
]
},
{
"id": "health_startup",
"description": "Persistent starts wait for /readyz and surface startup failure instead of silently succeeding.",
"tests": [
"tests/test_cli/test_install_cli.py",
"tests/test_install/test_health.py"
]
},
{
"id": "compression_backpressure",
"description": "Compression queue saturation and model cold-start fail open without hanging request paths.",
"tests": [
"tests/test_platform_stabilization_functional.py",
"tests/test_kompress_request_nonblocking.py",
"tests/test_proxy_compression_executor.py"
]
},
{
"id": "proxy_route_smoke",
"description": "Health and /v1/compress routes return functional metrics and fail open on timeout.",
"tests": [
"tests/test_platform_stabilization_functional.py"
]
}
]
}