Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions docs/CURRENT-STATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# Current State

**As of:** 2026-07-28 · **Branch:** `foundation/m0-headless-service-lab` (delivered as a PR into `main`)
**Milestone:** M0 — Headless Service Lab. **Most recent gate decision:** none yet (awaiting owner review).
**As of:** 2026-07-28 · **Branch:** `fix/m0-audit-corrections` (branched from reviewed PR-#1 head `beb9289`)
**Milestone:** M0 — Headless Service Lab. **Status:** bounded audit-correction pass COMPLETE; awaiting
independent re-review + owner-run human playtests.

**Independent audit** (PR #1: Conditional-Pass / Defer) found 3 High + 5 Medium. The bounded correction pass
addressed them (no M1, no new features):
- **H1** causal autopsy now attributes the primary loss by measured lost contribution (two-tier report),
removing the 88%-util flip; validated against covers-served response.
- **H2** menu-coherence lever defuses the discovered dominant hybrid (goldens byte-identical); dominance is
now SEARCHED. Residual **NEW-1** (uniform-overprice exploit) disclosed, deferred to M0.5.
- **H3** forecast de-biased (demand-opportunity vs expected-completed vs low-confidence range); band
coverage 0% -> 61% (stated 55%).
- **M4** exact integer-cents CLI price parsing; **M5** direct FIFO + labor tests; **M6** no-float guard now
scans static fields + properties; **M7** cross-OS determinism claims corrected to "verified same-env only."

See `../reports/m0/M0-CORRECTION-REPORT.md` and `../reports/m0/PRE-FIX-AUDIT-EVIDENCE.md`.

## What is complete
- Repository initialized; full structure; license; determinism/architecture/design/product/risk/commercial/
Expand All @@ -15,7 +29,9 @@
- **Evidence** (200 seeds/cell) committed under `reports/`.

## Latest test status
`dotnet test` → **74 passed, 0 failed** (Core 36, Determinism 30, Scenario 8). Re-run to confirm.
`dotnet test` → **103 passed, 0 failed** (Core 54, Determinism 31, Scenario 18) after the correction pass.
New tests lock each fix: attribution (5), forecast calibration (3), dominance regression (2), FIFO order,
labor value, exact price parse, widened no-float guard. Re-run to confirm.

## Latest determinism status
Harness determinism check: **PASS** for the sampled matrix (same seed ⇒ identical checksum). Golden
Expand Down
36 changes: 36 additions & 0 deletions docs/DECISION-LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@ consequences, owner, and conditions to revisit. Newest first.

---

### 2026-07-28 · D-019 · NEW-1 residual dominator (uniform overprice) disclosed, deferred to M0.5
- **Status:** open finding · **Owner:** owners
- **Decision:** The dominance search still finds one cross-market dominator: a uniformly-overpriced coherent
menu. It stems from M0 having no repeat-visit/reputation teeth on price/quality (same root as [[D-012]]).
Strengthening price elasticity would change the Focused Value golden, so it is NOT fixed in the bounded
pass. Disclosed in `reports/balance/dominance-search.md`; recommended for M0.5 calibration.
- **Revisit:** M0.5 (price elasticity) or M1 (reputation/repeat visits).

### 2026-07-28 · D-018 · Audit correction: docs corrected to "same-environment determinism verified"
- **Status:** locked · **Decision:** DETERMINISM-CONTRACT and ADR-002 no longer assert cross-OS byte-identity
as fact; cross-OS/arch is designed-for but unverified (matches CURRENT-STATE). (audit M7)

### 2026-07-28 · D-017 · Audit correction: forecast recalibrated + honestly labeled (H3)
- **Status:** locked · **Decision:** Forecast reports demand-opportunity ceiling, expected COMPLETED covers
(de-biased via a peaking realization factor + comp haircut), and a downward-skewed low-confidence
contribution range whose stated confidence (55%) is met by measured coverage (~61%). Forecaster is
pre-service only; the sim/checksum are unchanged.

### 2026-07-28 · D-016 · Audit correction: menu-coherence lever defuses the H2 dominant hybrid
- **Status:** locked · **Decision:** A dish priced far above the menu's own median tier is ordered less
(skepticism), scaled by segment, exactly zero below 2.0x median so the three golden fixtures are
byte-identical (master plan §10.6 coherence). No name branching, no global nerf.

### 2026-07-28 · D-015 · Audit correction: causal autopsy attributes by measured lost contribution (H1)
- **Status:** locked · **Decision:** Two-tier report — primary loss ranked by lost contribution per channel
(seating/kitchen/menu-fit/weak-demand, count-based fallback when loss-making); busiest station is a
secondary operational warning. Removes the arbitrary 88%-util flip. Checksum-excluded, so goldens hold.

### 2026-07-28 · D-014 · Audit correction: exact integer-cents CLI price parsing (M4)
- **Status:** locked · **Decision:** `Money.TryParse` (no `double`, InvariantCulture, rejects fractional
cents/NaN/scientific/negatives). Removes the last float from an authoritative-value path.

### 2026-07-28 · D-013 · Audit correction: stronger test guards (M5/M6)
- **Status:** locked · **Decision:** Direct FIFO behavioral test (dequeue-order inversions) + labor-value
test; no-float reflection guard widened to static fields + properties.

### 2026-07-28 · D-012 · Balance signal: throughput dominates a single service (honest M0 finding)
- **Status:** locked (as a finding, not a change)
- **Decision:** Record that, in M0's single-service scope, covers-served is the dominant profit lever and
Expand Down
8 changes: 7 additions & 1 deletion docs/NEXT-ACTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
> a doc is a timestamp, not a contract — verify against reality first.

## The single next authorized action
**Owner + independent reviewer close the M0 gate.** Specifically:
**Independent reviewer RE-CHECKS the bounded correction pass** (branch `fix/m0-audit-corrections`), then
owners run the human playtests. Re-check specifically: (1) the causal autopsy no longer flips on the 88%
util boundary and attributes the primary loss correctly (see `AttributionTests` + `PRE-FIX-AUDIT-EVIDENCE`);
(2) the forecast band coverage meets its stated confidence and labels are honest; (3) the coherence lever
kept the three golden checksums byte-identical and the hybrid is no longer a cross-market dominator; (4) the
**NEW-1** residual (uniform-overprice exploit) is disclosed, not hidden, and the owner accepts deferring it
to M0.5; (5) M4/M5/M6/M7 fixes; (6) determinism, accounting, and scope remain intact. Then:

1. **Independent reviewer** (not the Builder): clone fresh, run the tests and the harness with their own
tooling, try to break determinism, and confirm M0 stayed in scope (nothing from the non-goals list, no
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/ADR-002-NUMERIC-DETERMINISM.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This is not a convention that relies on discipline; it is a build gate:

**Positive**

- Cross-machine determinism is achievable and checkable. With no binary floats deciding outcomes, the FNV-1a checksum is stable across CPUs and OSes.
- Cross-machine determinism is *designed for and checkable*, not yet proven (audit M7). With no binary floats deciding outcomes, the FNV-1a checksum is **expected** to be stable across CPUs and OSes, but this is **verified only in the tested environment** so far (macOS/arm64, Debug+Release, repeated and reversed-insertion-order runs). Cross-OS/arch remains an OPEN ITEM until the golden fixtures run on a second platform. See DETERMINISM-CONTRACT.md.
- Money is exact. There is no fractional-cent drift, ever; the ledger reconciles to the cent.
- Rounding is centralized and documented. `MulDivRound` is the single rounding authority, so behaviour cannot silently vary between call sites.

Expand Down
8 changes: 7 additions & 1 deletion docs/architecture/DETERMINISM-CONTRACT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ determinism actually hard. The single biggest threat is binary floating-point. T
removes it from the authoritative core.

> **Rule:** The authoritative simulation is a pure function of `(initial state, seed, commands)`.
> Given the same three, it produces byte-identical end state on any machine, any OS, any run.
> Given the same three, it produces byte-identical end state on **repeated runs in the same environment**.
>
> **Verification status (audit M7):** repeated-run, insertion-order, and Debug/Release determinism are
> **verified** in the tested environment (macOS / arm64 / .NET 8.0.423) via the golden checksums and the
> determinism tests. Cross-operating-system and cross-architecture determinism are **designed for** (the
> core is integer-only, uses no platform RNG and no wall clock) but remain **unverified** until the golden
> fixtures are run on a second OS/arch. Do not state cross-OS reproducibility as an established fact.

---

Expand Down
27 changes: 27 additions & 0 deletions docs/design/M0-BALANCE-HYPOTHESES.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,30 @@ mechanism that makes "the menu is the strategy" pay off beyond a single night.
## Stop / rewrite triggers (from the contract) — none tripped
No strategy dominates all markets; poor strategies fail; the economy produces both real losses and real
profits; menu complexity creates real pressure; premium/price/capacity/menu-size are each not always best.

---

## Post-correction update (audit bounded correction pass, 2026-07-28)

The independent audit refuted the bare claim "no dominant strategy." Two corrections + one disclosure:

- **H2 fixed (menu incoherence exploit).** A discovered `Value Chassis + Premium Anchor` hybrid used to
dominate all three markets. A **menu-positioning coherence** lever (master plan §10.6) now makes a dish
priced far above the menu's own median tier less likely to be ordered, scaled by segment — **exactly zero
below a 2.0x-median threshold** so the three golden fixtures are byte-identical. After the fix the hybrid
**loses lunch and social** and is viable only in the enthusiast market (regression-locked in
`DominanceRegressionTests`). The distribution of the 9 named strategies is unchanged (still 2/3 distinct
winners).
- **Dominance is now SEARCHED, not asserted.** The harness runs a bounded random search over the decision
space (`reports/balance/dominance-search.md`), so the claim is tested against the space, not 9 points.
- **NEW-1 disclosed (not hidden).** The search still finds **one** residual dominator: a *uniformly
overpriced coherent* menu (e.g. Chicken@$52, Scallops@$41). Its prices are near its own median, so the
coherence lever correctly does not touch it. It dominates because M0 has **no repeat-visit / reputation
feedback**, so price and quality expectations have no economic teeth within a single service (the same
boundary as DECISION-LOG D-012). Strengthening price elasticity would change the Focused Value golden
(its burger is already slightly over the value budget), so it is **deferred to M0.5**, not hacked here.

**Honest scoped claim:** *No single NAMED strategy wins every market (2/3 distinct winners), the menu-
incoherence exploit is fixed, and one price-elasticity exploit remains — a manifestation of the disclosed
no-repeat-visit M0 boundary, deferred to M0.5.* This is a fair basis for the M0 gate; it is not the
unqualified "dominance ruled out."
12 changes: 6 additions & 6 deletions reports/balance/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ _Value-heavy, high-volume, price-sensitive, small parties, early peak. Rewards f

| Strategy | median contrib | p10 | p90 | loss% | avg covers | avg sat | avg ticket | win% |
|---|--:|--:|--:|--:|--:|--:|--:|--:|
| Focused Value | $304.15 | $29.25 | $551.95 | 8% | 93 | 531 | 16m | 76% |
| Focused Value | $304.15 | $29.25 | $551.95 | 8% | 93 | 531 | 16m | 74% |
| Premium Craft | -$51.88 | -$387.76 | $325.66 | 56% | 21 | 767 | 15m | 16% |
| Broad Menu | -$393.50 | -$887.00 | $37.00 | 87% | 77 | 561 | 20m | 5% |
| Broad Menu | -$282.00 | -$761.50 | $142.50 | 78% | 82 | 559 | 20m | 7% |
| Overcapacity | -$789.00 | -$929.00 | -$662.00 | 100% | 22 | 537 | 20m | 0% |
| Understaffed | -$528.00 | -$615.00 | -$448.50 | 100% | 12 | 506 | 22m | 0% |
| Balanced Competent | -$408.00 | -$726.00 | -$1.00 | 90% | 66 | 570 | 20m | 1% |
Expand All @@ -29,11 +29,11 @@ _Mid-budget social diners in groups, multi-course, moderate patience. Rewards a
| Strategy | median contrib | p10 | p90 | loss% | avg covers | avg sat | avg ticket | win% |
|---|--:|--:|--:|--:|--:|--:|--:|--:|
| Focused Value | $519.50 | $114.85 | $723.05 | 3% | 101 | 582 | 18m | 42% |
| Premium Craft | $361.90 | -$538.82 | $1334.24 | 31% | 58 | 639 | 24m | 43% |
| Broad Menu | -$66.00 | -$781.00 | $622.00 | 55% | 89 | 584 | 23m | 7% |
| Premium Craft | $361.90 | -$538.82 | $1334.24 | 31% | 58 | 639 | 24m | 42% |
| Broad Menu | $93.00 | -$600.00 | $706.50 | 42% | 95 | 581 | 23m | 10% |
| Overcapacity | -$572.50 | -$843.50 | -$326.00 | 100% | 37 | 578 | 21m | 0% |
| Understaffed | -$480.00 | -$607.50 | -$354.50 | 100% | 17 | 514 | 25m | 0% |
| Balanced Competent | $42.00 | -$540.50 | $655.50 | 48% | 87 | 609 | 21m | 7% |
| Balanced Competent | $42.00 | -$540.50 | $655.50 | 48% | 87 | 609 | 21m | 6% |
| Overpriced Weak Execution | -$899.10 | -$1077.60 | -$694.20 | 100% | 5 | 374 | 29m | 0% |
| Station Bottleneck | -$626.00 | -$807.50 | -$402.00 | 100% | 21 | 624 | 20m | 0% |
| Intentionally Bad | -$394.60 | -$488.80 | -$293.80 | 100% | 7 | 517 | 23m | 0% |
Expand All @@ -48,7 +48,7 @@ _High-budget enthusiasts, lower volume, high quality expectations, patient. Rewa
|---|--:|--:|--:|--:|--:|--:|--:|--:|
| Focused Value | $246.95 | $80.95 | $411.30 | 2% | 63 | 633 | 13m | 0% |
| Premium Craft | $1031.68 | $161.14 | $1754.74 | 6% | 68 | 612 | 24m | 74% |
| Broad Menu | $556.50 | -$100.50 | $930.00 | 11% | 88 | 586 | 23m | 11% |
| Broad Menu | $547.00 | -$38.00 | $945.50 | 12% | 88 | 587 | 23m | 11% |
| Overcapacity | -$20.50 | -$424.00 | $486.50 | 52% | 51 | 561 | 22m | 0% |
| Understaffed | -$336.00 | -$498.50 | -$171.00 | 98% | 22 | 466 | 27m | 0% |
| Balanced Competent | $484.50 | $191.50 | $743.00 | 0% | 78 | 642 | 18m | 13% |
Expand Down
17 changes: 17 additions & 0 deletions reports/balance/dominance-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# M0 Dominance Search Report

Closes audit finding H2: the old 'no dominant strategy' claim only compared 9 hand-authored plans.
This bounded random search over the DECISION SPACE (menu subset, prices, staffing, seats) looks for
any configuration that beats the best NAMED strategy in ALL three markets by a material margin.

Searched **500** random configurations x 40 seeds. Named-best medians: lunch-rush $236.70, social-dinner $542.25, enthusiast-evening $1054.92.

**Configurations that dominate all 3 markets by >= $150.00: 1.**

Best such config (min cross-market edge $340.46): menu[Classic Burger@$26.55, Roast Chicken@$52.14, Seared Scallops@$41.04, Veggie Bowl@$29.54] seats 36, 8 staff

> KNOWN RESIDUAL (audit NEW-1): the menu-coherence lever fixes the value-chassis-plus-premium-anchor
> exploit, but a UNIFORMLY-OVERPRICED COHERENT menu can still dominate because M0 has no repeat-visit
> or reputation feedback, so quality/price expectations have no economic teeth within a single service.
> This is the disclosed throughput-vs-quality M0 boundary (DECISION-LOG D-012); giving price a
> countervailing cost is an M0.5/M1 concern, not something to hack in this bounded pass. NOT hidden.
14 changes: 14 additions & 0 deletions reports/balance/forecast-calibration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# M0 Forecast Calibration Report

Closes audit finding H3 (forecast was 2-15x optimistic; its band contained ~0% of outcomes).
The forecast now reports a demand-opportunity ceiling, an expected COMPLETED-covers estimate
(de-biased for peaking and walkouts), and an honest, downward-skewed low-confidence contribution
range. Stated confidence: **55%**. Seeds/cell: 200.

| Scenario | contribution band coverage | median |covers bias| |
|---|--:|--:|
| lunch-rush | 1000/1800 = 55% | 126% |
| social-dinner | 984/1800 = 54% | 112% |
| enthusiast-evening | 1342/1800 = 74% | 29% |

**Aggregate band coverage: 3326/5400 = 61%** (was ~0% pre-fix; meets the stated 55% confidence).
6 changes: 3 additions & 3 deletions reports/determinism/checksums.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ A management sim that promises "same seed reproduces the same result" must pass
|---|---|--:|---|---|:--:|
| lunch-rush | Focused Value | 700042 | `F07AA46F729A0A8F` | `F07AA46F729A0A8F` | ✅ |
| lunch-rush | Premium Craft | 700042 | `A0D653B17FF192D8` | `A0D653B17FF192D8` | ✅ |
| lunch-rush | Broad Menu | 700042 | `E63EABF147F55033` | `E63EABF147F55033` | ✅ |
| lunch-rush | Broad Menu | 700042 | `1607D833572605AB` | `1607D833572605AB` | ✅ |
| social-dinner | Focused Value | 700042 | `54F356FF43370823` | `54F356FF43370823` | ✅ |
| social-dinner | Premium Craft | 700042 | `CC04BB7D20A81AEE` | `CC04BB7D20A81AEE` | ✅ |
| social-dinner | Broad Menu | 700042 | `A0054A9CE5021BBE` | `A0054A9CE5021BBE` | ✅ |
| social-dinner | Broad Menu | 700042 | `7CBDD747FEEBB6EC` | `7CBDD747FEEBB6EC` | ✅ |
| enthusiast-evening | Focused Value | 700042 | `94FEB3F3011C1E36` | `94FEB3F3011C1E36` | ✅ |
| enthusiast-evening | Premium Craft | 700042 | `24EE4A83E7436797` | `24EE4A83E7436797` | ✅ |
| enthusiast-evening | Broad Menu | 700042 | `764B71FDC6B9E691` | `764B71FDC6B9E691` | ✅ |
| enthusiast-evening | Broad Menu | 700042 | `2B5ABA477A42D072` | `2B5ABA477A42D072` | ✅ |

**All checksums matched: determinism holds for the sampled matrix.**
Loading