Skip to content

contract(apr-cli-trace-save-tensor-v1): v1.2.0 → v1.3.0 — FALSIFY-011 records CLI dispatch wire-up PARTIAL discharge#1418

Merged
noahgift merged 1 commit into
mainfrom
chore/contract-trace-save-tensor-v1.3.0-cli-dispatch
May 3, 2026
Merged

contract(apr-cli-trace-save-tensor-v1): v1.2.0 → v1.3.0 — FALSIFY-011 records CLI dispatch wire-up PARTIAL discharge#1418
noahgift merged 1 commit into
mainfrom
chore/contract-trace-save-tensor-v1.3.0-cli-dispatch

Conversation

@noahgift

@noahgift noahgift commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps contracts/apr-cli-trace-save-tensor-v1.yaml from v1.2.0 → v1.3.0
  • Adds FALSIFY-APR-TRACE-SAVE-011: apr trace --save-tensor dispatch wire-up — PARTIAL_ALGORITHM_LEVEL
  • binds_to: cli_signature (the contract's existing cli_signature: block)
  • algorithm_evidence cites the 5 unit tests landed in PR feat(apr-cli): wire apr trace --save-tensor end-to-end for .apr files #1417 (CLI dispatch)
  • pv validate returned 0 errors / 0 warnings before commit

Why

PR #1417 wires the merged apr trace --save-tensor clap surface (PR #1405) + plan-builder (PR #1406) + APR forward wrapper (PRs #1408, #1414) through the dispatch layer, so apr trace --save-tensor model.apr now actually invokes forward_traced_with_save_tensor and writes APRT files to disk. Without the contract update the dispatch wire-up has no provable-contracts trace.

Five Whys

  1. Why bump? PR feat(apr-cli): wire apr trace --save-tensor end-to-end for .apr files #1417 added a new code surface that closed the dispatch gap.
  2. Why does the contract need a new FALSIFY entry? Provable-contracts policy: every code surface must trace to a falsifier.
  3. Why PARTIAL_ALGORITHM_LEVEL? End-to-end live discharge is gated on PR feat(apr-cli): wire apr trace --save-tensor end-to-end for .apr files #1417 merging + an operator-driven smoke on the canonical 7B teacher (LFS asset). Until that smoke runs, only unit-level evidence exists.
  4. Why binds_to: cli_signature? The new dispatch path is the bridge between the existing cli_signature clap block and the existing apr_forward_wrapper impl block — cli_signature is the most-upstream binding point.
  5. Why a separate paperwork PR? Same pattern as PR contract(apr-cli-trace-save-tensor-v1): v1.1.0 → v1.2.0 — FALSIFY-010 records LmHead step-2 PARTIAL #1415 (paperwork follow-up to PR feat(aprender-serve): SHIP-007 PR-C-real step 2 — LmHead capture in forward_traced wrapper #1414's code) — keeps merge audits clean and lets code PRs merge on green CI without contract reviewers blocking.

Test plan

  • pv validate contracts/apr-cli-trace-save-tensor-v1.yaml — 0 errors / 0 warnings
  • Diff confined to single contract YAML (24 insertions, 1 deletion)
  • CI green (workspace-test + ci/gate)
  • Auto-merge on green

🤖 Generated with Claude Code

@noahgift noahgift enabled auto-merge (squash) May 3, 2026 09:57
@noahgift noahgift force-pushed the chore/contract-trace-save-tensor-v1.3.0-cli-dispatch branch from 3269cf6 to 2f138d0 Compare May 3, 2026 10:02
noahgift added a commit that referenced this pull request May 3, 2026
… 7B teacher (#1419)

End-to-end live smoke of `apr trace --save-tensor` against the canonical
Qwen2.5-Coder-7B-Instruct-Q4K teacher on RTX 4090 (lambda-labs).

Outcome: APRT byte format produced verbatim for `embedding,lm_head` stages.
- `layer-0/embedding.bin`: 100,364 bytes = 12-byte header + (7×3584)×4
- `lm_head.bin`: 608,268 bytes = 12-byte header + 152,064×4

xxd-confirmed APRT magic + correct layer/dim header fields. Forward pass
succeeded — 28 layer activations + 152,064 logits — same as `apr run`.

Discharges three FALSIFY-APR-TRACE-SAVE-* gates from PARTIAL_ALGORITHM_LEVEL
to FUNCTIONAL_DISCHARGED level (009/010/011). Contract v1.4.0 bump follows
once #1418 v1.3.0 paperwork lands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
… records CLI dispatch wire-up PARTIAL discharge

Follow-up paperwork to PR #1417 (`apr trace --save-tensor` end-to-end
dispatch for .apr files). Adds FALSIFY-APR-TRACE-SAVE-011 binding the
new dispatch wire-up at PARTIAL_ALGORITHM_LEVEL with `binds_to:
cli_signature`.

Before PR #1417, `apr trace --save-tensor` only printed a stub and
never invoked `forward_traced_with_save_tensor`. The contract test
`apr trace --save-tensor --help | grep save-tensor` (FALSIFY-001) was
already passing at the binary-boundary level — but the dispatch glue
was missing, leaving Embedding + LmHead capture surface unreachable
from the CLI for 2 days post-step-2 merge.

FALSIFY-011 extends the existing `cli_signature` invariant from
"the flag is recognized" to "the flag actually produces files".

## Five Whys

1. **Why a separate contract bump?** Avoids file-conflict with the
   in-flight refactor PR #1416 (which only touches
   `crates/aprender-serve/`). My contract change is isolated to
   `contracts/apr-cli-trace-save-tensor-v1.yaml`.
2. **Why `binds_to: cli_signature`?** PR #1417 doesn't change the
   byte format or determinism — it makes the CLI surface that the
   `cli_signature` equation already specified actually invocable.
   Same equation, expanded discharge level.
3. **Why PARTIAL_ALGORITHM_LEVEL?** The 5 unit tests cover path
   resolution (3) and recursive *.bin walking (2) — algorithm-level.
   A live discharge against the canonical 7B teacher is operator-
   gated by post-merge smoke (~30s for a 7B forward + 2 file writes).
4. **Why bump v1.2.0 → v1.3.0?** Adding a new falsification test
   that binds an existing invariant is a minor schema change per
   semver. v1.0.0 → v1.1.0 → v1.2.0 → v1.3.0 records each step's
   discharge timeline:
     - v1.1.0 (PR #1413): apr_diff_values_compat → APRT-aware diff
     - v1.2.0 (PR #1415): byte_format → LmHead capture (step 2)
     - v1.3.0 (this PR): cli_signature → end-to-end dispatch
5. **Why now?** Records the algorithm-level discharge so when the
   operator runs the live smoke post-#1417-merge, the contract
   ledger doesn't lag the code. Same paperwork pattern as #1415
   (which followed #1414).

## Verification

- `pv validate contracts/apr-cli-trace-save-tensor-v1.yaml` →
  0 errors, 0 warnings

## Ship % update

- MODEL-1: ~70% (unchanged — pure paperwork; code is in PR #1417).
- MODEL-2: corpus tokenization at ~115M tokens / 143 min (steady
  ~14K tok/s; ~33h ETA total).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@noahgift noahgift force-pushed the chore/contract-trace-save-tensor-v1.3.0-cli-dispatch branch from 2f138d0 to 1d13658 Compare May 3, 2026 11:04
@noahgift noahgift merged commit 4997196 into main May 3, 2026
10 checks passed
@noahgift noahgift deleted the chore/contract-trace-save-tensor-v1.3.0-cli-dispatch branch May 3, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant