{
  "date": "2026-10-28",
  "requirement": "Seven native Order P2 stock reservation examples: atomic Order/inventory rollback, no overselling, duplicate requests; preserve School and all Order receipts and pending marks; local evidence only.",
  "model": {"path": "model.xml", "revision": "1.2.0", "localEvaluation": {"errors": 0, "warnings": 0, "suggestions": 2, "skippedRules": 0}, "change": "Add Inventory, immutable StockReservation payload/relations and commerce_platform.reservation_sequence; replace the new fixture's generic optional note with concrete required text. Original 1.0.0 and isolation 1.1.0 models remain immutable.", "acceptedSuggestions": "Status badge color/progress are UI suggestions, outside the native stock fixture.", "runtimePins": "Retain all seven explicit runtime pins from the isolation revision."},
  "discovery": {"mode": "local-evaluation-generation-and-assist", "onlineModelTransmission": false, "assistScopesPerLanguage": 49, "totalAssistScopes": 343, "generatedTargets": 14, "generatorTests": "Stock generation regression 1/1 and existing nullable, pagination and insights regressions 3/3; logs and sources retained.", "generatedDomainSourceEditedManually": false, "generatedDomainSourceUsedForApiDiscovery": false},
  "result": {"stockCells": "7/7", "sqliteDatabases": "7/7", "requestsPerLanguage": 47, "databaseCheckpointsPerLanguage": 56, "totalDatabaseCheckpoints": 392, "concurrentRounds": 42, "independentWorkerProcesses": 84, "retainedCore": "119/119 model 1.0.0", "retainedIsolation": "7/7 model 1.1.0, 350 checkpoints", "retainedSchool": "238/238 historical advanced baseline"},
  "fixture": "Two tenants, two buyers per tenant, four single-item Orders per buyer: quantities 4,4,6,5, all one SKU. TENANT-A has 5 available, TENANT-B 11; each has unrelated control SKU stock 9. Initial domain state is 16 Orders, 16 items, 4 inventory rows and no receipts. USD minor-unit totals and all items stay unchanged.",
  "acceptance": [
    "One reservation confirms DRAFT to CONFIRMED, moves four units from available to reserved, increments tenant reservation_sequence and writes one immutable receipt in the same provider transaction.",
    "Trusted server session binds tenant and buyer. Receipt identity is tenant+buyer+requestKey; compare persisted canonical Order number, SKU and quantity before any replay. Matching requests after process restart return the same receipt ID with no business writes. Changed payloads reject, and a different key cannot reserve a confirmed Order.",
    "Reject unknown identity, forged scope, unknown fields, invalid keys and invalid quantities before provider access. Reject absent Order/inventory, incomplete or mismatched single-item payload and insufficient stock without mutations. Exact depletion reaches zero; later requests cannot make it negative.",
    "A separate test setup installs a SQLite trigger that aborts the last receipt INSERT. Native logs must show earlier tenant, Order and inventory UPDATEs; independent full domain snapshots remain unchanged, including versions and timestamps. Remove trigger and retry the same key successfully. Oracle is mode=ro and never installs faults or writes.",
    "Three oversell races per runtime use two independent native processes on different Orders with the same initial available=5 and quantity=4. Both atomically publish the same root/inventory/order versions before parent release. A read-only checkpoint proves no early writes. Require one RESERVED and one genuine optimistic conflict followed by fresh-read OUT_OF_STOCK; final available=1, reserved=4 and one receipt.",
    "Three duplicate races per runtime use the same request key and payload at the same barrier. Require one RESERVED and one genuine optimistic conflict followed by REPLAY with the winner's durable receipt ID. Stock, sequence and Order advance exactly once. Busy, locked and timeout errors are never optimistic conflicts.",
    "Each read-only database checkpoint independently verifies stock conservation against receipts, nonnegative availability, scoped unique keys, parent ownership, Order status/versions, line totals and complete domain snapshots. No compensating rollback writes."
  ],
  "repairs": [
    {"layer": "generator", "languages": ["java"], "detail": "A selected empty reverse relation may be the runtime immutable shared SmartList. Generated add-child helpers now allocate a mutable list for null or empty relations. Exact-model generation assertions and the retained earlier native aggregate commit cover the regression. No generated source was hand-edited."},
    {"layer": "generator", "languages": ["java", "python", "typescript", "go", "dotnet", "swift"], "detail": "Progressive update Assist now advertises the exact collection append API, including Java's generated add-child method and Go's typed relation Add."},
    {"layer": "application", "languages": ["java", "rust"], "detail": "Use the real explicit native provider transaction to save full scalar tenant, Order, inventory and receipt in that order. Java's graph scheduler places inserts before updates, so its trigger abort did not prove earlier business updates rolled back. The failed attempt is retained; final explicit saves prove late failure without compensation. Other five runtimes use one generated root graph save."},
    {"layer": "application", "detail": "Retain localized compiler/runtime failures for status updater spellings, Rust expression ownership and Go's required note type. Apply exact Assist and compiler diagnostics in app-owned code. Keep all command, build and verification attempts."},
    {"layer": "harness", "detail": "Preserve preliminary verification attempts and then rerun all final binaries with the strengthened independent stock-conservation oracle. Every build binds fixture, model, oracle, fault setup, runner and native application hashes."}
  ],
  "qualification": {"publishedRuntimes": ["java", "swift"], "workspacePendingRelease": ["go", "typescript", "rust", "python", "dotnet"], "generator": "Existing generator qualifications plus the new Java empty-list append and append Assist fixes remain workspace-tested-pending-deployment. No release or deployment claimed."},
  "limits": ["Native SQLite only; no distributed transaction or external inventory service.", "All participating writers must use this facade and tenant version gate. It intentionally serializes reservations per tenant, including independent SKUs; no fine-grained SKU lock, throughput benchmark or arbitrary raw-Q writer guarantee.", "One complete single-SKU line per fixture Order. Multi-SKU allocation, partial fulfillment, expiry/release/cancellation/restock, payment and shipping workflows need separate cases.", "Synthetic trusted server sessions; production authentication, tenant lifecycle and membership remain integration work.", "Provider-failure evidence is one late statement abort. Commit failure, process crash, cancellation and sustained stress remain unverified. Database identity allocation counters are outside the domain snapshot and may consume IDs after failed transactions."],
  "telemetry": {"tokenUsage": "not reported", "estimatedContextAvoided": "not measured", "queryPolicyExecutionCount": "not reported", "writePolicyExecutionCount": "not reported"},
  "mechanicalReview": "Source-bound generation, native build and runtime resolution; auditable provider SQL; exact persisted identities, unchanged snapshots, synchronized process barriers and receipt-chain validation.",
  "humanReviewFocus": "Production authentication and transaction admission, single-SKU business policy, tenant gate contention budget, idempotency key lifecycle and integration of non-facade writers.",
  "nextUse": "npm run evidence:order:stock -- --check"
}
