Skip to content

[P1][hillclimb] Add explicit hermetic package check, build and fixture-test CLI #84

Closed

Description

@AetherAI3

Outcome and current gap

Turn the shipped local package API into a usable terminal workflow without changing its security or reproducibility contract. At the reviewed baseline, compile_package accepts explicit manifest/lock paths; RFC 0066 explicitly defers package CLI tooling. This issue covers CLI orchestration, not new language semantics, registry resolution or automatic pin repair.

Contract to freeze first

Add a coherent nano package command group, with explicit --manifest and --lock on every build operation:

  • check: validate the closed input snapshot and emit text or one versioned JSON diagnostic document.

  • build: emit the existing package envelope and validated module, preserving packageHash/moduleHash/sourceMap meanings.

  • test --cases PATH: execute a strict, versioned, local fixture file using the existing VM and supplied frames. Cases assert proposed intents/diagnostics, never execute them. Only deterministic pure/intent test fixtures are admitted; inference and provider/effect handlers fail before execution.

  • Optional init --directory PATH is a separate later PR: create a minimal example only in a new/empty destination, refuse overwrite, and never discover or rewrite existing project pins.

Choose exact arguments, fixture schema, output framing and exit meanings in a short design document before editing shared CLI dispatch. Reuse existing exit-code conventions where possible; distinguish invalid source, invalid invocation and I/O failure. JSON stdout must contain one parseable document; progress/errors use stderr. Binary artifact output must preserve exact canonical bytes on Windows and Linux.

Implementation slices and file ownership

First PR: check/build dispatch, help, focused CLI tests and documentation. Second PR: strict fixture runner and negative controls. Keep compiler/package semantics in their existing owner lane; use its public API. Expected starting surfaces: nano/cli/main.py, nano/cli/commands.py, nano/compiler/package.py, tests/test_package.py, tests/test_cli.py and examples/agent-package/. New package CLI implementation/test modules are preferred over enlarging unrelated commands. Formatting is deferred because byte pins make silent rewrites consequential.

Required acceptance matrix

  1. The checked-in agent-package example builds through CLI and API with byte-identical canonical envelope and executable hashes, including source-map provenance.
  2. Running from another working directory, relocating the project, JSON metadata reordering, Windows/LF output framing and two repeated builds preserve the documented identities.
  3. Missing/stale pins, duplicate keys/symbols, wrong types, import/call cycles, ungranted effects and resource-limit violations return stable positioned diagnostics and nonzero exit codes.
  4. Absolute/escaping/symlink-escaping paths and ambient module discovery remain rejected. No network, model, QPU or ambient credentials are read.
  5. Read-only commands leave all source/manifest/lock bytes unchanged. No automatic refresh, parent search or hidden writes.
  6. Fixture tests distinguish an emitted intent from an executed action; malformed cases, unsupported handlers, mismatched expectations and all-skipped/empty case sets fail explicitly.
  7. Existing single-source nano check/compile, baseline v0.1.0 and v1 fixtures remain unchanged.
  8. A clean installed-wheel environment can reproduce the documented example outside the repository, with no optional quantum dependencies.

Dependencies: shipped #66 only; immutable-record work may proceed separately and is not required. This lane owns CLI dispatch; a concurrent host-client lane must not edit it. Packaging/release conformance consumes the stable commands after their contract is frozen.

Hillclimb protocol and evidence

Start from a clean, isolated branch and record the actual base SHA; the reviewed baseline is Nano cb6ea884d63dcaa8cc0e7c0b952bb88784e8219f (source). Rebase and recheck if main has advanced. Link this issue to roadmap #67. Before editing, freeze the contract/fixture hashes, reproduce the specific missing behavior, and record a passing adjacent compatibility control. A missing feature is an expected rejection, not an invented production incident.

Use at most three candidate iterations against the frozen development set. Log each hypothesis, minimal diff, command, seed/environment, result and regression delta. Keep any held-out set immutable and report its final evaluation separately; do not tune against it. Stop and report an unresolved failure or dependency rather than weakening validation, increasing caps, deleting a negative control or relabelling skips as passes.

Deliver small reviewable PRs with exact head/base SHAs, commands, pass/fail/skip denominators, fixture/artifact hashes and limitations. Coordinate shared schemas before implementation; only one lane edits each shared contract at a time. Preserve baseline/Intent/executable/package/quantum schema identities independently. Issue creation is planning authorization, not permission to launch agents, merge, deploy, spend or change runner/security/credential settings. Tests are offline, fake-provider or local simulator only. CI startup failure with zero jobs remains a failure; any later merge exception needs its own applicable authority. The prior local-test waiver covered only PRs #82/#188/#460.

Dependencies and lane boundary

Independent on the shipped scalar package API. Coordinate #85 through that API; do not wait for records or edit compiler internals for convenience. #88 consumes the resulting installed-wheel commands. This lane owns shared package CLI dispatch. #86 owns a separate TypeScript directory, and #87 owns benchmark fixtures.

Activity

  1. AetherAI3 commented on Nov 7, 2026

    @AetherAI3
    OwnerAuthor

    Hillclimb goal and frozen contract (lane owner: package CLI dispatch)

    Goal: nano package check | build | test with required --manifest/--lock, thin over the shipped compile_package API and existing v1 VM, satisfying every row of this issue's acceptance matrix. init and formatting stay deferred.

    Base: cb6ea884d63dcaa8cc0e7c0b952bb88784e8219f (= reviewed baseline; main has not advanced). Linked to roadmap #67.

    Frozen before any dispatch edit — commit 2a60d083e9fd071529782283e30fe965b6a83ec1 on claude/nano84-package-cli:

    Artifact sha256
    docs/package-cli.md (args, exit codes, framing, check/test JSON documents, fixture schema 1.0.0) 43e460dfb184550502818394c1f9cc9304667ae07a0e8c2904532f8ec81cab74
    examples/agent-package/cases.json (frozen dev set: 4 intent cases + 1 runtime rejection) 3c97ba8013349787991f445fc60a657db29c38b1c6b8f2255ac27482b0bf2abd

    Baseline API identity of the checked-in example (CLI must reproduce byte-for-byte): packageHash sha256:b5f5a854e33c94f48697be3b0e3f9fa2be5a3c5cd198e8556b66b9a4925da099, moduleHash sha256:78031edfa42c22e8d432af57bafa3a455da61b968b75ae8982994896d021200e.

    Missing behaviour reproduced (expected rejection, not an incident): python -m nano.cli package check --manifest examples/agent-package/nano.json --lock examples/agent-package/nano.lock → exit 2, invalid choice: 'package'.

    Adjacent compatibility control at base (test_package, test_cli, test_compiler_diagnostics, test_examples, test_docs, test_conformance, test_acceptance_parity): py3.12 and py3.13 → 241 passed, 1 skipped, 1 failed (pre-existing).

    Pre-existing findings outside this lane (reported, not fixed here):

    1. tests/test_package.py::test_metadata_depth_is_positioned fails on Python ≥3.12: json.loads("["*2000 + "]"*2000) no longer raises RecursionError (it does on 3.10/3.11), so the lock is rejected as unsupported lock format instead of metadata depth budget. CI matrix includes 3.12/3.13. Owner: compiler/package lane.
    2. CI on main cb6ea88 (run 41330855596) started zero jobs: "The job was not started because your account is locked due to a billing issue." Per this issue, zero-job CI is a failure; no runner/billing settings will be changed by this lane.

    Slices: PR1 check/build + dispatch + tests/docs; PR2 strict fixture runner (nano/cli/package_cases.py) + test wiring + negative controls. Max 3 candidate iterations each against the frozen dev set; held-out evaluation = clean installed-wheel reproduction outside the repo (+ Python 3.10), reported separately.

  2. AetherAI3 commented on Nov 7, 2026

    @AetherAI3
    OwnerAuthor

    Closed with evidence: #89 + #90 merged

    Main: 27e8a5f8d502f2c25cfa2b899de62871a63edc86. Its tree be01a4c6… is identical to the tested head f8446421, so every result below applies to main unchanged. Base was cb6ea884….

    Acceptance row Result
    Example builds via CLI and API, byte-identical; hashes and source map PASS. packageHash sha256:b5f5a854…a099, moduleHash sha256:78031edf…200e, envelope sha256 3a1bae4e…1070.
    Other cwd, relocation, metadata reorder, LF framing, 2 repeat builds PASS (tests/test_package_cli.py, including fresh-interpreter byte checks).
    Positioned diagnostics + nonzero exits (missing/stale pins, duplicate keys/symbols, types, cycles, ungranted effects, resource limits) PASS: parametrized, asserting exit code, code, path, line and column.
    Absolute, escaping and symlink paths; ambient discovery; no network/model/QPU/env PASS. The symlink test actually ran. A fresh interpreter with sockets disabled leaves qiskit, nano_qsearch and numpy unloaded.
    Read-only commands leave bytes unchanged; no hidden writes PASS: bytes and mtimes snapshotted. A failed multi-output build restores earlier outputs.
    Fixtures: intent vs action; malformed, unsupported handlers, mismatches, empty sets fail PASS. actionsExecuted: 0, provider=None asserted. Handlers are refused with a run_module call count of 0. No skip field exists, so an all-skipped run cannot happen.
    Single-source check/compile, v0.1.0 and v1 fixtures unchanged PASS. The full suite's failure set is identical at base and head (see below).
    Clean installed wheel outside the repo, no quantum deps PASS (held-out, not tuned against). Python 3.10.0 venv, --no-deps, qiskit and numpy absent. check, build and test 5/5 reproduce the same hashes and bytes.

    Denominators

    Frozen inputs: docs/package-cli.md sha256 43e460df…cab74; cases.json 3c97ba80…2abd, unchanged since freeze commit 2a60d08.

    Review: an independent review found 3 confirmed defects, all fixed with RED then GREEN tests:

    • partial write with two outputs;
    • int overflow traceback in fixtures;
    • non-ASCII case names crashing text mode.

    A 4th, a suspected symlinked-manifest gap, is unreachable and explained in #89.

    Still open, outside this lane:

    1. tests/test_package.py::test_metadata_depth_is_positioned fails on Python ≥3.12 (JSON nesting depth no longer raises RecursionError). It needs the compiler/package owner.
    2. test_qsearch_j6_a2_backends.py [ibm_kingston] and [ibm_marrakesh] fail at base in this environment (qsearch lane).
    3. CI starts zero jobs because of the account billing lock. Both PRs were merged with a ruleset admin bypass under the repo owner's explicit in-session waiver: "yes merge on local evidence, waiver for these PRs". It applies to feat(cli): add nano package check and build (#84) #89 and feat(cli): add nano package test with a strict fixture runner (#84) #90 only. No runner, billing or security settings were changed.

    Deferred by design: nano package init, formatting.

  3. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Follow-up landed: nano package init (#95)

    Main: 4307f4bd5548267e52db41155f02ad4fdbcb2518. Its tree 7461331e… is identical to the merge preview tested locally, which was #95 head 80593f3 merged with 4b57316.

    Evidence Result
    Contract frozen before code docs/package-cli.md init section, commit 9671ce6 (rebased form of 1883bb5)
    RED → GREEN 10 failed / 1 passed, then 11/11. Review round: 4 failed, then 16/16.
    Self-hosted CI, Linux, all 6 required jobs green at 55240f4 (contribution shape, package, test 3.10–3.13). It also caught a real determinism-guard violation (getattr(stat, …)) at 03b9368, which was fixed.
    After rebasing onto #85/#61 (80593f3) 453/0 on py3.12 and py3.13. Package identities unchanged: example b5f5a854…, scaffold 16bfedd0….
    Full suite, Windows py3.13 @ 80593f3 3147 passed / 2 failed / 18 skipped. The 2 are the qsearch ibm_kingston/ibm_marrakesh tests, which fail on main in this environment.
    Merge preview with #97 406/0 across package, guard, docs, CLI and benchmark tests
    Held-out: fresh py3.10 wheel install outside the repo init exit 0, re-init exit 2, check 16bfedd0…, test 2/2, 0 CR bytes
    Independent review 2 confirmed bugs fixed, plus 3 risks addressed. The residual check-to-write race is documented in the contract.

    Merge: the self-hosted runner was stopped because its host disk was full, so CI could not re-run on 80593f3. The repo owner authorized merging #95 on local evidence in-session. Merged with --admin --match-head-commit 80593f3.

    Remaining by design: formatting (fmt) stays deferred, because byte pins make silent rewrites consequential.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions