Skip to content

feat(b7-6-harness): promote ai-native-rag to stable/scaffoldable (B.7.6 — final B.7 brick)#33

Merged
Bogala merged 10 commits into
mainfrom
b7-6-harness
Jun 24, 2026
Merged

feat(b7-6-harness): promote ai-native-rag to stable/scaffoldable (B.7.6 — final B.7 brick)#33
Bogala merged 10 commits into
mainfrom
b7-6-harness

Conversation

@Bogala

@Bogala Bogala commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

B.7.6 — ai-native-rag promotion gate (b7-6-harness) — the FINAL B.7 brick

Promotes the ai-native-rag archetype candidatestable / scaffoldable:false → true. After this, forge init --archetype ai-native-rag renders the tree (it previously refused with exit 3). This is brick #9/9 — it completes the B.7 chain (8/9 already in main).

What's in it

  • .forge/scripts/tests/b7-6.test.sh — the ≥35-test promotion suite (35 at L1,2): Tier A aggregates all 8 sibling B.7 harnesses (b7-1/2/2a/3/5/9/10/pythia) as a superset gate; Tier B is L1 end-to-end structural (layer roots, unary+streaming proto, codegen manifest, Connect-handler seam, scaffold-plan coverage, standards conformance); Tier C is the L2 live-codegen legs; Tier D is the pre-flip held-guard + post-flip assertions.
  • harness-rust CI job (new, in forge-ci.yml) — bufbuild/buf-action@v1 (setup, v1.70.0) + dtolnay/rust-toolchain@stable + node, runs b7-6.test.sh --level 1,2: the live buf generate → Rust+TS codegen → cargo build/test → Qwik tsc path. This is the gate that proves the archetype builds end-to-end. Includes the 6→7 job-count cascade (g1/c1/forge-ci.md/forge-self-ci.md + the summary job's needs:) and the line-budget re-bump 340→380 in lock-step across all 4 budget harnesses + 2 docs.
  • Live-codegen wiring — the deferred forge-init-ai-native-rag.sh TODOs (buf generate, cargo fetch) realised (Option A — see below).
  • Deterministic snapshot .forge/scaffold-snapshots/ai-native-rag/1.0.0.tar.gz (913 KB, SOURCE_DATE_EPOCH, byte-stable) for forge upgrade BASE recovery.
  • THE FLIP (final commit) — .forge/schemas/ai-native-rag/1.0.0.yaml stage→stable, scaffoldable→true, with the sibling candidate-guards inverted in lock-step (b7-1 T-005/006/L2, b7-2 T-006, b7-2a T-003/L2, b7-7 test_rag_archetype_still_candidate) + npm run bundle regen (gitignored).

Key scope decision — Connect handler = flagship parity (Option A)

The plan's "register the RagService Connect handler compiled against generated stubs" turned out not to be a template-level edit: ai-native-rag has no grpc-api crate (Connect is consumed "by reference" per b7-2), main.rs's Connect line is a documented adopter seam, and the flagship 2.0.0 itself ships an unwired Connect seed (ConnectRouter::new() + TODO(adopter) + intentional 404). So the promotion bar is flagship parity, not a compiled Connect handler — adding a grpc-api crate would exceed a promotion gate's scope and hold this archetype above the flagship. The harness-rust job still proves a real end-to-end build: buf generate + cargo build of the existing 4-crate workspace + Qwik tsc consuming the buf-generated TS descriptor.

Verification

Faithful full-CI repro (npm bundle + the exact 64-entry harness array + verify.sh + constitution-linter.sh + validate-foundations.sh): all green — every flip-affected sibling (b7-1/2/2a/6/7), t5-1, and the 3 gates pass; forge init --archetype ai-native-rag live-renders 55 templates (was exit 3); validate-foundations passes with stage=stable. Guardrails clean: constitution / all standards (except forge-self-ci.md) / archetype.schema.json / frozen full-stack 1.0.0+2.0.0 trees + snapshot byte-unchanged.

The live buf build runs for the first time in the harness-rust CI job (buf+BSR are absent from the dev sandbox, so its L2 legs SKIP locally — recorded honestly in .forge/research/b7-6-live-codegen.md, not faked). This CI job gates the merge, so the flip cannot reach main on a red live build. It may take a couple of iterations to verify the first-ever live codegen+build.

Known, out-of-scope (tracked follow-ups — NOT regressions)

  • cli-trust e2e integration — NOW INCLUDED (commit d21dda1): the cli Vitest archetypes-smoke.test.ts hard-asserts the (pre-flip) exit-3 refusal, so the schema flip forced flipping the dispatch status→stable + adding cli/test/e2e/archetype-fixtures/ai-native-rag.yml (FR-T51-055). ai-native-rag now joins the cli-trust scaffold matrix (toolchain-gated on buf+cargo).
  • b8-1/b8-12/.../b8-15 local sweep flake: a pre-existing shared-tree snapshot-rebuild race (b8-obi/b8-signoz rebuild docker-compose.dev.yml mid-sweep). b7-6 touches none of them; they pass in isolation and on main's CI. Worth a separate ticket.

Spec consolidates into .forge/specs/ai-native-rag.md at archive (post-merge). Change is status: implemented (archived after merge).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz

Bogala and others added 10 commits June 23, 2026 15:40
… codegen wiring + candidate→stable flip

Plans the final B.7 brick: the ai-native-rag promotion gate. proposal/specs/
design/tasks/open-questions for a ≥35-test suite (aggregates the 8 sibling b7-*
harnesses + net-new e2e), live buf generate/cargo/Qwik wiring of the b7-2
deferred TODOs, and the suite-gated candidate→stable/scaffoldable:true schema
flip + npm run bundle regen (mirrors the B.8.14 promotion ordering, single change
— no constitution amendment forces a prep/flip split).

Genuine decisions recorded in open-questions.md for resolution at implementation
time (gated on #31+#32 merged + a buf/BSR environment, which is absent in CI and
this sandbox): Q-B (live build justified by a CI buf+cargo job vs a recorded
local run), Q-D (snapshot tarball now vs deferred). Q-A (single change), Q-C
(~37-test aggregate), Q-E (npm run bundle) baked per recommendation.

status: planned. No code/schema/template edited — plan docs only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…ness-rust CI job

Maintainer decisions (2026-06-23) applied to the b7-6 promotion-gate plan:
- Q-A: single change (no Article XII window forces a prep/flip split).
- Q-B: OPTION B — add a permanent `harness-rust` CI job (buf + Rust toolchain +
  node) running `b7-6.test.sh --level 1,2`; the candidate→stable flip is justified
  by THAT job green in CI, not a one-time local run. ADR-B7-6-005 rewritten in
  specs.md + design.md from the superseded option-a (skip-in-CI).
- Q-C: aggregate the 8 sibling harnesses + net-new e2e (≥35).
- Q-D: ship the deterministic SOURCE_DATE_EPOCH .tgz snapshot (FR-B7-6-010 IN).
- Q-E: npm run bundle (gitignored, CI-fresh).

Re-grounded the forge-ci cascades against the LIVE base (325 lines / 340 budget /
6 jobs, post b7-7+b7-10 merge — the plan's "all read 300" reconciliation note was
stale):
- size budget asserted in FOUR harnesses (g1, c1, t5-1, t5-otel-live-run) + TWO
  docs → bump 340→380 in lock-step (FR-B7-6-030).
- NEW job-count cascade (6→7): the harness-rust job adds harness-rust to the
  workflow_shape/needs/aggregator assertions in g1+c1, forge-ci.md FR-CI-001,
  forge-self-ci.md, and the summary needs/aggregator (FR-B7-6-030b/031, ADR-B7-6-007).

Plan-only; no harness/schema/workflow edits yet (those are the implementation phases).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
.forge/scripts/tests/b7-6.test.sh — the promotion gate (ADR-B7-1-002), 35 run_test
across four tiers, mirroring b7-2/b7-10 structure (--level parse, _helpers.sh,
run_test/print_summary):

- Tier A (8) — aggregation: re-runs each sibling B.7 harness (b7-1/2/2a/3/5/9/10/
  pythia) at its forge-ci CI level and asserts exit 0; absent sibling = clean SKIP
  (superset gate, FR-B7-6-003). Idiom mirrors b8-6/b8-14 sibling-coupling guards.
- Tier B (20) — net-new L1 e2e structural (hermetic, CI-safe): the assembled-
  archetype coherence no single sibling proves — proto unary+streaming coexistence
  + SourceChunk reuse, codegen-manifest Rust+TS targets ↔ Qwik rag_pb import,
  scaffold-plan↔tree no-orphan/no-dangling, the Connect /connect + rag.v1.RagService
  DOCUMENTED ADOPTER SEAM (flagship parity per Option-A, NOT a compiled handler),
  rag/mcp/llm-gateway conformance, XI.5/IX.6/XI.6 markers, pin discipline, streaming
  gateway + Qwik streaming UI, gated wrapper + dispatch entry (FR-B7-6-002/005).
- Tier C (5) — L2 live-codegen (toolchain-gated, SKIP-when-absent): overlay render
  + byte-stable re-render; buf generate → Rust+TS stubs; cargo build/test of the
  rendered 4-crate workspace; Qwik tsc; snapshot determinism. buf/tsc legs SKIP
  locally and RUN in the forge-ci harness-rust job (Q-B option b). Snapshot leg is
  a stub pending the snapshot-wiring commit (FR-B7-6-010).
- Tier D (2) — promotion held-guard: pre-flip the schema is candidate + the CLI
  refuses; the flip (final commit) inverts both (NFR-B7-6-001, b8-14-prep pattern).

Local result (cargo + node present, buf + tsc absent): 35/0, with the buf/tsc/
snapshot L2 legs SKIPping as designed; T-C03 cargo test --workspace ran live and
the rendered backbone compiled. NOT yet registered in forge-ci.yml (a RED/partial
suite must not gate main) — registration + the harness-rust job land with the flip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…go fetch (Option A)

forge-init-ai-native-rag.sh — implement the post-render TODOs (FR-B7-6-005) as
BEST-EFFORT codegen steps: `buf generate` (gated on buf present + BSR reachable) +
`cargo fetch` (gated on cargo present), each SKIPping with an adopter note rather
than failing the scaffold (the wrapper's exit-0 success contract is the RENDER).
The Connect handler stays a DOCUMENTED ADOPTER SEAM in main.rs — flagship parity
(the full-stack transport_connect adapter ships an unwired ConnectRouter::new()
seed); NO grpc-api crate is added (maintainer Option-A decision 2026-06-23; b7-2's
"Connect by reference" ADR-B7-2-007 preserved).

.forge/research/b7-6-live-codegen.md — honest verification record (NFR-B7-6-006):
the promotion bar is flagship parity (unwired Connect seed, grounded in the read
files), the real provable live path is buf generate → 4-crate cargo build → Qwik
tsc-resolves-rag_pb; cargo backbone build VERIFIED LOCALLY (T-C03 ran live, pins
resolve, no verify-then-pin fix needed); buf + tsc legs run in the harness-rust CI
job (buf absent locally — NOT faked).

b7-2 L2 (wrapper render path) re-run: 10/0 green (the new post-render steps exit 0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…t (FR-B7-6-010)

.forge/scaffold-snapshots/ai-native-rag/1.0.0.tar.gz (913 KB, ≤ 2 MB budget) — the
per-archetype snapshot for `forge upgrade` BASE recovery, mirroring the committed
mobile-only/full-stack convention (Q-D = ship the .tgz). Built via
bin/forge-snapshot.sh with SOURCE_DATE_EPOCH=0; byte-identical rebuild verified
(determinism via sorted entries + uid/gid0 + ustar + gzip mtime0 — the b8-obi
determinism machinery), recorded in .forge/research/b7-6-live-codegen.md. No .sha256
immutability guard (that is B.8.2's frozen-legacy-target treatment, not a fresh
scaffoldable archetype — mobile-only ships none either).

b7-6.test.sh — T-C05 (stub) replaced by T-D03 (always-run): the committed snapshot
exists + ≤ 2 MB (b4 _test_b4_019 budget) + valid gzip/tar + extractable round-trip
(b8-2 FR-B8-2-012 pattern). Suite stays 35 run_test; L1=31/0, L1,2=35/0 (buf/tsc
L2 legs SKIP locally).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…b7-6 + 6→7/340→380 cascades

forge-ci.yml — register `b7-6.test.sh --level 1` in the harness array (L1 +
aggregation + held guards, buf-less) AND add a new `harness-rust` job (Q-B option b,
ADR-B7-6-005): installs buf (bufbuild/buf-action@v1, setup_only, version pinned
1.70.0 per Context7 /websites/buf_build) + a Rust toolchain (dtolnay/rust-toolchain
@stable, the flagship-template convention) + node, then runs `b7-6.test.sh
--level 1,2` so the LIVE legs (buf generate → Rust+TS codegen → cargo build/test →
Qwik tsc) gate every PR. summary.needs + the aggregator + the notice gain
harness-rust as a required core job. Workflow 325 → 364 lines, 6 → 7 jobs.

Lock-step cascades (the b7-7 footgun — one assertion bumped, a sibling missed):
- size budget 340 → 380 in g1, c1, t5-1, t5-otel-live-run + forge-ci.md
  (FR-CI-013 / NFR-CI-002) + forge-self-ci.md.
- job count 6 → 7: g1 (workflow_shape expected_jobs + summary.needs expected + the
  needs.<j>.result loop), c1 (test_forge_ci_workflow_shape_six_jobs →
  _seven_jobs incl. MANIFEST + run_test rename; summary_aggregates_five_needs body),
  forge-ci.md (FR-CI-001 testable note + scope + changelog row), forge-self-ci.md
  (the "five jobs" → seven-job table refresh incl. example + harness-rust + the
  "six above" summary row).

Re-run green: g1 14/0, c1 30/0 (incl. manifest self-consistency), t5-1 17/0,
t5-otel-live-run 8/0. forge-ci.yml parses; all uses: pinned (g1 no-unpinned-uses ✓).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…ble:true (THE FLIP)

The suite-gated promotion (FR-B7-6-020, ADR-B7-6-006) — the LAST commit, performed
only after the ≥35-test b7-6 suite + the harness-rust CI gate were authored green.

Schema (.forge/schemas/ai-native-rag/1.0.0.yaml): stage candidate→stable,
scaffoldable false→true, header reworded to the promoted semantics. validate-
foundations stays PASS (the candidate⇒scaffoldable:false clause no longer applies;
1.0.0 no-prerelease clears the stable version floor). selectScaffoldableVersion now
returns 1.0.0.

Lockstep sibling inversions (the b8-14-flip break-cascade, SAME commit):
- b7-1 T-005 candidate→stable ; T-006 scaffoldable False→True ; L2 exit-3-refusal →
  no-longer-exit-3 (post-promotion render).
- b7-2 T-006 → positively requires the promoted state (schema stable/scaffoldable +
  the wrapper no longer exits 3 on the candidate gate).
- b7-2a T-003 (wrapper refuses, NO candidate guard → would hard-fail post-flip) →
  inverted to assert the candidate refusal is gone ; L2 exit-3 → no-longer-exit-3.
- b7-6 Tier-D held-guard T-D01/T-D02 → post-flip positive (stable/scaffoldable:true +
  the wrapper no longer refuses), fails loud on a revert (b8-15 pattern).

Bundle: `npm run bundle` regenerated the gitignored cli/assets with the flipped
schema (nothing to commit). VERIFIED LIVE: `forge init --archetype ai-native-rag`
now exits 0 and renders the full tree (55 templates, backend/frontend/infra/shared)
— it no longer refuses. The wrapper's Option-A cargo-fetch post-step ran ("✓
workspace dependencies pre-fetched").

NOT flipped (held for maintainer confirm): the dispatch-table `status: candidate`
field + b7-2a T-001 (ADR-B7-2A-005). It is descriptive-only (NOT consumed for
scaffoldability — that is schema-driven), so leaving it does not break any test; the
dispatch comment is the only stale bit, a low-risk doc follow-up.

.forge.yaml → status: implemented, timeline.implemented: 2026-06-23 (NOT archived —
the orchestrator archives after verify + push + PR).

Post-flip local: b7-1 19/0, b7-2 7/0, b7-2a 4/0, b7-6 31/0, validate-foundations PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…promotion

The B.7.6 flip (24236ac) promoted ai-native-rag candidate→stable/scaffoldable:true.
b7-7-example (already merged) carried TWO assertions that the framework schema
"stays candidate / scaffoldable:false" (FR-RAGEX-009) — written before this flip and
NOT in the plan's FR-B7-6-021 inversion list (the plan assumed b7-7 soft-follows; it
actually landed first). Both are the same lockstep break-cascade as b7-1/b7-2/b7-2a
(b8-14-flip pattern), so they invert in lockstep:
- test_rag_archetype_still_candidate (≈L265): stage candidate→stable, scaffoldable
  False→True. FR-RAGEX-009's intent (the example does not BY ITSELF promote the
  framework) is preserved — b7-6 is the flip's author; the assertion now records the
  promoted state.
- the exit-3-refusal premise check (≈L625): inverted to assert stable/scaffoldable:true
  (the CLI now scaffolds, no longer refuses).
The example TREE (examples/forge-rag-example/**) is unchanged; only b7-7's
framework-schema-state assertions flip. b7-7 now 22/0 (GREEN x3 in isolation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
The B.7.6 schema flip (candidate→stable/scaffoldable:true) made the dispatch
entry's "Registered candidate; not yet scaffoldable" comment+description stale.
Refreshed to state the schema is promoted and `forge init` scaffolds it.

The dispatch `status:` field is LEFT `candidate` deliberately: it is the cli-trust
e2e scaffold-matrix marker (archetypes-smoke.test.ts + t5-1.test.sh T-016 gate on
`status != candidate`), NOT the schema stage. Flipping it pulls ai-native-rag into
the cli-trust scaffold matrix, which requires a new
cli/test/e2e/archetype-fixtures/ai-native-rag.yml (FR-T51-055) — tracked as a
follow-up, out of this promotion gate's scope. Scaffoldability is schema-driven;
the schema (source of truth) is promoted. Comment/description content is not
asserted by any harness; status value unchanged (no cli-trust cascade).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
…p dispatch status + add e2e fixture)

The cli Vitest job (npm test) — which my shell-only repro had missed — failed:
cli/test/e2e/archetypes-smoke.test.ts hard-asserts `forge init --archetype
ai-native-rag` REFUSES exit 3, a candidate-precondition the B.7.6 schema flip
inverts (forge init now renders). That e2e is data-driven off the dispatch
`status` field: `scaffoldable = status != candidate` (needs an e2e fixture);
`candidates = status == candidate` (asserts exit-3 refusal). So a scaffoldable
schema with `status: candidate` is internally inconsistent — the refusal test
breaks. There is no green state that keeps `status: candidate`.

Completing the mandatory cascade (supersedes the deferral noted in 3883ac4):
- dispatch-table.yml: status candidate→stable (+ refreshed comment) — ai-native-rag
  joins the cli-trust scaffold matrix.
- b7-2a.test.sh T-001: assert status stable (supersedes ADR-B7-2A-005 candidate).
- NEW cli/test/e2e/archetype-fixtures/ai-native-rag.yml (FR-T51-055): has_rust_backend
  ⇒ the actual scaffold is toolchain-gated (skipped where buf/cargo absent, incl. CI's
  cli job), but the fixture MUST exist for the dispatch-table cross-reference.

Verified: `cd cli && npm test` 86 passed / 2 skipped (archetypes-smoke ai-native-rag
now scaffoldable + toolchain-skipped, fixture xref passes, refusal test gone);
faithful shell-harness repro + gates green (only the pre-existing b8-1 snapshot-race
flake family flickers, untouched by this branch).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPnqp5voa9PfC5JJ6HCKQz
@Bogala Bogala merged commit 481388b into main Jun 24, 2026
7 checks passed
@Bogala Bogala deleted the b7-6-harness branch June 24, 2026 03:44
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.

1 participant