Skip to content

Latest commit

 

History

History
190 lines (156 loc) · 11.2 KB

CANONICAL_GENERATION.md

File metadata and controls

190 lines (156 loc) · 11.2 KB

Canonical moon generation

Status and authority

The current authoritative moons.js and moonelements.js are preserved. Their exact source and output SHA-256 identities, numerical generator source hashes, serialization rules and upstream notices are bound in generation-manifest.json. This is a moon-assets contract, not the simulation's cross-OS byte-identity contract.

Canonical qualification is qualified for the current moon asset contract. The current native source refresh retains two pending and two strict runs after the validator/generator lifecycle fixes, their independent reviews and exact current source correspondence. The original native VM report and independent review remain historical evidence. The runtime is CPython 3.12.12 on Linux x86_64 (linux/amd64), image python:3.12.12-slim-bookworm, architecture-specific digest sha256:2986c55feb36e6cae00fa1fefb454283e4b33f35e75ff8bdd123b134130be301. That digest was resolved from official Docker Hub image metadata on 2026-09-11. The original investigation did not execute it. Neither a mutable tag nor a Linux ARM run qualifies the selected x86_64 image. The locally available WSL/Docker platform is aarch64; its runtime is diagnostic rather than acceptance evidence. The subsequent native VM investigation reproduced the authoritative files twice in the exact image before reviewed metadata promotion. This does not qualify other runtimes or the complete production release.

Operator commands and exits

No credentials, administrator permission or network access are needed for the checks. Use the committed pristine CSV inputs; do not fetch data during reproduction.

python tools/generate_moons.py --check
python tools/validate_moons.py
python -m unittest discover -s tests/python -p test_moon_generation.py -v

The first command checks all source/generator hashes, regenerates both outputs in memory, and compares generated and committed UTF-8/LF bytes with the reviewed hashes. It does not write. A successful noncanonical comparison prints a warning and is not canonical qualification. The validator also runs the independent held-out-vector accuracy checks. Its fixed limits remain 0.15 degrees angular error and 0.0025 fractional radial error, with at least 100 checks per moon; this work did not change the model or these limits.

generate_moons.py exits 0 on a successful permitted operation, 1 on output byte/hash mismatch, and 2 on invalid source/manifest or unqualified authoritative-generation request. validate_moons.py exits nonzero for any regeneration or numerical failure. Default generation without --check refuses unqualified runtimes before touching outputs. --require-canonical also refuses a read-only check unless every qualification condition is satisfied. Never respond to a noncanonical byte mismatch by overwriting the files.

Recorded two-platform comparison (2026-09-11)

The exact same committed three source files were used on both platforms; their hashes are in the manifest. The complete generator was evaluated without writing either output.

Observation Windows ARM64 CPython 3.14.3 WSL Ubuntu Linux aarch64 CPython 3.14.4, glibc 2.43
moons.js SHA-256 0fe13220d6214d62a6b472f5cc8e2ccb2f8fbfaeb7eb1d5e611b40c272a90f51 same
moonelements.js SHA-256 3353c5e2ff630c78b25c4f61a62fd5d97718d271ad051a87c2d77dc620f70f09 e1dfc8d737bf92c96cc132756c7e13e0c6bb9a6c49b86654996bb472112be05f (committed)
Oberon knot 320 q.hex() -0x1.1f4400d2bab6bp+0 -0x1.1f4400d2bab6ap+0
Serialized round(q, 12) -1.122131396721 -1.12213139672

The differing knot uses these exact input CSV values:

{"M":215.330717637,"a":583559.370317,"argp":173.844573139,"code":"704","e":0.002339866198,"i":97.905866073,"jd":2461455.5,"n":26.730324243881,"name":"Oberon","node":167.707504141,"planet":"Uranus"}

The measured q values differ by one binary64 ULP near a decimal rounding boundary. That establishes a runtime-dependent numerical/serialization difference, not its unique cause: OS, C math library and Python version also differ. No claim of an isolated CPython, architecture or libm defect is made. Linux ARM's successful reproduction proves source-to-output correspondence on that observed runtime, not universal Linux identity. Its independent 11,985 checks measured maximum angular error 0.1384 degrees (Nereid, JD 2461053.0) and radial error 0.1893 percent (Enceladus, JD 2461674.2), across the shared JD 2459219.0–2462859.0 validation interval.

Reproduce or renew the canonical qualification

This requires an operator-authorized Linux x86_64 environment with the exact pinned image already available. Do not silently pull a replacement tag or count an ARM image as amd64. Inspect the image digest/platform and observe platform.machine(), implementation and Python version inside the container. Keep the checkout read-only for both comparison runs. For example, from a Linux shell with the repository as the current directory:

docker image inspect python@sha256:2986c55feb36e6cae00fa1fefb454283e4b33f35e75ff8bdd123b134130be301
docker run --pull=never --rm --platform linux/amd64 --network none --read-only \
  --mount "type=bind,src=$PWD,dst=/work,readonly" --workdir /work \
  --env PYTHONDONTWRITEBYTECODE=1 \
  --env SOL_MOON_GENERATOR_IMAGE_DIGEST=sha256:2986c55feb36e6cae00fa1fefb454283e4b33f35e75ff8bdd123b134130be301 \
  python@sha256:2986c55feb36e6cae00fa1fefb454283e4b33f35e75ff8bdd123b134130be301 \
  python -B tools/validate_moons.py --require-canonical

For a qualification renewal, run the complete comparison twice in separate fresh containers, preserving both logs, observed runtime facts, input/generator/output hashes and numerical maxima. While status is pending, diagnostic runs will say noncanonical; this is deliberate. If either run differs, leave status pending and preserve authoritative files. Investigate the difference before proposing new output hashes; never lower tolerances to obtain a green check.

After independent review confirms both full runs have the same reviewed output hashes and pass the unchanged numerical bounds, record the evidence path and identical_runs: 2 and set canonical.status to qualified. The invoking workflow must then use the exact digest and set SOL_MOON_GENERATOR_IMAGE_DIGEST to that same digest, and run:

python -B tools/validate_moons.py --require-canonical

The environment variable is an assertion by the trusted launcher, not an independent container attestation; Python cannot prove an image digest from inside a process. Workflow image pinning and image inspection supply that part of the evidence. Do not set the variable on an arbitrary host as a workaround. CI enforcement must not label pending qualification as passed. The delivery workflow and its qualification evidence are owned separately.

Read-only evidence collector and CI integration

tools/collect_moon_evidence.py collects one comparison as JSON. It admits only the manifest's exact image assertion and Linux x86_64 CPython version, checks source identities, generates both modules in memory and runs the complete held-out-vector validator. It records hashes of all ten inputs before and after, generated and committed output hashes, runtime facts and the numerical log. An image assertion on an arbitrary host cannot qualify that host.

The collector exits 0 only for a passing comparison, 1 for a comparison failure and 2 for source/runtime/image admission refusal. qualification_granted remains false even when the comparison passes. A pending comparison is candidate evidence for independent review; it does not grant release qualification. When the manifest is qualified, the collector invokes the validator with --require-canonical and checks the recorded qualification conditions too.

Prepare only the fixed public inputs for an isolated mount:

python tools/collect_moon_evidence.py --snapshot build/NEW-moon-inputs

Snapshot mode requires a new directory under build/, verifies the source manifest and copies only the ten named files. It excludes .git, credentials and unrelated project content. Existing targets and redirected build roots are refused. Input mutation prevents successful completion; preserve incomplete evidence for inspection and choose a new directory for another attempt.

The moon-image-evidence job in CI has two matrix samples on native Ubuntu x86_64 runners. Each pulls the exact existing digest, checks the image OS/architecture and records repository digests, then runs a fresh container with read-only root and input mount, no network, two CPUs, 1 GiB memory, 128 PIDs, dropped capabilities and no new privileges. It retains JSON artifacts on failure as well as success. It never rewrites generated modules or promotes the manifest. After collection, CI explicitly requires both a passing comparison and recorded qualified status. A future pending reset can retain candidate evidence but fails the strict CI job. The duplicate host-dependent moon regeneration was moved out of the web job; both required image jobs still run the full numerical validator.

Both expanded matrix names are included in the authoritative release inventory in tools/release_policy.py, and the aggregate is required by the release gate. Missing, failed, skipped or cancelled evidence is rejected by regression tests. An independently maintained protected verifier/profile must adopt the reviewed inventory before accepting a future candidate; no protected settings, accepted profile, hosted job, commit, push or publication was changed by this local work.

The admission/reporting tests use mocks and do not count as numerical or native image evidence. Run them with the existing test runner:

python -m unittest discover -s tests/python -p test_canonical_moon_evidence.py -v
python -m unittest discover -s tests/python -p test_release_policy.py -v

Updating sources or generators and rollback

Treat sources, generator source hashes, reviewed output hashes and qualification as one reviewed change. Source bytes are immutable evidence: retain the previous version in Git and record new upstream provenance/notices before replacing inputs. A source/model change must reset canonical qualification to pending. The CLI intentionally refuses unreviewed source or output hashes. Candidate output review can be performed by importing build() in an isolated scratch checkout; it returns two strings without modifying authoritative files. Compare the complete outputs, not just the known Oberon knot, and independently run the numerical validator before accepting any new pin. No automatic manifest updater or tolerance relaxation is provided.

After review, update the manifest and both generated modules together in the same bounded change, then rebuild and validate the release/cache graph. A qualified default write only allows bytes already matching the reviewed manifest. Roll back by restoring the previously reviewed source, generator, manifest and two-output set together through normal code review; do not restore one moon file independently or use a broad worktree reset.