Skip to content

feat(research): add Prime-OAB reciprocal Hypercube V13 - #77

Open
ProCityHub wants to merge 2 commits into
mainfrom
feature/prime-oab-reciprocal-v13-20260726T163802Z
Open

feat(research): add Prime-OAB reciprocal Hypercube V13#77
ProCityHub wants to merge 2 commits into
mainfrom
feature/prime-oab-reciprocal-v13-20260726T163802Z

Conversation

@ProCityHub

@ProCityHub ProCityHub commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the GARVIS Prime-OAB Reciprocal Hypercube V13 research implementation.

This converts the Hypercube Heartbeat / Prime Lattice / OAB research program into repository-native, testable code and preserves the associated QASM experiment history and IBM evidence metadata.

Creator / conceptual architect: Adrien D. Thomas (ProCityHub/GARVIS).

Architecture

The research model represents recurrence as:

experience -> Heartbeat -> OAB retention -> reciprocal return -> changed next state

The canonical nine-phase Heartbeat remains:

RECEIVE -> SEGMENT -> PREDICT -> VERIFY -> SIMULATE -> PLAN -> OUTPUT -> FEEDBACK -> CONSOLIDATE

The two-way Heartbeat mirror is:

RECEIVE <-> CONSOLIDATE
SEGMENT <-> FEEDBACK
PREDICT <-> OUTPUT
VERIFY <-> PLAN
SIMULATE <-> SIMULATE

Prime Lattice topology remains ordinal-controlled:

corner = n mod 8
wall = floor(n / 8) mod 6
polarity = floor(n / 48) mod 2
epoch = floor(n / 96)

One epoch contains 96 unique addresses.

Prime values identify nodes; prime ordinals control topology.

New code

  • src/garvis/prime_oab_reciprocal.py

    • Heartbeat phase model
    • OAB wrap and reciprocal ordering
    • 96-address Prime Lattice
    • lattice antipodes
    • first 96 prime identities
    • prime gaps
    • finite Prime Mirror Defect field
    • nine-channel OAB role vectors
  • src/garvis/prime_oab_evidence.py

    • read-only IBM Executor result archive parsing
    • measurement counts
    • entropy
    • marginals
    • bit agreement
    • mutual information

Research assets

Preserves QASM V4 through V12, including:

  • phase/interference experiments
  • controlled evidence experiments
  • closed-loop OAB experiments
  • mirror-loop experiments
  • 100-qubit full Prime-Lattice epoch
  • 128-qubit two-way mirror experiments
  • 128-qubit hardware-aware Prime Mirror Field
  • 5-qubit runnable hardware twin

IBM workload results are stored only as derived research metadata.

No credentials or live IBM execution code are included.

Validation

Focused tests:

11 passed

Full GARVIS suite:

521 passed, 3 subtests passed

Package security/governance review:

  • network surface absent
  • process execution absent
  • dynamic code execution absent
  • credential handling absent
  • live IBM execution absent
  • hard-coded secret scan passed
  • JSON validation passed
  • 10 QASM files scanned
  • QASM register bounds passed
  • QASM self-two-qubit gate check passed
  • QASM manifest hashes passed
  • Python compile passed
  • repository governance guard passed
  • source-tree mutation none

Scientific boundary

This PR does not claim AGI, consciousness, singularity, or a universal physical law.

The retracted scalar-PHI Lattice decision formula is excluded from executable decision logic.

Prime Mirror Defect is treated only as an exact property of the finite 96-prime experimental window, not as a universal number-theory law.

Evidence outranks theory.

Governance

This PR contains research/prototype code and evidence only.

PR creation is authorized.

Merge and deployment require separate explicit approval.

Summary by CodeRabbit

  • New Features

    • Added deterministic research utilities for phase mapping, prime-lattice addressing, reciprocal roles, mirror behavior, and defect analysis.
    • Added read-only analysis of quantum evidence archives, including outcome statistics, bit marginals, agreement, and mutual information.
    • Added runnable quantum research circuits ranging from 5 to 128 qubits.
  • Documentation

    • Added architecture, reproducibility, governance, evidence-history, and artifact-integrity documentation.
  • Tests

    • Added coverage for evidence decoding and core mathematical invariants.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ProCityHub, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: db081304-119c-489c-ad7e-153c3afade85

📥 Commits

Reviewing files that changed from the base of the PR and between a39acb9 and 107a59b.

📒 Files selected for processing (1)
  • tests/garvis/test_prime_oab_reciprocal.py
📝 Walkthrough

Walkthrough

The PR adds Prime-OAB reciprocal-hypercube documentation, deterministic Python primitives, read-only IBM evidence analysis, quantum circuit history, artifact manifests, and tests covering mathematical invariants and evidence decoding.

Changes

Prime-OAB research package

Layer / File(s) Summary
Research contract and artifact inventory
docs/research/PRIME_OAB_RECIPROCAL_HYPERCUBE.md, research/quantum/prime_oab/README.md, research/quantum/prime_oab/*.json
Documents the architecture, governance constraints, historical workload evidence, and pinned QASM artifact inventory.
Reciprocal lattice primitives
src/garvis/prime_oab_reciprocal.py, tests/garvis/test_prime_oab_reciprocal.py
Adds phase transforms, role vectors, OAB capsules, prime-lattice mappings, mirror defects, arithmetic claims, and invariant tests.
Executor evidence decoding
src/garvis/prime_oab_evidence.py, tests/garvis/test_prime_oab_evidence.py
Adds validated ZIP parsing, IBM packed-bit decoding, outcome statistics, pairwise metrics, serialization, and parser tests.
Heartbeat and closed-loop circuits
research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_*
Adds OpenQASM heartbeat, phase-schedule, interference, controlled, closed-loop, and full-epoch experiments with witness measurements.
Two-way mirror circuits
research/quantum/prime_oab/qasm/GARVIS_*MIRROR*
Adds reversible two-pass, prime-mirror, Q-sphere, and 128-qubit two-way mirror circuits with OAB transfers and return-path measurements.

Estimated code review effort: 5 (Critical) | ~120 minutes

Poem

I’m a rabbit hopping through gates,
Mirroring paths through quantum states.
Prime trails sparkle, witnesses hum,
Evidence waits when circuits run.
With carrots stored, the tests all cheer—
A tidy research trail appears!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main change: adding the Prime-OAB Reciprocal Hypercube V13 research implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/prime-oab-reciprocal-v13-20260726T163802Z

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (3)
src/garvis/prime_oab_reciprocal.py (1)

387-424: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

__all__ isn't sorted per Ruff RUF022.

Static analysis flags this list as unsorted (e.g. POLARITIES sorts after PhasePoint, WALLS after lowercase entries, when using case-insensitive natural ordering).

Run ruff check --fix to auto-sort, or reorder manually to satisfy RUF022.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/garvis/prime_oab_reciprocal.py` around lines 387 - 424, Reorder the
exported names in __all__ using Ruff RUF022’s case-insensitive natural ordering,
including placing uppercase symbols such as POLARITIES and WALLS according to
that ordering. Preserve every existing export without adding or removing names.

Source: Linters/SAST tools

tests/garvis/test_prime_oab_reciprocal.py (1)

1-111: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No error-path coverage for the module's validation logic.

pytest is imported but pytest.raises is never used. The module raises PrimeOABError in many places (invalid phase index, negative ordinal, malformed RoleVector, out-of-range prime/defect, etc.), but none of these paths are tested here, so a regression in validation logic would go unnoticed.

def test_invalid_phase_index_raises():
    with pytest.raises(PrimeOABError):
        mirror_phase_index(9)


def test_role_vector_rejects_wrong_length():
    with pytest.raises(PrimeOABError):
        RoleVector((0.0,) * 8)


def test_role_vector_rejects_out_of_bounds_value():
    with pytest.raises(PrimeOABError):
        RoleVector((1.5,) + (0.0,) * 8)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/garvis/test_prime_oab_reciprocal.py` around lines 1 - 111, Add
validation error-path coverage to the test module by importing PrimeOABError and
adding pytest.raises cases for invalid phase indices via mirror_phase_index,
malformed RoleVector lengths, and out-of-bounds RoleVector values. Include
representative invalid ordinal, prime, or defect inputs if those validation
entry points are exposed, while preserving the existing valid-behavior tests.
tests/garvis/test_prime_oab_evidence.py (1)

19-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add negative-path test coverage for QuantumEvidenceError.

Only the happy path is tested. prime_oab_evidence.py raises QuantumEvidenceError in several places (malformed base64, bad/missing shape, ambiguous classical register, wrong file counts in the ZIP, missing archive) that aren't covered here, leaving those validation branches unverified.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/garvis/test_prime_oab_evidence.py` around lines 19 - 58, Add
negative-path tests covering QuantumEvidenceError from analyze_executor_zip and
related evidence parsing: malformed base64, missing or invalid shape, ambiguous
classical registers, incorrect ZIP file counts, and a missing archive. Assert
each scenario raises QuantumEvidenceError while retaining the existing
happy-path test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/research/PRIME_OAB_RECIPROCAL_HYPERCUBE.md`:
- Around line 125-127: Update the description of the V12 5Q runnable twin to
replace “clean real-QPU signal” with the recorded execution metrics from the
supplied evidence, or define an objective, reproducible acceptance criterion for
that result.
- Around line 143-151: Update the filesystem-safety bullet in the inward-only
guarantees section to state unambiguously that there are no filesystem writes
and that only explicit caller-directed file reading is permitted, without
changing the other guarantees.

In `@research/quantum/prime_oab/codepack_manifest.json`:
- Around line 84-92: Remove generated __pycache__/*.pyc and .pytest_cache
entries from codepack_manifest.json, then regenerate the manifest so it contains
only reproducible research inputs. Apply this to all matching entries, including
the adjacent manifest records.

In `@research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_CLOSED_LOOP_V8.qasm`:
- Around line 83-86: Update the q36 probe sequence by adding a closing Hadamard
gate after its final use as a CNOT target, matching the witness-probe pattern
used for q17 and q18. Ensure q36 is closed before measurement so its result
carries the phase information from q27.

In
`@research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm`:
- Around line 415-417: Replace the ambiguous “001 (LSB first)” parity wording in
research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm
lines 415-417 and its duplicate at line 78 with the explicit role-ordered triple
(q21,q22,q23) = (1,0,0). Apply the equivalent [1,0,0] wording to
research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_EVIDENCE_V6.qasm
lines 493-495, then regenerate the sha256 hashes and byte counts for both edited
files in research/quantum/prime_oab/qasm/manifest.json and
research/quantum/prime_oab/codepack_manifest.json.

In `@src/garvis/prime_oab_evidence.py`:
- Around line 24-34: Make ExecutorEvidence.counts truly immutable by storing a
read-only mapping rather than the plain dict currently created with
dict(counter). Update the construction path around the ExecutorEvidence creation
to wrap the counter in the project’s appropriate immutable/read-only mapping
type, preserving the Mapping[str, int] interface and ensuring archived evidence
cannot be mutated in place.

In `@src/garvis/prime_oab_reciprocal.py`:
- Around line 314-321: Update prime_coordinate to validate that prime is an
element of the values returned by first_epoch_primes(), raising PrimeOABError
for any in-range composite or otherwise non-epoch value before calculating the
coordinate. Preserve the existing boundary error behavior and normalization for
valid epoch primes.

---

Nitpick comments:
In `@src/garvis/prime_oab_reciprocal.py`:
- Around line 387-424: Reorder the exported names in __all__ using Ruff RUF022’s
case-insensitive natural ordering, including placing uppercase symbols such as
POLARITIES and WALLS according to that ordering. Preserve every existing export
without adding or removing names.

In `@tests/garvis/test_prime_oab_evidence.py`:
- Around line 19-58: Add negative-path tests covering QuantumEvidenceError from
analyze_executor_zip and related evidence parsing: malformed base64, missing or
invalid shape, ambiguous classical registers, incorrect ZIP file counts, and a
missing archive. Assert each scenario raises QuantumEvidenceError while
retaining the existing happy-path test.

In `@tests/garvis/test_prime_oab_reciprocal.py`:
- Around line 1-111: Add validation error-path coverage to the test module by
importing PrimeOABError and adding pytest.raises cases for invalid phase indices
via mirror_phase_index, malformed RoleVector lengths, and out-of-bounds
RoleVector values. Include representative invalid ordinal, prime, or defect
inputs if those validation entry points are exposed, while preserving the
existing valid-behavior tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4a222c4-dbef-415e-b6d1-c51b97e422d3

📥 Commits

Reviewing files that changed from the base of the PR and between 107470f and a39acb9.

📒 Files selected for processing (19)
  • docs/research/PRIME_OAB_RECIPROCAL_HYPERCUBE.md
  • research/quantum/prime_oab/README.md
  • research/quantum/prime_oab/codepack_manifest.json
  • research/quantum/prime_oab/evidence/ibm_fez_history.json
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_CLOSED_LOOP_V8.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_FULL_EPOCH_V10_100Q.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_CONTROLLED_V7.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_EVIDENCE_V6.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_PRIME_OAB_V4.qasm
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_MIRROR_LOOP_V9.qasm
  • research/quantum/prime_oab/qasm/GARVIS_PRIME_MIRROR_FIELD_V12_128Q_COMPOSER_SAFE.qasm
  • research/quantum/prime_oab/qasm/GARVIS_PRIME_OAB_MIRROR_QSPHERE_5Q_RUNNABLE.qasm
  • research/quantum/prime_oab/qasm/GARVIS_PRIME_OAB_TWO_WAY_MIRROR_V11_128Q_FIXED.qasm
  • research/quantum/prime_oab/qasm/manifest.json
  • src/garvis/prime_oab_evidence.py
  • src/garvis/prime_oab_reciprocal.py
  • tests/garvis/test_prime_oab_evidence.py
  • tests/garvis/test_prime_oab_reciprocal.py

Comment on lines +125 to +127
The `qasm/` directory preserves the V4-V12 progression used to develop the current
model. The current hardware-oriented design is the V12 128Q mirror field; the 5Q
runnable twin is the compressed experiment that produced a clean real-QPU signal.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Replace “clean real-QPU signal” with a reproducible statement.

The supplied evidence records execution metrics, but does not define “clean” or establish that conclusion. State the recorded V12 5Q execution metrics instead, or specify an objective acceptance criterion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/research/PRIME_OAB_RECIPROCAL_HYPERCUBE.md` around lines 125 - 127,
Update the description of the V12 5Q runnable twin to replace “clean real-QPU
signal” with the recorded execution metrics from the supplied evidence, or
define an objective, reproducible acceptance criterion for that result.

Comment on lines +143 to +151
This code is inward-only.

It has:

- no IBM credentials;
- no QPU submission code;
- no network calls;
- no filesystem writes outside explicit caller-directed file reading;
- no protected external action.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Make the read-only filesystem guarantee unambiguous.

“no filesystem writes outside explicit caller-directed file reading” mixes a write prohibition with a read exception. Use wording such as “no filesystem writes; only explicit caller-directed file reading” to match the read-only evidence module contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/research/PRIME_OAB_RECIPROCAL_HYPERCUBE.md` around lines 143 - 151,
Update the filesystem-safety bullet in the inward-only guarantees section to
state unambiguously that there are no filesystem writes and that only explicit
caller-directed file reading is permitted, without changing the other
guarantees.

Comment on lines +84 to +92
{
"path": "src/garvis/__pycache__/prime_oab_evidence.cpython-313.pyc",
"sha256": "8000648a98a351744939906ef7398070cc028fcdbb371bfd71475c5e7ca84c53",
"bytes": 12955
},
{
"path": "src/garvis/__pycache__/prime_oab_reciprocal.cpython-313.pyc",
"sha256": "1aad62cac2fd5687c581a6f88370178b3f60a6dbb3efd0ee597dd86215f7bd15",
"bytes": 18060

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Exclude generated bytecode and test caches from the codepack.

The manifest includes __pycache__/*.pyc and .pytest_cache files. These are environment-specific generated artifacts, not reproducible research inputs, and can preserve stale interpreter or test state. Remove them from packaging and regenerate the manifest.

Also applies to: 104-132

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@research/quantum/prime_oab/codepack_manifest.json` around lines 84 - 92,
Remove generated __pycache__/*.pyc and .pytest_cache entries from
codepack_manifest.json, then regenerate the manifest so it contains only
reproducible research inputs. Apply this to all matching entries, including the
adjacent manifest records.

Comment on lines +83 to +86
h q[36];
cx q[5],q[6];
cz q[3],q[6];
cx q[27],q[36];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

q36 is prepared as a Ramsey probe but never closed, so its measured bit is pure noise.

h q[36] at line 83 puts the "uncertainty branch" into |+>; lines 86 and 194 then use it as a CNOT target, which only kicks phase back onto q27. Without a closing Hadamard, q36 measures 50/50 in the Z basis and carries no information about q27. q17/q18 get their closing h at lines 245-246; q36 does not.

🔬 Proposed fix — close the probe with the other witnesses
 cx q[30],q[31];
 h q[17];
 h q[18];
+h q[36];
 barrier q;
 measure q -> c;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
h q[36];
cx q[5],q[6];
cz q[3],q[6];
cx q[27],q[36];
cx q[30],q[31];
h q[17];
h q[18];
h q[36];
barrier q;
measure q -> c;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_CLOSED_LOOP_V8.qasm` around
lines 83 - 86, Update the q36 probe sequence by adding a closing Hadamard gate
after its final use as a CNOT target, matching the witness-probe pattern used
for q17 and q18. Ensure q36 is closed before measurement so its result carries
the phase information from q27.

Comment on lines +415 to +417
// q17 expected ideally to return toward |0> because 9*(2*pi/9)=2*pi.
// q21:23 encode XOR/parity of the visited Boolean-cube coordinates.
// For C0..C7,C0,C1 the expected history parity is 001 (LSB first).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pre-registered cube-path parity is stated ambiguously in both circuits. The same expectation string was carried from V5 into V6: "001 (LSB first)" reads as bit0=0, but the visited path C0..C7,C0,C1 gives bit0=1, bit1=0, bit2=0 — i.e. (q21,q22,q23) = (1,0,0), which is what V5 line 442 and V7 line 509 already state. Converge on the explicit role-ordered triple so the preregistered target can't be read two ways.

  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm#L415-L417: replace "expected history parity is 001 (LSB first)" with (q21,q22,q23) = (1,0,0), and apply the same fix to the duplicate wording at line 78.
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_EVIDENCE_V6.qasm#L493-L495: replace "expected LSB-first parity is 001" with the same explicit [1,0,0] role-order triple used in V7.

Note both files are sha256-pinned in research/quantum/prime_oab/qasm/manifest.json and research/quantum/prime_oab/codepack_manifest.json, so any edit needs the manifest hashes and byte counts regenerated.

📍 Affects 2 files
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm#L415-L417 (this comment)
  • research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_EVIDENCE_V6.qasm#L493-L495
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm`
around lines 415 - 417, Replace the ambiguous “001 (LSB first)” parity wording
in
research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_INTERFERENCE_V5.qasm
lines 415-417 and its duplicate at line 78 with the explicit role-ordered triple
(q21,q22,q23) = (1,0,0). Apply the equivalent [1,0,0] wording to
research/quantum/prime_oab/qasm/GARVIS_HYPERCUBE_HEARTBEAT_EVIDENCE_V6.qasm
lines 493-495, then regenerate the sha256 hashes and byte counts for both edited
files in research/quantum/prime_oab/qasm/manifest.json and
research/quantum/prime_oab/codepack_manifest.json.

Comment on lines +24 to +34
@dataclass(frozen=True)
class ExecutorEvidence:
job_id: str
backend: str
status: str
shots: int
classical_bits: int
unique_outcomes: int
entropy_bits: float
counts: Mapping[str, int]
marginal_p1: Tuple[float, ...]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

counts mutable dict undermines the frozen dataclass's immutability guarantee.

ExecutorEvidence is frozen=True, but counts is stored as a plain dict (counts=dict(counter) at Line 205) typed as Mapping[str, int] (Line 33). Callers can still mutate it in place via evidence.counts[...] = ..., silently corrupting archived evidence — defeating the "immutable" design goal stated for this layer. As a corollary, since dict is unhashable, calling hash(evidence) (auto-generated by the frozen dataclass) would raise TypeError.

🔒️ Proposed fix using a read-only mapping view
+from types import MappingProxyType
...
     return ExecutorEvidence(
         job_id=str(info.get("id", "")),
         backend=str(info.get("backend", "")),
         status=str(info.get("status", "")),
         shots=shots,
         classical_bits=classical_bits,
         unique_outcomes=len(counter),
         entropy_bits=entropy,
-        counts=dict(counter),
+        counts=MappingProxyType(dict(counter)),
         marginal_p1=tuple(marginal),
     )

Also applies to: 197-207

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/garvis/prime_oab_evidence.py` around lines 24 - 34, Make
ExecutorEvidence.counts truly immutable by storing a read-only mapping rather
than the plain dict currently created with dict(counter). Update the
construction path around the ExecutorEvidence creation to wrap the counter in
the project’s appropriate immutable/read-only mapping type, preserving the
Mapping[str, int] interface and ensuring archived evidence cannot be mutated in
place.

Comment on lines +314 to +321
def prime_coordinate(prime: int) -> float:
"""Normalize a first-epoch prime identity from 2..503 into 0..1."""

values = first_epoch_primes()
if prime < values[0] or prime > values[-1]:
raise PrimeOABError("prime lies outside the first 96-prime epoch")
return (prime - values[0]) / float(values[-1] - values[0])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

prime_coordinate doesn't validate that the input is actually one of the epoch primes.

The function only checks that prime falls within [values[0], values[-1]] (i.e., [2, 503]), not that it is one of the 96 prime identities. A composite integer in range (e.g. 4) silently returns an interpolated coordinate instead of raising PrimeOABError, unlike sibling validators in this module (e.g. Line 158, Line 235, Line 318 nearby) that reject invalid inputs explicitly.

🐛 Proposed fix
 def prime_coordinate(prime: int) -> float:
     """Normalize a first-epoch prime identity from 2..503 into 0..1."""

     values = first_epoch_primes()
-    if prime < values[0] or prime > values[-1]:
-        raise PrimeOABError("prime lies outside the first 96-prime epoch")
+    if prime not in values:
+        raise PrimeOABError("value is not one of the first 96-prime epoch primes")
     return (prime - values[0]) / float(values[-1] - values[0])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def prime_coordinate(prime: int) -> float:
"""Normalize a first-epoch prime identity from 2..503 into 0..1."""
values = first_epoch_primes()
if prime < values[0] or prime > values[-1]:
raise PrimeOABError("prime lies outside the first 96-prime epoch")
return (prime - values[0]) / float(values[-1] - values[0])
def prime_coordinate(prime: int) -> float:
"""Normalize a first-epoch prime identity from 2..503 into 0..1."""
values = first_epoch_primes()
if prime not in values:
raise PrimeOABError("value is not one of the first 96-prime epoch primes")
return (prime - values[0]) / float(values[-1] - values[0])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/garvis/prime_oab_reciprocal.py` around lines 314 - 321, Update
prime_coordinate to validate that prime is an element of the values returned by
first_epoch_primes(), raising PrimeOABError for any in-range composite or
otherwise non-epoch value before calculating the coordinate. Preserve the
existing boundary error behavior and normalization for valid epoch primes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant