diff --git a/.gitignore b/.gitignore index e7c9f8dd..0051aa12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # OMC state .omc/ .claude/ +/.codex/ + +# Local research run records and literature, indexed outside production Git. +/work/ignis/ # OS .DS_Store diff --git a/CLAUDE.md b/CLAUDE.md index 6a102a8d..a8ab9a29 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,9 +4,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Repository Layout -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. +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. Note: parallel `perovskite-sim-phase2b/` worktree was removed once tandem v1 (PR #11) and Phase 2b Layer Builder UI (PR #2) merged into `main`. Short-lived feature isolation now uses `.worktrees//` (gitignored). @@ -33,6 +35,7 @@ test, and be understood: | Package data, tooling files | `perovskite_sim/data/`, tool-fixed names | as the tool or existing scheme requires | | Physics contract / policy / protocol / schema / certificate docs that code, tests or configs cite | `perovskite-sim/docs/` | multi-word CamelCase, versions as `V1`, `V2` (`TwodTransportContract.md`, `ExplicitDefectSchemaV2.md`) | | Registries and data the reproducibility chain reads | `perovskite-sim/reproducibility/` | CamelCase (`ConfigBenchmarkMatrix.yaml`); re-pin the sha256 in the matrix after any edit | +| Operational developer and extension guidance | `docs/` | Multi-word CamelCase, such as `DevelopmentGuide.md` | | Figures the root README embeds | `docs/figures/` | CamelCase, no date; regenerate under a new `V` and update the README link | | Tutorial notebooks and run-by-path benchmark scripts | `perovskite-sim/notebooks/` | CamelCase (`JvHysteresis.ipynb`, `IonmongerBenchmark.py`) | @@ -80,68 +83,59 @@ The one input file code still reads, `ScapsParams.xlsx`, stays at ## Git -`origin`: `github.com/ShaneLogic/SolarLab.git`, default branch `main`. - -The user authorized the full refactor on 2026-10-05. All refactor development, -staging, commits and pushes belong on **`devel`**. Do not modify, commit to, or -push `main`. A single coordinator-designated integrator owns branch changes, -staging, commits and synchronization in the shared checkout. Other workers must -verify the repository path, actual branch and HEAD before editing their assigned -files; they must not switch branches or commit concurrently. Preserve existing -changes and unrelated untracked files; never reset or stash them to start work. - -The automatic delivery endpoint is a fully validated, reproducible release and -a review-ready **`devel` → `main` PR**. Only the user may merge it. Agents must -not merge, enable auto-merge, bypass branch protection, or claim `main` has been -refactored before the human merge. Resolve safe integration conflicts and rerun -affected checks on `devel` before requesting that final review. Any per-task -branch advice in older plans is superseded for this shared refactor run. - -Follow archive `plans/Impl/ArchitectureRefactorExecutionV2.md` (V1 is frozen -history) and keep the sole active state at archive -`test/ArchitectureRefactor/ExecutionStateV2.json` with the append-only event log -`test/ArchitectureRefactor/EventLogV2.jsonl`. Worker reports are evidence, not -additional activity ledgers. Repository-required guidance stays in Git; plans, -evidence and scientific run artifacts stay in the archive. Use the supported Orca -task/message/lifecycle workflow and respect each Dispatch's file ownership. - -The refactor commander and sole integrator is the user-appointed Claude Code -session `0537b216-df76-4292-bb73-949175abc111` (model `claude-opus-5-5`, effort -`max`, Orca terminal `term_a33ad446-8ee7-473b-b4b7-00aea210c562`), appointed by -the user on 2026-10-29 and bound to Run `run_b01db3902366` at consumer -generation 6. It replaced Codex session `01a180c3-f826-7873-8d0b-44b2e40899c4` -(Orca terminal `term_3c65f4db-0a9b-41c7-b337-956eff7204dd`), which served as -deputy until the user replaced it on 2026-11-01 with Claude Code session -`d6a3ed06-5f79-4890-bd0b-8ada951d06d6` (`claude-opus-5-5`, effort `max`, Orca -terminal `term_ac765e70-e569-4ac0-972a-b27b4dea9e35`). The deputy makes no Git -mutations, dispatches or state writes; it takes over only when the commander -has been unreachable for more than 2 hours. Execution is authorized. The runnable new-core 1D research -release has been delivered (research packages up to V8). The next delivery is -the user-selected engineering milestone (option A, 2026-10-29): one unified -layout/term/assembly layer serving steady, transient and AC analyses, a -one-command green test suite, full CI coverage, and the existing new-core -capabilities migrated onto it. Functionality not yet migrated stays explicitly -behind the legacy facade, and G9P remains the final endpoint. The commander -sets the product time-integration route deadline (proposed 2026-11-08). If IDA -is not qualified by then, a new-core adaptive BDF becomes the product default -and IDA becomes optional; final scientific gates are unchanged. -Then continue the remaining approved scope. Clearly distinguish implementation, -verification, and scientific qualification; legacy execution is not new-core completion. -Routine reversible implementation and sequencing decisions belong to the commander. -Use approximately 15-minute investigation checkpoints; after two checkpoints -without useful evidence or progress, change the assumption, scope, or method. -Ask the user only about changes to final scientific standards, core delivery -scope, added resource cost, or merging main. Since 2026-11-01 (user decision) -every commanded worker role runs `claude-opus-5-5` at effort `max` with full -permissions and network enabled; the earlier Codex worker sessions are closed -and their resume ids are kept in the execution state. Every -participant's actual model/effort/permissions are verified once per session start -from its own runtime record (Codex turn_context or Claude transcript); a requested -setting or UI label alone is insufficient. Scientific thresholds change only -prospectively after independent review and before the affected runs; user-facing -acceptance targets change only with explicit user approval; old failures are -never relabelled. R1 L2/L3 qualification is a research track decoupled from the -product release. +`origin` is `github.com/ShaneLogic/SolarLab.git`; remote `main` retains the +published history. The user's November 10, 2026 consolidation keeps two local +development branches and workspaces: + +- **`devel`**: the shared new-core engineering and integration baseline. +- **`AIMC`**: the proposed microscopic aging model, based on the current + `devel` core. Its research design is not an implemented model capability. + +Use one active writer per checkout. Verify the actual repository path, branch +and HEAD before editing or staging. Preserve unrelated user changes; do not +reset or stash them to make room. Shared engineering changes belong on +`devel`; model-specific changes belong on `AIMC` until their contracts and +validation support integration. + +The former commander/deputy/worker terminal assignments were retired by the +user's consolidation request. Do not restart that roster or treat old +"in progress" terminal labels as current work. Future delegation follows the +user's current instructions and recorded model preferences. Live user +directions supersede historical staffing assignments. + +The sole active state remains archive +`test/ArchitectureRefactor/ExecutionStateV2.json`, with append-only events in +`test/ArchitectureRefactor/EventLogV2.jsonl`. The snapshot, pending-work +decisions, source/evidence recovery material and session indexes are under +`test/ArchitectureRefactor/WorkspaceConsolidationV1/`. Older formal task +counts and independently pinned results retain their historical scope; they +are not a current implementation percentage. + +The unified layout/term/assembly engineering milestone A was delivered and +merged through PR #26 on November 1, 2026. Supported new-core 1D and steady +2D entry points use that assembly layer; unmigrated features remain behind +the explicit legacy boundary. Backward Euler remains the general transient +default. Explicit BDF routes exist, but CND2 method-selection/default-switch +work is a separate unmerged candidate. + +For the next CND2 review, use +`Stage04/P04CoreV1/Core1D/AdaptiveBDFV1/Cnd2ReviewScopeDecisionV1.json` in the +archive: the November 2 user decision adopts the interface trust standard. +Earlier strict-scope failures remain historical. V4's committed-tree CI was +recorded green, while independent acceptance under the new standard remains +outstanding. November 8 was an earliest permitted switch date, not an +automatic switch; retain every applicable prerequisite. + +Scientific thresholds and resource limits are unchanged. Distinguish working +implementation, engineering verification and scientific qualification. +G2/C2, the applicable hysteresis/SCAPS reference work, refinement and final +G9P acceptance remain separate. R1 L2/L3 research qualification remains +decoupled from product engineering delivery. + +Do not modify or push remote `main`, merge a release PR, enable auto-merge +or bypass branch protection. Only the user merges into `main`. Keep a +review-ready `devel` change reproducible without reintroducing old worktree +paths, duplicate numerical implementations or unreviewed candidate defaults. ## Common Commands diff --git a/README.md b/README.md index f1feba4a..4ce07d17 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,18 @@ Xuan-Yan Chen · Longhan Zhang · Zecheng Gan* · Chang Yan& ## Overview +**Continuing development:** `devel` is the shared engineering baseline; +`AIMC` is the separate branch for the proposed microscopic aging model. +Start with the [Development Guide](docs/DevelopmentGuide.md) for the current +package layout, test commands, model extension boundaries and pending work. +The package remains `solarlab==0.1.0`; full scientific qualification is still +in progress. + +Supported new-core 1D and steady 2D entry points use the unified equation +assembly. Backward Euler remains the general transient default; adaptive BDF +is an explicit bounded route. The separate CND2 method-selection/default +switch is not part of this baseline. + **New-core development on `devel`:** the [1D research workflow](examples/research_1d/README.md) runs configuration, a real Poisson/drift-diffusion assembly, the new steady Newton solver, J–V, parameter sweeps and lossless result reading. It includes @@ -188,6 +200,16 @@ The function named `solve_equilibrium` provides a quasi-neutral starting state; ~~~text SolarLab/ + src/solarlab/ New core: configuration, physics, equations, + assembly, solvers, experiments, IO and identity + src/solarlab_server/ Registered execution, HTTP and legacy facade + src/solarlab_research/ Reserved research companion namespace + examples/research_1d/ Runnable new-core 1D workflows + examples/research_2d/ Runnable bounded new-core 2D workflows + tests/ Root contracts, integration and runtime tests + reproducibility/ Active reference and transition contracts + pyproject.toml, uv.lock Locked root package and development environment + docs/DevelopmentGuide.md Current development and extension workflow docs/figures/ Curated README and comparison figures perovskite-sim/ perovskite_sim/ Python models, physics, discretization, @@ -200,7 +222,7 @@ SolarLab/ scripts/ Experiments, imports, validation, plotting tests/ Unit, integration, regression, validation notebooks/ Exploratory workflows - pyproject.toml Core package and test dependencies + pyproject.toml Legacy package and test dependencies web/ Vite/TypeScript/Plotly/GoldenLayout UI scripts/ Repository support utilities docker-compose.yml Backend/frontend development stack @@ -219,6 +241,10 @@ automatically part of the published evidence. ## Installation +For the active `devel` package, install from the repository root using the +[locked development workflow](docs/DevelopmentGuide.md#start-from-the-root-package). +The perovskite-sim installation below is the legacy application setup. + ### Prerequisites - **Python 3.11+** (the package metadata requirement; focused checks below used 3.13) @@ -268,6 +294,11 @@ python scripts/verify_reproducibility.py --json # registry and frozen-ba ## Running the Application +The application commands below run the retained legacy backend. New-core +process/HTTP workflows and their saved-result readers are documented in the +[1D](examples/research_1d/README.md) and [2D](examples/research_2d/README.md) +examples. + SolarLab runs as **two processes**: a FastAPI backend that executes the simulations, and a Vite dev server that serves the UI. ### Start the backend @@ -520,6 +551,11 @@ The 2D solver is an experimental extension for lateral microstructure effects, n ## Numerical Method +This table describes the retained `perovskite_sim` engine. The new core has +shared equation assembly, dedicated nonlinear/time solvers, a Backward Euler +default and explicit adaptive BDF routes; see the +[development baseline](docs/DevelopmentGuide.md#current-behavior-and-limits). + | Ingredient | Choice | |:-----------|:-------| | **Driver topology** | Explicit transient, direct steady-state, quasi-Fermi DC, QF frequency-domain, and 2D paths | @@ -743,6 +779,12 @@ describe their declared historical configurations. The new ion-sweep preset carr ## Testing +From the repository root, `.venv/bin/python scripts/test_all.py` runs the +ordinary root CI pytest selections in isolated processes. Standalone web +tests/builds, installation checks and optional scientific/slow campaigns have +their own scope; see [Development Guide](docs/DevelopmentGuide.md). +The commands and dated measurements below describe the legacy suite. + The 2026-10-01 documentation review ran six focused modules for research-preset inventory/API round trips, SCAPS inline configuration, Calado protocol helpers, mode defaults, ionic-flux Jacobians, and solver dispatch: **77 tests passed**. This check did not rerun the full physics suite, historical grid campaigns, or external-solver comparisons quoted above. ```bash diff --git a/docs/DevelopmentGuide.md b/docs/DevelopmentGuide.md new file mode 100644 index 00000000..44d02cd6 --- /dev/null +++ b/docs/DevelopmentGuide.md @@ -0,0 +1,148 @@ +# Development Guide + +The continuing development branch is `devel`. `AIMC` is the separate branch +for the proposed microscopic aging model. The Python package remains +`solarlab==0.1.0`; a working development baseline is not a declaration of +complete scientific or release qualification. + +## Start from the root package + +The root `pyproject.toml` and `uv.lock` define the new-core environment. +With uv and Node installed, use: + +```sh +uv sync --frozen --all-extras +npm ci --prefix web +.venv/bin/python scripts/test_all.py +``` + +The test runner reproduces the ordinary root pytest selections and their +isolated process groups from `.github/workflows/ci.yml`. It retains skipped +and expected-failure cases in its summary. It does not run the separate +legacy suite, every CI installation mode, the full Python matrix, the +standalone TypeScript build, or the optional slow/coverage campaigns. + +Run the frontend checks separately when frontend or cross-language contracts +change: + +```sh +SOLARLAB_PYTHON="$PWD/.venv/bin/python" npm --prefix web run test:run +npm --prefix web run build +``` + +Start a scientific workflow with the existing [1D examples](../examples/research_1d/README.md) +or [2D examples](../examples/research_2d/README.md). Their input restrictions, +run commands and interpretation limits are part of the example contract. +Use a fresh local RunStore for a new calculation; use its reader to inspect +an existing calculation. + +## The code to extend + +| Layer | Location | Responsibility | +| --- | --- | --- | +| Input and material declarations | `src/solarlab/config/`, `materials/` | Explicit units, validated input and immutable material declarations | +| Device compilation | `src/solarlab/device/` | Resolve an admitted declaration into a bound device | +| Local physical laws | `src/solarlab/physics/` | Constitutive values and derivatives, independent of experiment orchestration | +| Geometry and discretization | `src/solarlab/mesh/`, `discretization/` | Control volumes, connectivity and stable numerical primitives | +| Equation composition | `src/solarlab/equations/assembly/` | Shared `SystemLayout`, `Term`, storage and `Assembler` contracts | +| Numerical solution | `src/solarlab/solvers/` | Nonlinear, time and linear solvers acting on equation contracts | +| Experiment orchestration | `src/solarlab/experiments/`, `sweeps/` | Protocols, preparation, execution and measurements | +| Persistence and identity | `src/solarlab/io/`, `reproducibility/` | RunStore, source/input identities, original attempts and lossless readers | +| Service and browser | `src/solarlab_server/`, `web/` | Registered execution, HTTP/events and client contracts | +| Legacy engine | `perovskite-sim/` and `solarlab_server/legacy_engine/` | Explicit compatibility routes for capabilities not yet migrated | +| Research companion | `src/solarlab_research/` | Reserved companion namespace; active runnable research entry points are currently in `examples/` | + +The import contracts in `pyproject.toml` enforce these boundaries. In +particular, the core does not import the server, research companion or legacy +engine; solvers do not import experiment orchestration. Keep optional quantum +or GPU backends outside ordinary core imports. + +## Current behavior and limits + +The supported 1D steady, transient and small-signal entry points and the +supported 2D steady entry points use the unified equation assembly by default. +Their explicit original-equation opt-out is +`with equation_implementation(LEGACY): ...`, or +`NEWCORE_EQUATIONS=legacy` for an independently started process. This opt-out +selects the original new-core equation classes; it does not select the +separate `perovskite_sim` engine. + +Backward Euler remains the general transient default. Adaptive BDF1/2 is an +explicit, bounded research route; its admitted electronic and single-positive-ion +adapters already use assembled equations. Equation implementation and time +integration method are separate choices. + +CND2 adds admission-bound method selection and the proposed BDF default +switch. Its V4 candidate is preserved outside the production branch. The +November 2, 2026 decision requires a fresh review under the interface trust +standard; a recorded green committed-tree CI run does not complete that +review. November 8 was an earliest permitted switch date, not an automatic +deadline that changes the running default. + +Remaining scientific work includes the applicable G2/C2 reference evidence, +hysteresis and SCAPS reference validation, mesh/time/voltage refinement, and +the final G9P release gates. Existing bounded working examples and historical +legacy results retain their own scope. Neither cleanup nor a green test suite +promotes those scientific gates. + +## Add a physical model without duplicating the solver + +1. Define the physical state, units, conserved inventory, supported input + domain and unavailable cases before adding a numerical path. +2. Add the local law and its derivatives in `physics/`; resolve declared + parameters through configuration/material/device compilation. +3. Bind the law through the existing layout and term/assembly contracts. + Extend storage, residuals and Jacobians together when the model adds a + dynamic state. Do not copy a steady or time solver into a model-specific + module. +4. Add the experiment and measurement protocol above the solver layer. + Preserve source, input, method and model identities in persisted results; + record failed attempts without replacing them with accepted results. +5. Verify zero-effect and limiting cases, units, conservation, derivative + consistency and unsupported-input refusals. Compare unchanged quantities + with the existing implementation; bind any new scientific claim to its + own declared reference and refinement evidence. +6. Add service/UI registration only after the Python contract and saved + reader are usable. Keep optional runtime dependencies optional. + +The executable local recombination extension in the 1D workflow is the +smallest existing example of this pattern. Broader dynamic defects and +microscopic charge/event coupling need their own contracts and tests. + +## The AIMC branch + +AIMC currently contains design and analytic research, not an implemented VMC, +atomistic event or device-coupling engine. Its branch-specific +`docs/AimcIntegration.md` records the agreed objective and next development +steps. Advance shared engineering changes from `devel` before changing the +physical model. Do not merge design status into production capability flags. + +The existing requirement is a real electronic VMC solve after each accepted +ion/vacancy position update. A cache, surrogate, or coarsened event schedule +must not silently replace that requirement. The contact, electronic charge +sectors, event mechanism, error targets and resource measurements still need +to be frozen before a target simulation is claimed. + +## Git and evidence workflow + +Use `devel` for shared engineering work and `AIMC` for the new model. +Keep one active writer per checkout. Commit only cohesive, reviewed changes; +check the actual branch and HEAD before staging. Remote `main` is retained +as published history and is not rewritten by workspace cleanup. + +Code, test fixtures and the operational guidance needed to use the repository +belong in Git. Research reports, raw outputs, historical candidate patches and +session recovery indexes belong in the existing SolarLab archive. Local +`.codex/` settings and `work/ignis/` runs are not production source. + +The sole execution-state record remains archive +`test/ArchitectureRefactor/ExecutionStateV2.json`; its older formal task counts +must not be read as a current implementation percentage. The consolidation +snapshot, per-worktree decisions, checked restoration material and validation +receipts are under +`test/ArchitectureRefactor/WorkspaceConsolidationV1/`. + +Use that folder's restoration tool to reopen a historical candidate in a fresh +directory. Do not reapply an old patch wholesale to the current branch merely +because a retired checkout had uncommitted files. Preserve each candidate's +base commit and review standard when continuing it. diff --git a/reproducibility/HysteresisReferenceContractV2.json b/reproducibility/HysteresisReferenceContractV2.json new file mode 100644 index 00000000..7a2c60e0 --- /dev/null +++ b/reproducibility/HysteresisReferenceContractV2.json @@ -0,0 +1,1144 @@ +{ + "schema": "solarlab.hysteresis_reference_contract.v2", + "version": 2, + "status": "frozen_standard_reference_qualification_pending", + "supersedes": { + "root": "repository", + "path": "reproducibility/HysteresisReferenceContractV1.json", + "sha256": "bec9fff7f5194a81492b9697f354d460413293a84aa66667c97cf5371adf8d67", + "bytes": 43782, + "retention": "V1 stays byte-identical as history", + "changed_key_paths": [ + "/schema", + "/version", + "/governance", + "/resource_proposal/maximum_stage_artifacts_GiB", + "/resource_proposal/maximum_stage_artifacts_bytes", + "/resource_proposal/maximum_stage_artifacts_basis", + "/supersedes", + "/decision" + ], + "changed_key_paths_rule": "Smallest JSON pointers that are added, removed or modified relative to V1; every other key path and value is identical to V1", + "inherited_v1_records": "created_at, frozen_at, independent_review, candidate_results_consulted, source_capture_head and review_working_head describe V1 and are carried unchanged; they are not a review or freeze of this revision" + }, + "decision": { + "id": "K3", + "choice": "b", + "statement": "keep the hysteresis originals; raise the stage storage allowance", + "record": { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage05/ReferenceTracksV1/K3DecisionV1.json", + "sha256": "483b95500e441044876fec29a2556f93bf6825c375e1cfcb03465aa2eb3f2cbf", + "bytes": 2898 + }, + "user_record": { + "transcript": "0537b216-df76-4292-bb73-949175abc111.jsonl", + "transcript_root": "~/.claude/projects/-Users-bytedance-Intern-SolarLab", + "line": 28046, + "offset": 58411918, + "bytes": 665, + "sha256": "78562b6302cc32b18c3b2b6ea7b5b95d87773e55de67f55d8d9eee04459ff581", + "at": "2026-11-01T14:05:26.433Z", + "origin": "human", + "verbatim": "1. \u5408\u5e76\n2. \u4e59\n3. U4 \u9009 B\n4. K3 \u9009 b", + "plan_record": { + "root": "archive", + "path": "plans/Impl/ArchitectureRefactorExecutionV2.md", + "record": 6 + } + }, + "options": { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage05/ReferenceTracksV1/MigrationV1/OptionsK3.md", + "sha256": "d1f37ab0664ff576e1cd1c88f8248a321b24727914135e55f7a3530af5217da1", + "lines": "48-58" + }, + "effect": "Prospective only. Stops, failures and measurements recorded under the V1 maximum (4294967296 bytes) keep their original classification", + "unchanged": "All scientific thresholds, gates, tolerances, reference and refinement plans, and the other resource caps (solves, wall budgets, RSS 8 GiB, workers, BLAS threads)", + "revision_review_requirement": "This revision takes effect only after the contract's own Science review (OptionsK3 line 58); the review receipt is recorded in ExecutionStateV2.json", + "migration_and_deletion": "None authorized; the originals (52,358 files, 13,483,544,355 bytes) stay in place", + "conditions_after": "K2 and K5 stay open as recorded in the decision record (/conditions_after)" + }, + "created_at": "2026-10-05T09:04:55.273556+00:00", + "frozen_at": "2026-10-05T09:51:28.332696+00:00", + "independent_review": { + "status": "approved", + "reviewer_session": "01a10b6e-1a04-79f3-8852-5d182fe6be54", + "reviewed_sha256": "ee35db8311a423afd10c5dca72d5f7985deb97b1848118732ac1eceec8c926fe", + "review_receipt": { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage00/HIIndependentReviewV1.json", + "sha256": "548fe81a5ebea29c518a21df2dfb08aa7365030853d501f4882159c0deeb40a0" + }, + "scope": "Corrected independent-control/observation reference plan and executable stricter power predicate, with unchanged numeric targets; reference/source/env qualifications and candidate execution remain separate", + "root_authorization_message": "msg_663fe18bb6d3", + "approved_sections_sha256": "4e6a1c6adf465ed7ccb310cb4d0a7b7789259b846da4e8b2e2888a84f478ac13", + "prior_numeric_review": { + "reviewer_session": "01a10b53-17dc-7bf2-a3e0-f3902e5b5d96", + "reviewed_sha256": "a544abcb27bb0e46e63da87d9e2d688c01db06af19146be02ab500a10ef6bd97" + } + }, + "candidate_results_consulted": false, + "source_capture_head": "0acc9d6cb7bd2e5c69cb3299a88522623c22bb37", + "governance": "Local proposal only; all global gate and acceptance activity is recorded solely in ExecutionStateV2.json", + "scope": "Reproduce all 21+21+3 original internal finite-time records and establish a separate prospective numerical/new-algorithm qualification; not Calado-paper fitting", + "source_bindings": [ + { + "root": "archive", + "path": "results/CaladoRepro/DenseIonMatrixV1/Matrix.json", + "sha256": "63942ee5fc3e89eb6403a01d10bff5dbb2b096e4de3f3cab201f3808369f127a", + "role": "42_curve_pairs" + }, + { + "root": "archive", + "path": "results/CaladoRepro/UiProtocol/RateMatrixV1/Matrix.json", + "sha256": "f9dd7757622d95a9d4b91b2b93911d1fc365c65895ef7e65b962748350d126cd", + "role": "three_scan_rates" + }, + { + "root": "archive", + "path": "results/CaladoRepro/UiProtocol/WaveformNominalSpatialFrontend.json", + "sha256": "dc3fb2c7bf2de13baf809f29663fe9e362adbd9cd066fc3891d8e1c82d6a51b4", + "role": "captured_original_request" + }, + { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage00/PeakProvenanceV1.json", + "sha256": "5b075ce4b069cf7533d533337deef3bbecf3350840ae0bdb0cd3e7c87355e83b", + "role": "checked_peak_numeric_payload_lineage" + }, + { + "root": "repository", + "path": "perovskite-sim/docs/IonSweepFigureReference.md", + "sha256": "a068a50962ed14a6863496c54e98bf4cdfaddcc623f74063ede9c7b20cc7f3ef", + "role": "four_case_same_grid_contract" + }, + { + "root": "repository", + "path": "perovskite-sim/perovskite_sim/experiments/waveform_jv.py", + "sha256": "cac7648c136190db6bca65697cdb3200ab7b57e81787736a67d706cda333d1e7", + "role": "actual_old_control_and_sampling_semantics" + }, + { + "root": "repository", + "path": "perovskite-sim/perovskite_sim/experiments/jv_sweep.py", + "sha256": "428fbe1c421192e2495ac94fa171df42f2be94dca7733b7a5ab2e07a9628ef96", + "role": "actual_hold_caps_fallbacks_and_interval_current_definition" + }, + { + "root": "repository", + "path": "perovskite-sim/perovskite_sim/solver/mol.py", + "sha256": "1c02ff41356cfaf75245e3e9e3a0101064d43a766e9e416053ea1e75ef54b61a", + "role": "actual_dense_output_and_rhs_budget_semantics" + }, + { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage00/HIPowerPreconditionV1.py", + "sha256": "90c7ed2722448874968361f1fd07fe1dfb5bb81b5e8ff582dc74483891bda6ff", + "role": "required_executable_HI_reference_power_predicate" + } + ], + "reference_set": { + "manifest_path": "reproducibility/RefactorReferenceManifestV1.json", + "cases_pointer": "/hi/cases", + "required_case_ids": [ + "hi_diffusivity_00", + "hi_diffusivity_01", + "hi_diffusivity_02", + "hi_diffusivity_03", + "hi_diffusivity_04", + "hi_diffusivity_05", + "hi_diffusivity_06", + "hi_diffusivity_07", + "hi_diffusivity_08", + "hi_diffusivity_09", + "hi_diffusivity_10", + "hi_diffusivity_11", + "hi_diffusivity_12", + "hi_diffusivity_13", + "hi_diffusivity_14", + "hi_diffusivity_15", + "hi_diffusivity_16", + "hi_diffusivity_17", + "hi_diffusivity_18", + "hi_diffusivity_19", + "hi_diffusivity_20", + "hi_density_00", + "hi_density_01", + "hi_density_02", + "hi_density_03", + "hi_density_04", + "hi_density_05", + "hi_density_06", + "hi_density_07", + "hi_density_08", + "hi_density_09", + "hi_density_10", + "hi_density_11", + "hi_density_12", + "hi_density_13", + "hi_density_14", + "hi_density_15", + "hi_density_16", + "hi_density_17", + "hi_density_18", + "hi_density_19", + "hi_density_20", + "hi_rate_20", + "hi_rate_40", + "hi_rate_80" + ], + "cases_payload_sha256": "646d85ce8f72ee23fb289e0ba604b30136f8f86d595bb0bd5d6e8e43c3c43300", + "payload_hash_rule": "SHA-256 of UTF-8 json.dumps(value, sort_keys=True, separators=(comma, colon), ensure_ascii=True, allow_nan=False); parsed integer/float values retained; not an RFC 8785 claim", + "record_count": 45, + "distinct_request_count": 43, + "removed_records": 0, + "dedup_rule": "Only identical full effective source/input/protocol/initial/model/numerics/environment identity may share an execution; preserve every coverage relation" + }, + "identity": { + "Dref_m2_s": 2.585e-18, + "cref_m3": 1e+25, + "temperature_K": 300, + "nominal_request_sha256": "f85b35f9926a85b31bb8c865c91d1ab093abdca5dbcf06a906b940aa0ee13d6d", + "protocol": { + "dark_seed": { + "voltage_V": 0, + "duration_s": 120 + }, + "dark_preparation": { + "voltage_V": -1, + "duration_s": 30 + }, + "forward_light_dwell_s": 0.5, + "forward": [ + -1, + 1.2 + ], + "dark_turnaround_s": 3, + "reverse_light_dwell_s": 0.5, + "reverse": [ + 1.2, + -1 + ], + "rates_V_s": [ + 0.02, + 0.04, + 0.08 + ], + "branch_durations_s": [ + 110, + 55, + 27.5 + ], + "uniform_generation_m3_s": 2.5e+27, + "driver": "continuous waveform, finite-time Radau; no substitution of a steady solve", + "all_four_contact_S": null, + "contact_semantics": "Original all-carrier Dirichlet; not paper mixed-minority contacts", + "effective_material_input": "Exact nominal_request.device retained; alter only the selected absorber field", + "numerics": { + "requested_N_grid": 60, + "actual_nodes": 61, + "samples_per_branch": 111, + "rtol": 0.0001, + "atol_m3": 1 + } + }, + "controls": { + "diffusivity": { + "ratios": [ + 0.0, + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1.0, + 1.1, + 1.2, + 1.3, + 1.4, + 1.5, + 1.6, + 1.7, + 1.8, + 1.9, + 2.0 + ], + "varied_field": "absorber.D_ion", + "fixed_c0_m3": 1e+25, + "zero_meaning": "D=0 keeps the uniform mobile-ion population and equal negative background" + }, + "density": { + "ratios": [ + 0.0, + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1.0, + 1.1, + 1.2, + 1.3, + 1.4, + 1.5, + 1.6, + 1.7, + 1.8, + 1.9, + 2.0 + ], + "varied_field": "absorber.P0", + "fixed_D_m2_s": 2.585e-18, + "zero_meaning": "c0=0 removes initial mobile inventory and fixed countercharge", + "coupling": "Every c0 change updates both fixed negative background and initial mobile population" + } + }, + "current_effective_source_gap": "Two of six old code pins match current files; resolve each changed file and full historical environment before treating an old artifact as exact algorithm replay" + }, + "evidence_channels": { + "historical_four_same_grid": { + "scope": "D ratios 0, 0.2, 1, 2 only; original 61 nodes and 110 archived current samples per branch", + "existing_limits": { + "source_id": "hi_existing_test", + "fixture_source_id": "hi_fixture", + "ratios": [ + 0, + 0.2, + 1, + 2 + ], + "J": { + "unit": "A/m^2", + "atol": 0.001, + "rtol": 1e-05, + "rule": "sum" + }, + "HI_P": { + "unit": "1", + "atol": 1e-05, + "rtol": 0.0002, + "rule": "max_existing_pytest_approx" + }, + "voltage": { + "unit": "V", + "atol": 1e-12, + "rtol": 0 + }, + "mask": "Only the inherited [1:] stored-current scope on both branches; original omission remains visible", + "qualification": "historical four-case same-grid regression only; no full scan or new solver certification" + }, + "grants_full_matrix_or_new_solver": false + }, + "full_record_reproduction": { + "scope": "All 45 records, full native branches and current/metric/status fields under original input/history; old stored comparisons apply at their 110 available coordinates", + "status": "requires_complete_source_and_new_prospective_budgets", + "coarse_reference_policy": "If original finite-grid values fail reference-error requirements, keep them as historical anchors and explicitly rebaseline numerical evidence; do not force agreement by loosening gates" + }, + "numerical_and_new_algorithm": { + "scope": "Comparison against independently qualified numerical references, preserving physical preparation and observations; adaptive internal steps need not match", + "proposed_gates": { + "J_A_m2": { + "atol": 0.001, + "rtol": 0.0001, + "unit": "A/m^2", + "rule": "sum" + }, + "Pmax_W_m2": { + "atol": 0.0005, + "rtol": 0.0001, + "unit": "W/m^2", + "rule": "sum", + "additional_limit": "Must also meet the tighter per-case HI uncertainty allocation" + }, + "Voc_V": { + "atol": 0.0001, + "rtol": 0.0, + "unit": "V", + "requires": "bracket and current-to-voltage slope/error propagation" + }, + "Jsc_A_m2": { + "atol": 0.001, + "rtol": 0.0001, + "unit": "A/m^2", + "rule": "sum" + }, + "FF_fraction": { + "atol": 0.0001, + "rtol": 0.0001, + "unit": "1", + "rule": "sum", + "requires": "resolved Voc/Jsc denominator" + }, + "PCE_percent": { + "atol": 0.001, + "rtol": 0.0001, + "unit": "percentage_point", + "rule": "sum", + "requires": "fixed declared incident power or mark undefined" + }, + "HI_P": { + "atol": 0.001, + "rtol": 0.0, + "unit": "1", + "requires": "resolved supplied power uncertainties and same definition" + }, + "HI_normalized": { + "atol": 0.001, + "rtol": 0.0, + "unit": "1", + "requires": "resolved reverse-power uncertainty" + }, + "ion_inventory_relative_drift": { + "limit": 1e-08, + "scale": "independently integrated initial physical inventory" + }, + "zero_inventory_absolute_m_minus2": { + "limit": 100000000.0, + "scale": "fixed cref*400nm = 4e18 m^-2; no division by zero" + } + }, + "design_basis": "Retain section 14 Voc 1e-4 V, relative Jsc/FF/PCE 1e-4 and HI absolute 1e-3 targets. The J absolute floor is 6.24e-6 of the fixed q*G*400nm=160.2176634 A/m2 generation scale; Pmax floor is J floor times fixed 0.5 V; FF floor is 0.01 percentage point; PCE floor is 0.01 W/m2 at declared 1000 W/m2 Pin. These are explicit prospective engineering floors, not inferred continuum errors.", + "old_gate_precedence": "Exact historical four-case same-grid replay must still satisfy its own stricter J relative and HI gates; the new numerical channel cannot waive an existing gate", + "not_ready_for_execution": "The reviewed thresholds and corrected reference plan may freeze before physical refinement runs. Actual source/environment/control support and independent per-case reference errors are mandatory before qualified-reference use and candidate acceptance; no execution is authorized here." + } + }, + "error_budget": { + "reference_error_fraction_max": 0.3333333333333333, + "combination": "Conservative sum of independently bounded spatial, temporal, solver and observable-extraction errors; no cancellation credit", + "axis_initial_allocation": "Four independently assessed contributions (space, integration/time, solver accuracy, observable extraction) each start with at most 1/12 of the migration allowance; legacy coupled changes receive no separate per-axis credit", + "HI_resolution": "Require forward/reverse Pmax error intervals excluding zero; propagate interval corners and require propagated HI error <= one third of 1e-3 for the reference", + "weak_peak_example": { + "case_id": "hi_diffusivity_02", + "historical_Pf_W_m2": 0.8051574747501198, + "historical_Pr_W_m2": 78.26439288754077, + "reference_HI_error_allocation": 0.0003333333333333333, + "first_order_common_power_error_ceiling_W_m2": 2.7329465269315636e-06, + "exact_symmetric_interval_common_power_ceiling_W_m2": 2.7329372505209222e-06, + "use": "Planning estimate only; actual acceptance uses nonlinear interval propagation; do not lower a floor to make the denominator resolved", + "exact_common_power_formula": "e=B*f^2/(f+r+B*f), B=0.001/3; unequal uncertainties use exact interval corners", + "generic_full_Pmax_limits_permit_HI_error": 0.08048303454445498, + "generic_one_third_Pmax_limits_permit_HI_error": 0.026814779972999796 + }, + "rounding": "Captured binary JSON values are historical stored outputs, not a numerical-error certificate", + "required_power_precondition": { + "executable_source": { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage00/HIPowerPreconditionV1.py", + "sha256": "90c7ed2722448874968361f1fd07fe1dfb5bb81b5e8ff582dc74483891bda6ff" + }, + "callable": "qualify_reference_power", + "required_for": "Every record and every qualified numerical reference before comparison eligibility; generic Pmax checks are necessary but insufficient", + "arguments": { + "pmax_atol": 0.0005, + "pmax_rtol": 0.0001, + "hi_p_atol": 0.001, + "hi_normalized_atol": 0.001 + }, + "reference_allocation": { + "numerator": 1, + "denominator": 3 + }, + "input": "Actual forward/reverse powers and independently justified absolute power uncertainties, all W/m2; absent uncertainties remain unknown", + "all_required": [ + "Each power uncertainty <= (0.0005 + 0.0001*abs(P))/3", + "Forward and reverse denominator intervals both exclude zero", + "Exact interval-corner HI_P error <= 0.001/3", + "Exact interval-corner HI_normalized error <= 0.001/3", + "Source, environment and uncertainty-evidence qualification independently verified" + ], + "failure": "Any false/unknown predicate blocks reference use and candidate acceptance; no scalar HI match substitutes" + }, + "legacy_joint_evidence": "The old sample-count ladder changes restart placement, internal step caps and interval displacement extraction together; it is one joint diagnostic and never three independent bounds", + "freeze_vs_qualification": "Freeze numeric thresholds and this reviewed reference plan before generating candidate outputs. Actual reference error/source/environment evidence is then required before qualified-reference use and candidate acceptance; this task authorizes no simulation." + }, + "refinement_plan": { + "status": "corrected_prospective_plan_driver_not_implemented_no_runs_authorized", + "source_audit": { + "waveform_file": "perovskite-sim/perovskite_sim/experiments/waveform_jv.py", + "restarts": "sweep() calls advance() for every requested voltage point; each nonzero segment starts a new solve", + "ramp_cap": "duration/20 per adjacent requested-sample interval; max_nfev=100000 per solve", + "hold_cap": "_integrate_step uses the hold/subdivision duration/20, max_nfev=100000, max_bisect=10, with recorded numerical/radiative/BDF fallbacks; a smaller cap alone is not a branch certificate", + "current": "At a point, conduction is evaluated at the endpoint, displacement uses epsilon*(E_end-E_prev)/duration with the prior point/dwell state; it is not automatically an instantaneous ramp current", + "dense_output": "run_transient passes dense_output=False; no decoupled dense-output reference driver exists" + }, + "legacy_joint_refinement": { + "classification": "JOINT restart/sampling/internal-step-cap/observable-extraction diagnostic", + "existing_numeric_payloads_reused": true, + "per_axis_error_credit": false, + "divisor80_warning": "80 was a prospective unsupported setting; current code hardcodes 20. Even at fixed 80, changing 111/221/441 points changes interval seconds and restart/current definitions together.", + "cap_table": [ + { + "rate_V_s": 0.02, + "samples_per_branch": 111, + "ramp_restarts_per_branch": 110, + "interval_s": 1.0, + "actual_hardcoded_max_step_s": 0.05, + "hypothetical_divisor80_max_step_s": 0.0125 + }, + { + "rate_V_s": 0.02, + "samples_per_branch": 221, + "ramp_restarts_per_branch": 220, + "interval_s": 0.5, + "actual_hardcoded_max_step_s": 0.025, + "hypothetical_divisor80_max_step_s": 0.00625 + }, + { + "rate_V_s": 0.02, + "samples_per_branch": 441, + "ramp_restarts_per_branch": 440, + "interval_s": 0.25, + "actual_hardcoded_max_step_s": 0.0125, + "hypothetical_divisor80_max_step_s": 0.003125 + }, + { + "rate_V_s": 0.04, + "samples_per_branch": 111, + "ramp_restarts_per_branch": 110, + "interval_s": 0.5, + "actual_hardcoded_max_step_s": 0.025, + "hypothetical_divisor80_max_step_s": 0.00625 + }, + { + "rate_V_s": 0.04, + "samples_per_branch": 221, + "ramp_restarts_per_branch": 220, + "interval_s": 0.25, + "actual_hardcoded_max_step_s": 0.0125, + "hypothetical_divisor80_max_step_s": 0.003125 + }, + { + "rate_V_s": 0.04, + "samples_per_branch": 441, + "ramp_restarts_per_branch": 440, + "interval_s": 0.125, + "actual_hardcoded_max_step_s": 0.00625, + "hypothetical_divisor80_max_step_s": 0.0015625 + }, + { + "rate_V_s": 0.08, + "samples_per_branch": 111, + "ramp_restarts_per_branch": 110, + "interval_s": 0.25, + "actual_hardcoded_max_step_s": 0.0125, + "hypothetical_divisor80_max_step_s": 0.003125 + }, + { + "rate_V_s": 0.08, + "samples_per_branch": 221, + "ramp_restarts_per_branch": 220, + "interval_s": 0.125, + "actual_hardcoded_max_step_s": 0.00625, + "hypothetical_divisor80_max_step_s": 0.0015625 + }, + { + "rate_V_s": 0.08, + "samples_per_branch": 441, + "ramp_restarts_per_branch": 440, + "interval_s": 0.0625, + "actual_hardcoded_max_step_s": 0.003125, + "hypothetical_divisor80_max_step_s": 0.00078125 + } + ], + "new_simulations_authorized": false + }, + "phase0": { + "new_solves": 0, + "actions": [ + "Verify pinned inputs/curves and exact physical history", + "Apply the per-record executable power-error predicate; missing evidence stays unknown", + "Implement and independently check decoupled controls, interpolation/derivatives and event-side current under a separate authorized task before reference generation" + ] + }, + "future_decoupled_reference_driver": { + "implementation_status": "not_implemented", + "source_path": null, + "control_restart_grid": { + "status": "exact_proposed_grid_to_freeze", + "physical_phase_boundaries": "The seven phase starts/ends listed in phase_profiles", + "ramp_control_intervals_per_branch": 440, + "ramp_restart_formula": "phase_start + j*phase_duration/440 for integer j=0..440, with the same grid for every observation request and every max-step/solver refinement level", + "hold_restart_rule": "One fixed control interval per hold phase, ending at its physical event boundary", + "local_time_origin": "0 at each fixed control interval; physical time=interval_start+local_time; carry the final physical state without an output-driven reset or new initialization", + "observation_independence": "111/221/441 or additional qualified observation points never alter this control grid", + "basis": "Fix the existing 441-point peak-reference control cadence once; do not reinterpret a changing n_points value as independent temporal refinement" + }, + "phase_profiles": [ + { + "rate_V_s": 0.02, + "phases": [ + { + "id": "dark_seed", + "start_s": 0.0, + "end_s": 120.0, + "duration_s": 120.0, + "max_step_s_levels": [ + 6.0, + 3.0, + 1.5 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_prebias", + "start_s": 120.0, + "end_s": 150.0, + "duration_s": 30.0, + "max_step_s_levels": [ + 1.5, + 0.75, + 0.375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_light_dwell", + "start_s": 150.0, + "end_s": 150.5, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_ramp", + "start_s": 150.5, + "end_s": 260.5, + "duration_s": 110.0, + "max_step_s_levels": [ + 0.0125, + 0.00625, + 0.003125 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_turnaround", + "start_s": 260.5, + "end_s": 263.5, + "duration_s": 3.0, + "max_step_s_levels": [ + 0.15, + 0.075, + 0.0375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_light_dwell", + "start_s": 263.5, + "end_s": 264.0, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_ramp", + "start_s": 264.0, + "end_s": 374.0, + "duration_s": 110.0, + "max_step_s_levels": [ + 0.0125, + 0.00625, + 0.003125 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + } + ], + "physical_phase_boundaries_s": [ + 0.0, + 120.0, + 150.0, + 150.5, + 260.5, + 263.5, + 264.0, + 374.0 + ] + }, + { + "rate_V_s": 0.04, + "phases": [ + { + "id": "dark_seed", + "start_s": 0.0, + "end_s": 120.0, + "duration_s": 120.0, + "max_step_s_levels": [ + 6.0, + 3.0, + 1.5 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_prebias", + "start_s": 120.0, + "end_s": 150.0, + "duration_s": 30.0, + "max_step_s_levels": [ + 1.5, + 0.75, + 0.375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_light_dwell", + "start_s": 150.0, + "end_s": 150.5, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_ramp", + "start_s": 150.5, + "end_s": 205.5, + "duration_s": 55.0, + "max_step_s_levels": [ + 0.00625, + 0.003125, + 0.0015625 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_turnaround", + "start_s": 205.5, + "end_s": 208.5, + "duration_s": 3.0, + "max_step_s_levels": [ + 0.15, + 0.075, + 0.0375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_light_dwell", + "start_s": 208.5, + "end_s": 209.0, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_ramp", + "start_s": 209.0, + "end_s": 264.0, + "duration_s": 55.0, + "max_step_s_levels": [ + 0.00625, + 0.003125, + 0.0015625 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + } + ], + "physical_phase_boundaries_s": [ + 0.0, + 120.0, + 150.0, + 150.5, + 205.5, + 208.5, + 209.0, + 264.0 + ] + }, + { + "rate_V_s": 0.08, + "phases": [ + { + "id": "dark_seed", + "start_s": 0.0, + "end_s": 120.0, + "duration_s": 120.0, + "max_step_s_levels": [ + 6.0, + 3.0, + 1.5 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_prebias", + "start_s": 120.0, + "end_s": 150.0, + "duration_s": 30.0, + "max_step_s_levels": [ + 1.5, + 0.75, + 0.375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_light_dwell", + "start_s": 150.0, + "end_s": 150.5, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "forward_ramp", + "start_s": 150.5, + "end_s": 178.0, + "duration_s": 27.5, + "max_step_s_levels": [ + 0.003125, + 0.0015625, + 0.00078125 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "dark_turnaround", + "start_s": 178.0, + "end_s": 181.0, + "duration_s": 3.0, + "max_step_s_levels": [ + 0.15, + 0.075, + 0.0375 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_light_dwell", + "start_s": 181.0, + "end_s": 181.5, + "duration_s": 0.5, + "max_step_s_levels": [ + 0.025, + 0.0125, + 0.00625 + ], + "proposed_max_rhs_evaluations": 100000, + "control_intervals": 1, + "max_rhs_evaluations_per_control_interval": 100000 + }, + { + "id": "reverse_ramp", + "start_s": 181.5, + "end_s": 209.0, + "duration_s": 27.5, + "max_step_s_levels": [ + 0.003125, + 0.0015625, + 0.00078125 + ], + "proposed_max_rhs_evaluations": 44000000, + "control_intervals": 440, + "max_rhs_evaluations_per_control_interval": 100000 + } + ], + "physical_phase_boundaries_s": [ + 0.0, + 120.0, + 150.0, + 150.5, + 178.0, + 181.0, + 181.5, + 209.0 + ] + } + ], + "max_step_rule": "Use the literal seconds in the selected common refinement level for every integration. These fixed numbers were chosen once from the source hold caps and legacy 441-point ramp intervals; they are independent of the requested observation count.", + "work_cap_rationale": "100000 is the existing per-attempt RHS cap. Apply that fixed cap to each declared control interval; 44000000 is only the aggregate branch ceiling over the 440 frozen intervals. The 600 s wall and RSS caps still stop first. Old automatic bisection/radiative/BDF fallback is not silently inherited; any fallback must be explicitly recorded and qualified.", + "observation_grids": { + "samples_per_branch": [ + 111, + 221, + 441 + ], + "voltage_axis": "Uniform -1..1.2 V forward and reverse, with exact phase time map", + "independence": "All grids query the same accepted trajectory at fixed control/restart/max-step settings; requesting more observations must not change accepted steps or the physical history", + "output_kind": "native endpoint or independently qualified solver dense output, with interpolation/state/derivative error evidence; display PCHIP is never counted as a new observation or accepted step" + }, + "storage": "Retain control event-side states, all accepted-step times and error evidence, required native branch outputs and dense-output coefficients or an equivalent replayable representation; no omission of difficult intervals" + }, + "sentinel_case_ids": [ + "hi_diffusivity_00", + "hi_density_00", + "hi_diffusivity_01", + "hi_diffusivity_02", + "hi_diffusivity_03", + "hi_density_01", + "hi_density_02", + "hi_density_03", + "hi_diffusivity_10", + "hi_diffusivity_20", + "hi_density_20", + "hi_rate_20", + "hi_rate_80" + ], + "sentinel_conditions": 13, + "phase1_spatial": { + "requested_N": [ + 60, + 120, + 240 + ], + "expected_actual_nodes": [ + 61, + 121, + 241 + ], + "fixed_output_samples_per_branch": 441, + "fixed_max_step_level": 2, + "fixed_solver_rtol": 1e-06, + "fixed_density_atol_m3": 0.01, + "maximum_new_solves": 39, + "rule": "Compare conserved/weighted fields with separate interface traces; preserve the exact phase restart grid and current observable" + }, + "phase1_temporal": { + "fixed_actual_nodes": 121, + "fixed_output_samples_per_branch": 441, + "max_step_levels": [ + 0, + 1, + 2 + ], + "fixed_solver_rtol": 1e-06, + "fixed_density_atol_m3": 0.01, + "maximum_additional_solves": 26, + "rule": "Only literal seconds caps change; the fixed 440-interval ramp control grid, hold boundaries and observation grid stay fixed; level 2 overlaps spatial runs" + }, + "phase1_solver": { + "fixed_actual_nodes": 121, + "fixed_output_samples_per_branch": 441, + "fixed_max_step_level": 2, + "rtol_values": [ + 0.0001, + 1e-05, + 1e-06 + ], + "density_atol_m3_values": [ + 1, + 0.1, + 0.01 + ], + "maximum_additional_solves": 26, + "rule": "This is a joint local-error tolerance ladder. An independent nonlinear/residual or alternative-algorithm accuracy check remains necessary; do not count rtol and atol as separate axes." + }, + "phase1_observable_extraction": { + "samples_per_branch": [ + 111, + 221, + 441 + ], + "maximum_additional_integrations": 0, + "rule": "Query the same qualified finest trajectory and explicit current definitions at the three observation grids; bracket true Pmax/Voc and bound interpolation/derivative errors. Dense interpolation without an independent bound earns no precision credit." + }, + "phase1_solver_independence_gap": "The present waveform path exposes no independently user-controlled nonlinear residual gate and no qualified dense-output derivative. These must be supplied and checked by an authorized future driver; current plan arithmetic does not certify them.", + "phase1_admission": "Require independently justified conservative bounds for all four contributions and the stricter per-case power predicate; contraction or repeatability alone is not a certificate", + "phase2_full_matrix": { + "records": 45, + "maximum_distinct_conditions_if_complete_identity_deduplicates": 43, + "one_axis_maximum_integrations_per_condition": 4, + "maximum_initial_solves_without_deduplication": 180, + "observation_re_evaluation_integrations": 0, + "settings": "Qualified common base plus adjacent space/time/solver checks for each otherwise untested case; observation grids reuse a qualified trajectory", + "reuse": "Only exact full identity intersections; retain all 45 coverage relations", + "rule": "Sentinels do not certify other coordinates; insufficient error bounds or coupled axes remain unresolved within the initial cap, with further work requiring a separately reviewed bounded plan" + }, + "bounded_failure": "Preserve first failure, unstarted work and unsupported controls; no automatic larger budgets or relaxed numeric limits" + }, + "resource_proposal": { + "maximum_phase1_new_solves": 91, + "maximum_phase2_solves_before_reuse": 180, + "wall_limit_per_case_s": 600, + "phase1_wall_budget_s": 21600, + "phase2_wall_budget_s": 43200, + "active_scientific_workers": 1, + "BLAS_threads": 1, + "maximum_RSS_GiB": 8, + "maximum_stage_artifacts_bytes": 16168676163, + "maximum_stage_artifacts_basis": { + "unit": "byte; an exact integer, not a GiB, GB or rounded value", + "previous_maximum": "V1 maximum_stage_artifacts_GiB = 4, i.e. 4294967296 bytes", + "allowance": "K3 = b no-migration allowance; the hysteresis originals stay in place. It is the governed total at the census (13,483,544,355 bytes of originals in 52,358 files, 29,088,800 bytes of Stage05 and a 1,048,576-byte packet allowance) plus the Stage05 growth reserve plus one 121-node sentinel peak reservation", + "components": [ + { + "name": "governed_total_at_census", + "bytes": 13513681731, + "bounds_pointer": "/census/governed_total_G0" + }, + { + "name": "stage05_growth_reserve", + "bytes": 67108864, + "bounds_pointer": "/k5/stage05_growth_reservation_bytes" + }, + { + "name": "one_sentinel_peak_reservation", + "bytes": 2587885568, + "bounds_pointer": "/k5/reserved_sentinel_peak_bytes" + } + ], + "bounds": { + "root": "archive", + "path": "test/ArchitectureRefactor/Stage05/ReferenceTracksV1/MigrationV1/Bounds.json", + "sha256": "fb8d6e870aae7089032e2a4c3e6e3bea4eb310b3d8e08d4fe4c577e4dcf55083", + "pointer": "/option_b_allowance/keep_originals_without_migration_bytes" + }, + "conditional_variant": { + "bytes": 17418628839, + "applies_only_if": "a separately reviewed migration (condition K2) later keeps its containers in the governed folder beside the kept originals", + "otherwise": "maximum_stage_artifacts_bytes (16168676163) is the stage maximum", + "components": [ + { + "name": "governed_total_with_migrated_containers_and_originals_kept", + "bytes": 14763634407, + "bounds_pointer": "/schedule_A_materialize_all_then_verify_then_optional_removal/final_if_originals_kept" + }, + { + "name": "stage05_growth_reserve", + "bytes": 67108864, + "bounds_pointer": "/k5/stage05_growth_reservation_bytes" + }, + { + "name": "one_sentinel_peak_reservation", + "bytes": 2587885568, + "bounds_pointer": "/k5/reserved_sentinel_peak_bytes" + } + ], + "bounds_pointer": "/option_b_allowance/keep_originals_with_containers_peak_bytes" + } + }, + "derivation": "The corrected decoupled plan has 39 spatial plus 26 time-cap plus 26 solver integrations; observation refinements reuse accepted trajectories. Current legacy sampling is joint and earns no independent credit. Existing historical costs remain context only; all caps are stop rules, not predictions or execution authorization.", + "scheduling": "Correctness phase is not a performance claim. No three-repeat performance requirement added to expensive science runs." + }, + "first_point_contract": { + "historical": "All archived stored-current curves omit first sample; 90 branch-start currents have no historical array reference", + "new_output": "Retain end-dwell and event-side states, input derivatives, and explicit instantaneous ramp-side current; also retain separately labeled legacy interval endpoint current if comparing historical arrays", + "do_not_substitute": "A finite difference across the light switch or the full dwell is not the ramp-start instantaneous displacement current", + "verification": "Check current components, boundary orientation and Maxwell balance; compare later common samples without hiding the first point and certify starts against an independent derivative/residual reference" + }, + "conservation_proposal": { + "interval_and_total": "Apply the inventory thresholds to every accepted interval and the sum of absolute interval balance defects over each physical phase and whole history; terminal drift alone cannot hide cancellation", + "current_balance_A_m2": { + "atol": 0.001, + "rtol": 0.0001, + "fixed_scale_A_m2": 160.2176634, + "rule": "sum" + }, + "current_balance_definition": "Maximum spread of properly oriented total (conduction plus displacement) current, with the same physical terminal definition; no claim from conduction-current constancy alone", + "controls_gap": "Bind actual accepted-step data and a validated residual/current reconstruction before these checks can be executed" + }, + "metric_contract": { + "HI_P": "Pmax_reverse/Pmax_forward - 1", + "HI_normalized": "(Pmax_reverse-Pmax_forward)/Pmax_reverse", + "zero_denominator": "unknown with null value and reason; never filled with zero", + "weak_forward_power": "Propagate independent Pmax uncertainty before accepting a large HI; do not enlarge floors from candidate results", + "required_acceptance_outputs": [ + "both full native J-V branches including negative bias and injection", + "Pmax on each branch", + "Jsc on each branch", + "Voc and bracket/slope on each branch", + "FF and PCE when defined", + "both explicitly named HI definitions", + "inventory/current components and first-point status" + ], + "first_point": "Original stored-state current reconstruction omitted index 0 on each branch because its predecessor was not exported; this omission is tagged and does not authorize new solvers to discard first points", + "PCHIP": "401-point display guides are not new simulations, observations, or accepted sample counts" + }, + "external_data_needs": "No new author Calado data needed for original internal-matrix reproduction. Exact historical source/environment or explicit current-source rebaseline is needed; original Calado paper quantitative match remains outside this task.", + "execution_authorized": false, + "scientific_qualification_granted": false, + "review_working_head": "9224f652aa2527db9139579f25033d93aafc77f4", + "freeze_scope": { + "threshold_and_reference_plan_freeze": "Requires independent approval of this corrected plan and the already approved numeric limits; does not require already completed physical refinement runs", + "qualified_reference_use": "Requires actual immutable source/input/environment/initial-state bindings and independently established per-case reference errors, including the executable power predicate", + "candidate_acceptance": "Requires the frozen contract, qualified reference, eligible candidate identity and all physical/numerical checks; no missing uncertainty may be zero-filled", + "candidate_execution_authorized": false + }, + "observable_definitions": { + "historical_interval_current": { + "definition": "J_cond(t_j) plus signed [D(t_j)-D(t_(j-1))]/(t_j-t_(j-1)); use original 111-point branch intervals for old stored-current comparisons", + "scope": "110 archived current values/branch; the original driver first value was a dwell-interval current, and the archived reconstruction omitted it", + "identity": "Explicitly label legacy_interval_endpoint; never compare it silently with instantaneous current" + }, + "instantaneous_ramp_current": { + "definition": "J_cond(t)+signed dD/dt on the requested ramp event side; for this fixed-epsilon HI model, Ddot=epsilon0*epsilon_face*Edot, with Edot from differentiated Poisson using the full charge derivative and the actual boundary voltage derivative", + "event_rule": "Save end-dwell prestate and evaluate the ramp-side derivative at t=0+; a voltage/light discontinuity has event-side and integrated-charge accounting, not a fabricated finite instantaneous impulse value", + "identity": "instantaneous_ramp_side_v1; future qualified driver only" + }, + "independent_error_estimate": { + "legacy_to_instantaneous": "On a smooth single physical phase, interval quotient bias is bounded by (Delta_t/2)*sup|D_second_time_derivative| plus endpoint/interpolation/Poisson errors; do not apply this across events", + "instantaneous": "Bound differentiated-Poisson residual and RHS/state/dense-derivative errors, crosscheck against a separately refined temporal solution or independent derivative calculation; an ODE state tolerance alone does not bound Ddot", + "metric_propagation": "Propagate qualified current/dense-output errors to bracketed Pmax/Voc and then apply the executable per-case HI power predicate", + "status": "independent bounds not yet available" + }, + "history_comparison": "Compute both labeled observables from the same qualified future trajectory if needed; historical agreement does not certify instantaneous currents and no observable definition changes inside a comparison" + } +} diff --git a/reproducibility/RefactorReferenceManifestV1.json b/reproducibility/RefactorReferenceManifestV1.json index 858ca6fe..d548f611 100644 --- a/reproducibility/RefactorReferenceManifestV1.json +++ b/reproducibility/RefactorReferenceManifestV1.json @@ -897,9 +897,9 @@ { "id": "hi_reference_contract", "root": "repository", - "path": "reproducibility/HysteresisReferenceContractV1.json", - "sha256": "bec9fff7f5194a81492b9697f354d460413293a84aa66667c97cf5371adf8d67", - "bytes": 43782, + "path": "reproducibility/HysteresisReferenceContractV2.json", + "sha256": "9a62e36920dd558e19c196cefed6cc191c74253db05ea54a0e1644d6a22eb96a", + "bytes": 49140, "role": "frozen_prospective_HI_thresholds_and_reference_plan", "status": "frozen_standard_reference_qualification_pending" }, diff --git a/scripts/benchmarks/hysteresis_reference.py b/scripts/benchmarks/hysteresis_reference.py index 9620f39e..1db1f68f 100644 --- a/scripts/benchmarks/hysteresis_reference.py +++ b/scripts/benchmarks/hysteresis_reference.py @@ -28,8 +28,8 @@ from typing import Any -CONTRACT = "reproducibility/HysteresisReferenceContractV1.json" -CONTRACT_SHA256 = "bec9fff7f5194a81492b9697f354d460413293a84aa66667c97cf5371adf8d67" +CONTRACT = "reproducibility/HysteresisReferenceContractV2.json" +CONTRACT_SHA256 = "9a62e36920dd558e19c196cefed6cc191c74253db05ea54a0e1644d6a22eb96a" ANALYTIC = "tests/numerical_contracts/AnalyticGatesV1.json" ANALYTIC_SHA256 = "43c9ba4ab1b6a95b3e278efcd8eed9a67dc4d5e258295c8e6961c53f7ee57201" PHASE_IDS = ("dark_seed", "dark_prebias", "forward_light_dwell", "forward_ramp", diff --git a/tests/ci/exclusions.json b/tests/ci/exclusions.json index 2977fd52..3163fe69 100644 --- a/tests/ci/exclusions.json +++ b/tests/ci/exclusions.json @@ -95,6 +95,7 @@ ], "platform_bound_fixtures": { "tests/support/assembly_baselines.json": "Raw float/complex words and sparse patterns captured on the recorded Darwin arm64 Python/NumPy/SciPy and Accelerate stack.", + "tests/unit/assembly/fixtures/dc2d_gate_v1.npz": "Original pinned 4c7fb353 gate arrays; raw-word comparisons use the shared capture-environment guard while live old-vs-new readouts remain unconditional.", "tests/unit/assembly/fixtures/dc2d_steady_seeds_v1.json": "Exact historical input-coordinate bytes are portable; decoded physical-field word digests require the supported capture stack. Live original-vs-assembled solves use the unchanged input words and current gates on every platform.", "env:SOLARLAB_ASSEMBLY_2D_BASELINE": "Optional pinned DC2D gate NPZ contains original captured float arrays and sparse patterns; compare only on the capture stack.", "tests/independent/p04/fixtures/P04LegacyGoldenV1.json": "Existing macOS/Accelerate golden: floating comparisons retain their current platform prerequisites; metadata and quoted-value checks remain portable.", diff --git a/tests/refactor/test_hysteresis_reference.py b/tests/refactor/test_hysteresis_reference.py index 936acd35..f3c157fe 100644 --- a/tests/refactor/test_hysteresis_reference.py +++ b/tests/refactor/test_hysteresis_reference.py @@ -2,6 +2,7 @@ from __future__ import annotations import copy +import hashlib import importlib.util import json import os @@ -24,6 +25,19 @@ spec.loader.exec_module(hr) +def changed_key_paths(old, new, path=""): + """Smallest JSON pointers added, removed or modified from old to new.""" + if isinstance(old, dict) and isinstance(new, dict): + keys = [*old, *(key for key in new if key not in old)] + return [found for key in keys for found in ( + changed_key_paths(old[key], new[key], f"{path}/{key}") if key in old and key in new + else [f"{path}/{key}"])] + if isinstance(old, list) and isinstance(new, list) and len(old) == len(new): + return [found for index, pair in enumerate(zip(old, new)) + for found in changed_key_paths(*pair, f"{path}/{index}")] + return [] if type(old) is type(new) and old == new else [path] + + class RecordingAdapter: """Analytic synthetic fixture only; seven arbitrary carried state blocks.""" @@ -114,6 +128,13 @@ def test_wrong_frozen_source_digest_rejected(self): with self.assertRaisesRegex(hr.ReferenceError, "source mismatch"): hr.checked_json(REPO/hr.CONTRACT, "0"*64) + def test_superseded_contract_is_unchanged_history_and_only_declared_paths_differ(self): + superseded = self.contract["supersedes"] + raw = (REPO/superseded["path"]).read_bytes() + self.assertEqual((hashlib.sha256(raw).hexdigest(), len(raw)), (superseded["sha256"], superseded["bytes"])) + self.assertEqual(sorted(changed_key_paths(json.loads(raw), self.contract)), + sorted(superseded["changed_key_paths"])) + class TestTimeline(FrozenFixture): def test_exact_physical_phases_for_all_three_rates(self): diff --git a/tests/unit/assembly/fixtures/dc2d_gate_v1.npz b/tests/unit/assembly/fixtures/dc2d_gate_v1.npz new file mode 100644 index 00000000..640c2722 Binary files /dev/null and b/tests/unit/assembly/fixtures/dc2d_gate_v1.npz differ diff --git a/tests/unit/assembly/test_assembly_ordered_readout.py b/tests/unit/assembly/test_assembly_ordered_readout.py index 0045ebff..1ef04fac 100644 --- a/tests/unit/assembly/test_assembly_ordered_readout.py +++ b/tests/unit/assembly/test_assembly_ordered_readout.py @@ -1,8 +1,8 @@ """The ordered port readout against the original 2D contact readout. -The five 2D harness factories at their four probes (Core's 2D-gate probes, -cross-checked against the gate's frozen ``Baseline4c7fb353.npz`` states) are -read out through :meth:`Assembler.reaction_flux_ordered`. The Terms here +The five 2D harness factories at their four probes are read out through +:meth:`Assembler.reaction_flux_ordered`. Their frozen gate states are checked +separately, with the capture guard, in ``test_assembly_two_dimensional``. The Terms here return the original constitutive values (SG/CT face fluxes, generation and the bound recombination as two plain cell parts), so only the readout arithmetic is under test, not a 2D F/J binding. Every fixed-reservoir port @@ -15,7 +15,6 @@ from collections.abc import Iterator, Mapping from dataclasses import dataclass, field, replace -from pathlib import Path from typing import Any, Callable, TypeAlias import numpy as np @@ -40,7 +39,6 @@ FLUX = PARTICLE / (AREA * SECOND) SOURCE = PARTICLE / (VOLUME * SECOND) BALANCE = PARTICLE / (LENGTH * SECOND) -GATE = Path("/Users/bytedance/Intern/SolarLab/.worktrees/assembly_2d/artifacts/Assembly2DGateV1/Baseline4c7fb353.npz") @pytest.fixture(scope="module", autouse=True) @@ -134,7 +132,6 @@ def bits(value: object) -> bytes: def test_twenty_probes_read_out_every_fixed_port_bitwise(request: pytest.FixtureRequest) -> None: - gate = np.load(GATE) if GATE.exists() else None compared = changed_plain = probes = 0 for name in FACTORIES: case = REFERENCE_FACTORIES[name]() @@ -142,8 +139,6 @@ def test_twenty_probes_read_out_every_fixed_port_bitwise(request: pytest.Fixture assembler = readout_binding(device) for state in case.states: probes += 1 - if gate is not None: - assert bits(gate[f"{name}__{state.name}_u"]) == bits(state.u) inputs = OperatingInputs(state.voltage_V, state.generation_scale) original = DC2DProblem(device, state.voltage_V, state.generation_scale).contact_particle_fluxes(state.u) system = assembler.evaluate(state.u, inputs, derivatives=False) @@ -173,7 +168,7 @@ def test_twenty_probes_read_out_every_fixed_port_bitwise(request: pytest.Fixture assert probes == 20 and compared == 56 request.node.user_properties.append(("ordered_readout", { "probes": probes, "fixed_port_vectors": compared, "changed_words": 0, - "plain_reaction_flux_changed_words": changed_plain, "gate_states_checked": gate is not None})) + "plain_reaction_flux_changed_words": changed_plain})) def test_the_readout_identity_records_the_operation_and_both_stencils() -> None: diff --git a/tests/unit/assembly/test_assembly_two_dimensional.py b/tests/unit/assembly/test_assembly_two_dimensional.py index ff3153dc..8fa07d4c 100644 --- a/tests/unit/assembly/test_assembly_two_dimensional.py +++ b/tests/unit/assembly/test_assembly_two_dimensional.py @@ -1,9 +1,10 @@ """Bitwise DC2D migration, against frozen oracles and the unchanged readouts. The twenty harness states are algebra probes, not accepted steady results. -Set SOLARLAB_ASSEMBLY_2D_BASELINE to the pinned gate NPZ to additionally -compare the raw arrays captured at 4c7fb353; the repository's frozen digest -oracle is checked on its capture environment. Live old-vs-new comparisons +The checked-in gate NPZ retains the raw arrays captured at 4c7fb353; +SOLARLAB_ASSEMBLY_2D_BASELINE may explicitly override its location with the +same pinned bytes. Raw arrays and the repository's frozen digest oracle +are checked on their capture environment. Live old-vs-new comparisons run on every platform. No baseline is rewritten and no solver is called. """ @@ -36,6 +37,7 @@ FACTORIES = ("dc2d:fixed", "dc2d:contacts", "dc2d:ct", "dc2d:grain", "dc2d:composed") BASELINE_SHA256 = "dee5eae717fbba920fa0d8ddd1dc7d657beb7d33dca34ad594d00031fd687345" +BASELINE = Path(__file__).with_name("fixtures") / "dc2d_gate_v1.npz" @pytest.fixture(scope="module", autouse=True) @@ -51,10 +53,7 @@ def cases() -> dict[str, ReferenceCase]: @pytest.fixture(scope="module") def gate_baseline(frozen_digests: tuple[Callable[[Any], dict[str, Any]], dict[str, Any]]) -> Iterator[Any]: - filename = os.environ.get("SOLARLAB_ASSEMBLY_2D_BASELINE") - if filename is None: - yield None - return + filename = os.environ.get("SOLARLAB_ASSEMBLY_2D_BASELINE", str(BASELINE)) path = Path(filename) assert hashlib.sha256(path.read_bytes()).hexdigest() == BASELINE_SHA256 with np.load(path, allow_pickle=False) as baseline: @@ -117,13 +116,12 @@ def test_all_twenty_states_match_frozen_original_arrays( candidate = assembled_capture(case, state) assert candidate.S is None and candidate.S_u is None and candidate.M is None 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) + 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) request.node.user_properties.append(("frozen_parity", {"factory": name, "states": len(case.states), "F_changed_words": 0, "J_changed_words": 0, "gate_NPZ": gate_baseline is not None}))