Skip to content

fix(build): primitive-compliance-trace's gapsAfter silently fell back to gapsBefore (#786) - #790

Merged
developer-ainative merged 1 commit into
mainfrom
fix/compliance-trace-gapsafter-786
Sep 16, 2026
Merged

developer-ainative merged 1 commit into
mainfrom
fix/compliance-trace-gapsafter-786

Conversation

@developer-ainative

Copy link
Copy Markdown
Contributor

Summary

Closes #786.

Found live while verifying #774/#785's Stripe primitive didn't regress ZeroCommerce: a real, genuinely fully-compliant generation (confirmed by reading the actual saved code) showed a trace with closed:true alongside gapsAfter listing all 5 primitives as still open — self-contradictory, for the exact endpoint built specifically so live verification doesn't require guessing (#624).

Root cause: closePrimitiveComplianceGap's gapsAfter was only ever assigned inside the retry loop body. The post-loop fallback return computes closed from a fresh final check but never touched gapsAfter, so finish()'s own gapsAfter.length ? gapsAfter : gapsBefore substitution silently used the stale pre-retry gap list.

Fix: always derive gapsAfter from the SAME fresh compliance check closed is computed from, immediately before every finish() call — removed the stale gapsBefore fallback entirely since gapsAfter is now always set fresh beforehand.

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run — full suite: 397 files, 5620 tests passed, 0 failures
  • New test asserts the fix's exact structure (fresh gapsAfter assignment before the fallback finish() call, stale fallback removed)
  • Verified the test is real, not a tautology: temporarily reverted just the route change and confirmed the new test genuinely fails against the old code, then restored the fix

… to gapsBefore (#786)

Found live while verifying #774/#785's Stripe primitive didn't regress
ZeroCommerce: a real, genuinely fully-compliant generation (confirmed by
reading the actual saved code -- it called every one of ZeroCommerce/
ZeroPipeline/ZeroVoice/Content Workflow/ZeroMemory) showed a trace with
closed:true alongside gapsAfter listing all 5 primitives as still open --
self-contradictory, for the exact endpoint built specifically so live
verification doesn't require guessing (#624).

Root cause: closePrimitiveComplianceGap's `gapsAfter` was only ever
assigned INSIDE the retry loop body, on a candidate that passed validation.
The post-loop fallback return computes `closed` from a fresh `final` check
but never touched `gapsAfter`, so finish()'s own `gapsAfter.length ?
gapsAfter : gapsBefore` substitution silently used the stale pre-retry gap
list for display.

Fixed by always deriving gapsAfter from the SAME fresh compliance check
`closed` is computed from, immediately before every finish() call --
removed the stale gapsBefore fallback entirely since gapsAfter is now
always set fresh beforehand.

Verified the fix is real (not a tautology): temporarily reverted just the
route change and confirmed the new test genuinely fails against the old
code, then restored the fix.
@developer-ainative
developer-ainative merged commit ca88e07 into main Sep 16, 2026
1 check passed
@developer-ainative
developer-ainative deleted the fix/compliance-trace-gapsafter-786 branch September 16, 2026 18:23
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.

[BUG] primitive-compliance-trace's gapsAfter silently falls back to gapsBefore, making a genuinely-fixed generation look unresolved

1 participant