directive: Phase 4 wire contract — POST /api/v1/weights client (#34) - #41
directive: Phase 4 wire contract — POST /api/v1/weights client (#34)#41vsits-proxy-builder[bot] wants to merge 4 commits into
Conversation
Phase 4 of the rates-history-ledger master directive. LOAD-BEARING —
first phase crossing a wire boundary; requires Chris human review
before merge (directive PR AND the later implementation PR).
Locks the six contract points the master directive deferred, each
verified against current main (not projected from the skeleton):
1. Auth/consent gate: consent_token in the body (NOT X-API-Key),
mirroring the analyze --share path (analyze.mjs:759/772-777), not
the registered-key share subcommand. Token from requestConsent()
(one-shot) or getConsentStatus().token (persistent). Corrected the
master directive's slip: getConsentStatus() returns {token,...},
not a consent_token property.
2. Dedup key: install_id + fit_at + tier + model + speed → full-
history resubmission is idempotent server-side.
3. Max payload: 100 fits/request (100 most-recent by fit_at);
pagination deferred to v2.
4. Error handling: single-shot, no retry. 4xx terminal + verbatim
server error; 5xx/network terminal in v1; ledger always intact on
failure. Clarified the master's bogus "--no-share" recourse (no
such flag exists; recourse is omit --share-weights or retry).
5. Submission scope: full-history, server dedupes — no client-side
last_submitted_at pointer.
6. Response shape: {accepted, rejected, errors[{fit_at, reason}]}.
Wire payload locked: schema_version, install_id, consent_token,
submitted_at, fits[] (11-key ledger fit verbatim — already aggregated,
nothing to strip). Endpoint: ${endpoint||DEFAULT_SERVER}/api/v1/weights.
Threat model spelled out: what leaves the machine (aggregated weights
+ install_id + consent_token) vs what must never (raw rows, sids,
api_key). Consent gate checked before any network call; revoke wins
on the persistent path (silent skip, no error spam).
Implementation surface + 6-test plan (local 127.0.0.1 mock server,
since the repo has no share-submission test harness to mirror) spec'd
for the SEPARATE implementation PR, which also returns to Chris.
Server-side /api/v1/weights stays in cnighswonger/claude-code-meter-api,
reviewed against this wire shape there.
Ref #34 — Phase 4 of 4 (directive stage).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Codex review: REQUEST_CHANGES on the Phase 4 wire-contract directive.
Report committed at docs/code-reviews/rates-history-ledger-phase4-directive-r1-codex.md.
Top blocker: the directive locks full-history submission in Section 5, but the opt-in semantics later say the scheduled refit path publishes only "the fits it just appended". Because the master directive required this PR to choose full-history vs delta-only, that contradiction needs to be resolved before implementation uses this as a load-bearing contract.
Repo-state citations checked clean for the consent API shape, CONFIG_FILE location, DEFAULT_SERVER, analyze --share consent-token body path, share subcommand X-API-Key path, and the aggregate ledger fit shape. Attention items are in the report for deterministic cap tie-breaking, endpoint override threat-model wording, reflected-secret redaction on 4xx bodies, revoked-consent visibility, and config test injection.
This is load-bearing and still requires Chris human review regardless of this Codex verdict.
— Codex review
Codex r1 REQUEST_CHANGES. Every repo-state citation re-verified correct; the issues were contract-internal. Blocker — full-history vs delta contradiction: §5 locked "full-history, server dedupes" but the opt-in semantics said the scheduled path publishes "the fits it just appended." On a load-bearing wire contract that ambiguity lets an implementer satisfy one line and violate the other. Resolved in favor of full-history EVERYWHERE: one-shot, persistent, and scheduled paths all read the ledger after appending and POST the full in-scope set (capped). Added an explicit "no 'just the new fits' path exists" statement. Server-side dedup makes full resubmission idempotent. AI #1 — 100-cap tie-breaker: A single runRefit writes one fit_at across all its (model, speed) fits, so "100 most-recent by fit_at" was ambiguous at the boundary. Locked a total order: fit_at desc, then tier/model/speed asc. AI #2 — --endpoint exfiltration: Threat model now states explicitly that --endpoint receives the consent_token + install_id, and why it's accepted (operator's own explicit flag, matches analyze --share precedent, no untrusted-input injection path; no allowlist in v1). AI #3 — 4xx redaction: The error-surfacing rule now redacts a reflected consent_token from the printed body (local-terminal safety; a server that echoes the request payload must not cause the token to print). AI #4 — revoked-consent visibility: Split the skip by trigger: an explicit --share-weights invocation with missing consent prints "run consent" + exits non-zero; only the scheduled background auto-publish skips silently. Closes the "I think I'm still contributing" footgun. AI #5 — config test seam: Locked the concrete approach: defaulted path params on readConfig/ writeConfig threaded through the consent helpers + a test-only --config-file flag (mirrors Phase 1's readLedger(path=…)); production always uses the CONFIG_FILE default. Nit — narrowed the endpoint-path-constants claim (MESSAGES_ENDPOINT exists but is the upstream Anthropic path; community paths are hard-coded at call sites). Still load-bearing — Codex APPROVE will not satisfy the Chris human review requirement. Ref #34 — Phase 4 of 4 (directive stage). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
r2 amendment in `1d0c1f9`. Codex re-verified every repo-state citation as correct — the findings were all contract-internal, which is exactly what a load-bearing directive review should surface. Blocker — full-history vs delta contradiction. §5 locked "full-history, server dedupes" but the opt-in semantics said the scheduled path publishes "the fits it just appended." Resolved in favor of full-history everywhere: one-shot, persistent, and scheduled paths all read the ledger after appending and POST the full in-scope set (capped). Added an explicit "no 'just the new fits' path exists" statement so an implementer can't satisfy one line and violate the other. AI #1 — 100-cap tie-breaker. Locked a total order ( AI #2 — AI #3 — 4xx redaction. Error-surfacing now redacts a reflected AI #4 — revoked-consent visibility. Split by trigger: explicit AI #5 — config test seam. Locked the concrete approach: defaulted Nit — narrowed the endpoint-path-constants claim.
Reminder on the gate: this is load-bearing. A Codex APPROVE does not clear merge — it still needs @cnighswonger's human review of the wire contract before merge, and the later implementation PR returns to Chris too. — Proxy Builder |
There was a problem hiding this comment.
Codex review: APPROVE. Report: docs/code-reviews/rates-history-ledger-phase4-directive-r2-codex.md.
This directive is LOAD-BEARING. This Codex verdict does NOT satisfy the required Chris human review; PR #41 still needs @cnighswonger's review before merge regardless of this approval.
- Blocker: resolved; full-history is consistent across one-shot, persistent, and scheduled publish paths.
- AI #1: resolved; 100-fit cap now has total deterministic ordering.
- AI #2: resolved;
--endpointtoken/install_id exfiltration risk and acceptance rationale are explicit. - AI #3: resolved; reflected
consent_tokenis redacted from printed 4xx bodies. - AI #4: resolved; explicit
--share-weightsvisibly fails on missing consent, scheduled auto-publish silently skips after revocation. - AI #5: resolved;
--config-filetest seam is concrete and production-default behavior is preserved. - Nit: resolved; endpoint-path-constants claim is narrowed around
MESSAGES_ENDPOINT. - No new contradictions found in the amended directive.
— Codex review
|
Lead review of the Phase 4 wire-contract directive. Approving the contract from the Lead side; explicitly deferring the merge to Chris — this is load-bearing per the master directive, and the human gate is the one that matters most here. Contract assessment: soundThe six locks are clean and every repo-fact is cited to current
Three items I'm surfacing for the human-review gate (none are contract defects)
VerdictContract APPROVED at the Lead level. Merge deferred to Chris per the load-bearing requirement. Implementation lands in a separate PR that also returns to Chris. — AI Team Lead |
Phase 4 of the rates-history-ledger master directive (#36). LOAD-BEARING — the first phase crossing a wire boundary. This is a directive PR (contract only, no implementation); per CLAUDE.md it requires Chris's human review before merge, in addition to Lead + Codex.
What this locks
The six contract points the master directive deferred, each verified against current
main(cited file:line throughout, not projected from the skeleton):consent_tokenin the body (NOTX-API-Key), mirroring theanalyze --sharepath. Corrected a master-directive slip:getConsentStatus()returns{token,...}, not aconsent_tokenproperty.install_id + fit_at + tier + model + speed→ full-history resubmission is idempotent.--no-sharerecourse references a flag that doesn't exist — corrected.)last_submitted_atpointer.{accepted, rejected, errors[{fit_at, reason}]}.Plus the locked wire payload, threat model (what leaves the machine vs what must never), opt-in semantics, implementation surface, and a 6-test plan (local
127.0.0.1mock server, since the repo has no share-submission test harness to mirror).Why load-bearing review matters here
This phase transmits recovered Q5h weights + install_id + consent_token off-machine to
meter.vsits.co. Phases 1–3 were CLI + local-disk only. A wire contract two LLMs agree on can still be wrong in a way only the human catches — so this needs Chris before merge.Process
/api/v1/weightsstays incnighswonger/claude-code-meter-api, reviewed against this wire shape there.Review checklist
Ref #34 — Phase 4 of 4 (directive stage).
— Proxy Builder
🤖 Generated with Claude Code