Skip to content

test(specializer): pin substr negative-start paths; xfail the constant-fold known residual - #28

Merged
ahrzb merged 1 commit into
masterfrom
substr-constant-fold-xfail
Jul 26, 2026
Merged

test(specializer): pin substr negative-start paths; xfail the constant-fold known residual#28
ahrzb merged 1 commit into
masterfrom
substr-constant-fold-xfail

Conversation

@claude-agent-ahrzb

Copy link
Copy Markdown

Finding: the TASK-45-review substr "parity bug" is not an engine bug

The report compared two different DuckDB paths. Measured on DuckDB 1.5.5:

expr DuckDB constant-fold DuckDB vectorized (column input) engine
substr('ab', -4, 2) '' 'ab' 'ab'
substr('ab', -3, 2) 'a' 'ab' 'ab'
substr('ab', -5, 3) '' 'ab' 'ab'

DuckDB disagrees with itself: the constant-fold path clamps the window after applying length, the vectorized path clamps rs to 1 first. The engine deliberately pins the vectorized path — the one every column input (and the mined corpus) takes — per docs/superpowers/specs/2026-07-26-stretch4-builtin-pins.md §4, which already records the pure-literal case as a known residual. The report's proposed fix (drop the pre-clamp) would break column-path parity for these same triples.

What this PR adds

  • test_substr_negative_start_column_path_differential — the report's triples through the column path; passes, proving engine ↔ DuckDB agreement where it matters.
  • test_substr_constant_fold_divergence — the pure-literal shape, xfail(strict=True); makes the spec's known residual executable. Flips loudly if the engine ever grows a constant-fold mirror or a DuckDB bump reconciles the paths.

No engine change (per the native-engine bug process: no inline fix without a ticket). Suite: 35 passed, 1 xfailed.

🤖 Generated with Claude Code

…ty green, constant-fold divergence xfail-strict

The TASK-45-review substr report compared the engine's column path against
DuckDB's constant-fold path. Measured (DuckDB 1.5.5): those two DuckDB paths
disagree with each other on negative starts; the engine matches the
vectorized path, per the builtin-pins spec §4 pin. Column-path triples from
the report now pass differentially; the pure-literal known residual is
documented as a strict xfail.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ahrzb
ahrzb merged commit 78b95e4 into master Jul 26, 2026
1 check passed
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