From 15149d3c66d74c8054ac50abe6eff32c0e8784d4 Mon Sep 17 00:00:00 2001 From: David Bowman Date: Fri, 24 Jul 2026 18:39:45 -0400 Subject: [PATCH 1/5] plans: add final HTTPX release qualification closure --- ...lification-wiring-and-exact-sha-closure.md | 1479 +++++++++++++++++ 1 file changed, 1479 insertions(+) create mode 100644 plans/httpx-drop-in-release-qualification-wiring-and-exact-sha-closure.md diff --git a/plans/httpx-drop-in-release-qualification-wiring-and-exact-sha-closure.md b/plans/httpx-drop-in-release-qualification-wiring-and-exact-sha-closure.md new file mode 100644 index 00000000..628f2213 --- /dev/null +++ b/plans/httpx-drop-in-release-qualification-wiring-and-exact-sha-closure.md @@ -0,0 +1,1479 @@ +# HTTPX Drop-In Release Qualification Wiring and Exact-SHA Closure Plan + +Status: implementation handoff + +Baseline commit: `f24b62b552486ac8b35eb8d60210304a5e67cee9` + +Target classification after this plan: **Stage C released**, but only after the exact candidate SHA has a retained green Required CI Gate, a retained green qualification run, a validated evidence bundle, and no subsequent release-relevant commits. + +Current classification: **Stage C candidate — release qualification is nonfunctional**. + +## 1. Purpose + +This plan closes the remaining gap between the increasingly credible HTTPX compatibility implementation and an executable, trustworthy release-qualification system. + +The product-side facade, typed API oracle, auth ownership, repeated-value merging, and several native tests are materially improved. The remaining defects are concentrated in integration and evidence integrity: + +1. `.github/workflows/qualification.yml` still calls removed `--wheel-dir` runner interfaces. +2. The workflow does not generate or propagate the artifact manifest or candidate identity introduced by the latest implementation. +3. Raw pytest JSON is passed to evidence generation without normalization. +4. Artifact paths used by the workflow do not match paths searched by evidence verification. +5. Native timeout, proxy/TLS, shutdown, resource, and soak result sections are mandatory to independent validation but are not produced or supplied. +6. Downstream source hashes are verified against downloaded wheels that are not necessarily the wheels installed. +7. Installed downstream versions are not compared with manifest versions. +8. The release-blocking downstream portfolio does not mechanically cover all eight declared Stage C consumer categories. +9. Several downstream commands are invalid, synthetic, or fail to materially exercise the named package. +10. Proxy, TLS, shutdown, and soak tests are not all native, strict, or invoked by qualification. +11. `scripts/validate_qualification_workflow.py` claims substantially more validation than it performs. +12. The status artifact names a stale candidate SHA and overstates completed tracks. +13. No retained exact-SHA CI or qualification evidence exists for current `main`. + +This is a closure plan, not a new compatibility expansion. Do not reopen already-corrected facade semantics unless a release-blocking suite exposes a concrete regression. + +## 2. Non-goals + +This pass must not: + +- broaden the HTTPX compatibility surface beyond the current Stage C profile; +- add unrelated features to the Rust engine, Python API, CLI, or documentation; +- publish crates, wheels, or a PyPI release; +- weaken existing tests to obtain a green workflow; +- replace package-specific downstream behavior with import-only smoke tests; +- accept partial request success in concurrency, shutdown, resource, or soak qualification; +- infer release readiness from local runs, commit messages, checked-in JSON, or status prose; +- merge generated evidence into the repository; +- promote to Stage C released before exact-SHA retained evidence exists. + +## 3. Governing invariants + +Implementation must preserve the following invariants throughout the pass. + +### 3.1 One candidate + +Every release-blocking job must operate on one exact 40-character candidate SHA supplied by the qualification workflow. + +No job may independently choose `main`, `HEAD`, a branch name, a pull-request merge ref, or a locally resolved commit. + +### 3.2 Build once + +The eggfetch wheel and the controlled replacement `httpx` wheel are built exactly once for the candidate SHA. + +All compatibility, downstream, shim, native, resource, soak, evidence, and final-gate jobs must consume those exact retained wheel artifacts. + +### 3.3 One normalized artifact directory + +After download, every consuming job must normalize both wheels into one deterministic directory such as: + +```text +target/qualification/artifacts/ + eggfetch--.whl + httpx-0.28.1-py3-none-any.whl + artifact-manifest.json + candidate-identity.json +``` + +No release-blocking script may search arbitrary fallback directories. + +### 3.4 One canonical identity + +A single candidate identity record and canonical identity digest must bind: + +- candidate SHA; +- workflow run ID and attempt; +- workflow URL; +- eggfetch version; +- eggfetch wheel filename and SHA-256; +- replacement `httpx` wheel filename and SHA-256; +- reference HTTPX version; +- artifact-manifest SHA-256; +- producer schema version. + +Every result must embed or reference the same identity digest. + +### 3.5 Fail closed + +Missing, malformed, skipped, xfailed, stale, mismatched, partial, unknown, unverified, or empty release-blocking evidence is failure. + +A process crash is not a valid structured success condition. A required suite must emit a valid result contract explaining its outcome. + +### 3.6 Evidence is derived + +`overall_pass` must be mechanically derived from validated result contracts. It must never be authored manually or inferred from job success alone. + +### 3.7 Any release-relevant commit invalidates qualification + +If code, tests, manifests, workflow files, qualification scripts, compatibility profiles, allowed differences, controlled replacement packaging, or release documentation changes after qualification, the new SHA must be requalified. + +## 4. Required final architecture + +The qualification workflow must implement this dependency graph: + +```text +verify-candidate + | + v +build-candidate-artifacts + | + v +normalize-artifacts-and-create-identity + | + +----------------------+-----------------------+ + | | | + v v v +compat-and-oracle downstream-matrix native-proof + | | | + +----------------------+-----------------------+ + | + v + aggregate-retained-results + | + v + generate-evidence-bundle + | + v + independent-evidence-validation + | + v + qualification-summary-gate +``` + +The workflow must not preserve parallel legacy paths that use old arguments, old result formats, or direct wheel globs. + +## 5. Phase 0 — Freeze and establish an honest baseline + +### 5.1 Freeze release-relevant scope + +Before implementation: + +1. Record baseline `f24b62b552486ac8b35eb8d60210304a5e67cee9` in the new closure status file. +2. Mark the current state as `Stage C candidate — qualification nonfunctional`. +3. Enumerate every release-relevant path covered by this pass: + - `.github/workflows/qualification.yml` + - `.github/workflows/ci.yml` + - `compat/downstream/**` + - `compat/httpx/0.28.1/**` + - `compat/httpx-controlled-replacement/**` + - `scripts/candidate_identity.py` + - `scripts/generate_artifact_manifest.py` + - `scripts/normalize_pytest_result.py` + - `scripts/run_downstream_compat.py` + - `scripts/run_isolated_downstream.py` + - `scripts/generate_compatibility_evidence.py` + - `scripts/validate_compatibility_evidence.py` + - `scripts/validate_qualification_workflow.py` + - native qualification tests under `crates/eggfetch-python/tests/compat/` + - release and compatibility documentation. +4. Prohibit status promotion until the exact-SHA gate in Phase 10 passes. + +### 5.2 Baseline negative assertions + +Add tests or workflow-validator fixtures proving the current known defects are detected: + +- workflow invokes removed `--wheel-dir` argument; +- workflow omits artifact-manifest generation; +- workflow omits candidate-identity generation; +- workflow passes raw pytest JSON to evidence generation; +- workflow omits native result arguments; +- downstream matrix differs from required manifest set; +- evidence artifact lookup cannot resolve nested download paths; +- required downstream installation is unpinned; +- required category coverage is incomplete; +- stale status SHA is rejected. + +Acceptance criteria: + +- Each defect has a deterministic negative fixture or test. +- Tests fail before implementation and pass only when the corresponding defect is corrected. +- No fixture merely searches for a vague word such as `soak` or `resource`. + +## 6. Phase 1 — Normalize artifacts and create the candidate identity once + +### 6.1 Canonical artifact directory + +Update `generate_artifact_manifest.py` or add a small orchestration wrapper so that every job uses one directory supplied explicitly by argument. + +Required behavior: + +1. Accept the exact candidate SHA and source download directories. +2. Require exactly one eggfetch wheel. +3. Require exactly one controlled replacement `httpx` wheel. +4. Copy, not symlink, both wheels into the canonical directory. +5. Reject duplicate or ambiguous wheel candidates. +6. Compute SHA-256 by streaming file contents. +7. Record absolute or workspace-relative canonical paths. +8. Verify distribution names and versions from wheel metadata: + - eggfetch distribution name must be `eggfetch`; + - replacement distribution name must be `httpx`; + - replacement version must equal the reference profile version `0.28.1`. +9. Reject an upstream HTTPX wheel or a replacement wheel missing the eggfetch shim marker package. +10. Emit `artifact-manifest.json` atomically. + +Required artifact-manifest fields: + +```json +{ + "schema_version": "1", + "candidate_sha": "<40-char SHA>", + "producer": "generate_artifact_manifest.py", + "artifacts": [ + { + "artifact_type": "eggfetch", + "distribution": "eggfetch", + "version": "", + "filename": "", + "path": "", + "sha256": "<64-char digest>", + "size_bytes": 123 + }, + { + "artifact_type": "httpx-controlled-replacement", + "distribution": "httpx", + "version": "0.28.1", + "filename": "", + "path": "", + "sha256": "<64-char digest>", + "size_bytes": 123 + } + ] +} +``` + +### 6.2 Canonical identity and digest + +Revise `candidate_identity.py` so there is one schema and one creation path. + +Required behavior: + +1. Load and validate the artifact manifest. +2. Derive wheel records from the manifest rather than duplicate caller-provided values. +3. Include run ID, run attempt, workflow URL, candidate SHA, and exact timestamps. +4. Canonicalize JSON using sorted keys and stable separators. +5. Compute `identity_digest = sha256(canonical_identity_without_digest)`. +6. Store the digest in the final identity object. +7. Validate the digest when reading the identity. +8. Require `started_at < finished_at` only after finalization; permit a distinct in-progress creation state or generate both timestamps at finalization. +9. Remove unused top-level duplicate wheel fields unless every consumer requires them. +10. Reject empty run IDs, attempts, URLs, hashes, filenames, or producer values. + +Required identity fields: + +```json +{ + "schema_version": "4", + "candidate_sha": "<40-char SHA>", + "eggfetch_version": "", + "reference_httpx_version": "0.28.1", + "artifact_manifest_sha256": "<64-char digest>", + "eggfetch_wheel": { + "filename": "...", + "sha256": "..." + }, + "httpx_replacement_wheel": { + "filename": "...", + "sha256": "..." + }, + "run_id": "...", + "run_attempt": "...", + "workflow_run_url": "...", + "producer": "candidate_identity.py", + "started_at": "...", + "finished_at": "...", + "identity_digest": "<64-char digest>" +} +``` + +### 6.3 Retained identity artifact + +The normalization job must upload one artifact containing: + +```text +candidate-artifacts/ + *.whl + artifact-manifest.json + candidate-identity.json +``` + +Every downstream job must download this artifact rather than separately downloading wheel artifacts and reconstructing paths. + +Acceptance criteria: + +- Tampering with either wheel causes manifest validation failure. +- Tampering with the manifest causes identity validation failure. +- Tampering with the identity causes digest validation failure. +- Every consumer can locate both wheels using only `artifact-manifest.json`. +- No consumer performs fallback path scanning. + +## 7. Phase 2 — Introduce one result contract for every release-blocking producer + +### 7.1 Result schema + +Define one versioned result contract used by: + +- compatibility suite; +- facade API oracle; +- top-level shim API oracle; +- each downstream package; +- downstream aggregate; +- native timeout suite; +- proxy/TLS suite; +- shutdown suite; +- resource suite; +- soak suite; +- workflow validation. + +Required common fields: + +```json +{ + "schema_version": "1", + "producer": "