Skip to content

spec(automation): service_ledger v3 -- one door settle_service for the money path - #11791

Merged
github-actions[bot] merged 1 commit into
masterfrom
spec/service-ledger-one-door
Oct 25, 2026
Merged

github-actions[bot] merged 1 commit into
masterfrom
spec/service-ledger-one-door

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

Goal

One spec-owned door (settle_service) that settles any of the four services in a
fixed order -- books-STOP, receipt gate, payout eligibility, books arithmetic,
delivery -- answering SETTLE_STOP / SETTLE_NONE / SETTLE_HOLD / SETTLE_PAY.

Closes #11790

What

  • NEW specs/automation/service_ledger.t27 (v1..v3): four services (course,
    operation, node-job, resale), one receipt gate, books derived from entries
    only (BOOK_STOP fail-closed, no adjustment entry, accrued = paid + outstanding conserved), and settle_service -- the single door that runs the
    whole chain in one fixed order. HOLD is reachable only when the books already
    say PAY: earned, not payable today, never NONE and never PAY.
  • specs/automation/token-wallet.t27 v2: the three-unit trade (TRADE_UNITS 3;
    one unit is the operation's price, one funds the bounty pool, one pays the
    referrer). The house's own price per operation does not move.
  • specs/verified/payout.t27: trade_split_fits -- refuses a client-side
    split that exceeds the charge, subtracting instead of adding so a share near
    the top of u64 cannot wrap the sum back inside.

Honesty / claim status

DESIGN, no host yet: COMPLETION_HOST_EXISTS=false, BOOKS_HOST_EXISTS=false,
LIVE=false, TRI_PAYABLE=false. Nothing here is sold as live; the spec
records the entitlement and the gate and does not promise or mint $TRI.

Verification

./target-bench/release/t27c test-report specs/automation/service_ledger.t27   # 24 tests, 2 invariants, vacuous 0
./target-bench/release/t27c test-report specs/automation/token-wallet.t27     # 11 tests (1 vacuous pre-exists on master)
./target-bench/release/t27c test-report specs/verified/payout.t27             # 17 tests, vacuous 0
./target-bench/release/t27c seal --verify specs/automation/service_ledger.t27 # all hashes MATCH
./target-bench/release/t27c validate-seals --pr-files specs/automation/service_ledger.t27,specs/automation/token-wallet.t27,specs/verified/payout.t27
  • seals regenerated for all three specs, --verify MATCH x3, validate-seals exit 0
  • L3 ASCII clean (0 non-ASCII lines)
  • cross-repo links checked live: trinity-fpga settlement_law.t27 + ledger.zig
    exist; 999-multibots-telegraf host files (billing-shared.ts,
    token-ledger.ts, token-wallet.ts + vendored gen) exist
  • pre-commit hooks green: own-language, foreign-budget, secret-gate
  • docs/now entry well-formed (checker exit 0)

Note on the working tree

Built in a clean worktree from origin/master (a059416) because the primary
checkout was mid-interactive-rebase on an unrelated branch (wasm-board-p3); that
state was left untouched.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-23 12:02:36 UTC

Summary

Status Count
Total Open PRs 19
PRs with Failing Checks 18
PRs with All Checks Green 1
READY 1
FAILING 18
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5aec047d42ec != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@tri-claw

tri-claw Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary by t27-bees

Checked by the t27 compiler

t27c parse, parse-complete and typecheck on each changed .t27 file at 44e09e2. Nothing was generated, built or run. A pass means the file is well formed, not that it is right.

  • specs/automation/service_ledger.t27: parses and typechecks.
  • specs/automation/token-wallet.t27: parses and typechecks.
  • specs/verified/payout.t27: parses and typechecks.

Read by the model

This PR introduces a new service_ledger spec (v3) with a single settle_service door that runs the money path in fixed order (books STOP → receipt gate → payout eligibility → books arithmetic → delivery), upgrades token-wallet to v2 with a three-unit trade (1× price, 1× bounty, 1× referral), and adds trade_split_fits to payout.t27 with subtractive logic to prevent u64 wraparound.

Worth a look

  • specs/automation/token-wallet.t27:115 — trade_split_fits only validates that the three shares sum to ≤ charged; it does not enforce that each share equals charged / 3. A caller could pass house=24, bounty=0, referral=0 for charged=24 and pass validation while violating the "two thirds to growth" principle documented in the spec.

  • specs/verified/payout.t27:268 — Same issue: trade_split_fits(u64) only checks sum ≤ charged, not equal thirds. The two specs (u32 in token-wallet, u64 in payout) now have parallel but independent split validation with no shared constant for the 1/3/1 ratio.

  • specs/automation/service_ledger.t27:500 — settle_service calls books_pay(accrued, paid, want, books_readable) once at the start and caches the result. If a future change makes accrued/paid depend on earlier checks in the chain, the cached books_answer could become stale. Currently all inputs are parameters so this is safe, but the pattern is fragile.

  • specs/automation/service_ledger.t27:470 — books_pay returns BOOK_NONE (not BOOK_STOP) when want > accrued - paid, paying nothing rather than a partial amount. This is intentional per the comment, but means a caller asking for more than is outstanding gets a silent SETTLE_NONE rather than a distinct "over-request" signal.

  • specs/automation/service_ledger.t27:340 — accrues calls payout(outcome, verified, verdict_referenced) == PAY_NORMAL from verified::payout. The payout function returns PAY_NORMAL only for OUT_CREDITED with both flags true. Any other outcome (including OUT_REJECTED_AND_SLASHED) yields PAY_NONE and thus no accrual. This matches the spec's "slash books no accrual" rule, but couples the ledger's accrual logic directly to payout's outcome codes.


Read: 7 files, +827 -37, the whole diff. Head 44e09e2. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@gHashTag

Copy link
Copy Markdown
Collaborator Author

CI triage: 8 red checks, none from this diff

The diff is 7 files (3 specs, 3 seals, 1 docs/now entry). Every failing check
names files outside it, and the ones that can run on master itself are already
red there:

Check Failing because Red on master?
Corpus ratchet specs/port/browseros/.../lib/soul.t27 gained an assertionless test yes (a059416, 8002b73, 36828c7)
scan (devhome paths) specs/port/tools/check_devhome_paths.t27:14 spells /Users/playra/ by design yes (same three)
spec-guards / coverage 5 stale seals: compiler/cli/git.t27, specs/t27f/{work_graph,display_list,export_video}.t27 yes
Documented t27c subcommands docs/tri-ssot-integration.md:92,98 names tri issue / tri pr create yes
emit-bitexact 4 specs newly do not generate: specs/claw/demo_broken.t27 and 3 specs/port/browseros/... workflow last ran on master 2026-08-28
t27b-native-linux/macos t27b native lane yes (same three)

Green on this PR: L1 TRACEABILITY, check-linked-issue, own-language,
foreign-budget, gitleaks, conflict-markers, damage-negatives,
fix-carries-source, duplicate-bodies, phi-loop-check, budget.

Locally verified on this branch: test-report 24+11+17 tests green
(service_ledger vacuous 0; token-wallet's 1 vacuous already exists on clean
master), seal --verify MATCH x3, validate-seals exit 0, L3 ASCII clean.

This was referenced Oct 23, 2026
This was referenced Oct 24, 2026
…e money path (Closes #11790)

The owner's principle of 2026-10-23, in both halves: a service never holds,
prices or moves money -- it emits a receipt, one splitter reads it, and the
distribution is decided by rules alone; and the accounting is settled without
any person taking part.

- NEW specs/automation/service_ledger.t27 (v1..v3): four services, one receipt
  gate, books derived from entries only (BOOK_STOP fail-closed, no adjustment
  entry), and settle_service -- the single door running STOP -> receipt gate
  -> payout eligibility -> books arithmetic -> delivery in one fixed order,
  answering SETTLE_STOP / SETTLE_NONE / SETTLE_HOLD / SETTLE_PAY. HOLD is
  reachable only when the books already say PAY: earned, not payable today.
- specs/automation/token-wallet.t27 v2: the three-unit trade (TRADE_UNITS 3;
  one unit is the price, one funds the bounty pool, one pays the referrer).
- specs/verified/payout.t27: trade_split_fits refuses a client-side split
  exceeding the charge, subtracting so a share near u64 top cannot wrap.

Claim status stays honest: DESIGN, no host (COMPLETION_HOST_EXISTS=false,
BOOKS_HOST_EXISTS=false, LIVE=false, TRI_PAYABLE=false). Nothing is sold live.

Verification: test-report green (service_ledger 24 tests, 2 invariants,
vacuous 0; token-wallet 11; payout 17), seals regenerated + verified,
validate-seals exit 0, L3 ASCII clean.

Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-25 01:27:44 UTC

Summary

Status Count
Total Open PRs 45
PRs with Failing Checks 40
PRs with All Checks Green 5
READY 1
FAILING 40
PENDING 0
NO CHECKS YET 0

These columns do not partition: 1 + 40 + 0 + 0 = 41, and there are 45 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=55c0f1b1b32d != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

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.

spec automation/service_ledger v3: one door settle_service for the money path (receipt, gate, books, delivery)

1 participant