qig-stack 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: qig-stack
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: QIG toolchain metapackage — pins the mutually-tested latest set and ships the qig-doctor launch preflight (version gate + entry-point wiring gate + capability-slot report)
5
5
  Project-URL: Homepage, https://braden.com.au
6
6
  Project-URL: Repository, https://github.com/GaryOcean428/qig-stack
@@ -14,15 +14,16 @@ Classifier: Intended Audience :: Science/Research
14
14
  Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Topic :: Scientific/Engineering :: Physics
17
- Requires-Python: >=3.10
17
+ Requires-Python: >=3.11
18
18
  Requires-Dist: packaging>=22
19
- Requires-Dist: qig-bench==0.1.3
20
- Requires-Dist: qig-compute==0.9.2
21
- Requires-Dist: qig-consciousness==0.3.2
22
- Requires-Dist: qig-core==2.12.2
23
- Requires-Dist: qig-tokenizer==0.2.7
24
- Requires-Dist: qig-warp==0.6.5
25
- Requires-Dist: qigkernels==0.4.2
19
+ Requires-Dist: qig-bench==0.1.9
20
+ Requires-Dist: qig-compute==0.9.10
21
+ Requires-Dist: qig-coordizer==0.1.5
22
+ Requires-Dist: qig-core==2.15.3
23
+ Requires-Dist: qig-geocoding==0.1.2
24
+ Requires-Dist: qig-warp==0.6.10
25
+ Requires-Dist: qigkernels==0.4.5
26
+ Requires-Dist: quner==0.1.3
26
27
  Provides-Extra: dev
27
28
  Requires-Dist: pytest>=7.0; extra == 'dev'
28
29
  Description-Content-Type: text/markdown
@@ -32,8 +33,7 @@ Description-Content-Type: text/markdown
32
33
  The QIG toolchain **metapackage** + deterministic launch preflight.
33
34
 
34
35
  `pip install qig-stack` installs the mutually-tested latest set of the QIG packages
35
- (qig-compute / qig-warp / qig-core / qig-bench / qig-consciousness / qig-tokenizer /
36
- qigkernels) at compatible versions — the whole "crystal" — and ships the `qig-doctor`
36
+ (see `pyproject.toml` and the bundled capability contract) at compatible versions — the whole "crystal" — and ships the `qig-doctor`
37
37
  preflight.
38
38
 
39
39
  ## qig-doctor — step-0 of every launcher
@@ -43,6 +43,7 @@ qig-doctor # full preflight; exits 1 if any package is stale OR
43
43
  qig-doctor --no-network # skip PyPI; contract snapshot + wiring report only
44
44
  qig-doctor --json # machine-readable
45
45
  qig-doctor --probe # also import-check each entry-point resolves (diagnostic, off the gate)
46
+ qig-doctor --release-check # release acceptance: live latest, required wiring, all probes resolve
46
47
  qig-doctor --deep # also call Tier-B describe() descriptors (imports packages)
47
48
  ```
48
49
 
@@ -91,6 +92,54 @@ registry under review control.
91
92
  ## Development
92
93
 
93
94
  ```bash
94
- pip install pytest # tests import only qig_stack.doctor (pure stdlib)
95
+ pip install pytest packaging # doctor uses packaging for PEP 440 versions
95
96
  pytest -q # contract schema + doctor unit tests (no network)
96
97
  ```
98
+
99
+ ## Active release set
100
+
101
+ The dependency pins and bundled contract describe the same tested release set.
102
+ Retired qig-consciousness and qig-tokenizer are excluded; qig-coordizer supplies
103
+ active coordization. qig-geocoding and quner are included as active libraries and
104
+ tools. Installing quner does not enable its daemon or modify system power settings.
105
+ The doctor checks package availability and capability wiring; an import check is
106
+ not an experimental certification or a performance benchmark.
107
+
108
+ Release acceptance installs the published pinned wheels into a clean environment,
109
+ runs the doctor with live package metadata and probes, and records any hardware-only
110
+ checks separately. Frozen experiment environments keep their historical pins.
111
+
112
+ ## Verification boundaries
113
+
114
+ PyPI timeouts, malformed versions and HTTP 404 responses are unverified states,
115
+ not successful latest-version checks. They fail the version gate. Ahead/local
116
+ builds also do not equal the latest published version. Offline mode compares the
117
+ contract snapshot and reports `latest_verified: false`, even if that comparison
118
+ passes. Retry live verification when connectivity is restored.
119
+
120
+ The current contract sets `entry_point_gates.require_activation: true`: all
121
+ required shipped declarations must exist, including when the entire group is
122
+ empty. Historical contracts can retain their initial rollout grace explicitly by
123
+ omitting that setting; the pure wiring helper preserves that compatibility.
124
+
125
+ The Phase 2/3 design deliberately kept `--probe` diagnostic and non-gating;
126
+ that remains true. For release acceptance use `qig-doctor --release-check --json`.
127
+ It requires live PyPI equality, equality to the mutually-tested contract pins,
128
+ required declarations, successful import probes
129
+ and no moved contract probes, and emits `release_gate_passed` with a nonzero exit
130
+ on failure. `--no-network` cannot be combined with release checking. Unknown
131
+ additional capability declarations remain warnings if they resolve. This command
132
+ imports packages, but does not run physics experiments or enable daemons.
133
+
134
+ Runtime `qig_stack.__version__` reads installed distribution metadata using
135
+ [importlib.metadata](https://docs.python.org/3/library/importlib.metadata.html),
136
+ with `0+uninstalled` only when no distribution metadata exists. It is not a
137
+ second manually maintained version constant.
138
+
139
+ `qig-doctor` is the console entry point for `qig_stack.doctor:main`; the equivalent
140
+ module command is `python -m qig_stack.doctor`. Package-version coverage includes
141
+ every contract package. Capability coverage includes shipped slots with a declared
142
+ `provider_pkg`; engine-local (`provider_pkg: null`) and explicitly unshipped slots
143
+ are exempt. A package with no contract capability slots is still version-checked;
144
+ this is not an assertion that its features were exercised. Integration acceptance
145
+ must additionally exercise the actual cooperating package APIs.
@@ -0,0 +1,115 @@
1
+ # qig-stack
2
+
3
+ The QIG toolchain **metapackage** + deterministic launch preflight.
4
+
5
+ `pip install qig-stack` installs the mutually-tested latest set of the QIG packages
6
+ (see `pyproject.toml` and the bundled capability contract) at compatible versions — the whole "crystal" — and ships the `qig-doctor`
7
+ preflight.
8
+
9
+ ## qig-doctor — step-0 of every launcher
10
+
11
+ ```bash
12
+ qig-doctor # full preflight; exits 1 if any package is stale OR a slot is under-filled
13
+ qig-doctor --no-network # skip PyPI; contract snapshot + wiring report only
14
+ qig-doctor --json # machine-readable
15
+ qig-doctor --probe # also import-check each entry-point resolves (diagnostic, off the gate)
16
+ qig-doctor --release-check # release acceptance: live latest, required wiring, all probes resolve
17
+ qig-doctor --deep # also call Tier-B describe() descriptors (imports packages)
18
+ ```
19
+
20
+ Three fail-closed jobs:
21
+
22
+ 1. **Version gate** — every stack package must be installed at PyPI-latest. `installed
23
+ < latest` is a LAUNCH BLOCKER (non-zero exit), per the "latest version, always
24
+ optimised" rule.
25
+ 2. **Wiring gate (Phase 2)** — enumerates the `qig.capabilities` entry-points the
26
+ installed packages self-register (Tier A: metadata-only, no import on the gate
27
+ path) and cross-checks them against the capability contract:
28
+ - **under-fill → FAIL**: a shipped provider that did not register its entry-point.
29
+ - **drift → WARN**: an entry-point the contract doesn't know, or one whose
30
+ `module:attr` moved off the contract probe.
31
+ 3. **Wiring report** — which capability slots are filled by what is installed (the
32
+ automated Gate-A lever inventory).
33
+
34
+ ## The capability contract
35
+
36
+ `src/qig_stack/contract.json` is the fixed lattice the stack crystallizes into — every
37
+ slot, the package primitive that fills it (`provider_pkg` + `module:attr` probe), the
38
+ latest-published version, and the camera-certification `cam_id`/`lever_id`. It is the
39
+ Genesis-kernel / E8-root analog: given the lattice + installed packages + version
40
+ policy, the wiring is determined — no per-experiment hand-wiring, no agentic guessing.
41
+
42
+ ## Self-wiring (Phase 2)
43
+
44
+ Each package declares the slots it fills in its own `pyproject.toml`:
45
+
46
+ ```toml
47
+ [project.entry-points."qig.capabilities"]
48
+ "SLOT-Q-QFI" = "qig_compute.qfi:qfi_from_mps_tangent_space"
49
+ ```
50
+
51
+ `qig-doctor` reads those declarations from installed metadata and confirms the crystal
52
+ assembled correctly before any compute spend. Entry-points assert only *"installed
53
+ package X fills slot Y via probe Z"* — certification stays in the camera-certification
54
+ registry under review control.
55
+
56
+ ## Design
57
+
58
+ - [self-wiring genesis design note](https://github.com/GaryOcean428/qig-verification/blob/development/docs/current/20260619-self-wiring-genesis-design-1.00W.md)
59
+ - [entry-point capability spec](https://github.com/GaryOcean428/qig-verification/blob/development/docs/current/20260619-qig-entry-point-capability-spec-1.00W.md)
60
+ - [Phase 2/3 design](https://github.com/GaryOcean428/qig-verification/blob/development/docs/plans/2026-06-30-qig-stack-self-wiring-phase23-design.md)
61
+
62
+ ## Development
63
+
64
+ ```bash
65
+ pip install pytest packaging # doctor uses packaging for PEP 440 versions
66
+ pytest -q # contract schema + doctor unit tests (no network)
67
+ ```
68
+
69
+ ## Active release set
70
+
71
+ The dependency pins and bundled contract describe the same tested release set.
72
+ Retired qig-consciousness and qig-tokenizer are excluded; qig-coordizer supplies
73
+ active coordization. qig-geocoding and quner are included as active libraries and
74
+ tools. Installing quner does not enable its daemon or modify system power settings.
75
+ The doctor checks package availability and capability wiring; an import check is
76
+ not an experimental certification or a performance benchmark.
77
+
78
+ Release acceptance installs the published pinned wheels into a clean environment,
79
+ runs the doctor with live package metadata and probes, and records any hardware-only
80
+ checks separately. Frozen experiment environments keep their historical pins.
81
+
82
+ ## Verification boundaries
83
+
84
+ PyPI timeouts, malformed versions and HTTP 404 responses are unverified states,
85
+ not successful latest-version checks. They fail the version gate. Ahead/local
86
+ builds also do not equal the latest published version. Offline mode compares the
87
+ contract snapshot and reports `latest_verified: false`, even if that comparison
88
+ passes. Retry live verification when connectivity is restored.
89
+
90
+ The current contract sets `entry_point_gates.require_activation: true`: all
91
+ required shipped declarations must exist, including when the entire group is
92
+ empty. Historical contracts can retain their initial rollout grace explicitly by
93
+ omitting that setting; the pure wiring helper preserves that compatibility.
94
+
95
+ The Phase 2/3 design deliberately kept `--probe` diagnostic and non-gating;
96
+ that remains true. For release acceptance use `qig-doctor --release-check --json`.
97
+ It requires live PyPI equality, equality to the mutually-tested contract pins,
98
+ required declarations, successful import probes
99
+ and no moved contract probes, and emits `release_gate_passed` with a nonzero exit
100
+ on failure. `--no-network` cannot be combined with release checking. Unknown
101
+ additional capability declarations remain warnings if they resolve. This command
102
+ imports packages, but does not run physics experiments or enable daemons.
103
+
104
+ Runtime `qig_stack.__version__` reads installed distribution metadata using
105
+ [importlib.metadata](https://docs.python.org/3/library/importlib.metadata.html),
106
+ with `0+uninstalled` only when no distribution metadata exists. It is not a
107
+ second manually maintained version constant.
108
+
109
+ `qig-doctor` is the console entry point for `qig_stack.doctor:main`; the equivalent
110
+ module command is `python -m qig_stack.doctor`. Package-version coverage includes
111
+ every contract package. Capability coverage includes shipped slots with a declared
112
+ `provider_pkg`; engine-local (`provider_pkg: null`) and explicitly unshipped slots
113
+ are exempt. A package with no contract capability slots is still version-checked;
114
+ this is not an assertion that its features were exercised. Integration acceptance
115
+ must additionally exercise the actual cooperating package APIs.
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "qig-stack"
7
- version = "0.1.0"
7
+ version = "0.1.2"
8
8
  description = "QIG toolchain metapackage — pins the mutually-tested latest set and ships the qig-doctor launch preflight (version gate + entry-point wiring gate + capability-slot report)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
11
- requires-python = ">=3.10"
11
+ requires-python = ">=3.11"
12
12
  authors = [
13
13
  { name = "Braden Lang", email = "braden@garyocean.com" },
14
14
  ]
@@ -25,18 +25,19 @@ classifiers = [
25
25
  "Topic :: Scientific/Engineering :: Physics",
26
26
  ]
27
27
 
28
- # The mutually-tested crystal: PyPI-latest at authoring (2026-06-30). Bumped as a
29
- # set on each tested release; qig-doctor still resolves live latest at launch and
30
- # fails closed if the installed venv is behind.
28
+ # The active package set. Release only after the pinned wheels pass integration.
29
+ # Bumped as a set on each tested release; qig-doctor still resolves live latest at
30
+ # launch and fails closed if the installed venv is behind.
31
31
  dependencies = [
32
32
  "packaging>=22", # PEP 440-correct version comparison in the version gate
33
- "qig-compute==0.9.2", # first release carrying qig.capabilities entry-points + born sampler
34
- "qig-warp==0.6.5", # first release carrying qig.capabilities entry-points
35
- "qig-core==2.12.2",
36
- "qig-bench==0.1.3",
37
- "qig-consciousness==0.3.2",
38
- "qig-tokenizer==0.2.7",
39
- "qigkernels==0.4.2",
33
+ "qig-compute==0.9.10", # qig.capabilities entry-points + born sampler
34
+ "qig-warp==0.6.10", # qig.capabilities entry-points live since 0.6.5
35
+ "qig-core==2.15.3",
36
+ "qig-bench==0.1.9",
37
+ "qig-coordizer==0.1.5",
38
+ "qigkernels==0.4.5",
39
+ "qig-geocoding==0.1.2",
40
+ "quner==0.1.3",
40
41
  ]
41
42
 
42
43
  [project.optional-dependencies]
@@ -1,8 +1,7 @@
1
1
  """qig-stack -- the QIG toolchain metapackage + deterministic launch preflight.
2
2
 
3
3
  `pip install qig-stack` pins the mutually-tested latest set of the QIG packages
4
- (qig-compute / qig-warp / qig-core / qig-bench / qig-consciousness / qig-tokenizer /
5
- qigkernels) and ships the `qig-doctor` preflight (version gate + entry-point wiring
4
+ (see the dependency pins in pyproject.toml and bundled capability contract) and ships the `qig-doctor` preflight (version gate + entry-point wiring
6
5
  gate + capability-slot report). See `qig_stack.doctor`.
7
6
 
8
7
  The public symbols are exposed lazily (PEP 562) so importing the package does NOT
@@ -14,7 +13,12 @@ from __future__ import annotations
14
13
 
15
14
  from typing import TYPE_CHECKING
16
15
 
17
- __version__ = "0.1.0"
16
+ from importlib.metadata import PackageNotFoundError, version
17
+
18
+ try:
19
+ __version__ = version("qig-stack")
20
+ except PackageNotFoundError:
21
+ __version__ = "0+uninstalled"
18
22
 
19
23
  _LAZY = frozenset(
20
24
  {
@@ -0,0 +1,225 @@
1
+ {
2
+ "doc": "QIG Stack Capability Contract",
3
+ "version": "1.02W",
4
+ "date": "2026-07-04",
5
+ "supersedes": "qig-verification:docs/current/20260619-qig-stack-capability-contract-1.00W.json (Phase-1 authored record) | 2026-07-04: ratified the 5 library-tier capability slots (channel=library, shipped:false) so the qig.capabilities entry-points registered in qig-core/qigkernels/qig-consciousness/qig-coordizer/qig-bench are FILLED not DRIFT. Flip shipped:true on the coordinated republish. Physics-compute channels unchanged.",
6
+ "principle": "Genesis-kernel deterministic self-assembly (vex-agent Core-8 / E8-root analog). The stack crystallizes into this FIXED lattice of capability slots; each slot is filled by a package primitive at latest-published version, cited to a camera-certification cert. With Phase 2 (entry-point self-registration) live, the wiring is DERIVED from installed metadata, not hand-authored.",
7
+ "authority": "PI directive 2026-06-19 (Phase 1) + 2026-06-30 (Phase 2/3 + born-sampler promotion); standing latest-version / step-0 lever-inventory rule (qig-verification/CLAUDE.md)",
8
+ "cert_registry": "qig-verification:docs/current/20260619-camera-certification-registry-1.00W.json",
9
+ "design_note": "qig-verification:docs/current/20260619-self-wiring-genesis-design-1.00W.md",
10
+ "entry_point_spec": "qig-verification:docs/current/20260619-qig-entry-point-capability-spec-1.00W.md",
11
+ "phase23_design": "qig-verification:docs/plans/2026-06-30-qig-stack-self-wiring-phase23-design.md",
12
+ "preflight": "qig_stack.doctor (console script: qig-doctor)",
13
+ "entry_point_group": "qig.capabilities",
14
+ "version_policy": {
15
+ "rule": "installed == latest-published (PyPI) at every launch; installed < latest is a LAUNCH BLOCKER (fail-closed, non-zero exit).",
16
+ "pin_exception": "Frozen reproducibility scripts keep pinned era-versions for bit-for-bit replay; this is never a reason to run a NEW launcher behind latest.",
17
+ "stack_packages_latest_at_authoring": {
18
+ "qig-compute": "0.9.10",
19
+ "qig-warp": "0.6.10",
20
+ "qig-core": "2.15.3",
21
+ "qig-bench": "0.1.9",
22
+ "qig-coordizer": "0.1.5",
23
+ "qigkernels": "0.4.5",
24
+ "qig-geocoding": "0.1.2",
25
+ "quner": "0.1.3"
26
+ },
27
+ "note_on_latest": "These are a SNAPSHOT for reference only. qig_stack.doctor resolves latest live from PyPI at launch; do not treat this block as the source of truth -- the live query is. The qig-stack metapackage pins this exact set in pyproject.toml as the mutually-tested crystal.",
28
+ "retired_packages": [
29
+ "qig-consciousness",
30
+ "qig-tokenizer"
31
+ ]
32
+ },
33
+ "slot_status_legend": {
34
+ "CERTIFIED": "matched-cell equivalence certified once; cite the cam_id, never re-run",
35
+ "REFERENCE": "the exact reference path a cheap camera is certified against",
36
+ "PENDING": "uncertified cheap path; one-time cert must land before its results count",
37
+ "LEVER": "an efficiency lever (no measurement channel of its own)",
38
+ "CONDITIONAL": "usable only behind a controlled recheck at a calibration anchor",
39
+ "LIBRARY": "a library capability primitive (no physics measurement channel, no CAM cert); presence-checked only \u2014 the entry-point must resolve to the named callable. shipped:false until the package republishes with it."
40
+ },
41
+ "entry_point_gates": {
42
+ "under_fill": "FAIL (non-zero exit): a slot with provider_pkg set and shipped != false but no installed qig.capabilities entry-point (stale / mis-built / un-republished package).",
43
+ "drift": "WARN (non-fatal): an installed entry-point whose slot_id is not in the contract, or whose module:attr value differs from the slot probe.",
44
+ "exempt": "Slots with provider_pkg: null (engine-local, e.g. SLOT-GROUND-STATE/TeNPy) or shipped: false are exempt from under_fill.",
45
+ "require_activation": true
46
+ },
47
+ "slots": [
48
+ {
49
+ "slot_id": "SLOT-GROUND-STATE",
50
+ "role": "prepare the lattice ground state psi that both channels read",
51
+ "channel": "state",
52
+ "provided_by": "qig-verification (engine) + TeNPy DMRG-complex",
53
+ "provider_pkg": null,
54
+ "primitive": "DMRG/MPS ground-state preparation vs ED",
55
+ "probe": "tenpy",
56
+ "cam_id": "CAM-STATE-DMRG-VS-ED",
57
+ "cert_status": "CERTIFIED",
58
+ "feasible_at": "L>=6 via MPS/DMRG"
59
+ },
60
+ {
61
+ "slot_id": "SLOT-Q-QFI",
62
+ "role": "quantum Fisher information (Q channel) -- exact, tensor-contractible",
63
+ "channel": "Q",
64
+ "provided_by": "qig-compute",
65
+ "provider_pkg": "qig-compute",
66
+ "primitive": "qfi.qfi_from_mps_tangent_space(psi_mps, L)",
67
+ "probe": "qig_compute.qfi:qfi_from_mps_tangent_space",
68
+ "cam_id": "CAM-QFI-MPS-TANGENT",
69
+ "cert_status": "CERTIFIED",
70
+ "feasible_at": "all L (O(chi^3) contraction, no sampling, zero error bar)",
71
+ "alternatives": [
72
+ "CAM-QFI-DENSE-STREAMING",
73
+ "CAM-QFI-BITFLIP",
74
+ "CAM-QFI-SPARSE-NN",
75
+ "CAM-QFI-SITE-PRUNE",
76
+ "CAM-QFI-SITELOCAL"
77
+ ]
78
+ },
79
+ {
80
+ "slot_id": "SLOT-C-SUSCEPTIBILITY-REF",
81
+ "role": "classical / phase-blind Bhattacharyya fidelity-susceptibility (C channel) EXACT reference",
82
+ "channel": "C",
83
+ "provided_by": "qig-compute",
84
+ "provider_pkg": "qig-compute",
85
+ "primitive": "qfi.classical_fidelity_susceptibility(p_plus, p_minus, eps)",
86
+ "probe": "qig_compute.qfi:classical_fidelity_susceptibility",
87
+ "cam_id": "CAM-C-DENSE-REF",
88
+ "cert_status": "REFERENCE",
89
+ "feasible_at": "L<=5 ONLY (dense Born p over 2^N states; L=6 -> ~1.1 TB, infeasible)"
90
+ },
91
+ {
92
+ "slot_id": "SLOT-C-BORN-SAMPLER",
93
+ "role": "MPS Born-sampler -- the L=6-feasible C path (CERTIFIED via EXP-122 2026-06-19; PROMOTED to qig-compute 2026-06-30)",
94
+ "channel": "C",
95
+ "provided_by": "qig-compute (promoted from EXP-122 launcher born_C_score, byte-identical numerics)",
96
+ "provider_pkg": "qig-compute",
97
+ "primitive": "sampling.born_classical_fisher_score(psi_base, psi_p, psi_m, eps, M, seed): x ~ p(x) from MPS perfect (Ferris-Vidal) sampling, O(N chi^2)/sample; C = E_{x~p_base}[((log p+ - log p-)/2eps)^2] (PHASE-FREE classical-Fisher SCORE, estimator (c)). The Bhattacharyya form (estimator (a)) FAILS the 1/eps^2 variance test -- (c) is the certified estimator.",
98
+ "probe": "qig_compute.sampling:born_classical_fisher_score",
99
+ "cam_id": "CAM-C-BORN-MPS",
100
+ "cert_status": "CERTIFIED",
101
+ "shipped": true,
102
+ "promoted": "2026-06-30 from qig-verification/scripts/exp122_dmrg_complex.py:born_C_score (byte-identical). The frozen launcher keeps its inline copy for bit-for-bit reproducibility of the L=5 cert.",
103
+ "feasible_at": "L=6 (CERTIFIED at L=5: EXP-122 L=5 cert results/exp122/20260619_exp122_L5_born_cert.json @566b245 -- M=150k Delta=0.000373 bias PASS, sigma_D=0.00332 < D_sep/3=0.00473 variance PASS)."
104
+ },
105
+ {
106
+ "slot_id": "SLOT-SCREENING",
107
+ "role": "site pruning / screening lever (Yukawa shell cutoff)",
108
+ "channel": "lever",
109
+ "provided_by": "qig-warp",
110
+ "provider_pkg": "qig-warp",
111
+ "primitive": "prune_sites / screening_cutoff",
112
+ "probe": "qig_warp.screening:prune_sites",
113
+ "cam_id": "CAM-QFI-SITE-PRUNE",
114
+ "cert_status": "CERTIFIED"
115
+ },
116
+ {
117
+ "slot_id": "SLOT-EARLY-STOP",
118
+ "role": "convergence early-stop across the chi sub-ladder (8/16/24/32)",
119
+ "channel": "lever",
120
+ "provided_by": "qig-warp",
121
+ "provider_pkg": "qig-warp",
122
+ "primitive": "convergence.check_ci_stabilized / find_early_stop_point",
123
+ "probe": "qig_warp.convergence:check_ci_stabilized",
124
+ "lever_id": "LEV-CONVERGENCE-EARLYSTOP",
125
+ "cert_status": "LEVER"
126
+ },
127
+ {
128
+ "slot_id": "SLOT-RUNTIME-PRICING",
129
+ "role": "spend preflight before heavy launches",
130
+ "channel": "lever",
131
+ "provided_by": "qig-warp + chi-ladder pace-check",
132
+ "provider_pkg": "qig-warp",
133
+ "primitive": "bridge.predict_runtime (J-scaling) / chi-ladder pace-check",
134
+ "probe": "qig_warp.bridge:predict_runtime",
135
+ "lever_id": "LEV-CHI-PACE-CHECK",
136
+ "cert_status": "LEVER",
137
+ "caveat": "predict_runtime is J-scaling and is WRONG for L/chi-BOUND jobs at fixed J (EXP-122). For those, use the chi-ladder pace-check (LEV-CHI-PACE-CHECK)."
138
+ },
139
+ {
140
+ "slot_id": "SLOT-BLAS-PIN",
141
+ "role": "deterministic BLAS threading (API, not raw env-vars)",
142
+ "channel": "lever",
143
+ "provided_by": "qig-compute",
144
+ "provider_pkg": "qig-compute",
145
+ "primitive": "pin_blas_threads / single_thread_blas",
146
+ "probe": "qig_compute.blas:pin_blas_threads",
147
+ "lever_id": "LEV-BLAS-PIN",
148
+ "cert_status": "LEVER"
149
+ },
150
+ {
151
+ "slot_id": "SLOT-FISHER-RAO-DISTANCE",
152
+ "role": "the canonical Fisher-Rao distance on Delta (the geometry every package's basins share)",
153
+ "channel": "library",
154
+ "provided_by": "qig-core",
155
+ "provider_pkg": "qig-core",
156
+ "primitive": "fisher_rao_distance",
157
+ "probe": "qig_core.geometry.fisher_rao:fisher_rao_distance",
158
+ "cam_id": null,
159
+ "cert_status": "LIBRARY",
160
+ "shipped": true,
161
+ "feasible_at": "always (library import)"
162
+ },
163
+ {
164
+ "slot_id": "SLOT-KERNEL",
165
+ "role": "the pure geometric kernel (Delta63 layers, Gibbs-over-FR attention, no dot-product)",
166
+ "channel": "library",
167
+ "provided_by": "qigkernels",
168
+ "provider_pkg": "qigkernels",
169
+ "primitive": "Kernel",
170
+ "probe": "qigkernels.kernel:Kernel",
171
+ "cam_id": null,
172
+ "cert_status": "LIBRARY",
173
+ "shipped": true,
174
+ "feasible_at": "always (library import)"
175
+ },
176
+ {
177
+ "slot_id": "SLOT-ATTRACTOR-EXTRACT",
178
+ "role": "basin-attractor extraction from a model's activations",
179
+ "channel": "library",
180
+ "provided_by": "RETIRED (qig-consciousness)",
181
+ "provider_pkg": null,
182
+ "primitive": "AttractorBasisExtractor",
183
+ "probe": null,
184
+ "cam_id": null,
185
+ "cert_status": "RETIRED",
186
+ "shipped": false,
187
+ "feasible_at": "n/a \u2014 retired",
188
+ "retired_note": "Provider qig-consciousness was retired + deinit'd 2026-07-23 (parent 6d75c30 / 956162b; superseded by geo/gk/hybrid in qig-studio + qig-core consciousness modules). The activation-extraction attractor approach is superseded by per-faculty wide-Dirichlet identity births (qig-studio identity_anchor.py). Slot preserved (never deleted) as RETIRED so the wiring gate does not require a filled provider."
189
+ },
190
+ {
191
+ "slot_id": "SLOT-COORDIZER",
192
+ "role": "text -> Delta63 basin coordizer (Fisher-Rao merges)",
193
+ "channel": "library",
194
+ "provided_by": "qig-coordizer",
195
+ "provider_pkg": "qig-coordizer",
196
+ "primitive": "FisherCoordizer",
197
+ "probe": "qig_coordizer.coordizer:FisherCoordizer",
198
+ "cam_id": null,
199
+ "cert_status": "LIBRARY",
200
+ "shipped": true,
201
+ "feasible_at": "always (library import)"
202
+ },
203
+ {
204
+ "slot_id": "SLOT-BENCH-SUITE",
205
+ "role": "the QIG benchmark suite runner",
206
+ "channel": "library",
207
+ "provided_by": "qig-bench",
208
+ "provider_pkg": "qig-bench",
209
+ "primitive": "run_suite",
210
+ "probe": "qig_bench.suite:run_suite",
211
+ "cam_id": null,
212
+ "cert_status": "LIBRARY",
213
+ "shipped": true,
214
+ "feasible_at": "always (library import)"
215
+ }
216
+ ],
217
+ "how_to_use": "Step-0 of every launcher: run `qig-doctor` (from the qig-stack package; qig-verification/scripts/qig_doctor.py is a back-compat shim). It (1) fails closed if any stack package is behind PyPI-latest, (2) fails closed on under-filled slots (a shipped provider that did not self-register its entry-point), and (3) enumerates which slots are filled by what is installed -- the automated Gate-A lever inventory. An experiment then cites the cam_id/lever_id for each slot it uses and never re-runs a matched-cell gate.",
218
+ "roadmap": {
219
+ "phase_1": "DONE -- fixed lattice (this contract) + qig_doctor.py fail-closed version preflight (qig-verification).",
220
+ "phase_2": "DONE 2026-06-30 -- each package self-registers its slots via [project.entry-points.'qig.capabilities'] (qig-compute, qig-warp); qig_stack.doctor derives wiring from entry-points (Tier-A metadata-only) with under-fill (FAIL) + drift (WARN) gates.",
221
+ "phase_3": "DONE 2026-06-30 -- qig-stack metapackage pins the mutually-tested latest set, houses the doctor + this contract, ships the qig-doctor console script; CI runs contract schema + doctor unit tests (no network).",
222
+ "born_sampler_promotion": "DONE 2026-06-30 -- SLOT-C-BORN-SAMPLER shipped:false -> true; born_C_score promoted to qig_compute.sampling.born_classical_fisher_score (byte-identical), gains an entry-point. CAM-C-BORN-MPS stays CERTIFIED.",
223
+ "activation": "entry-points go live in the installed crystal on each package's next PyPI release; cut qig-compute / qig-warp / qig-stack releases to activate (PI greenlight)."
224
+ }
225
+ }
@@ -14,11 +14,12 @@ Step-0 of every launcher. Three jobs, all fail-closed:
14
14
  shipped but did not register its entry-point (stale / mis-built package).
15
15
  - DRIFT -> WARN: an installed entry-point the contract does not know, or
16
16
  one whose module:attr moved off the contract probe.
17
- ACTIVATION GRACE: if NO `qig.capabilities` entry-point is installed at all,
17
+ HISTORICAL ACTIVATION GRACE (older contracts only): if NO `qig.capabilities` entry-point is installed at all,
18
18
  the feature is not yet activated in this venv (the providers have not
19
19
  republished with entry-points) -- the gate reports PENDING and PASSES rather
20
20
  than false-blocking every launch. Once any provider registers, the gate is
21
- strict: a missing expected slot is then a real UNDER-FILL.
21
+ strict: a missing expected slot is then a real UNDER-FILL. The current
22
+ contract requires activation and treats an empty required group as FAIL.
22
23
 
23
24
  3. WIRING REPORT -- which contract slots are filled by what is installed (the
24
25
  automated Gate-A lever inventory).
@@ -33,6 +34,7 @@ Usage:
33
34
  qig-doctor --json # machine-readable report
34
35
  qig-doctor --probe # also import-check each entry-point resolves (off the gate)
35
36
  qig-doctor --deep # also call Tier-B describe() descriptors (imports packages)
37
+ qig-doctor --release-check # live latest + required wiring + probe failures gate exit
36
38
  qig-doctor --contract PATH # override the bundled contract (testing)
37
39
  """
38
40
 
@@ -75,7 +77,7 @@ def latest_pypi_version(package: str, timeout: float = PYPI_TIMEOUT_S) -> str |
75
77
 
76
78
  Raises _PyPIAbsent on a definitive HTTP 404 (package/version genuinely not on
77
79
  PyPI -- yanked or renamed), so the caller can distinguish that from a transient
78
- network blip (which returns None -> fail-open).
80
+ network failure (which returns None -> latest unverified, gate fails).
79
81
  """
80
82
  url = f"https://pypi.org/pypi/{package}/json"
81
83
  try:
@@ -87,8 +89,8 @@ def latest_pypi_version(package: str, timeout: float = PYPI_TIMEOUT_S) -> str |
87
89
  return None
88
90
  except (urllib.error.URLError, TimeoutError, ValueError):
89
91
  return None
90
- info = payload.get("info", {})
91
- version = info.get("version")
92
+ info = payload.get("info", {}) if isinstance(payload, dict) else {}
93
+ version = info.get("version") if isinstance(info, dict) else None
92
94
  return version if isinstance(version, str) else None
93
95
 
94
96
 
@@ -136,7 +138,7 @@ def enumerate_capability_entrypoints() -> dict[str, str]:
136
138
 
137
139
  Metadata-only -- enumerates DECLARATIONS without importing any package, so it
138
140
  can never run package code and cannot inject non-determinism into a launch.
139
- Requires the Python 3.10+ selectable entry_points(group=) API (requires-python>=3.10).
141
+ Requires the Python 3.11+ selectable entry_points(group=) API (requires-python>=3.11).
140
142
  """
141
143
  return {ep.name: ep.value for ep in importlib_metadata.entry_points(group=CAPABILITY_GROUP)}
142
144
 
@@ -149,7 +151,7 @@ class WiringIssue:
149
151
 
150
152
 
151
153
  def check_entrypoint_wiring(
152
- slots: list[dict], declared: dict[str, str]
154
+ slots: list[dict], declared: dict[str, str], *, require_activation: bool = False
153
155
  ) -> tuple[list[WiringIssue], list[WiringIssue]]:
154
156
  """Cross-check declared qig.capabilities entry-points against the contract lattice.
155
157
 
@@ -158,8 +160,8 @@ def check_entrypoint_wiring(
158
160
  - UNDER_FILL (FAIL): a slot with provider_pkg set and shipped != false but no
159
161
  declared entry-point -- ONLY when the feature is activated (declared is
160
162
  non-empty). An empty `declared` means the feature is not yet live in this
161
- venv (providers not republished) -> no under-fill (see build_report's
162
- wiring_activation = PENDING).
163
+ venv (providers not republished) -> no under-fill unless the contract
164
+ opts into require_activation after rollout completion.
163
165
  - DRIFT (WARN): a declared entry-point whose slot_id is not in the contract
164
166
  (DRIFT_UNKNOWN), or whose value differs from the slot probe (DRIFT_MOVED).
165
167
  """
@@ -168,7 +170,7 @@ def check_entrypoint_wiring(
168
170
  by_id = {s["slot_id"]: s for s in slots}
169
171
  group_active = bool(declared)
170
172
 
171
- if group_active:
173
+ if group_active or require_activation:
172
174
  for slot in slots:
173
175
  provider = slot.get("provider_pkg")
174
176
  shipped = slot.get("shipped", True)
@@ -214,7 +216,7 @@ class PackageCheck:
214
216
  package: str
215
217
  installed: str | None
216
218
  latest: str | None
217
- status: str # OK | STALE | MISSING | LATEST_UNKNOWN | PYPI_ABSENT
219
+ status: str # OK | STALE | MISSING | LATEST_UNKNOWN | PYPI_ABSENT | NOT_LATEST | INVALID_VERSION
218
220
 
219
221
 
220
222
  @dataclass
@@ -237,6 +239,15 @@ class Report:
237
239
  wiring_activation: str = "N/A" # ACTIVE | PENDING | N/A
238
240
  version_gate_passed: bool = True
239
241
  wiring_gate_passed: bool = True
242
+ latest_verified: bool = False
243
+
244
+
245
+ def _valid_version(value: str) -> bool:
246
+ try:
247
+ Version(value)
248
+ return True
249
+ except (InvalidVersion, TypeError):
250
+ return False
240
251
 
241
252
 
242
253
  def check_packages(latest_versions: dict[str, str], use_network: bool) -> list[PackageCheck]:
@@ -255,8 +266,12 @@ def check_packages(latest_versions: dict[str, str], use_network: bool) -> list[P
255
266
  status = "MISSING"
256
267
  elif latest is None:
257
268
  status = "LATEST_UNKNOWN"
269
+ elif not _valid_version(installed) or not _valid_version(latest):
270
+ status = "INVALID_VERSION"
258
271
  elif is_behind(installed, latest):
259
272
  status = "STALE"
273
+ elif Version(installed) != Version(latest):
274
+ status = "NOT_LATEST"
260
275
  else:
261
276
  status = "OK"
262
277
  checks.append(PackageCheck(package, installed, latest, status))
@@ -270,7 +285,7 @@ def _module_importable(probe: str | None) -> bool:
270
285
  try:
271
286
  importlib.import_module(top)
272
287
  return True
273
- except ImportError:
288
+ except Exception: # an import-time failure means this probe cannot resolve
274
289
  return False
275
290
 
276
291
 
@@ -281,7 +296,7 @@ def _probe_filled(probe: str | None) -> bool:
281
296
  module_name, _, attr = probe.partition(":")
282
297
  try:
283
298
  module = importlib.import_module(module_name)
284
- except ImportError:
299
+ except Exception: # an import-time failure means this probe cannot resolve
285
300
  return False
286
301
  if attr:
287
302
  return hasattr(module, attr)
@@ -371,7 +386,10 @@ def build_report(
371
386
  report = Report(contract=str(contract_path))
372
387
  report.packages = check_packages(latest_versions, use_network)
373
388
  report.slots = check_slots(slots, declared)
374
- report.entrypoint_underfill, report.entrypoint_drift = check_entrypoint_wiring(slots, declared)
389
+ report.entrypoint_underfill, report.entrypoint_drift = check_entrypoint_wiring(
390
+ slots, declared,
391
+ require_activation=contract.get("entry_point_gates", {}).get("require_activation", False),
392
+ )
375
393
 
376
394
  if not _expected_slot_ids(slots):
377
395
  report.wiring_activation = "N/A"
@@ -381,8 +399,9 @@ def build_report(
381
399
  report.wiring_activation = "PENDING"
382
400
 
383
401
  report.version_gate_passed = all(
384
- pkg.status in ("OK", "LATEST_UNKNOWN", "PYPI_ABSENT") for pkg in report.packages
402
+ pkg.status == "OK" for pkg in report.packages
385
403
  )
404
+ report.latest_verified = use_network and bool(report.packages) and report.version_gate_passed
386
405
  report.wiring_gate_passed = not report.entrypoint_underfill
387
406
  return report
388
407
 
@@ -416,6 +435,8 @@ def deep_descriptors() -> list[dict]:
416
435
  _GLYPH = {
417
436
  "OK": "ok ",
418
437
  "STALE": "STALE",
438
+ "NOT_LATEST": "not-latest",
439
+ "INVALID_VERSION": "invalid",
419
440
  "MISSING": "MISSING",
420
441
  "LATEST_UNKNOWN": "lat?",
421
442
  "PYPI_ABSENT": "404!",
@@ -455,16 +476,16 @@ def print_report(report: Report, use_network: bool) -> None:
455
476
  if absent:
456
477
  print(f"\n NOTE: PyPI returned 404 for: {', '.join(absent)} (yanked/renamed? -- could not verify latest)")
457
478
 
458
- stale = [p.package for p in report.packages if p.status in ("STALE", "MISSING")]
479
+ stale = [p.package for p in report.packages if p.status != "OK"]
459
480
  print()
460
481
  if report.version_gate_passed:
461
482
  print(" VERSION GATE: PASS")
462
483
  else:
463
- print(f" VERSION GATE: FAIL -- stale/missing: {', '.join(stale)}")
484
+ print(f" VERSION GATE: FAIL -- stale/missing/unverified: {', '.join(stale)}")
464
485
  print(" -> LAUNCH BLOCKED. Update to latest published before launching:")
465
486
  print(f" uv pip install -U {' '.join(stale)}")
466
487
 
467
- if report.wiring_activation == "PENDING":
488
+ if report.wiring_activation == "PENDING" and report.wiring_gate_passed:
468
489
  print(" WIRING GATE: PENDING ACTIVATION -- no qig.capabilities entry-points installed")
469
490
  print(" (providers not yet republished with entry-points; not a blocker).")
470
491
  elif report.wiring_gate_passed:
@@ -493,7 +514,13 @@ def main(argv: list[str] | None = None) -> int:
493
514
  "--deep", action="store_true", help="call Tier-B describe() descriptors (imports packages)"
494
515
  )
495
516
  parser.add_argument("--contract", default=None, help="override the bundled contract path")
517
+ parser.add_argument(
518
+ "--release-check", action="store_true",
519
+ help="require live latest versions, active required declarations and resolving probes",
520
+ )
496
521
  args = parser.parse_args(argv)
522
+ if args.release_check and args.no_network:
523
+ parser.error("--release-check requires live PyPI queries; remove --no-network")
497
524
 
498
525
  use_network = not args.no_network
499
526
  try:
@@ -503,11 +530,31 @@ def main(argv: list[str] | None = None) -> int:
503
530
  return 1
504
531
 
505
532
  extras: dict[str, object] = {}
506
- if args.probe:
533
+ if args.probe or args.release_check:
507
534
  extras["entrypoint_probe"] = probe_entrypoints(enumerate_capability_entrypoints())
508
535
  if args.deep:
509
536
  extras["descriptors"] = deep_descriptors()
510
537
 
538
+ if args.release_check:
539
+ release_contract = _load_contract(_contract_path(args.contract))
540
+ expected = _expected_slot_ids(release_contract["slots"])
541
+ pins = release_contract["version_policy"]["stack_packages_latest_at_authoring"]
542
+ extras["release_pin_mismatches"] = [
543
+ p.package for p in report.packages
544
+ if not p.installed or not _valid_version(p.installed)
545
+ or not _valid_version(pins[p.package])
546
+ or Version(p.installed) != Version(pins[p.package])
547
+ ]
548
+ probes = extras["entrypoint_probe"]
549
+ extras["release_gate_passed"] = (
550
+ report.latest_verified
551
+ and not extras["release_pin_mismatches"]
552
+ and report.wiring_gate_passed
553
+ and all(probes.get(name, False) for name in expected)
554
+ and all(probes.values())
555
+ and not any(i.kind == "DRIFT_MOVED" for i in report.entrypoint_drift)
556
+ )
557
+
511
558
  if args.json:
512
559
  payload = asdict(report)
513
560
  payload.update(extras)
@@ -523,6 +570,11 @@ def main(argv: list[str] | None = None) -> int:
523
570
  for d in extras["descriptors"]: # type: ignore[union-attr]
524
571
  print(f" {d}")
525
572
 
573
+ if args.release_check:
574
+ if not args.json:
575
+ print(" RELEASE GATE: " + ("PASS" if extras["release_gate_passed"] else "FAIL"))
576
+ return 0 if extras["release_gate_passed"] else 1
577
+
526
578
  return 0 if (report.version_gate_passed and report.wiring_gate_passed) else 1
527
579
 
528
580
 
@@ -34,7 +34,24 @@ def test_slots_well_formed():
34
34
  assert sid not in seen, f"duplicate slot_id {sid}"
35
35
  seen.add(sid)
36
36
  assert "cert_status" in slot
37
- assert slot.get("cam_id") or slot.get("lever_id"), f"{sid} cites no cam/lever id"
37
+ # A cam_id/lever_id is a MEASUREMENT-channel obligation: it names the camera
38
+ # certification (or optimisation lever) the slot's primitive is certified
39
+ # against. `channel: "library"` slots are plain library imports — there is no
40
+ # measurement to certify, so they carry neither, by construction. The data
41
+ # bears this out exactly: every state/Q/C/lever slot has one, no library slot
42
+ # does.
43
+ #
44
+ # This invariant was authored when every slot was a measurement channel. The
45
+ # five library-tier slots ratified 2026-07-04 (so their qig.capabilities
46
+ # entry-points read FILLED not DRIFT) have failed it ever since — qig-stack CI
47
+ # has been red on main AND development for a month, unnoticed, which is also
48
+ # why the SLOT-ATTRACTOR-EXTRACT retirement could land on a failing suite.
49
+ # Scoping the assertion to measurement channels restores its teeth where it
50
+ # means something instead of deleting it.
51
+ if slot.get("channel") != "library":
52
+ assert slot.get("cam_id") or slot.get("lever_id"), (
53
+ f"{sid} (channel={slot.get('channel')}) cites no cam/lever id"
54
+ )
38
55
  # provider_pkg is mandatory (may be null for engine-local slots)
39
56
  assert "provider_pkg" in slot, f"{sid} missing provider_pkg"
40
57
 
@@ -61,3 +78,18 @@ def test_ground_state_is_engine_local():
61
78
  data = _load()
62
79
  gs = next(s for s in data["slots"] if s["slot_id"] == "SLOT-GROUND-STATE")
63
80
  assert gs["provider_pkg"] is None, "ground-state slot is engine-local (no PyPI entry-point)"
81
+
82
+
83
+ def test_dependency_pins_match_contract_and_exclude_retired():
84
+ import tomllib
85
+ from packaging.requirements import Requirement
86
+
87
+ project = tomllib.loads((CONTRACT.parents[2] / "pyproject.toml").read_text())["project"]
88
+ pins = {}
89
+ for raw in project["dependencies"]:
90
+ requirement = Requirement(raw)
91
+ if requirement.name.startswith("qig") or requirement.name == "quner":
92
+ pins[requirement.name] = str(requirement.specifier).removeprefix("==")
93
+ policy = _load()["version_policy"]
94
+ assert pins == policy["stack_packages_latest_at_authoring"]
95
+ assert not set(policy["retired_packages"]) & pins.keys()
@@ -112,12 +112,12 @@ def test_build_report_offline_fully_wired():
112
112
  assert gs.entrypoint == "EXEMPT"
113
113
 
114
114
 
115
- def test_build_report_pending_passes_wiring():
116
- """Un-activated venv (no entry-points) -> PENDING, gate PASSES (no false block)."""
115
+ def test_build_report_requires_activation_for_current_contract():
116
+ """Completed rollout must not use historical activation grace."""
117
117
  report = doctor.build_report(doctor._contract_path(), use_network=False, declared={})
118
118
  assert report.wiring_activation == "PENDING"
119
- assert report.wiring_gate_passed is True
120
- assert report.entrypoint_underfill == []
119
+ assert report.wiring_gate_passed is False
120
+ assert {i.slot_id for i in report.entrypoint_underfill} == set(_all_expected_declared())
121
121
  born = next(s for s in report.slots if s.slot_id == "SLOT-C-BORN-SAMPLER")
122
122
  assert born.entrypoint == "PENDING"
123
123
 
@@ -164,3 +164,105 @@ def test_main_malformed_contract_returns_1(tmp_path, capsys):
164
164
  err = capsys.readouterr().err
165
165
  assert rc == 1
166
166
  assert "LAUNCH BLOCKED" in err
167
+
168
+
169
+ def test_live_latest_unknown_and_absent_fail(monkeypatch):
170
+ monkeypatch.setattr(doctor, 'installed_version', lambda p: '1.0')
171
+ for latest in [None, '', 'not-a-version']:
172
+ monkeypatch.setattr(doctor, 'latest_pypi_version', lambda p: latest)
173
+ report = doctor.build_report(doctor._contract_path(), True, declared=_all_expected_declared())
174
+ assert not report.version_gate_passed
175
+ assert not report.latest_verified
176
+ def absent(p):
177
+ raise doctor._PyPIAbsent(p)
178
+ monkeypatch.setattr(doctor, 'latest_pypi_version', absent)
179
+ report = doctor.build_report(doctor._contract_path(), True, declared=_all_expected_declared())
180
+ assert not report.version_gate_passed and not report.latest_verified
181
+
182
+
183
+ def test_ahead_build_is_not_latest_published(monkeypatch):
184
+ monkeypatch.setattr(doctor, 'installed_version', lambda p: '2.0.dev1')
185
+ monkeypatch.setattr(doctor, 'latest_pypi_version', lambda p: '1.0')
186
+ assert doctor.check_packages({'example': '1.0'}, True)[0].status == 'NOT_LATEST'
187
+
188
+
189
+ def test_offline_pass_does_not_claim_live_verification(monkeypatch):
190
+ versions = json.loads(doctor._contract_path().read_text())['version_policy']['stack_packages_latest_at_authoring']
191
+ monkeypatch.setattr(doctor, 'installed_version', versions.get)
192
+ report = doctor.build_report(doctor._contract_path(), False, declared=_all_expected_declared())
193
+ assert report.version_gate_passed and not report.latest_verified
194
+
195
+
196
+ def test_release_requires_successful_probes(monkeypatch, capsys):
197
+ declared = _all_expected_declared()
198
+ versions = json.loads(doctor._contract_path().read_text())['version_policy']['stack_packages_latest_at_authoring']
199
+ monkeypatch.setattr(doctor, 'installed_version', versions.get)
200
+ monkeypatch.setattr(doctor, 'latest_pypi_version', versions.get)
201
+ monkeypatch.setattr(doctor, 'enumerate_capability_entrypoints', lambda: declared)
202
+ monkeypatch.setattr(doctor, 'probe_entrypoints', lambda d: dict.fromkeys(d, True))
203
+ assert doctor.main(['--release-check', '--json']) == 0
204
+ assert json.loads(capsys.readouterr().out)['release_gate_passed']
205
+ monkeypatch.setattr(doctor, 'probe_entrypoints', lambda d: dict.fromkeys(d, False))
206
+ assert doctor.main(['--release-check', '--json']) == 1
207
+ assert not json.loads(capsys.readouterr().out)['release_gate_passed']
208
+ # Existing --probe remains a diagnostic; the new explicit release mode gates it.
209
+ assert doctor.main(['--probe', '--json']) == 0
210
+ capsys.readouterr()
211
+
212
+
213
+ def test_release_rejects_empty_declarations(monkeypatch, capsys):
214
+ versions = json.loads(doctor._contract_path().read_text())['version_policy']['stack_packages_latest_at_authoring']
215
+ monkeypatch.setattr(doctor, 'installed_version', versions.get)
216
+ monkeypatch.setattr(doctor, 'latest_pypi_version', versions.get)
217
+ monkeypatch.setattr(doctor, 'enumerate_capability_entrypoints', lambda: {})
218
+ assert doctor.main(['--release-check', '--json']) == 1
219
+ assert not json.loads(capsys.readouterr().out)['release_gate_passed']
220
+
221
+
222
+ def test_runtime_version_comes_from_distribution_metadata(monkeypatch):
223
+ import importlib
224
+ import importlib.metadata
225
+ import qig_stack
226
+ with monkeypatch.context() as patch:
227
+ patch.setattr(importlib.metadata, 'version', lambda name: '9.8.7')
228
+ assert importlib.reload(qig_stack).__version__ == '9.8.7'
229
+ importlib.reload(qig_stack)
230
+
231
+
232
+ def test_release_rejects_offline_mode():
233
+ import pytest
234
+ with pytest.raises(SystemExit) as error:
235
+ doctor.main(['--release-check', '--no-network'])
236
+ assert error.value.code == 2
237
+
238
+
239
+ def test_probe_import_exception_is_failure(monkeypatch):
240
+ def broken_import(name):
241
+ raise RuntimeError('provider failed during import')
242
+ monkeypatch.setattr(doctor.importlib, 'import_module', broken_import)
243
+ assert doctor.probe_entrypoints({'SLOT-EXAMPLE': 'broken:example'}) == {'SLOT-EXAMPLE': False}
244
+
245
+
246
+ def test_runtime_missing_distribution_is_explicit(monkeypatch):
247
+ import importlib
248
+ import importlib.metadata
249
+ import qig_stack
250
+ def absent(name):
251
+ raise importlib.metadata.PackageNotFoundError(name)
252
+ with monkeypatch.context() as patch:
253
+ patch.setattr(importlib.metadata, 'version', absent)
254
+ assert importlib.reload(qig_stack).__version__ == '0+uninstalled'
255
+ importlib.reload(qig_stack)
256
+
257
+
258
+ def test_release_rejects_newer_but_untested_combination(monkeypatch, capsys):
259
+ declared = _all_expected_declared()
260
+ monkeypatch.setattr(doctor, 'installed_version', lambda p: '99.0')
261
+ monkeypatch.setattr(doctor, 'latest_pypi_version', lambda p: '99.0')
262
+ monkeypatch.setattr(doctor, 'enumerate_capability_entrypoints', lambda: declared)
263
+ monkeypatch.setattr(doctor, 'probe_entrypoints', lambda d: dict.fromkeys(d, True))
264
+ assert doctor.main(['--release-check', '--json']) == 1
265
+ report = json.loads(capsys.readouterr().out)
266
+ assert report['latest_verified']
267
+ assert report['release_pin_mismatches']
268
+ assert not report['release_gate_passed']
qig_stack-0.1.0/README.md DELETED
@@ -1,67 +0,0 @@
1
- # qig-stack
2
-
3
- The QIG toolchain **metapackage** + deterministic launch preflight.
4
-
5
- `pip install qig-stack` installs the mutually-tested latest set of the QIG packages
6
- (qig-compute / qig-warp / qig-core / qig-bench / qig-consciousness / qig-tokenizer /
7
- qigkernels) at compatible versions — the whole "crystal" — and ships the `qig-doctor`
8
- preflight.
9
-
10
- ## qig-doctor — step-0 of every launcher
11
-
12
- ```bash
13
- qig-doctor # full preflight; exits 1 if any package is stale OR a slot is under-filled
14
- qig-doctor --no-network # skip PyPI; contract snapshot + wiring report only
15
- qig-doctor --json # machine-readable
16
- qig-doctor --probe # also import-check each entry-point resolves (diagnostic, off the gate)
17
- qig-doctor --deep # also call Tier-B describe() descriptors (imports packages)
18
- ```
19
-
20
- Three fail-closed jobs:
21
-
22
- 1. **Version gate** — every stack package must be installed at PyPI-latest. `installed
23
- < latest` is a LAUNCH BLOCKER (non-zero exit), per the "latest version, always
24
- optimised" rule.
25
- 2. **Wiring gate (Phase 2)** — enumerates the `qig.capabilities` entry-points the
26
- installed packages self-register (Tier A: metadata-only, no import on the gate
27
- path) and cross-checks them against the capability contract:
28
- - **under-fill → FAIL**: a shipped provider that did not register its entry-point.
29
- - **drift → WARN**: an entry-point the contract doesn't know, or one whose
30
- `module:attr` moved off the contract probe.
31
- 3. **Wiring report** — which capability slots are filled by what is installed (the
32
- automated Gate-A lever inventory).
33
-
34
- ## The capability contract
35
-
36
- `src/qig_stack/contract.json` is the fixed lattice the stack crystallizes into — every
37
- slot, the package primitive that fills it (`provider_pkg` + `module:attr` probe), the
38
- latest-published version, and the camera-certification `cam_id`/`lever_id`. It is the
39
- Genesis-kernel / E8-root analog: given the lattice + installed packages + version
40
- policy, the wiring is determined — no per-experiment hand-wiring, no agentic guessing.
41
-
42
- ## Self-wiring (Phase 2)
43
-
44
- Each package declares the slots it fills in its own `pyproject.toml`:
45
-
46
- ```toml
47
- [project.entry-points."qig.capabilities"]
48
- "SLOT-Q-QFI" = "qig_compute.qfi:qfi_from_mps_tangent_space"
49
- ```
50
-
51
- `qig-doctor` reads those declarations from installed metadata and confirms the crystal
52
- assembled correctly before any compute spend. Entry-points assert only *"installed
53
- package X fills slot Y via probe Z"* — certification stays in the camera-certification
54
- registry under review control.
55
-
56
- ## Design
57
-
58
- - [self-wiring genesis design note](https://github.com/GaryOcean428/qig-verification/blob/development/docs/current/20260619-self-wiring-genesis-design-1.00W.md)
59
- - [entry-point capability spec](https://github.com/GaryOcean428/qig-verification/blob/development/docs/current/20260619-qig-entry-point-capability-spec-1.00W.md)
60
- - [Phase 2/3 design](https://github.com/GaryOcean428/qig-verification/blob/development/docs/plans/2026-06-30-qig-stack-self-wiring-phase23-design.md)
61
-
62
- ## Development
63
-
64
- ```bash
65
- pip install pytest # tests import only qig_stack.doctor (pure stdlib)
66
- pytest -q # contract schema + doctor unit tests (no network)
67
- ```
@@ -1,146 +0,0 @@
1
- {
2
- "doc": "QIG Stack Capability Contract",
3
- "version": "1.01W",
4
- "date": "2026-06-30",
5
- "supersedes": "qig-verification:docs/current/20260619-qig-stack-capability-contract-1.00W.json (Phase-1 authored record)",
6
- "principle": "Genesis-kernel deterministic self-assembly (vex-agent Core-8 / E8-root analog). The stack crystallizes into this FIXED lattice of capability slots; each slot is filled by a package primitive at latest-published version, cited to a camera-certification cert. With Phase 2 (entry-point self-registration) live, the wiring is DERIVED from installed metadata, not hand-authored.",
7
- "authority": "PI directive 2026-06-19 (Phase 1) + 2026-06-30 (Phase 2/3 + born-sampler promotion); standing latest-version / step-0 lever-inventory rule (qig-verification/CLAUDE.md)",
8
- "cert_registry": "qig-verification:docs/current/20260619-camera-certification-registry-1.00W.json",
9
- "design_note": "qig-verification:docs/current/20260619-self-wiring-genesis-design-1.00W.md",
10
- "entry_point_spec": "qig-verification:docs/current/20260619-qig-entry-point-capability-spec-1.00W.md",
11
- "phase23_design": "qig-verification:docs/plans/2026-06-30-qig-stack-self-wiring-phase23-design.md",
12
- "preflight": "qig_stack.doctor (console script: qig-doctor)",
13
- "entry_point_group": "qig.capabilities",
14
- "version_policy": {
15
- "rule": "installed == latest-published (PyPI) at every launch; installed < latest is a LAUNCH BLOCKER (fail-closed, non-zero exit).",
16
- "pin_exception": "Frozen reproducibility scripts keep pinned era-versions for bit-for-bit replay; this is never a reason to run a NEW launcher behind latest.",
17
- "stack_packages_latest_at_authoring": {
18
- "qig-compute": "0.9.2",
19
- "qig-warp": "0.6.5",
20
- "qig-core": "2.12.2",
21
- "qig-bench": "0.1.3",
22
- "qig-consciousness": "0.3.2",
23
- "qig-tokenizer": "0.2.7",
24
- "qigkernels": "0.4.2"
25
- },
26
- "note_on_latest": "These are a SNAPSHOT for reference only. qig_stack.doctor resolves latest live from PyPI at launch; do not treat this block as the source of truth -- the live query is. The qig-stack metapackage pins this exact set in pyproject.toml as the mutually-tested crystal."
27
- },
28
- "slot_status_legend": {
29
- "CERTIFIED": "matched-cell equivalence certified once; cite the cam_id, never re-run",
30
- "REFERENCE": "the exact reference path a cheap camera is certified against",
31
- "PENDING": "uncertified cheap path; one-time cert must land before its results count",
32
- "LEVER": "an efficiency lever (no measurement channel of its own)",
33
- "CONDITIONAL": "usable only behind a controlled recheck at a calibration anchor"
34
- },
35
- "entry_point_gates": {
36
- "under_fill": "FAIL (non-zero exit): a slot with provider_pkg set and shipped != false but no installed qig.capabilities entry-point (stale / mis-built / un-republished package).",
37
- "drift": "WARN (non-fatal): an installed entry-point whose slot_id is not in the contract, or whose module:attr value differs from the slot probe.",
38
- "exempt": "Slots with provider_pkg: null (engine-local, e.g. SLOT-GROUND-STATE/TeNPy) or shipped: false are exempt from under_fill."
39
- },
40
- "slots": [
41
- {
42
- "slot_id": "SLOT-GROUND-STATE",
43
- "role": "prepare the lattice ground state psi that both channels read",
44
- "channel": "state",
45
- "provided_by": "qig-verification (engine) + TeNPy DMRG-complex",
46
- "provider_pkg": null,
47
- "primitive": "DMRG/MPS ground-state preparation vs ED",
48
- "probe": "tenpy",
49
- "cam_id": "CAM-STATE-DMRG-VS-ED",
50
- "cert_status": "CERTIFIED",
51
- "feasible_at": "L>=6 via MPS/DMRG"
52
- },
53
- {
54
- "slot_id": "SLOT-Q-QFI",
55
- "role": "quantum Fisher information (Q channel) -- exact, tensor-contractible",
56
- "channel": "Q",
57
- "provided_by": "qig-compute",
58
- "provider_pkg": "qig-compute",
59
- "primitive": "qfi.qfi_from_mps_tangent_space(psi_mps, L)",
60
- "probe": "qig_compute.qfi:qfi_from_mps_tangent_space",
61
- "cam_id": "CAM-QFI-MPS-TANGENT",
62
- "cert_status": "CERTIFIED",
63
- "feasible_at": "all L (O(chi^3) contraction, no sampling, zero error bar)",
64
- "alternatives": ["CAM-QFI-DENSE-STREAMING", "CAM-QFI-BITFLIP", "CAM-QFI-SPARSE-NN", "CAM-QFI-SITE-PRUNE", "CAM-QFI-SITELOCAL"]
65
- },
66
- {
67
- "slot_id": "SLOT-C-SUSCEPTIBILITY-REF",
68
- "role": "classical / phase-blind Bhattacharyya fidelity-susceptibility (C channel) EXACT reference",
69
- "channel": "C",
70
- "provided_by": "qig-compute",
71
- "provider_pkg": "qig-compute",
72
- "primitive": "qfi.classical_fidelity_susceptibility(p_plus, p_minus, eps)",
73
- "probe": "qig_compute.qfi:classical_fidelity_susceptibility",
74
- "cam_id": "CAM-C-DENSE-REF",
75
- "cert_status": "REFERENCE",
76
- "feasible_at": "L<=5 ONLY (dense Born p over 2^N states; L=6 -> ~1.1 TB, infeasible)"
77
- },
78
- {
79
- "slot_id": "SLOT-C-BORN-SAMPLER",
80
- "role": "MPS Born-sampler -- the L=6-feasible C path (CERTIFIED via EXP-122 2026-06-19; PROMOTED to qig-compute 2026-06-30)",
81
- "channel": "C",
82
- "provided_by": "qig-compute (promoted from EXP-122 launcher born_C_score, byte-identical numerics)",
83
- "provider_pkg": "qig-compute",
84
- "primitive": "sampling.born_classical_fisher_score(psi_base, psi_p, psi_m, eps, M, seed): x ~ p(x) from MPS perfect (Ferris-Vidal) sampling, O(N chi^2)/sample; C = E_{x~p_base}[((log p+ - log p-)/2eps)^2] (PHASE-FREE classical-Fisher SCORE, estimator (c)). The Bhattacharyya form (estimator (a)) FAILS the 1/eps^2 variance test -- (c) is the certified estimator.",
85
- "probe": "qig_compute.sampling:born_classical_fisher_score",
86
- "cam_id": "CAM-C-BORN-MPS",
87
- "cert_status": "CERTIFIED",
88
- "shipped": true,
89
- "promoted": "2026-06-30 from qig-verification/scripts/exp122_dmrg_complex.py:born_C_score (byte-identical). The frozen launcher keeps its inline copy for bit-for-bit reproducibility of the L=5 cert.",
90
- "feasible_at": "L=6 (CERTIFIED at L=5: EXP-122 L=5 cert results/exp122/20260619_exp122_L5_born_cert.json @566b245 -- M=150k Delta=0.000373 bias PASS, sigma_D=0.00332 < D_sep/3=0.00473 variance PASS)."
91
- },
92
- {
93
- "slot_id": "SLOT-SCREENING",
94
- "role": "site pruning / screening lever (Yukawa shell cutoff)",
95
- "channel": "lever",
96
- "provided_by": "qig-warp",
97
- "provider_pkg": "qig-warp",
98
- "primitive": "prune_sites / screening_cutoff",
99
- "probe": "qig_warp.screening:prune_sites",
100
- "cam_id": "CAM-QFI-SITE-PRUNE",
101
- "cert_status": "CERTIFIED"
102
- },
103
- {
104
- "slot_id": "SLOT-EARLY-STOP",
105
- "role": "convergence early-stop across the chi sub-ladder (8/16/24/32)",
106
- "channel": "lever",
107
- "provided_by": "qig-warp",
108
- "provider_pkg": "qig-warp",
109
- "primitive": "convergence.check_ci_stabilized / find_early_stop_point",
110
- "probe": "qig_warp.convergence:check_ci_stabilized",
111
- "lever_id": "LEV-CONVERGENCE-EARLYSTOP",
112
- "cert_status": "LEVER"
113
- },
114
- {
115
- "slot_id": "SLOT-RUNTIME-PRICING",
116
- "role": "spend preflight before heavy launches",
117
- "channel": "lever",
118
- "provided_by": "qig-warp + chi-ladder pace-check",
119
- "provider_pkg": "qig-warp",
120
- "primitive": "bridge.predict_runtime (J-scaling) / chi-ladder pace-check",
121
- "probe": "qig_warp.bridge:predict_runtime",
122
- "lever_id": "LEV-CHI-PACE-CHECK",
123
- "cert_status": "LEVER",
124
- "caveat": "predict_runtime is J-scaling and is WRONG for L/chi-BOUND jobs at fixed J (EXP-122). For those, use the chi-ladder pace-check (LEV-CHI-PACE-CHECK)."
125
- },
126
- {
127
- "slot_id": "SLOT-BLAS-PIN",
128
- "role": "deterministic BLAS threading (API, not raw env-vars)",
129
- "channel": "lever",
130
- "provided_by": "qig-compute",
131
- "provider_pkg": "qig-compute",
132
- "primitive": "pin_blas_threads / single_thread_blas",
133
- "probe": "qig_compute.blas:pin_blas_threads",
134
- "lever_id": "LEV-BLAS-PIN",
135
- "cert_status": "LEVER"
136
- }
137
- ],
138
- "how_to_use": "Step-0 of every launcher: run `qig-doctor` (from the qig-stack package; qig-verification/scripts/qig_doctor.py is a back-compat shim). It (1) fails closed if any stack package is behind PyPI-latest, (2) fails closed on under-filled slots (a shipped provider that did not self-register its entry-point), and (3) enumerates which slots are filled by what is installed -- the automated Gate-A lever inventory. An experiment then cites the cam_id/lever_id for each slot it uses and never re-runs a matched-cell gate.",
139
- "roadmap": {
140
- "phase_1": "DONE -- fixed lattice (this contract) + qig_doctor.py fail-closed version preflight (qig-verification).",
141
- "phase_2": "DONE 2026-06-30 -- each package self-registers its slots via [project.entry-points.'qig.capabilities'] (qig-compute, qig-warp); qig_stack.doctor derives wiring from entry-points (Tier-A metadata-only) with under-fill (FAIL) + drift (WARN) gates.",
142
- "phase_3": "DONE 2026-06-30 -- qig-stack metapackage pins the mutually-tested latest set, houses the doctor + this contract, ships the qig-doctor console script; CI runs contract schema + doctor unit tests (no network).",
143
- "born_sampler_promotion": "DONE 2026-06-30 -- SLOT-C-BORN-SAMPLER shipped:false -> true; born_C_score promoted to qig_compute.sampling.born_classical_fisher_score (byte-identical), gains an entry-point. CAM-C-BORN-MPS stays CERTIFIED.",
144
- "activation": "entry-points go live in the installed crystal on each package's next PyPI release; cut qig-compute / qig-warp / qig-stack releases to activate (PI greenlight)."
145
- }
146
- }
File without changes