# 66 Artifact Types & 79 Verified Bugs: Layer-by-Layer Anatomy of an AI Deterministic Code Generation System

An exhaustive inventory of all 66 artifact types emitted by `metarch-truthsrc` (`scala-cqrs-play-service-v2`) classified by architectural layer, code role, ownership boundary, and specification origin, paired with a full-cycle post-mortem of **79 empirically verified bugs** across the **Friday real-PRD roadshow (Waves 4–8, 13 bugs) + Wave-9 deep audit (47 bugs) + differential/metamorphic/real-JVM/evolution probing (`0010`–`0023`, 19 bugs)** (as of 2026-11-28).

<div class="co-report co-taxonomy">

<div class="verdict">
<p><strong>Core Finding:</strong> Across all 66 artifact types, <strong>54 (81.8%) live in the read-only generated zone</strong>, <strong>8 (12.1%) live in the handwritten isolation zone</strong>, and <strong>4 (6.1%) form locked test oracles</strong>. Only 14 artifact types (21.2%) derive directly from EARS behavioral specifications; the remaining 52 (78.8%) originate from structural models and Play/Akka runtime contracts.</p>
<p><strong>Empirical Bug &amp; Roadshow Verdict:</strong> All <strong>79 verified defects occurred inside compiler gates, code generators, the read-only generated zone, or verification tooling</strong>. The "data-lineage blocker" hit mid-way during the Friday real-PRD roadshow (commit <code>8950ba3</code>) was neither a Truth authoring error nor a codegen bug—it was a <strong>false-positive compiler gate block in <code>lib/v2/lineage.mjs</code></strong> that forgot to register <code>@PROPAGATED</code> event-field consumption for event-triggered Policies.</p>
</div>

<section class="hero-strip" id="co-metrics" aria-label="Key metrics">
<div>
<div class="metric-val">66</div>
<div class="metric-label"><code>scala-cqrs-play-service-v2</code> artifact types (54 generated · 8 handwritten · 4 locked oracles)</div>
</div>
<div>
<div class="metric-val amber">79</div>
<div class="metric-label">Full-cycle verified real bugs (Friday Roadshow 13 · Wave-9 47 · Diff/JVM 19)</div>
</div>
<div>
<div class="metric-val teal">13</div>
<div class="metric-label">Real-world engineering landmines exposed on the spot during the Friday PRD roadshow (Waves 4–8)</div>
</div>
<div>
<div class="metric-val">100%</div>
<div class="metric-label">All 79 defects sat in the compiler, generator, or read-only scaffold—every generator flaw fans out to every downstream service</div>
</div>
</section>

<section class="sec" id="spatial-map">
<h2>3 Layers × 3 Roles × 2 Zones: Complete Spatial Map of All 66 Artifact Types</h2>
<p>From an internal engineering perspective, every microservice generated by <code>metarch-truthsrc</code> partitions along two orthogonal axes: vertically across <strong>Domain / Application / Infrastructure (including Interfaces and Controllers)</strong>, and horizontally across <strong>Structural Skeleton / Glue &amp; Wiring / Behavioral Logic</strong> plus two strict ownership zones—the <strong>read-only generated zone (<code>generated-scaffold/</code>)</strong> and the <strong>handwritten isolation zone (<code>handwritten/</code>)</strong>.</p>
<p><strong>Behavioral code does not live exclusively in the handwritten isolation zone.</strong> Deterministic L1 domain rules, event folding (<code>EventHandler</code>), replay invariants (<code>Axioms</code>), ReadSide projections, and Policy state machines are emitted directly into the read-only generated zone. Only L2 non-deterministic computations (<code>@host</code> / <code>ComputationsImpl</code>), L3 cross-port application orchestration (<code>*StoryImpl</code>), external connectors, and authorization adapters land inside <code>handwritten/</code> slots protected by <code>overwriteCloze: false</code>.</p>

<figure class="arch-fig">
<div class="fig-title">The generated zone carries 81.8% of structure, glue, and deterministic behavior; the isolation zone holds only 8 controlled extension slots</div>
<img src="/assets/img/metarch-truthsrc-artifact-bug-taxonomy-architecture.jpg" alt="Architectural cutaway of three layers partitioned into read-only generated zone and handwritten isolation zone" width="1376" height="768"/>
<figcaption>Cutaway: Domain, Application, and Infrastructure &amp; Interfaces from top to bottom; the left 80% represents read-only <code>generated-scaffold/</code>, while the amber slots beyond the dashed boundary represent <code>handwritten/</code> isolation slots. Source: <code>metarch-truthsrc</code> v2 bridge and <code>catalog.json</code> inventory.</figcaption>
</figure>

<div class="article-table">
<table>
<thead>
<tr>
<th>Layer &amp; Artifact Group</th>
<th>Code Role</th>
<th>Ownership Zone</th>
<th>Origin</th>
<th>Count</th>
<th>Concrete Artifact Inventory (66 Total)</th>
</tr>
</thead>
<tbody>
<tr class="group-row"><td colspan="6">Domain Layer (11 total: 9 read-only generated · 2 handwritten)</td></tr>
<tr>
<td>Kernel &amp; Value Object Types</td>
<td>Skeleton</td>
<td>Generated Zone</td>
<td class="tag-struct">Structural</td>
<td class="num">4</td>
<td><code>CommonTypes</code>, <code>CborSerializable</code>, <code>ValueObject / ExactType (Money/Decimal)</code>, <code>ExternalPayload</code></td>
</tr>
<tr>
<td>Entity State, Protocol &amp; Params</td>
<td>Skeleton</td>
<td>Generated Zone</td>
<td class="tag-struct">Structural</td>
<td class="num">2</td>
<td><code>&lt;Agg&gt;Entity (State/Event)</code>, <code>&lt;Agg&gt;RuleParams</code></td>
</tr>
<tr>
<td>Domain Computation Port &amp; Bridge</td>
<td>Glue</td>
<td>Generated Zone</td>
<td class="tag-ears">EARS + Struct</td>
<td class="num">1</td>
<td><code>&lt;Agg&gt;Computations</code> (declares L2 commands and <code>@host</code> function signatures)</td>
</tr>
<tr>
<td>Deterministic L1 Rules, Folding &amp; Axioms</td>
<td>Behavior</td>
<td>Generated Zone</td>
<td class="tag-ears">EARS-derived</td>
<td class="num">2</td>
<td><code>&lt;Agg&gt;Rules</code> (guards &amp; postconditions), <code>&lt;Agg&gt;EventHandler</code> + <code>&lt;Agg&gt;Axioms</code> (2 classes: rules/folding + axioms)</td>
</tr>
<tr>
<td>L2 Non-Deterministic Computation Slots</td>
<td>Behavior</td>
<td class="tag-cloze">Handwritten Zone</td>
<td class="tag-ears">EARS-derived</td>
<td class="num">2</td>
<td><code>&lt;Agg&gt;ComputationsImpl</code> (<code>@host</code> &amp; non-L1 commands), <code>&lt;Target&gt;Impl</code> (L2 <code>@cloze</code> implementations)</td>
</tr>
<tr class="group-row"><td colspan="6">Application Layer (15 total: 14 read-only generated · 1 handwritten)</td></tr>
<tr>
<td>Use-Case Ports, Contracts &amp; Read Views</td>
<td>Skeleton</td>
<td>Generated Zone</td>
<td class="tag-struct">Struct + EARS</td>
<td class="num">5</td>
<td><code>&lt;Story&gt;Port</code>, <code>CallerContractSpec</code>, <code>&lt;View&gt;</code>, <code>&lt;Readside&gt;Repository</code> (Port), <code>&lt;Stem&gt;Table</code></td>
</tr>
<tr>
<td>Aggregate Actor, Query &amp; Outbound Ports</td>
<td>Glue</td>
<td>Generated Zone</td>
<td class="tag-struct">Runtime</td>
<td class="num">5</td>
<td><code>&lt;Agg&gt;Aggregate</code> (Akka EventSourcedBehavior), <code>&lt;View&gt;QueryService</code>, <code>OutboundConnectors</code>, <code>ToolGatePort</code>, <code>&lt;Flow&gt;InvocationFace</code></td>
</tr>
<tr>
<td>Projection, Policy &amp; Saga Shells</td>
<td>Behavior</td>
<td>Generated Zone</td>
<td class="tag-ears">EARS + Orch</td>
<td class="num">4</td>
<td><code>&lt;Readside&gt;ProjectionHandler</code> + <code>Projection</code>, <code>PolicyMachine</code> + <code>&lt;Policy&gt;</code>, <code>&lt;Flow&gt;SagaModule / FixtureHost / CompositionHost</code>, <code>&lt;Eff&gt;EffectFace</code></td>
</tr>
<tr>
<td>L3 Application Story Orchestration Slot</td>
<td>Behavior</td>
<td class="tag-cloze">Handwritten Zone</td>
<td class="tag-ears">EARS-derived</td>
<td class="num">1</td>
<td><code>&lt;Story&gt;Impl</code> (cross-port authz, <code>extern</code> checks, aggregate dispatch, response assembly)</td>
</tr>
<tr class="group-row"><td colspan="6">Infrastructure &amp; Interfaces Layer (36 total: 31 read-only generated · 5 handwritten)</td></tr>
<tr>
<td>Proto3 Schemas, DDL &amp; Build Config</td>
<td>Skeleton</td>
<td>Generated Zone</td>
<td class="tag-struct">Struct + Build</td>
<td class="num">10</td>
<td><code>&lt;agg&gt;.proto</code>, <code>shared_value_objects.proto</code>, <code>&lt;flow&gt;_host.proto</code>, <code>&lt;eff&gt;_effect.proto</code>, <code>&lt;Readside&gt;Schema</code> (DDL), <code>build.sbt</code>, <code>plugins.sbt</code>, <code>service.conf</code>, <code>dev.conf</code>, <code>routes</code></td>
</tr>
<tr>
<td>Play Controllers, Routes &amp; API DSL</td>
<td>Glue</td>
<td>Generated Zone</td>
<td class="tag-ears">EARS + API</td>
<td class="num">7</td>
<td><code>ApiDto</code>, <code>&lt;Story&gt;Controller</code>, <code>HttpRouter</code>, <code>PlayHttpBridge</code>, <code>&lt;Story&gt;PlayController</code>, <code>AggregateStateApiController</code>, <code>AuthEndpointDsl / CommandDsl / HttpStatusMapper</code></td>
</tr>
<tr>
<td>Serializers, Converters &amp; Persistence</td>
<td>Glue</td>
<td>Generated Zone</td>
<td class="tag-struct">Runtime</td>
<td class="num">8</td>
<td><code>SharedValueProtoConverters</code>, <code>&lt;Agg&gt;ProtoConverter</code>, <code>DomainConverters</code>, <code>DomainProtoSerializer</code>, <code>&lt;Flow&gt;HostSerializer</code>, <code>&lt;Eff&gt;EffectSerializer</code>, <code>&lt;Readside&gt;RepositoryImpl</code>, <code>ScalikeJdbcProjectionSession / InMemoryStore / PolicyDlqBury</code></td>
</tr>
<tr>
<td>Guice DI &amp; Bootstrap Startup Chain</td>
<td>Glue</td>
<td>Generated Zone</td>
<td class="tag-struct">Runtime</td>
<td class="num">6</td>
<td><code>BootstrapModule</code>, <code>GeneratedBindingsModule</code>, <code>OnionBootstrap</code>, <code>OrchestrationModule</code>, <code>&lt;Readside&gt;Bootstrap / ProjectionModule</code>, <code>SagaCoordinatorBootstrap / ProcessBootstrap / EffectBootstrap</code></td>
</tr>
<tr>
<td>Infrastructure &amp; External Integration Slots</td>
<td>Behavior + Glue</td>
<td class="tag-cloze">Handwritten Zone</td>
<td class="tag-struct">Runtime</td>
<td class="num">5</td>
<td><code>HandwrittenBindingsModule</code>, <code>AuthorizationPortImpl</code> (PDP), <code>ServerSnapshotProviderImpl</code>, <code>&lt;Port&gt;ConnectorImpl</code>, <code>&lt;Eff&gt;EffectPortImpl / &lt;Stem&gt;ApplyEventSemanticsImpl</code></td>
</tr>
<tr class="group-row"><td colspan="6">Cross-Layer Governance &amp; Locked Test Oracles (4 total: 4 locked)</td></tr>
<tr>
<td>Z3 Locked Specs &amp; Provenance Manifests</td>
<td>Test Oracle</td>
<td>Locked Test Zone</td>
<td class="tag-ears">EARS-derived</td>
<td class="num">4</td>
<td><code>&lt;Agg&gt;&lt;Cmd&gt;EarsSpec</code> (ScalaTest), <code>&lt;Story&gt;EarsSpec</code> (App + HTTP route specs), <code>locked-tests.manifest.json</code>, <code>canonical-v2.json / knowledge.sqlite</code></td>
</tr>
</tbody>
</table>
</div>
</section>

<section class="sec" id="friday-roadshow">
<h2>Friday Real-PRD Roadshow Post-Mortem (Waves 4–8): 13 Landmines &amp; the Data-Lineage False Positive</h2>
<p>On Friday, November 27, 2026, running an external real-world PRD end-to-end stalled mid-pipeline and triggered <strong>5 rapid fix waves (Waves 4–8, commits <code>1e87c6a</code> → <code>ab207e7</code>) covering 13 real bugs</strong>. Unlike static audits or differential fuzzers, these failures stemmed from <strong>uncut real-world business modeling</strong>—multi-aggregate event choreography, nested containers, package renames, and strongly-typed GET query parameters—exposing real user paths that curated demos never exercise.</p>

<div class="split">
<div><h3>Classifying the Lineage Blocker: Neither Bad Truth Nor Bad Codegen</h3></div>
<div>
<p>Commit <code>8950ba3</code> (Wave-6) captures the exact data-lineage blocker hit during the roadshow. The PRD authored a completely valid <strong>event-triggered Policy (<code>WHEN Event ... SHALL dispatch TargetAgg.Cmd</code>)</strong> whose event fields propagated automatically to downstream command parameters via <code>@PROPAGATED</code>—the <strong>Truth specification was 100% correct</strong>.</p>
<p>The fault lived inside the <strong>static compiler gate <code>lib/v2/lineage.mjs</code></strong>: Check 3 (<code>verifyDispatchLineage</code>) failed to record event fields consumed by event-triggered rules into <code>consumedEventFields</code>, causing Check 4 to emit a false-positive <code>V2_LINEAGE_UNCONSUMED_*</code> error and abort compilation. The fix took 3 lines of code, but the lesson is fundamental: <strong>a false positive in a static governance gate hurts real users just as badly as a compiler crash</strong>.</p>
</div>
</div>

<div class="cols-3">
<div class="col-item">
<h3>Lineage Gate · Hard Blocks (Default <code>error</code>)</h3>
<ul class="clean">
<li><code>post:</code> or ReadModel references to missing or type-mismatched <code>eventField:</code> / <code>stateField:</code>.</li>
<li>Type incompatibility between <code>dispatch</code> parameters and upstream inputs.</li>
<li><code>V2_LINEAGE_UNCONSUMED_NUMERIC_FIELD</code> (default <code>failClosedNumeric = true</code> blocks unconsumed numeric event fields).</li>
</ul>
</div>
<div class="col-item">
<h3>Lineage Gate · Soft Alerts (Default <code>warning</code>)</h3>
<ul class="clean">
<li><strong>Defined but unread</strong>: <code>DEAD_STATE_FIELD</code>, <code>WRITE_ONLY_STATE_FIELD</code>, <code>UNCONSUMED_EVENT_FIELD</code>.</li>
<li><strong>Downstream missing upstream</strong>: <code>DISPATCH_UNBOUND_PARAM</code>, <code>UNWRITTEN_STATE_FIELD</code>, <code>UNSOURCED_READMODEL_FIELD</code>.</li>
<li>Requires <code>strictLineage = true</code> to escalate into hard blocks (legitimate write-only fields use <code>waiveLineage</code>).</li>
</ul>
</div>
<div class="col-item">
<h3>Lineage Gate · Three Real Blind Spots (False Negatives)</h3>
<ul class="clean">
<li><strong>Inside <code>@cloze</code> handwritten bodies</strong>: Does not parse Scala bodies; <code>DISPATCH_UNBOUND_PARAM</code> assumes manual synthesis, requiring locked specs and mutation testing as backstops.</li>
<li><strong>Cross-service async events</strong>: Scoped to a single BC (or merged subdomain); cannot statically prove remote upstream producers.</li>
<li><strong>Same-name semantic aliasing</strong>: <code>@PROPAGATED</code> aligns by name + type and cannot distinguish business meaning (e.g., order <code>id</code> vs. user <code>id</code>).</li>
</ul>
</div>
</div>

<div class="cols-3">
<div class="col-item">
<h3>Waves 4–5: Nested Containers &amp; Package Renames (5)</h3>
<ul class="clean">
<li><code>1e87c6a</code>: Nested Proto3 containers lacked <code>BoxPO</code> wrappers and converters (Infra Proto); <code>PlayController</code> dropped principal entitlements/attributes with case-sensitive lookup (Infra Play).</li>
<li><code>93a6350</code>: 2D nested <code>Map[String, Map[String, VO]]</code> caused SMT/witness/codegen gaps and <code>encVal/encBool</code> stack overflow (Domain SMT); handwritten slots lacked non-destructive method sync (Tooling); package rename left stale starter files (Governance).</li>
</ul>
</div>
<div class="col-item">
<h3>Waves 6–7: Lineage FP, Optional &amp; Typed GET (6)</h3>
<ul class="clean">
<li><code>8950ba3</code>: Missing <code>@PROPAGATED</code> consumption tracking for event-triggered Policies (Compiler Gate); <code>Optional[VO]</code> member access lacked null-safe expansion in Scala &amp; TS (Domain).</li>
<li><code>cf4545a</code>: Flow-sensitive <code>Optional[T]</code> narrowing &amp; OR boundary witnesses (M24); missing <code>forall + sum</code> coupled LIA axioms (M26); schema-driven typed GET query parsing (M25); <code>check-v2 --sync</code> stale handwritten detection after package rename (M27).</li>
</ul>
</div>
<div class="col-item">
<h3>Wave 8: Multi-BC Bridge &amp; ReadSide Wrapping (2)</h3>
<ul class="clean">
<li><code>ab207e7</code> (M28): Multi-BC <code>#46 external-event-bridge</code> missed strongly-typed Payload VOs and complete <code>slotMembers</code> / <code>identityKey</code> wiring (App/Orchestration).</li>
<li><code>ab207e7</code> (M30): <code>#26 ApplyEvent</code> and <code>#28 ReadsideProjectionHandler</code> omitted <code>Some(...)</code> wrapping when writing non-Optional event fields into Optional ReadModel columns (Infra ReadSide).</li>
</ul>
</div>
</div>
</section>

<section class="sec" id="bug-distribution">
<h2>Spatial Distribution of All 79 Bugs: How Three Campaigns Cleared Different Blind Spots</h2>
<p>Combining the <strong>Friday Roadshow (Waves 4–8, 13 bugs)</strong>, the <strong>Wave-9 Deep Audit (<code>0001</code>–<code>0007</code>, 47 bugs)</strong>, and <strong>Differential / Metamorphic / Real <code>scalac</code>+JVM / ReadSide-Saga Probing (<code>0010</code>–<code>0023</code>, 19 bugs)</strong> into <strong>79 verified defects</strong> highlights sharp complementarity: the real-PRD roadshow caught compiler-gate false positives, nested containers, and rename friction; Wave-9 swept Play startup, Guice/Authz/DLQ, and gate bypasses; and differential + real-JVM execution exposed cross-stage SMT↔Scala semantic drift invisible to unit tests and code review.</p>

<figure class="chart-fig">
<div class="fig-title">Domain translation (31) and Infrastructure glue/persistence (29) account for 75.9% of all 79 bugs</div>
<svg viewBox="0 0 700 400" width="100%" role="img" aria-label="Stacked horizontal bar chart of 79 verified bugs across 5 architectural spaces by discovery campaign">
<line x1="220" y1="40" x2="220" y2="322" class="svg-axis"/>
<line x1="330" y1="40" x2="330" y2="322" class="svg-grid"/>
<line x1="440" y1="40" x2="440" y2="322" class="svg-grid"/>
<line x1="550" y1="40" x2="550" y2="322" class="svg-grid"/>

<text x="220" y="344" text-anchor="middle" font-size="13" class="svg-mono">0</text>
<text x="330" y="344" text-anchor="middle" font-size="13" class="svg-mono">10</text>
<text x="440" y="344" text-anchor="middle" font-size="13" class="svg-mono">20</text>
<text x="550" y="344" text-anchor="middle" font-size="13" class="svg-mono">30</text>
<text x="412" y="370" text-anchor="middle" font-size="13" class="svg-sub">Verified &amp; fixed bugs across full cycle (Total: 79)</text>

<rect x="155" y="10" width="13" height="13" class="svg-bar-roadshow"/>
<text x="174" y="21" font-size="13" class="svg-label">Roadshow W4–8 (13)</text>
<rect x="335" y="10" width="13" height="13" class="svg-bar-wave9"/>
<text x="354" y="21" font-size="13" class="svg-label">Wave-9 Audit (47)</text>
<rect x="495" y="10" width="13" height="13" class="svg-bar-diff"/>
<text x="514" y="21" font-size="13" class="svg-label">Diff / Real JVM (19)</text>

<text x="210" y="76" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Domain Behavior / SMT</text>
<rect x="220" y="56" width="44" height="28" class="svg-bar-roadshow"/>
<rect x="264" y="56" width="154" height="28" class="svg-bar-wave9"/>
<rect x="418" y="56" width="143" height="28" class="svg-bar-diff"/>
<text x="242" y="75" text-anchor="middle" font-size="13" class="svg-on-bar">4</text>
<text x="341" y="75" text-anchor="middle" font-size="13" class="svg-on-bar">14</text>
<text x="489" y="75" text-anchor="middle" font-size="13" class="svg-on-bar">13</text>
<text x="571" y="75" font-size="14" class="svg-val">31 (39.2%)</text>

<text x="210" y="132" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Infra Glue / Play / Authz</text>
<rect x="220" y="112" width="22" height="28" class="svg-bar-roadshow"/>
<rect x="242" y="112" width="176" height="28" class="svg-bar-wave9"/>
<rect x="418" y="112" width="11" height="28" class="svg-bar-diff"/>
<text x="231" y="131" text-anchor="middle" font-size="12" class="svg-on-bar">2</text>
<text x="330" y="131" text-anchor="middle" font-size="13" class="svg-on-bar">16</text>
<text x="439" y="131" font-size="14" class="svg-val">19 (24.1%)</text>

<text x="210" y="188" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Gates / Lineage / Tooling</text>
<rect x="220" y="168" width="44" height="28" class="svg-bar-roadshow"/>
<rect x="264" y="168" width="77" height="28" class="svg-bar-wave9"/>
<text x="242" y="187" text-anchor="middle" font-size="13" class="svg-on-bar">4</text>
<text x="302" y="187" text-anchor="middle" font-size="13" class="svg-on-bar">7</text>
<text x="351" y="187" font-size="14" class="svg-val">11 (13.9%)</text>

<text x="210" y="244" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Infra ReadSide / SQL</text>
<rect x="220" y="224" width="22" height="28" class="svg-bar-roadshow"/>
<rect x="242" y="224" width="55" height="28" class="svg-bar-wave9"/>
<rect x="297" y="224" width="33" height="28" class="svg-bar-diff"/>
<text x="231" y="243" text-anchor="middle" font-size="12" class="svg-on-bar">2</text>
<text x="269" y="243" text-anchor="middle" font-size="13" class="svg-on-bar">5</text>
<text x="313" y="243" text-anchor="middle" font-size="13" class="svg-on-bar">3</text>
<text x="340" y="243" font-size="14" class="svg-val">10 (12.7%)</text>

<text x="210" y="300" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Application / Saga / BC</text>
<rect x="220" y="280" width="11" height="28" class="svg-bar-roadshow"/>
<rect x="231" y="280" width="55" height="28" class="svg-bar-wave9"/>
<rect x="286" y="280" width="22" height="28" class="svg-bar-diff"/>
<text x="258" y="299" text-anchor="middle" font-size="13" class="svg-on-bar">5</text>
<text x="297" y="299" text-anchor="middle" font-size="12" class="svg-on-bar">2</text>
<text x="318" y="299" font-size="14" class="svg-val">8 (10.1%)</text>
</svg>
<figcaption>Scope: all 79 verified fixes from <code>1e87c6a</code> (Wave-4) through <code>0e8df64</code> (<code>0023</code>). Note: the trailing amber segment on Infra Glue is 1 (<code>PolicyMachine $aggType·</code>); the leading teal segment on Application is 1 (M28 multi-BC bridge).</figcaption>
</figure>
</section>

<div class="ed-band" id="ai-root-causes">
<h2>AI Engineering Coding Root Causes: How These 79 Defects Systematically Formed</h2>
<p>When AI participates heavily in building compilers, bridges, and code generators, these 79 bugs cluster tightly into <strong>4 structural AI coding failure modes</strong>—mirroring <a href="https://www.computer.org/csdl/proceedings-article/icse/2025/056900a717/251mH51B1AY">Wang et al.'s (ICSE 2025) empirical taxonomy of 557 LLM code-generation errors</a>, where semantic and contract misalignments vastly outnumber basic syntax errors:</p>

<div class="cols-2">
<div class="col-item">
<h3>1. Cross-Stage Semantic Drift</h3>
<p><code>metarch-truthsrc</code> spans five decoupled stages: Parser → Binder → <code>smt-encoder</code> → <code>witness-materialize</code> → <code>ears-simplify / v1-strict-scala</code>. When adding a feature in a single context window, AI routinely wires the first 2 stages while missing the downstream 3—producing <code>Seq/Map is empty</code> gaps, unregistered <code>Record ==</code>, 2D <code>Map</code> recursion, and missing <code>@host</code> <code>Computations</code> declarations.</p>
</div>
<div class="col-item">
<h3>2. Config-Equals-Runtime Illusion</h3>
<p>AI readily conflates "a directive exists in a config or template" with "it is enforced at runtime." Classic cases: <code>service.conf</code> listed <code>CSRFFilter</code> while the live Play server let un-tokened requests pass (caught immediately by <code>0021</code> black-box E2E); <code>v1-strict-orchestration</code> claimed <code>strict-saga-module</code> while emitting stubs; Ubuntu CI's <code>apt-get install scala</code> silently pulled Scala 2.11 instead of 2.13.</p>
</div>
<div class="col-item">
<h3>3. Fail-Open / Silent Fallback Bias</h3>
<p>To avoid crashes, AI defaults to <code>.getOrElse(Zero)</code>, <code>Try(...).toOption</code>, and <code>Boolean(val)</code>, silently swallowing fatal semantic errors: <code>Money.create(0.01, "id_2").getOrElse(Money.Zero)</code> zeroed out test amounts; <code>coerceTypedValue('false', bool)</code> silently returned <code>true</code>; ReadSide <code>Optional</code> columns turned corrupt JSON into <code>None</code>.</p>
</div>
<div class="col-item">
<h3>4. Combinatorial Interaction &amp; Gate-FP Blindness</h3>
<p>Single-factor unit tests hide two-factor interaction bugs (<code>Optional[Record] × post:</code>, <code>2D Map × Axioms</code>), matching <a href="https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-142.pdf">NIST SP 800-142</a>; meanwhile, static governance gates (like <code>lineage.mjs</code> missing event-Policy <code>@PROPAGATED</code> or 248 drifted entries in <code>docs/artifacts</code>) stall real users with false positives whenever they lack real-PRD regression suites.</p>
</div>
</div>
</div>

<section class="sec" id="whitebox-vs-blackbox">
<h2>White-Box vs. Black-Box Discovery Matrix: Matching Weapons to Architectural Spaces</h2>
<p>Empirically, <strong>no single verification technique captures more than 40% of real defects</strong>: real-PRD roadshows expose gate false positives and evolution friction; static audits catch explicit architectural violations; Pairwise + metamorphic + real-JVM traces dismantle cross-stage semantic drift; and live Play black-box E2E remains the sole proof of transport and security enforcement.</p>

<figure class="chart-fig">
<div class="fig-title">Six verification methods are strictly complementary across the five defect spaces</div>
<svg viewBox="0 0 700 390" width="100%" role="img" aria-label="Heatmap matrix of discovery effectiveness for 6 white-box and black-box verification techniques across 5 defect spaces">
<text x="245" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Static Lint</text>
<text x="245" y="45" text-anchor="middle" font-size="12" class="svg-mono">White-box</text>

<text x="325" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Unit / Mut</text>
<text x="325" y="45" text-anchor="middle" font-size="12" class="svg-mono">White-box</text>

<text x="405" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Pairwise</text>
<text x="405" y="45" text-anchor="middle" font-size="12" class="svg-mono">Combinat.</text>

<text x="485" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Metamorph</text>
<text x="485" y="45" text-anchor="middle" font-size="12" class="svg-mono">Equiv Diff</text>

<text x="565" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Real JVM</text>
<text x="565" y="45" text-anchor="middle" font-size="12" class="svg-mono">Cross-RT</text>

<text x="645" y="28" text-anchor="middle" font-size="13" font-weight="600" class="svg-label">Play E2E</text>
<text x="645" y="45" text-anchor="middle" font-size="12" class="svg-mono">Live Proc</text>

<line x1="20" y1="58" x2="685" y2="58" class="svg-axis"/>

<text x="195" y="96" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Domain Behavior / SMT</text>
<rect x="210" y="70" width="70" height="42" class="svg-hm-low"/><text x="245" y="96" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="290" y="70" width="70" height="42" class="svg-hm-mid"/><text x="325" y="96" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="370" y="70" width="70" height="42" class="svg-hm-main"/><text x="405" y="96" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="450" y="70" width="70" height="42" class="svg-hm-main"/><text x="485" y="96" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="530" y="70" width="70" height="42" class="svg-hm-main"/><text x="565" y="96" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="610" y="70" width="70" height="42" class="svg-hm-low"/><text x="645" y="96" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>

<text x="195" y="152" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Application / Saga</text>
<rect x="210" y="126" width="70" height="42" class="svg-hm-mid"/><text x="245" y="152" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="290" y="126" width="70" height="42" class="svg-hm-main"/><text x="325" y="152" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="370" y="126" width="70" height="42" class="svg-hm-mid"/><text x="405" y="152" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="450" y="126" width="70" height="42" class="svg-hm-mid"/><text x="485" y="152" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="530" y="126" width="70" height="42" class="svg-hm-mid"/><text x="565" y="152" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="610" y="126" width="70" height="42" class="svg-hm-crit"/><text x="645" y="152" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Critical</text>

<text x="195" y="208" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Infra ReadSide / Proto</text>
<rect x="210" y="182" width="70" height="42" class="svg-hm-main"/><text x="245" y="208" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="290" y="182" width="70" height="42" class="svg-hm-mid"/><text x="325" y="208" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="370" y="182" width="70" height="42" class="svg-hm-mid"/><text x="405" y="208" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="450" y="182" width="70" height="42" class="svg-hm-low"/><text x="485" y="208" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="530" y="182" width="70" height="42" class="svg-hm-mid"/><text x="565" y="208" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="610" y="182" width="70" height="42" class="svg-hm-crit"/><text x="645" y="208" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Critical</text>

<text x="195" y="264" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Infra Play / Authz / CSRF</text>
<rect x="210" y="238" width="70" height="42" class="svg-hm-mid"/><text x="245" y="264" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="290" y="238" width="70" height="42" class="svg-hm-low"/><text x="325" y="264" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="370" y="238" width="70" height="42" class="svg-hm-low"/><text x="405" y="264" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="450" y="238" width="70" height="42" class="svg-hm-low"/><text x="485" y="264" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="530" y="238" width="70" height="42" class="svg-hm-low"/><text x="565" y="264" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="610" y="238" width="70" height="42" class="svg-hm-crit"/><text x="645" y="264" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Sole Proof</text>

<text x="195" y="320" text-anchor="end" font-size="14" font-weight="600" class="svg-label">Gates / Lineage / Cloze</text>
<rect x="210" y="294" width="70" height="42" class="svg-hm-mid"/><text x="245" y="320" text-anchor="middle" font-size="13" class="svg-hm-mid-t">Med</text>
<rect x="290" y="294" width="70" height="42" class="svg-hm-main"/><text x="325" y="320" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="370" y="294" width="70" height="42" class="svg-hm-low"/><text x="405" y="320" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="450" y="294" width="70" height="42" class="svg-hm-low"/><text x="485" y="320" text-anchor="middle" font-size="13" class="svg-hm-low-t">Low</text>
<rect x="530" y="294" width="70" height="42" class="svg-hm-main"/><text x="565" y="320" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Primary</text>
<rect x="610" y="294" width="70" height="42" class="svg-hm-road"/><text x="645" y="320" text-anchor="middle" font-size="13" class="svg-hm-hi-t">Roadshow</text>

<text x="350" y="368" text-anchor="middle" font-size="13" class="svg-sub">Blue = Primary tool · Amber = Irreplaceable live-runtime proof · Teal = Real-PRD roadshow</text>
</svg>
<figcaption>Derived from the actual discovery paths of all 79 verified bugs from Wave-4 through <code>0023</code>.</figcaption>
</figure>

<div class="article-table">
<table>
<thead>
<tr>
<th>Code Space</th>
<th>Representative Failure Modes</th>
<th>White-Box Strategy</th>
<th>Black-Box / Cross-Runtime Strategy</th>
<th>Preventive Engineering Guardrail</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Domain Behavior &amp; SMT Translation</strong> (Generated)</td>
<td>Unregistered collection emptiness &amp; Record equality, <code>Option.copy</code> &amp; 2D Map compile errors, <code>Optional[VO]</code> null-safety, silent <code>Money.Zero</code> fallback</td>
<td>Exhaustive AST unit tests, <code>smt-encoder</code> pre-registration invariants, lint banning <code>.getOrElse(Zero)</code></td>
<td>2-wise Pairwise + metamorphic equivalence + real <code>scalac 2.13</code>/JVM execution + 900-step stateful traces</td>
<td>Enforce a <strong>5-stage contract checklist</strong> (Parser / Bind / SMT / Materialize / Scala) for every new EARS AST node</td>
</tr>
<tr>
<td><strong>Application &amp; Saga Orchestration</strong> (Generated)</td>
<td>Stub Saga claiming <code>saga-core</code>, non-idempotent replay, cross-BC serializer ID collision, multi-BC <code>#46</code> missing typed Payload VO</td>
<td>Reuse certified v1 <code>emitter/families/#40–#43</code> <code>checkInput</code> contracts, multi-BC merge collision tests</td>
<td>Multi-subdomain BC merge compilation, duplicate/terminal event replay tests, Play route load tests</td>
<td>Forbid claiming uninvoked families in <code>familiesUsed</code>; bridge certified v1 <code>saga-core</code> families rather than ad-hoc stubs</td>
</tr>
<tr>
<td><strong>Infra ReadSide / SQL / Proto</strong> (Generated)</td>
<td>Partial event overwrite wiping columns, Optional corrupt decode silently returning <code>None</code>, missing <code>Some(...)</code>, nested Proto3 missing <code>BoxPO</code>, <code>Int</code> pagination overflow</td>
<td><code>npm run test:proto-compat</code> (&lt;1s wire-evolution check), SQL reserved-word &amp; fail-fast regex regressions</td>
<td>Real PostgreSQL container running multi-event projections + corrupt-column injection + historical Proto byte replay</td>
<td>Standardize ReadSide updates on <code>findById</code>-merge-then-<code>upsert</code>; make <code>proto-compat</code> a blocking CI gate</td>
</tr>
<tr>
<td><strong>Infra Play / HTTP / Authz / CSRF</strong> (Generated)</td>
<td>Configured CSRF filter inactive at runtime, dropped principal entitlements, typed GET query coercion mismatch, 401/403 inversion, Ubuntu CI pulling Scala 2.11</td>
<td>Static lint (ban orphan <code>app/</code>, ban fallback <code>userId</code>), explicit CI toolchain pinning (Scala 2.13.14)</td>
<td><strong>Every transport assertion requires live Play server proof</strong> (401 / 403 / missing-CSRF 403 / malformed JSON 400 / cross-tenant denial)</td>
<td>Maintain a <strong>Transport Patch Checklist</strong>: any change to routes, filters, Authz, or Guice requires a matching live HTTP assertion in <code>e2e-play-smoke</code></td>
</tr>
<tr>
<td><strong>Compiler Gates, Lineage &amp; Cloze</strong> (Tooling + <code>handwritten/</code>)</td>
<td>Event-Policy <code>@PROPAGATED</code> lineage false positive blocking builds, missed <code>@host</code> method sync on regeneration, stale starter files after package rename</td>
<td><code>guard-write</code>, <code>overwriteCloze: false</code> + <code>syncMissingScalaMethods</code> regressions, 100% mutation gate</td>
<td>Locked <code>*EarsSpec</code> oracles + real-PRD E2E drills (including package renames, event edits, and multi-aggregate Policies)</td>
<td>Pair every static gate rule with both positive and negative tests (preventing both FNs and FPs), and flag stale files in <code>check-v2 --sync</code></td>
</tr>
</tbody>
</table>
</div>

<blockquote class="pull">
"The strict E2E assertions in 0021 turned 'CSRF is in the config' into 'CSRF actually blocks at runtime'; and Friday's 8950ba3 lineage false positive proved that static gates must guard against false positives just as fiercely as false negatives."
</blockquote>
</section>

<section class="sec" id="industry-literature">
<h2>Industry Practice &amp; Academic Literature: A Reusable Long-Term Playbook</h2>
<p>The verification stack forged across these 79 fixes—<strong>real-PRD roadshows + formal models + Pairwise combinatorial suites + metamorphic equivalence + cross-runtime real-JVM differential traces + live-process black-box E2E</strong>—aligns directly with the strongest compiler and automated-reasoning engineering practices in industry and academia:</p>

<div class="split">
<div><h3>Industry Benchmark: AWS Cedar's Verification-Guided Development</h3></div>
<div>
<p>AWS built the Cedar authorization engine using <strong>Verification-Guided Development</strong> (<a href="https://www.amazon.science/blog/how-we-built-cedar-with-automated-reasoning-and-differential-testing">AWS Science, 2023</a>): proving safety invariants in Dafny while running <strong>Differential Random Testing (DRT)</strong> across hundreds of millions of nightly inputs comparing the Dafny model against the Rust production engine. AWS specifically warns that purely random inputs concentrate in error branches and miss deep logic, necessitating policy-consistent generators—mirroring our Pairwise + Z3 witness-driven JVM differential harness.</p>
</div>
</div>

<div class="split">
<div><h3>Four Classic Pillars of Compiler &amp; Translator Verification</h3></div>
<div>
<ul class="clean">
<li><strong>Differential Testing</strong>: <a href="https://www.semanticscholar.org/paper/Differential-Testing-for-Software-McKeeman/fc881e8d0432ea8e4dd5fda4979243cac5e4b9e3">McKeeman (1998)</a> showed that feeding identical inputs to independent implementations directly exposes silent semantic bugs via output divergence.</li>
<li><strong>UB-Free Program Generation (Csmith)</strong>: <a href="https://www.flux.utah.edu/paper/yang-pldi11/">Yang, Chen, Eide &amp; Regehr (PLDI 2011)</a> uncovered 325+ GCC/LLVM bugs, proving that silent wrong-code defects are far more dangerous than compiler crashes.</li>
<li><strong>Metamorphic Testing &amp; EMI / Semantic Fusion</strong>: <a href="https://people.inf.ethz.ch/suz/publications/emi.pdf">Le, Afshari &amp; Su (PLDI 2014)</a> found 600+ compiler bugs via Equivalence Modulo Inputs; <a href="https://cs.hku.hk/~tse/Papers/2010s/hlmtCSUR.html">Chen et al. (ACM Computing Surveys 2018)</a> systematized metamorphic relations for the oracle problem; <a href="https://testsmt.github.io/papers/winterer-zhang-su-pldi20.pdf">Winterer, Zhang &amp; Su (PLDI 2020)</a> validated SMT solvers via Semantic Fusion (YinYang).</li>
<li><strong>Combinatorial Interaction Testing</strong>: <a href="https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-142.pdf">Kuhn, Kacker &amp; Lei (NIST SP 800-142)</a> established the low-degree interaction rule explaining why 2-wise Pairwise catches the vast majority of multi-factor faults at minimal cost.</li>
</ul>
</div>
</div>

<div class="split">
<div><h3>AI Coding Failure Taxonomy &amp; Living Post-Mortem Discipline</h3></div>
<div>
<p><a href="https://www.computer.org/csdl/proceedings-article/icse/2025/056900a717/251mH51B1AY">Wang et al. (ICSE 2025)</a> demonstrated across 557 LLM code-generation errors that syntactically valid yet semantically misaligned code is the norm. Accordingly, this report serves as a <strong>Living Post-Mortem</strong>: each time a real PRD, PostgreSQL stress test, cross-aggregate Saga bridge (<code>#40</code>–<code>#43</code>), or bilingual EARS run uncovers a new bug, it is logged into its exact "Layer × Role × Zone" cell and converted into a permanent white-box or black-box gate.</p>
</div>
</div>
</section>

<section class="sources-sec" id="references">
<h2>References</h2>
<ol class="refs">
<li>William M. McKeeman (1998). <a href="https://www.semanticscholar.org/paper/Differential-Testing-for-Software-McKeeman/fc881e8d0432ea8e4dd5fda4979243cac5e4b9e3">Differential Testing for Software</a>. <em>Digital Technical Journal</em>, 10(1), 100–107.</li>
<li>D. Richard Kuhn, Raghu N. Kacker, &amp; Yu Lei (2010). <a href="https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-142.pdf">Practical Combinatorial Testing</a>. <em>NIST Special Publication 800-142</em>.</li>
<li>Xuejun Yang, Yang Chen, Eric Eide, &amp; John Regehr (2011). <a href="https://www.flux.utah.edu/paper/yang-pldi11/">Finding and Understanding Bugs in C Compilers</a>. <em>Proc. ACM SIGPLAN PLDI 2011</em>, 283–294.</li>
<li>Vu Le, Mehrdad Afshari, &amp; Zhendong Su (2014). <a href="https://people.inf.ethz.ch/suz/publications/emi.pdf">Compiler Validation via Equivalence Modulo Inputs</a>. <em>Proc. ACM SIGPLAN PLDI 2014</em>.</li>
<li>Tsong Yueh Chen, Fei-Ching Kuo, Huai Liu, Pak-Lok Poon, Dave Towey, T. H. Tse, &amp; Zhi Quan Zhou (2018). <a href="https://cs.hku.hk/~tse/Papers/2010s/hlmtCSUR.html">Metamorphic Testing: A Review of Challenges and Opportunities</a>. <em>ACM Computing Surveys</em>, 51(1), Article 4.</li>
<li>Dominik Winterer, Chengyu Zhang, &amp; Zhendong Su (2020). <a href="https://testsmt.github.io/papers/winterer-zhang-su-pldi20.pdf">Validating SMT Solvers via Semantic Fusion</a>. <em>Proc. ACM SIGPLAN PLDI 2020</em>.</li>
<li>Amazon Science / AWS Automated Reasoning Group (2023). <a href="https://www.amazon.science/blog/how-we-built-cedar-with-automated-reasoning-and-differential-testing">How we built Cedar with automated reasoning and differential testing</a>.</li>
<li>Zhijie Wang et al. (2025). <a href="https://www.computer.org/csdl/proceedings-article/icse/2025/056900a717/251mH51B1AY">Towards Understanding the Characteristics of Code Generation Errors Made by Large Language Models</a>. <em>Proc. IEEE/ACM ICSE 2025</em>.</li>
</ol>
</section>

</div>
