Scope: Passive T36.2a evaluation for one native counted unit/account/profile and immediate successive full-cycle release. Build review records accepted snapshots and current verification gates. T36.2b and E36 remain open.
Intelligence: none — Capacity is bounded arithmetic over attributed native observations and explicit assumptions; a model cannot reserve quota or promise completion.
Source: contract, evaluator. Tests: source semantics/history, installed consumer, package helper, exact graph. Installed API, limits, example and trust boundaries.
Public entry software-factory/capacity-planning has no effects, ambient clock, callbacks or runtime dependency on Temporal Planning, Journal, Portfolio, Intelligence or providers. Exact plain-data parsers return deeply frozen copies; invalid binding/support refuses. Signed per-window balances and residual allowances retain each stable debit once. Unfinished observations never claim continuous state through an unobserved gap. Native units, complete cohorts, profile pins and all three explicit future assumptions govern finite output.
The closure is capacity-planning/contract, canonical-json, strict-input and errors, with buffer/crypto builtins and erased reporting types. Fixed-v1 replay validates the full derived result using embedded policy/asOf. Hosts own source authentication, original admission pins and cross-snapshot monotonicity. Retain all old protocols, receipts, ceilings, artefacts and date semantics. Nothing authorises a provider request, grant, reservation, renewal, reclaim, dispatch or durable workflow.
Factory use
scripts/factory-capacity.ts is the first Factory consumer and lives outside src/; this module is unchanged. It opens the journal with CommandJournal.openReadOnly, maps LifecycleSchedule.read() into CapacityInputs, calls forecastCapacity and prints two lines: the forecast as one JSON document that parseCapacityForecast accepts, then one plain-words line. It records, retries, grants, reserves and dispatches nothing; the journal stays byte-identical. Tests: mapping and command.
The mapping, in the unit discovery-ledger-token (LEDGER_UNIT, the schedule's estimated ledger tokens, never provider quota):
- The cutoff is the start of the ISO week holding
--atin the commission's zone. Windowledger-<week>observes, at that cutoff, the week's current ceiling less the debits of calls already settled by then, never below zero. - Every call the week's ledger debits is counted exactly once, on either account, because both accounts share the ledger. A call's week is fixed in the zone at its admission, so it can settle at the cutoff itself or, after a revision moves the zone, before it; its debit is then in the observation. A call with known usage settled after the cutoff is a settled charge of its debit. A call in flight is an
activeexposure at its full bound. A lost or unknown call, or one ended without a usage report, is aneffect-unknownexposure at its full bound, as the ledger keeps it. - A call admitted in an earlier week and still unresolved debits that week's ledger, so it is no exposure here. Capacity Planning debits every exposure from every window and cannot hold one that only blocks completion, so such a call on the forecast's lane makes the cohort coverage incomplete (
target-lane-unresolved-in-earlier-week): the completion range stays unknown and the headroom stays the ledger's. Only a caller cohort coverage with exactly the coverage parser's shape gains that reason; any other is passed on unchanged, so Capacity Planning refuses it the same way on every lane. - While the account's
windowClosedUntilis after--at, windowprovider-<account>observes 0 from the cutoff until that reset. The schedule records only the reset, so the start is modelled as the cutoff. The default horizon stops at the earliest reset; a horizon past a reset ishorizon-crosses-reset, never assumed open. An open provider window is not observed and adds no window. The plain-words line then names the closed window, not the ledger, as the cause of the 0. - Window coverage is complete only when the schedule could admit the account at all: an owner record exists, says overage is off, stays current through the horizon, and no overage or sign-in refusal followed it.
- Usage coverage is complete only when the ledger covers the window: the calls the state retains for the week sum to the ledger's
debited. Settled occurrences leave the state (two per lane), so a week with pruned calls has unknown headroom. Its value rises once LS-R records live schedule data; attributing pruned calls from the journal's history is a proposal, not built. - Samples, their sources, the cohort coverage and the policy come only from an optional caller file (
sf-factory-capacity-samples/1). Without it the policy assumes nothing, the cohort isunavailableand the completion range is unknown; headroom is still reported.
Charge and exposure IDs are call- plus the first 40 hex of SHA-256 over <occurrence>/call/<k>; exposure admission pins name the occurrence's commission revision and a digest of its admitted rhythm bounds. Input files are regular UTF-8 JSON of at most 64 KiB and are refused above that, never truncated. The schedule is read as it is now. Without --at the forecast is as of the host clock read just after the snapshot. A given --at must not be later than the host clock or earlier than any instant the schedule recorded, and the current commission revision must be dated at or before it (COMMISSION_NOT_DATED otherwise). A revision records no instant of its own, so it is dated only by its lanes joining (revision 1) or by a retained occurrence admitted under it; otherwise a backdated forecast would silently use a ceiling, zone or record age that may not yet have been in force. Exit codes follow factory:bet: 64 invalid, 65 conflict, 66 unavailable, 70 corrupt or error, 75 limit.
Shared value implementation: common contracts. Owning errors, limits, stored identities and authority remain as specified above.
