Skip to content

test(compliance): witness the five user-visible semantics with edge-case rows#1

Open
sfc-gh-wpugh wants to merge 1 commit into
proposal-semantics-foundationfrom
test/semantic-invariant-coverage
Open

test(compliance): witness the five user-visible semantics with edge-case rows#1
sfc-gh-wpugh wants to merge 1 commit into
proposal-semantics-foundationfrom
test/semantic-invariant-coverage

Conversation

@sfc-gh-wpugh

Copy link
Copy Markdown
Owner

Stacked on apache#125 (Proposal semantics foundation) — base is proposal-semantics-foundation, so this diff is only the audit delta.

Why

Reviewer doubt on Semantic 1 — "no fact row is silently dropped" was well-founded at the suite level:

  • the only orphan test (t-061) is status: planned (dormant);
  • t-048-null-foreign-key contains no NULL FK (its gold admits it runs "the same shape as T-001");
  • f_chain / f_composite have no orphan rows, so the multi-hop/composite tests pass identically whether the planner emits LEFT or INNER;
  • 52 of 60 tests are status: planned and the default runner omits --include-planned, so the default gate ran only 8 tests — none witnessing Semantic 1.

The guarantee was effectively unasserted.

What this adds

  • 3 fixtures carrying the actual dropped-row cases: f_s1_star (value-orphan and literal NULL FK + a 1:1 table), f_s1_chain (broken FK at every hop), f_s1_composite (partial + full composite-key miss).
  • 27 active witness tests across tests/semantic{1..5}_* (default gate 8 → 27, 100% pass) that fail if a regression reintroduces an orphan-dropping join.
  • 2 status: planned gap tests with spec-correct gold for the Semantic 2 deferrals found (D-003 home-grain pre-aggregation; reverse cross-grain).
  • SEMANTIC_AUDIT.md — full findings + file:line references.

Findings (no implementation changes here)

  • Semantic 1 holdsLEFT is structurally enforced (joins.py:489-491 + RI deferred at graph.py:157-158 / deferred.py:114-117); no Foundation path can pick an orphan-dropping INNER.
  • Semantic 2 partial: M:N bridge dedup works; home-grain pre-aggregation (D-003) is deferred and currently rejected with a mislabeled E_UNSAFE_REAGGREGATION (planner.py:219-242) — a distributive COUNT/SUM survives decomposition, so that code is misleading.
  • Semantics 3/4/5 hold (FULL OUTER stitch; typed errors).

Tests generated by scripts/gen_semantic_tests.py + scripts/copy_negative_witnesses.sh.

🤖 Generated with Claude Code

…ase rows

Reviewer doubt on Semantic 1 ("no fact row is silently dropped") was
well-founded at the suite level: the only orphan test (t-061) was
status:planned, t-048 "null-foreign-key" contains no NULL FK, and the
multi-hop/composite fixtures have no orphans — so those tests pass
identically whether the planner emits LEFT or INNER, and the default
gate ran only 8 of 60 tests. The guarantee was effectively unasserted.

Add fixtures that actually carry the dropped-row cases (value-orphan,
literal NULL FK, broken multi-hop chain, composite partial-key miss,
1:1 orphan) and 27 active witness tests across all five semantics, so a
regression that reintroduced an orphan-dropping join would now fail.

The engine itself adheres to Semantic 1 (LEFT is structurally enforced;
INNER-promotion is gated behind deferred referential integrity). Two
Semantic 2 gaps (D-003 home-grain pre-aggregation; reverse cross-grain)
ship as status:planned tests with spec-correct gold. Full write-up in
compliance/foundation-v0.1/SEMANTIC_AUDIT.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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