Skip to content

feat(tuning): record physical sort rewrites as attested evidence - #2924

Merged
joeharris76 merged 1 commit into
developfrom
feat/tuning-sort-evidence-attested
Oct 16, 2026
Merged

joeharris76 merged 1 commit into
developfrom
feat/tuning-sort-evidence-attested

Conversation

@joeharris76

@joeharris76 joeharris76 commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A successful physical sort rewrite
(CTAS or constraint-preserving in-place sort) is recorded as an executed
post_load ledger statement with mechanism="sorted_ingestion", and
corroboration reports it as the non-blocking attested verdict with reason
physical sort executed; no catalog footprint. The explorer drill-down
labels attested entries Recorded; not catalog-checkable.

Soundness review

This change touches trust paths (ledger vocabulary, corroboration verdicts,
receipt payloads). Requesting soundness review of the current head before
merge. It merges once the oracle approves the current head.

Soundness questions for the reviewer:

  • attested is deliberately outside _VERIFIABLE_VERDICTS: it never
    satisfies a catalog-verifiable intent, never counts toward gate totals,
    and attested-only receipts never promote a run to verified. Confirm this
    matches the intent that attested evidence never verifies a run.
  • The success record upgrades a verb-recorded twin in place instead of
    appending a duplicate (DataFusion path). Confirm single-evidence
    accounting is the right call.
  • MotherDuck wiring is unchanged per the item's condition: attested-only
    runs stay applied_unverified, and no DuckDB introspector is attached
    to MotherDuck.
  • corroborate() gains no parameters (stays configuration-free).

Verification

  • New test_sort_evidence_attested.py (12 tests, incl. a real DuckDB
    in-memory execution recording test and promotion tests through
    corroborate_applied_ledger).
  • Explorer vitest for the attested drill-down label (40/40 in file).
  • uv run -- python -m pytest -m fast -q: 37,962 passed, 26 skipped.
  • uv run -- ruff check ., ruff format --check ., ty check: clean.
  • make comment-policy-check, make agent-write-preflight: pass.

@joeharris76

Copy link
Copy Markdown
Collaborator Author

/oracle-review

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: failure for 42f8cb053c074e71c19b5b57cd93d3fb6d2ff3f4

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP WITH FIXES.

Reviewer: muse (muse muse-spark-1.3-contributor, effort medium).

The attested-verdict gate logic is sound, but the FK-safe DuckDB/MotherDuck path records the sort twice and leaves a gate-blocking UNVERIFIABLE entry, and the ORDER BY fallback parser publishes trailing DELETE/INSERT/DROP text as expected columns. Fix ledger deduplication/marking for multi-statement rewrites and terminate column parsing at the statement boundary.

Reviewers not available

  • luna: absent (error)

Comment thread benchbox/platforms/base/sorted_ingestion.py Outdated
Comment thread benchbox/core/tuning/introspection.py Outdated
@joeharris76

Copy link
Copy Markdown
Collaborator Author

/oracle-review

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 77805f9aa72093ae2611295b003b0f54e91afe3d

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP.

Reviewer: muse (muse muse-spark-1.3-contributor, effort medium).

Both earlier defects are fixed: FK-safe sorts upgrade in place without double-recording and ATTESTED never gates verification; the sort-column parser is scoped per script segment. No new merge-blocking defects found in the changed files.

Verified fixed: D1, D2. Resolve their review threads.

Scope: files changed since head 42f8cb053c074e71c19b5b57cd93d3fb6d2ff3f4 was reviewed.

@joeharris76

Copy link
Copy Markdown
Collaborator Author

/oracle-review

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 9212b94e9dff929797cf24514cc0e9109da29b11

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP.

Reviewer: muse (muse muse-spark-1.3-contributor, effort medium).

The new test only renders a fabricated attested receipt and asserts the 'Recorded; not catalog-checkable' label and reason. It matches RunReceipt.tsx and introspection.py strings, asserts no promotion by using corroborated:false, and does not weaken gates or publish numbers.

Scope: files changed since head 77805f9aa72093ae2611295b003b0f54e91afe3d was reviewed.

@joeharris76
joeharris76 force-pushed the feat/tuning-sort-evidence-attested branch from 9212b94 to 5bcb5c0 Compare October 14, 2026 18:44

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 5bcb5c0eecd02ab59cf0e6c096efda162accc985

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP, carried from head 9212b94e9dff929797cf24514cc0e9109da29b11.

The patch is unchanged since head 9212b94e9dff929797cf24514cc0e9109da29b11 was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

@joeharris76
joeharris76 enabled auto-merge (squash) October 14, 2026 23:26
@joeharris76
joeharris76 force-pushed the feat/tuning-sort-evidence-attested branch from 5bcb5c0 to 1d2a761 Compare October 15, 2026 00:07
@joeharris76

Copy link
Copy Markdown
Collaborator Author

Stand-in oracle review: APPROVE 1d2a761

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 1d2a76138f92ab773c3fc97da16d5d4bb06af278

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP, carried from head 5bcb5c0eecd02ab59cf0e6c096efda162accc985.

The patch is unchanged since head 5bcb5c0eecd02ab59cf0e6c096efda162accc985 was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 638fa6ced1c5bc5066171e887117b91eb0496024

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP, carried from head 1d2a76138f92ab773c3fc97da16d5d4bb06af278.

The patch is unchanged since head 1d2a76138f92ab773c3fc97da16d5d4bb06af278 was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

@joeharris76
joeharris76 force-pushed the feat/tuning-sort-evidence-attested branch from 638fa6c to 096274a Compare October 16, 2026 04:23

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 096274a64eaf27342a47463669826b178d48e991

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP, carried from head 638fa6ced1c5bc5066171e887117b91eb0496024.

The patch is unchanged since head 638fa6ced1c5bc5066171e887117b91eb0496024 was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

A successful CTAS or constraint-preserving in-place sort rewrite is recorded
as an executed post_load ledger statement with mechanism sorted_ingestion. It
upgrades a statement recorded from the verb instead of adding a duplicate.
Corroboration reports it as attested with the reason "physical sort executed;
no catalog footprint". The attested verdict is outside the verifiable set, so
attested-only evidence never satisfies a catalog-verifiable intent and never
promotes a run to verified. The explorer drill-down labels attested entries
"Recorded; not catalog-checkable". MotherDuck wiring is unchanged: attested-only
runs stay unverified.
@joeharris76
joeharris76 force-pushed the feat/tuning-sort-evidence-attested branch from 096274a to 17fe7e4 Compare October 16, 2026 07:50

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 17fe7e445d2d53f7836a2838d2b9cf021e676410

This result supersedes those for earlier heads; their open review threads still apply.

Tier: low-medium (data-only or small single-area change).

Decision: SHIP, carried from head 096274a64eaf27342a47463669826b178d48e991.

The patch is unchanged since head 096274a64eaf27342a47463669826b178d48e991 was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

@joeharris76
joeharris76 merged commit b05e3ad into develop Oct 16, 2026
76 of 78 checks passed
@joeharris76
joeharris76 deleted the feat/tuning-sort-evidence-attested branch October 16, 2026 08:49

This branch was successfully deployed

1 active deployment
oracle — 17fe7e44 Deployed Oct 16, 2026 by joeharris76 via post #818
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