Skip to content

Devel - #27

Merged
ShaneLogic merged 2 commits into
mainfrom
devel
Nov 11, 2026
Merged

ShaneLogic merged 2 commits into
mainfrom
devel

Conversation

@ShaneLogic

@ShaneLogic ShaneLogic commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Summary by Sourcery

Establish the consolidated new-core development baseline with updated documentation, reproducibility contracts, and self-contained assembly validation.

New Features:

  • Add a root development guide documenting the new-core package layout, extension workflow, validation commands, and current capability boundaries.
  • Add a versioned hysteresis reference contract and preserve its superseded contract with explicit provenance and change tracking.
  • Check in a frozen 2D assembly gate fixture for platform-independent bitwise parity validation.

Bug Fixes:

  • Make 2D assembly parity tests use the checked-in frozen gate fixture by default instead of relying on an external worktree artifact.

Enhancements:

  • Update repository guidance and README documentation to distinguish the active new-core development baseline, legacy engine, and AIMC research branch.
  • Clarify supported equation assembly, transient defaults, scientific qualification status, and testing scopes across the project documentation.
  • Strengthen hysteresis reference tests to verify superseded-contract integrity and declared-only changes.

CI:

  • Update CI exclusions for the revised development and validation baseline.

Documentation:

  • Document the consolidated devel/AIMC workflow, root package setup, architecture boundaries, extension process, and evidence requirements.

Tests:

  • Add a committed 2D assembly baseline and require frozen raw-array, residual, and Jacobian parity checks across the reference states.

Chores:

  • Refresh reproducibility manifests and repository ignore/configuration guidance for the consolidated development structure.

ShaneLogic and others added 2 commits November 2, 2026 02:19
…r decision K3

On 2026-11-01 the user chose option (b) for K3: keep the hysteresis reference
originals instead of deleting them after a migration, and raise the stage
storage allowance. The V1 contract capped stage artifacts at 4 GiB. Its own
bounded-failure rule forbids an automatic larger budget, so the change is a
new contract version, not an edit of V1.

reproducibility/HysteresisReferenceContractV2.json:
- copies V1 except for these intended roots;
- replaces maximum_stage_artifacts_GiB = 4 with the exact byte cap
  maximum_stage_artifacts_bytes = 16168676163, the no-migration allowance
  from the OptionsK3 census, which includes Stage05 growth and one sentinel
  reservation;
- records 17418628839 bytes as a fixed ceiling, valid only if a separately
  reviewed migration (condition K2) later keeps its containers;
- adds supersedes and decision blocks bound to K3DecisionV1 and the user's
  verbatim record;
- moves governance from ExecutionStateV1 to ExecutionStateV2;
- bumps schema and version to v2.
Every gate, tolerance, refinement rule and other resource cap is unchanged;
that covers solves, wall budgets, RSS 8 GiB, workers and BLAS threads. V1 stays
byte-identical as history.

The hysteresis harness and the reference manifest's hi_reference_contract
entry now point at V2. The 4 GiB per-run watchdog cap in the harness is a
separate limit and is unchanged. The manifest's 2026-10-05 freeze receipt
keeps its V1 sha256 because it records history. A new portable test locks V1's
size and sha256 to V2's supersedes block. It also checks that the minimal
V1->V2 differing key paths equal V2's declared changed_key_paths.

Engineering authored it. Validation passed in a fresh clean clone:
- test_all passed 7510, with 0 failed, 198 skipped, 7 xfailed;
- static tests/ci passed 222;
- the reader tests passed 198 plus 1 pre-existing strict xfail.
An independent Science review (HysteresisContractV2ReviewV1, a08dc1f2 / dc96fd08)
accepted it with conditions, and all six checks pass:
- V2 differs from V1 only in the 8 intended roots, by its own structural diff;
- the cap is exact and bound to the decision;
- the repins are complete;
- the lock test kills 14 of 14 mutations on Python 3.11 and 3.13;
- tests/ci passed 222;
- the packages job passed 1910 on each Python version.
Conditions: C1, V2 takes effect once these bytes land and the receipt is
recorded. C2, a K5 sentinel proof must not count the growth reserve twice on
top of a fresh census. C3, K2 and K5 stay open.

Constraint: user decision K3 = b, transcript line 28046, sha256 78562b63; no other cap or gate may change
Rejected: editing V1 in place | V1's bounded_failure forbids automatic larger budgets and its sha256 is pinned history
Confidence: high
Scope-risk: narrow
Directive: never add the Stage05 growth reserve on top of a fresh census in K5 proofs (review condition C2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

The V2 hysteresis reference contract raises the stage-artifact allowance under the K3 decision while preserving V1 as pinned history, and the reference manifest records the new contract binding.

  • reproducibility/HysteresisReferenceContractV2.json L1-1144
  • reproducibility/RefactorReferenceManifestV1.json L900-902

Implementation

The hysteresis benchmark harness now loads and verifies the V2 contract without changing its separate per-run watchdog cap.

  • scripts/benchmarks/hysteresis_reference.py L31-32

Configuration

Repository ignore and CI-exclusion configuration are updated for the consolidated development workspace.

  • .gitignore L4-7
  • tests/ci/exclusions.json L98

Documentation

The repository guidance and README describe the current devel/AIMC layout, engineering baseline, development workflow, and outstanding qualification limits.

  • CLAUDE.md L7-11, L38, L86-138
  • README.md L50-61, L203-212, L782-787 (+4 small edits)
  • docs/DevelopmentGuide.md L1-148

Tests

The hysteresis reference tests lock the superseded V1 contract bytes and verify that V2 declares exactly the changed paths.

  • tests/refactor/test_hysteresis_reference.py L5, L28-40, L131-137

The 2D assembly gate test now checks its frozen arrays using a checked-in fixture, while the ordered-readout test no longer relies on an external workstation artifact.

  • tests/unit/assembly/test_assembly_ordered_readout.py L3-171 (6 small edits)
  • tests/unit/assembly/test_assembly_two_dimensional.py L4-7, L119-124 (+2 small edits)
  • tests/unit/assembly/fixtures/dc2d_gate_v1.npz

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T06:24:30.017480Z 7e20fff PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai sourcery-ai 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.

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docs/DevelopmentGuide.md" line_range="14" />
<code_context>
+With uv and Node installed, use:
+
+```sh
+uv sync --frozen --all-extras
+npm ci --prefix web
+.venv/bin/python scripts/test_all.py
</code_context>
<issue_to_address>
**Frozen setup fails on Python 3.15**

When a developer uses Python 3.15, which the documented `Python 3.11+` prerequisite permits, `uv sync --frozen --all-extras` cannot use the lock on Python 3.15 because `uv.lock` supports only versions below 3.15, so developers following the documented root setup cannot reach the test command.

Document Python 3.11–3.14 as the supported range for this locked workflow, or extend the lock to support Python 3.15.
</issue_to_address>

### Comment 2
<location path="tests/unit/assembly/test_assembly_two_dimensional.py" line_range="120-124" />
<code_context>
         assert digest(candidate) == expected[name]["states"][state.name]["quantities"]
-        if gate_baseline is not None:
-            prefix = f"{name}__{state.name}"
-            assert_bits(gate_baseline[prefix + "_u"], state.u)
-            assert_bits(gate_baseline[prefix + "_F"], candidate.F)
-            assert_bits(gate_baseline[prefix + "_J_data"], candidate.J.data)
-            assert np.array_equal(gate_baseline[prefix + "_J_indices"], candidate.J.indices)
-            assert np.array_equal(gate_baseline[prefix + "_J_indptr"], candidate.J.indptr)
+        prefix = f"{name}__{state.name}"
+        assert_bits(gate_baseline[prefix + "_u"], state.u)
</code_context>
<issue_to_address>
**Frozen parity fails off capture platform**

When the test runs on a platform or numerical stack different from the fixture's capture environment, the frozen-array assertions compare locally regenerated residual and Jacobian values directly with captured raw words on every platform, so numerical-stack differences fail the test in environments the fixture policy says are not capture environments.

Apply the repository's capture-environment guard to the raw-array comparisons, while retaining the live old-versus-new parity checks on every platform.
</issue_to_address>

### Comment 3
<location path="CLAUDE.md" line_range="7-11" />
<code_context>
+The active package lives in `src/solarlab/`, with the service in
</code_context>
<issue_to_address>
**Contributors get conflicting architecture guidance**

`CLAUDE.md` and `README.md` identify `src/solarlab/` as the active package and limit the legacy guide to legacy behavior, contradicting the stated project-tree map and authority of `perovskite-sim/CLAUDE.md`; contributors following these changes get guidance that conflicts with the required architecture reference.

Keep the repository guidance consistent with the required project-tree map and authoritative architecture guide.

Also at `README.md:50`.
</issue_to_address>

### Comment 4
<location path="scripts/benchmarks/hysteresis_reference.py" line_range="31" />
<code_context>

-CONTRACT = "reproducibility/HysteresisReferenceContractV1.json"
-CONTRACT_SHA256 = "bec9fff7f5194a81492b9697f354d460413293a84aa66667c97cf5371adf8d67"
+CONTRACT = "reproducibility/HysteresisReferenceContractV2.json"
+CONTRACT_SHA256 = "9a62e36920dd558e19c196cefed6cc191c74253db05ea54a0e1644d6a22eb96a"
 ANALYTIC = "tests/numerical_contracts/AnalyticGatesV1.json"
</code_context>
<issue_to_address>
**Cited contract is misplaced**

`hysteresis_reference.py` now loads the cited hysteresis reference contract from root `reproducibility/`, rather than the required `perovskite-sim/docs/` location for cited protocol contracts; the contract therefore violates the repository's placement rule.

Place the cited contract in `perovskite-sim/docs/` and update its references accordingly.
</issue_to_address>

### Comment 5
<location path="tests/unit/assembly/test_assembly_two_dimensional.py" line_range="120-124" />
<code_context>
         assert digest(candidate) == expected[name]["states"][state.name]["quantities"]
-        if gate_baseline is not None:
-            prefix = f"{name}__{state.name}"
-            assert_bits(gate_baseline[prefix + "_u"], state.u)
-            assert_bits(gate_baseline[prefix + "_F"], candidate.F)
-            assert_bits(gate_baseline[prefix + "_J_data"], candidate.J.data)
-            assert np.array_equal(gate_baseline[prefix + "_J_indices"], candidate.J.indices)
-            assert np.array_equal(gate_baseline[prefix + "_J_indptr"], candidate.J.indptr)
+        prefix = f"{name}__{state.name}"
+        assert_bits(gate_baseline[prefix + "_u"], state.u)
</code_context>
<issue_to_address>
**Frozen 2D parity is skipped cross-platform**

When the test runs outside the recorded capture environment, `gate_baseline` depends on `frozen_digests`, whose capture-environment guard skips on a nonmatching platform before these comparisons run; the checked-in NPZ therefore does not provide the claimed platform-independent frozen parity check there, though live old-versus-new parity still runs.

Separate portable validation of the checked-in fixture from capture-environment-only floating-point oracle checks, and make any claimed cross-platform frozen comparison use a portable contract.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/DevelopmentGuide.md
With uv and Node installed, use:

```sh
uv sync --frozen --all-extras

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Frozen setup fails on Python 3.15

When a developer uses Python 3.15, which the documented Python 3.11+ prerequisite permits, uv sync --frozen --all-extras cannot use the lock on Python 3.15 because uv.lock supports only versions below 3.15, so developers following the documented root setup cannot reach the test command.

Document Python 3.11–3.14 as the supported range for this locked workflow, or extend the lock to support Python 3.15.

Prompt for AI agents
In `docs/DevelopmentGuide.md` at line 14:

**Frozen setup fails on Python 3.15**

When a developer uses Python 3.15, which the documented `Python 3.11+` prerequisite permits, `uv sync --frozen --all-extras` cannot use the lock on Python 3.15 because `uv.lock` supports only versions below 3.15, so developers following the documented root setup cannot reach the test command.

Document Python 3.11–3.14 as the supported range for this locked workflow, or extend the lock to support Python 3.15.

Comment on lines +120 to +124
assert_bits(gate_baseline[prefix + "_u"], state.u)
assert_bits(gate_baseline[prefix + "_F"], candidate.F)
assert_bits(gate_baseline[prefix + "_J_data"], candidate.J.data)
assert np.array_equal(gate_baseline[prefix + "_J_indices"], candidate.J.indices)
assert np.array_equal(gate_baseline[prefix + "_J_indptr"], candidate.J.indptr)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Frozen parity fails off capture platform

When the test runs on a platform or numerical stack different from the fixture's capture environment, the frozen-array assertions compare locally regenerated residual and Jacobian values directly with captured raw words on every platform, so numerical-stack differences fail the test in environments the fixture policy says are not capture environments.

Apply the repository's capture-environment guard to the raw-array comparisons, while retaining the live old-versus-new parity checks on every platform.

Prompt for AI agents
In `tests/unit/assembly/test_assembly_two_dimensional.py` at lines 120-124:

**Frozen parity fails off capture platform**

When the test runs on a platform or numerical stack different from the fixture's capture environment, the frozen-array assertions compare locally regenerated residual and Jacobian values directly with captured raw words on every platform, so numerical-stack differences fail the test in environments the fixture policy says are not capture environments.

Apply the repository's capture-environment guard to the raw-array comparisons, while retaining the live old-versus-new parity checks on every platform.

Comment thread CLAUDE.md
Comment on lines +7 to +11
The active package lives in `src/solarlab/`, with the service in
`src/solarlab_server/`, root `tests/`, `examples/` and `web/`. Read
[Development Guide](docs/DevelopmentGuide.md) for the current extension and
validation workflow. `perovskite-sim/` is the retained legacy engine and has
its own `CLAUDE.md`; read that guide before working on legacy behavior.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Contributors get conflicting architecture guidance

CLAUDE.md and README.md identify src/solarlab/ as the active package and limit the legacy guide to legacy behavior, contradicting the stated project-tree map and authority of perovskite-sim/CLAUDE.md; contributors following these changes get guidance that conflicts with the required architecture reference.

Keep the repository guidance consistent with the required project-tree map and authoritative architecture guide.

Also at README.md:50.

Prompt for AI agents
In `CLAUDE.md` at lines 7-11:

**Contributors get conflicting architecture guidance**

`CLAUDE.md` and `README.md` identify `src/solarlab/` as the active package and limit the legacy guide to legacy behavior, contradicting the stated project-tree map and authority of `perovskite-sim/CLAUDE.md`; contributors following these changes get guidance that conflicts with the required architecture reference.

Keep the repository guidance consistent with the required project-tree map and authoritative architecture guide.

Also at `README.md:50`.

From CLAUDE.md L7-9:

Project trees: `perovskite-sim/` (Python simulator and backend), root `web/`
(the frontend), plus `docs/figures/`
(only the PNGs the root README embeds). **`perovskite-sim/` has its own `CLAUDE.md`** with exhaustive architecture notes (solver hot paths, TMM optics, backend SSE pattern, frontend panel structure, test BLAS-pinning gotcha, etc.). **Always read `perovskite-sim/CLAUDE.md`** — it is the authoritative guide.


CONTRACT = "reproducibility/HysteresisReferenceContractV1.json"
CONTRACT_SHA256 = "bec9fff7f5194a81492b9697f354d460413293a84aa66667c97cf5371adf8d67"
CONTRACT = "reproducibility/HysteresisReferenceContractV2.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ Low · Cited contract is misplaced

hysteresis_reference.py now loads the cited hysteresis reference contract from root reproducibility/, rather than the required perovskite-sim/docs/ location for cited protocol contracts; the contract therefore violates the repository's placement rule.

Place the cited contract in perovskite-sim/docs/ and update its references accordingly.

Prompt for AI agents
In `scripts/benchmarks/hysteresis_reference.py` at line 31:

**Cited contract is misplaced**

`hysteresis_reference.py` now loads the cited hysteresis reference contract from root `reproducibility/`, rather than the required `perovskite-sim/docs/` location for cited protocol contracts; the contract therefore violates the repository's placement rule.

Place the cited contract in `perovskite-sim/docs/` and update its references accordingly.

From CLAUDE.md L34:

Physics contract / policy / protocol / schema / certificate docs that code, tests or configs cite | `perovskite-sim/docs/`

Comment on lines +120 to +124
assert_bits(gate_baseline[prefix + "_u"], state.u)
assert_bits(gate_baseline[prefix + "_F"], candidate.F)
assert_bits(gate_baseline[prefix + "_J_data"], candidate.J.data)
assert np.array_equal(gate_baseline[prefix + "_J_indices"], candidate.J.indices)
assert np.array_equal(gate_baseline[prefix + "_J_indptr"], candidate.J.indptr)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Frozen 2D parity is skipped cross-platform

When the test runs outside the recorded capture environment, gate_baseline depends on frozen_digests, whose capture-environment guard skips on a nonmatching platform before these comparisons run; the checked-in NPZ therefore does not provide the claimed platform-independent frozen parity check there, though live old-versus-new parity still runs.

Separate portable validation of the checked-in fixture from capture-environment-only floating-point oracle checks, and make any claimed cross-platform frozen comparison use a portable contract.

Prompt for AI agents
In `tests/unit/assembly/test_assembly_two_dimensional.py` at lines 120-124:

**Frozen 2D parity is skipped cross-platform**

When the test runs outside the recorded capture environment, `gate_baseline` depends on `frozen_digests`, whose capture-environment guard skips on a nonmatching platform before these comparisons run; the checked-in NPZ therefore does not provide the claimed platform-independent frozen parity check there, though live old-versus-new parity still runs.

Separate portable validation of the checked-in fixture from capture-environment-only floating-point oracle checks, and make any claimed cross-platform frozen comparison use a portable contract.

@ShaneLogic
ShaneLogic merged commit 3c67532 into main Nov 11, 2026
25 checks passed
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