Skip to content

[P1][hillclimb] Publish a portable lifecycle wire contract and TypeScript read-only client #86

Closed

Description

@AetherAI3

Outcome and existing implementation

Make Nano job visibility usable by another host language without recreating scheduling or accounting. There is already a working Python LifecycleClient with explicit status/cancel/refresh/replace calls, per-call signing, response limits and no implicit polling. lifecycle.py defines the job-state projection. Extend and document this contract; do not replace the Python client or invent a second lifecycle authority.

First milestone and strict scope

Publish a versioned machine-readable lifecycle/error protocol schema plus language-neutral golden request/response fixtures. Implement a small TypeScript read-only status client and offline example using caller-injected transport/clock/nonce/signing capability. No default environment credential loading, browser storage, telemetry, service discovery or new endpoints. Do not add cancellation/replacement methods in the first milestone; their write semantics need a separate follow-up after interoperability is proved.

Freeze supported JS runtime/build target, package layout, integer/number handling, byte encoding and cryptographic adapter boundary before code. Use strict runtime validation, not TypeScript types alone. If an existing HMAC implementation is reused, prove byte-for-byte parity against Python using synthetic keys only; never include real credentials in fixtures or output.

Wire and governance rules

Document canonical method/path/body bytes, timestamp/nonce framing, response body cap, permitted origins/redirect refusal, timeout versus queue/accounting deadline, supported version policy and unknown-code behavior. Bind every accepted response to the exact requested digest and schema. Pin the full state envelope and mandatory identity/usage fields; unknown usage is null/held, not zero, and a cancellation request is not terminal confirmation.

A status invocation performs exactly one HTTP read. No refresh, cancel, replace, resubmit or automatic retry follows from an error, deadline or next_action value. Next-action codes are information for caller policy, not authorization. The client must not validate final zero by reimplementing the server's evidence predicate or modify budgets.

Work packets and ownership

PR1: schema/docs and goldens derived from actual Python/service behavior, recording any discrepancy as a failing compatibility test. PR2: TS status client plus isolated fake-transport tests and README example. Freeze protocol fixtures jointly with #61 before touching any shared identities; this lane owns a separate SDK directory and fixtures, not service, receipt or provider internals. A Python parity fix, if discovered, must be a small separate patch with a reproduced failure.

Acceptance matrix

  1. A Python-produced canonical status fixture and TS parser agree on every identity, execution/accounting/reservation status, deadlines and next-action field.
  2. Fake queued/running/completed/failed/cancelled/accounting-pending/settled-positive/confirmed-zero histories remain distinct; unknown zero remains held.
  3. Wrong digest/version/types, bool-as-number, NaN/infinity/unsafe integers, missing fields, duplicate JSON keys and oversized responses fail before a successful result is returned. Unknown optional extension handling must match documented version policy.
  4. Redirects, malformed JSON, timeouts, transport failure and remote errors produce bounded stable errors without URL, key, auth header, raw exception or response-body leakage.
  5. Repeated status reads have zero write/submission/budget side effects; fake transport asserts exact operation count. Timeout handling never fabricates a terminal state.
  6. Golden signature/canonical bytes agree across supported Python/JS runtimes with synthetic inputs; request timeout is tested independently of lifecycle deadlines.
  7. Installation/build/import works outside the checkout, with no dependency on Qiskit, ATLAS, Predator or Python at runtime.
  8. Existing Python client tests and service state fixtures remain passing and byte-stable.

No live connection is needed to complete this issue. Cross-repo receipt authority remains in ATLAS/Predator; private branch delivery is not a deployment.

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

Read-only status uses completed #59 and does not depend on #61 completion. Coordinate any new native-operation IDs with #61; status-only clients must fail unsupported capabilities explicitly. Freeze protocol goldens for #88. Keep implementation in a separate SDK directory; do not race #84 on Python CLI dispatch.

Activity

  1. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Hillclimb evidence (first milestone: contract + read-only TS status client)

    Delivered as three stacked PRs: #91 (contract + Python-derived goldens) → #92 (Python duplicate-key parity fix) → #93 (TypeScript status client). Linked to roadmap #67.

    Baseline and freeze

    Iterations (TypeScript; log in sdk/typescript/qsearch-lifecycle/HILLCLIMB.md)

    • Candidate 1: initial implementation.
    • Candidate 2: fixes from the first review.
    • Candidate 3: fixes from the second review, which found a forged signer result causing an unhandled rejection, and missing node10 type resolution. Both were reproduced red first.
    • Three candidates used, the cap.
    • Against the Python goldens: 80/80 pass on the first run; 81/81 after candidate 3.

    Held-out (reported separately, not tuned against): 24/24 on candidate 2 and 24/24 on candidate 3. The UTF-8 BOM case is the one point the contract wording did not spell out (RFC 8259 lets a reader ignore a BOM). The TypeScript client refuses it, and the Python gap is now recorded in #92.

    Acceptance matrix

    • Python canonical fixture vs TS parser: identity, execution, accounting, reservation, deadlines and next_action agree on all 15 histories. Confirmed zero comes from the real seal and real predicate, with no monkeypatch.
    • Distinct histories: queued, running, completed, failed, cancelled, accounting-pending, settled-positive, confirmed-zero and unknown-zero-held are all distinct. Unknown zero stays held/null.
    • Rejected before any result is returned: wrong digest or version, wrong types, bool-as-number, NaN/Infinity, unsafe integers, missing members, duplicate keys and oversized bodies. There are 53 negatives. The closed envelope is the documented version policy.
    • Transport failures: redirect, malformed JSON, timeout, transport failure and remote errors each produce a bounded, stable error. URL, key, header, nonce, body and exception text never appear in it.
    • Side effects:
      • Each status call is exactly one transport call, or zero if refused before I/O.
      • Repeated reads change no request, event, link or job rows; only nonces are written.
      • A timeout never produces a terminal state.
    • Signing: golden signature and canonical bytes match across Python 3.13 and Node 24 using synthetic keys only. The request timeout is tested separately from lifecycle deadlines.
    • Install outside the checkout: the packed tarball installs and runs outside the repo with no Python, Qiskit, ATLAS or Predator. Types resolve under node10, node16 and bundler.
    • Existing Python tests: these remain passing and byte-stable. git diff of tests/qsearch_fixtures is empty, and the only nano_qsearch change is the parity fix in fix(qsearch): refuse duplicate JSON members in lifecycle client (#86, 2/3) #92.

    Full Python suite (py3.13, one file at a time on the stack head 7ea82b6): 2686 passed, 18 skipped, 26 xfailed, 5 failed.

    • Four of the five fail on base too: test_package::test_metadata_depth_is_positioned, test_quantum_prepare::…without_atlas_or_ibm, and two j6_a2_backends tests (aether_atlas is not installed).
    • The fifth is test_qsearch_service::test_concurrency_cap_bounds_overlapping_runs[2], a thread-overlap timing race. It failed 1 time in 22 runs (0 of 10 on head and 0 of 10 on base when run alone, plus a full-file rerun of 74 passed). The stack does not change service.py, store.py or auth.py.

    Independent reviews: two, one for TypeScript and one for Python/security. Neither found a CRITICAL or HIGH issue. The MEDIUM findings are fixed in #92 and #93, and the remaining Python looseness is recorded as 26 strict xfails.

    CI: every run starts zero jobs (0 steps): "The job was not started because your account is locked due to a billing issue." That counts as a failure, not a pass. The owner waived CI for this PR set to merge on local evidence. Nothing is published or deployed; the SDK package is private.

    Follow-ups (not in this milestone): write semantics for cancel/refresh/replace; tightening the Python client to the closed envelope, the 2^53-1 cap and UTF-8 only; a CI job for the SDK.

  2. added 3 commits that reference this issue on Nov 8, 2026
  3. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Landed on main via #91 (dfe9c4a) → #92 (3452591) → #93 (f346487). Each was merged with --admin under the owner's waiver for this PR set: CI starts zero jobs because of the billing lock. Each merge was pinned to its verified head commit, and after each one main's tree equals the tested head's tree byte for byte (2acf815, 7ea82b6, 6e63455).

    Post-merge smoke on the main-identical tree: regen.py --check exits 0, SHA256SUMS verifies, and TypeScript node --test passes 81/81.

    Follow-ups stay out of this milestone:

    • write semantics for cancel, refresh and replace
    • tightening the Python client to the closed envelope, the 2^53-1 cap and UTF-8 only (26 strict xfails track these)
    • a CI job for the SDK
  4. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Post-landing CI evidence, now that Nano CI runs on the self-hosted runner aether-vps-3-nano-01.

    CI run 42443589616 ran on main at 545282a, which contains #91–#93 (f346487). All 7 jobs passed: test on 3.10, 3.11, 3.12 and 3.13, package, Contribution shape, and Quantum local conformance. The py3.13 summary is 3090 passed, 61 skipped, 26 xfailed, 0 failed. The 26 xfails are this lane's strict compatibility records, so the wire-contract suite ran under real CI.

    This replaces the earlier "local evidence only" caveat for the Python side. The TS SDK had no workflow and now has one in #100.

  5. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Follow-ups landed on green self-hosted CI with normal merges (no --admin), each pinned to its verified head:

    #100 593564a: CI workflow for the TS SDK. It runs Node 20 and 24 (the engines floor and current), npm ci, npm test against the Python goldens, and the out-of-checkout pack:check. Both SDK jobs and all 6 required checks passed. The workflow file on main is byte-identical to the tested head 6d09d4a.

    #102 5d83c92: Python LifecycleClient now matches wire contract v1. The strict-xfail discrepancies went from 26 to 0. Strict UTF-8 parsing, the 2^53-1 cap, depth 64 and duplicate-member refusal now apply to every body, and a stdlib closed-envelope validator checks every 2xx. Errors no longer carry an exception chain or frame locals that could expose the response body.

    CONTRACT §4 now records no remaining Python discrepancies. Write semantics (refresh/cancel/replace) are tracked in #101.

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