Fix YAML harness cleanup on parse failure#218
Conversation
Restructure the embedded Pascal harness in run_yaml_test_suite.py to use try..finally so Parser.Free, Source.Free, and TGarbageCollector.Shutdown are always reachable. Previously, Halt(0) in the try block made these cleanup calls dead code. Fixes #167 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe embedded Pascal harness in the YAML test runner was restructured to guarantee resource cleanup execution. A nested Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/run_yaml_test_suite.py`:
- Around line 49-54: The except block currently calls Halt(1), which aborts the
process and prevents outer finally cleanup (Parser.Free, Source.Free,
TGarbageCollector.Shutdown) from running; change the exception handling so it
does not call Halt: capture/log E.Message as now, set the global ExitCode := 1
(or store an error flag) and allow the exception handler to return (do not
re-raise), so the outer finally can run and perform cleanup; locate the except
block that references Halt(1) and replace the Halt call with setting ExitCode
(or an error flag) and returning control to let Parser.Free, Source.Free, and
TGarbageCollector.Shutdown execute.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fef6c285-20f7-4d8f-9e45-c53d5f9e1778
📒 Files selected for processing (1)
scripts/run_yaml_test_suite.py
Halt() in FreePascal terminates immediately without executing enclosing try..finally blocks. Use an ExitCode variable instead so the finally block runs cleanup before the process exits. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Benchmark Results274 benchmarks Interpreted: 🟢 146 improved · 🔴 51 regressed · 77 unchanged · avg +2.2% arraybuffer.js — Interp: 🟢 12, 🔴 1, 1 unch. · avg +6.9% · Bytecode: 🟢 6, 🔴 1, 7 unch. · avg +0.9%
arrays.js — Interp: 🟢 17, 2 unch. · avg +6.7% · Bytecode: 🟢 3, 🔴 15, 1 unch. · avg -1.9%
async-await.js — Interp: 🟢 6 · avg +6.0% · Bytecode: 🔴 4, 2 unch. · avg -3.9%
classes.js — Interp: 🟢 19, 🔴 7, 5 unch. · avg +2.5% · Bytecode: 🟢 5, 🔴 1, 25 unch. · avg +0.9%
closures.js — Interp: 🟢 6, 🔴 1, 4 unch. · avg +1.6% · Bytecode: 🟢 1, 🔴 2, 8 unch. · avg -0.1%
collections.js — Interp: 🟢 8, 🔴 3, 1 unch. · avg +2.2% · Bytecode: 🟢 3, 🔴 4, 5 unch. · avg -0.5%
destructuring.js — Interp: 🟢 6, 🔴 6, 10 unch. · avg -0.3% · Bytecode: 🟢 4, 🔴 6, 12 unch. · avg -1.0%
fibonacci.js — Interp: 🟢 6, 2 unch. · avg +6.3% · Bytecode: 🟢 6, 2 unch. · avg +2.6%
for-of.js — Interp: 🔴 1, 6 unch. · avg -0.1% · Bytecode: 🟢 4, 🔴 1, 2 unch. · avg +1.7%
helpers/bench-module.js — Interp: 0 · Bytecode: 0
iterators.js — Interp: 🟢 14, 6 unch. · avg +2.7% · Bytecode: 🟢 5, 🔴 7, 8 unch. · avg -0.4%
json.js — Interp: 🟢 15, 5 unch. · avg +5.3% · Bytecode: 🔴 6, 14 unch. · avg -1.6%
jsx.jsx — Interp: 🟢 9, 12 unch. · avg +1.5% · Bytecode: 🟢 16, 5 unch. · avg +4.2%
modules.js — Interp: 🟢 7, 2 unch. · avg +3.1% · Bytecode: 🔴 8, 1 unch. · avg -1.3%
numbers.js — Interp: 🟢 9, 🔴 1, 1 unch. · avg +7.1% · Bytecode: 🟢 3, 🔴 4, 4 unch. · avg +3.7%
objects.js — Interp: 🟢 2, 🔴 2, 3 unch. · avg -0.2% · Bytecode: 🔴 1, 6 unch. · avg -1.3%
promises.js — Interp: 🟢 1, 🔴 8, 3 unch. · avg -2.9% · Bytecode: 🔴 2, 10 unch. · avg -0.5%
regexp.js — Interp: 🟢 4, 🔴 2, 5 unch. · avg +1.3% · Bytecode: 🟢 2, 🔴 2, 7 unch. · avg -0.0%
strings.js — Interp: 🟢 2, 🔴 4, 5 unch. · avg -1.1% · Bytecode: 🟢 7, 🔴 1, 3 unch. · avg +2.4%
typed-arrays.js — Interp: 🟢 3, 🔴 15, 4 unch. · avg -3.5% · Bytecode: 🟢 3, 🔴 8, 11 unch. · avg -0.9%
Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
Suite Timing
Measured on ubuntu-latest x64. |
Summary
finallyblock so they always run.TGarbageCollector.Shutdownexecutes even when YAML loading or parsing raises an exception.Fixes #167