Skip to content

R3 gate #27: omni SQL DDL alternative demo - #2597

Merged
briansrls merged 3 commits into
mainfrom
session/cool-fox-847
May 10, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/cool-fox-847

Conversation

@briansrls

@briansrls briansrls commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the R3 gate #27 SQL DDL Shape B alternative over the existing omni service workflow projection. The new DDL projection consumes the same compiled DAG route set as the runnable backend, and the gate test checks that the schema lists exactly the backend exposure set.

Also updates the R3 program ledger to mark omni_sql_ddl_alternative_demo as consumer landed + passing and extends the shared-node-tree note to include SQL DDL.

Review follow-up

Fixed the empty-route DDL path so it emits a valid empty schema comment without a dangling INSERT INTO ... VALUES statement. Added sql_ddl_projection_emits_valid_empty_schema_without_insert_values as a regression test.

Test plan

@briansrls briansrls changed the title R3 gate #27: omni sql ddl alternative demo R3 gate #27: omni SQL DDL alternative demo May 10, 2026
@briansrls
briansrls marked this pull request as ready for review May 10, 2026 15:27
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-thinking
  • Commit: df95f2ab · Trigger: manual
  • Comparison: main @ dbccd6d5 ... session/cool-fox-847 @ df95f2ab
  • Conversation: View conversation

1. Story of the diff

This PR closes R3 gate #27 by adding SQL DDL as another Shape B projection over the existing omni service route extraction path. The load-bearing move is that project_sql_ddl_schema starts from extract_rest_routes(dag)? at src/v3/compiler/src/omni_shape_b_openapi.rs:261, so SQL DDL does not introduce a second route authority; it serializes the same RestRoute facts already used by OpenAPI, Markdown, and the runnable backend. The output is intentionally narrow: one omni_service_routes table keyed by (method, path_template), with method-domain constraints when routes exist and a valid no-route schema branch when none do.

The tests then assert the demo contract from both sides: omni_layers_share_one_node_tree now includes SQL in the same single-compile structural-fold receipt at src/v3/compiler/tests/integration/m1_5_omni_shape_b_openapi_test.rs:494, while the new SQL demo test compares the DDL rows to canonical extracted routes and probes the generated backend for the same routes at src/v3/compiler/tests/integration/m1_5_omni_shape_b_openapi_test.rs:582–621. The empty projection regression is also covered at src/v3/compiler/tests/integration/m1_5_omni_shape_b_openapi_test.rs:625–638, matching the df95f2a commit intent.

2. Invariant categories

  1. LAYER MODEL — N/A. The diff does not introduce or mutate substrate types, Dag storage, pass-crossing carrier shapes, or dag.rs concepts; it adds a fixture-scoped implementation projection and tests. The projection explicitly consumes existing DAG-derived route facts through extract_rest_routes(dag)? at src/v3/compiler/src/omni_shape_b_openapi.rs:261.
  2. INVARIANTS.md + modeling-discipline.md — Compliant. Single-authority / facts-flow-forward is preserved: SQL reads the canonical route projection once at src/v3/compiler/src/omni_shape_b_openapi.rs:261, and the PM-visible receipt says the SQL DDL “consumes the same workflow DAG as the runnable backend” at docs/r3-program-plan.md:253. Fail-closed behavior is also preserved at the projection boundary via ? rather than fallback fabrication at src/v3/compiler/src/omni_shape_b_openapi.rs:261; the empty-route case is explicit output, not a malformed partial insert, at src/v3/compiler/src/omni_shape_b_openapi.rs:288–290.
  3. CODING.md — Compliant. The new production API follows the project’s data + free-function style: pub fn project_sql_ddl_schema(dag: &Dag) -> Result<String, ProjectOpenApiError> at src/v3/compiler/src/omni_shape_b_openapi.rs:260 has explicit inputs, structured error shape, no hidden state, and delegates quoting to a small helper at src/v3/compiler/src/omni_shape_b_openapi.rs:643–645.
  4. TESTING.md — Compliant. The diff adds behavior-level tests at the right layer for this demo: the SQL/backend drift-lock test extracts canonical routes, projects backend + SQL from the same DAG, compares the SQL route set to the canonical route set, and probes the runnable backend at src/v3/compiler/tests/integration/m1_5_omni_shape_b_openapi_test.rs:582–621. The empty-route regression is focused and directly covers the dangling-INSERT failure mode at src/v3/compiler/tests/integration/m1_5_omni_shape_b_openapi_test.rs:625–638. This is integration-heavy, but the subject is an omni projection demo spanning compile, projection, and backend execution, so compile-to-DAG is the unit here.
  5. LOCKED DESIGN DECISIONS — Compliant. Shape B SQL schemas are supposed to be artifact projections, not compiler language targets; the thesis distinguishes Shape A compiler targets from Shape B user-program artifacts, including SQL schemas, and says Shape B should derive from the same node tree rather than becoming another compiler target. chatgpt-review-8e2edc3d-7f61-47…

The diff preserves that boundary by emitting the comment “Shape B SQL DDL projection; not a compiler target” at src/v3/compiler/src/omni_shape_b_openapi.rs:269, and by updating the R3 gate to say the SQL projection consumes the same workflow DAG as the backend at docs/r3-program-plan.md:253.

  1. TRACKED vs UNTRACKED DEBT — Compliant. This remains inside the pre-existing fixture-scoped R3 bridge rather than a new unbounded scaffold: the added function is inserted into the module’s P5 bridge-bound list at src/v3/compiler/src/omni_shape_b_openapi.rs:10. The implementation itself reinforces the bound by saying SQL DDL is “not a compiler target” at src/v3/compiler/src/omni_shape_b_openapi.rs:269. That satisfies the tracked-bridge posture: documented scaffold, bounded to the fixture receipt, with the module’s existing dissolution trigger still applying; scaffolds need named dissolution triggers under P5. chatgpt-review-6a1f84ab-b8dd-43…

2.5. Top-down PM intent review

Compliant. The highest-level omni intent is “one workflow declaration projects onto every layer” and “coherence between layers is structural,” with SQL schemas listed as Shape B artifacts rather than compiler targets. chatgpt-review-8e2edc3d-7f61-47…

The diff’s PM-facing claim matches that: gate #27 now says the SQL projection “consumes the same workflow DAG as the runnable backend” at docs/r3-program-plan.md:253, and gate #28 extends the shared-node-tree receipt to “OpenAPI YAML + Markdown + SQL DDL projections” at docs/r3-program-plan.md:254. I do not see semantic dilution into a permanent compiler emitter path because the code labels the DDL as Shape B and “not a compiler target” at src/v3/compiler/src/omni_shape_b_openapi.rs:269.

3. Verdict

APPROVE. The PR adds a narrow SQL DDL Shape B demo over the existing route authority, updates the R3 receipt, and tests both the normal route set and the empty projection regression. I found no diff-cited invariant violation.

@briansrls
briansrls merged commit ef56e2b into main May 10, 2026
4 checks passed
@briansrls
briansrls deleted the session/cool-fox-847 branch May 10, 2026 15:51
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