Skip to content

Commit dac46b9

Browse files
committed
W25 Step C: lint gate — catch local extern decls of API functions
Per W25 spec docs/w25-hbb-canonicalization.md §3 Step C + theologian [chat L2347] revised lint pattern. Final W25 step — makes the §1b drift surface mechanically uncloseable post-Step-B. LINT PATTERN (theologian L2347): ^[[:space:]]*extern[[:space:]]+.*hir_(c_|cfg_|block_|bb_|edge_|func_|instr_) - ^[[:space:]]*extern matches BOTH file-scope (^extern) AND function-scope ( extern indented). Catches the L2280 blind-spot class. - hir_(c_|cfg_|block_|bb_|edge_|func_|instr_) namespace prefixes - --exclude=hir_c_api.h (canonical decls) + hir_basic_block_c.h (canonical decls) + builder.cpp (legitimate extern "C" bridge impls) VERIFIED at HEAD 0d1851d (post-77a + 77a-fix): 0 violators (clean baseline). Step B closed the lint surface; lint gate prevents regression. CHANGES (+25/0): scripts/gate_phoenix.sh: new Step 1d "W25 Lint Gate" between Step 1c Preserved Symbol Check and Step 2 JIT Smoke Test. Sets GATE_PASS=0 + appends w25_lint:<count> to FAILURES if violators found. Prints actionable fix message (delete extern + #include canonical header). DISCIPLINE NOTE: lint runs on every gate cycle. Future regressions to local externs of canonical API functions get caught at gate time instead of in §5.3 mutation re-runs (which only sample one function). NEXT per supervisor [chat L2364] sequence: Push 78: §5.3 POST-STEP-B-FINAL re-run with hir_c_create_* mutation (validates function-scoped path per theologian L2351) Then: INVOKE_* Phase 2 per Option B continuation Authorization chain: - W25 spec §3 Step C: theologian L2017 - Lint pattern revision (function-scope catch): theologian L2280 + L2347 - Push 77b sequencing: supervisor L2364
1 parent 0d1851d commit dac46b9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

scripts/gate_phoenix.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,29 @@ else
167167
echo "Preserved symbols: PASS (all $( echo $MUST_SURVIVE | wc -w) symbols present)" | tee -a "$RESULTS_FILE"
168168
fi
169169

170+
# Step 1d: W25 lint gate (Step C per W25 spec docs/w25-hbb-canonicalization.md §3).
171+
# Catches local extern decls of API functions (file-scope OR function-scope) that
172+
# would re-introduce the §1b drift surface W25 Step B closed (293 lint externs
173+
# across 9 TUs). Theologian L2347 revised pattern uses ^[[:space:]]*extern to
174+
# match both line-start (file-scope) and indented (function-scope) externs.
175+
echo "" | tee -a "$RESULTS_FILE"
176+
echo "--- Step 1d: W25 Lint Gate ---" | tee -a "$RESULTS_FILE"
177+
W25_VIOLATORS=$(grep -rE '^[[:space:]]*extern[[:space:]]+.*hir_(c_|cfg_|block_|bb_|edge_|func_|instr_)' \
178+
"$CPYTHON_ROOT/Python/jit/hir/" \
179+
--include='*.c' --include='*.cpp' \
180+
--exclude='hir_c_api.h' --exclude='hir_basic_block_c.h' --exclude='builder.cpp' \
181+
2>/dev/null || true)
182+
if [ -n "$W25_VIOLATORS" ]; then
183+
echo "GATE FAIL — W25 lint pattern matched local extern decls of API functions:" | tee -a "$RESULTS_FILE"
184+
echo "$W25_VIOLATORS" | tee -a "$RESULTS_FILE"
185+
echo "Fix: delete the extern + add #include of canonical header (hir_c_api.h," | tee -a "$RESULTS_FILE"
186+
echo " hir_basic_block_c.h, hir_instr_c.h, or hir_cfg_rpo_c.h depending on the function)." | tee -a "$RESULTS_FILE"
187+
GATE_PASS=0
188+
FAILURES="$FAILURES w25_lint:$(echo "$W25_VIOLATORS" | wc -l)"
189+
else
190+
echo "W25 lint gate: PASS (0 lint-pattern externs)" | tee -a "$RESULTS_FILE"
191+
fi
192+
170193
# Step 2: Verify JIT compiles and executes
171194
echo "" | tee -a "$RESULTS_FILE"
172195
echo "--- Step 2: JIT Smoke Test ---" | tee -a "$RESULTS_FILE"

0 commit comments

Comments
 (0)