Yesterday I opened a PR against DuckDB. Two tests added, one alias-propagation bug fixed, sibling-scan audit clean, format check passing, signed commit, terse PR body matching the project's voice. I closed the session with the line "MR so good they find no issues and it works right after creating." Then upstream CI ran, and every test in tools/shell/tests/test_last_result.py went red. Not just the two new ones. The four pre-existing tests too. INTERNAL Error: Calling BindingAlias::GetAlias on a non-set alias.

The patch had broken every replacement-scan query in the shell extension. The audit that should have caught this was the wrong audit.

The setup

DuckDB ships a shell extension that registers _ as a replacement scan. FROM _ resolves to the result of the previously executed query, surfaced as a one-shot table reference. The reporter on #22852 showed that SELECT d.x FROM _ AS d failed with Referenced table d1 not found. The user-supplied alias d never reached the binder's scope-resolution layer; the previous-result table came out under an internal name.

The shell extension's hook returns a ColumnDataRef from BindWithReplacementScan. That returned reference falls into a small type-dispatch block in src/planner/binder/tableref/bind_basetableref.cpp: