Centralize CLI source pipeline handling#685
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughThis PR introduces a CLI-specific source pipeline result wrapper and shared source-map output procedure, then refactors five CLI applications to use them. The abstraction consolidates warning display, resource ownership management, and coverage registration, replacing scattered per-application logic with reusable components. ChangesCLI Source Pipeline Result and Application Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Suite TimingTest Runner (interpreted: 9,798 passed; bytecode: 9,798 passed)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Test runner worker shutdown frees thread-local heaps in bulk; that shutdown reclamation is not counted as GC collections or collected objects.
Benchmarks (interpreted: 407; bytecode: 407)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Benchmark runner performs explicit between-file collections, so collection and collected-object counts can be much higher than the test runner.
Measured on ubuntu-latest x64. |
Benchmark Results407 benchmarks Interpreted: 🟢 399 improved · 🔴 5 regressed · 3 unchanged · avg +42.2% arraybuffer.js — Interp: 🟢 14 · avg +48.7% · Bytecode: 🟢 1, 🔴 11, 2 unch. · avg -5.4%
arrays.js — Interp: 🟢 19 · avg +48.9% · Bytecode: 🔴 19 · avg -12.3%
async-await.js — Interp: 🟢 6 · avg +63.5% · Bytecode: 🔴 5, 1 unch. · avg -7.5%
async-generators.js — Interp: 🟢 2 · avg +102.1% · Bytecode: 🔴 1, 1 unch. · avg -9.4%
base64.js — Interp: 🟢 10 · avg +28.9% · Bytecode: 🟢 7, 🔴 2, 1 unch. · avg -0.2%
classes.js — Interp: 🟢 31 · avg +37.9% · Bytecode: 🔴 22, 9 unch. · avg -4.9%
closures.js — Interp: 🟢 11 · avg +43.8% · Bytecode: 🔴 10, 1 unch. · avg -9.5%
collections.js — Interp: 🟢 12 · avg +44.1% · Bytecode: 🔴 12 · avg -10.0%
csv.js — Interp: 🟢 13 · avg +41.7% · Bytecode: 🔴 13 · avg -8.8%
destructuring.js — Interp: 🟢 22 · avg +42.3% · Bytecode: 🔴 21, 1 unch. · avg -7.9%
fibonacci.js — Interp: 🟢 8 · avg +43.9% · Bytecode: 🔴 8 · avg -10.2%
float16array.js — Interp: 🟢 32 · avg +42.2% · Bytecode: 🔴 28, 4 unch. · avg -7.5%
for-of.js — Interp: 🟢 7 · avg +47.0% · Bytecode: 🔴 7 · avg -9.2%
generators.js — Interp: 🟢 4 · avg +32.1% · Bytecode: 🔴 4 · avg -7.9%
iterators.js — Interp: 🟢 42 · avg +44.2% · Bytecode: 🔴 37, 5 unch. · avg -6.1%
json.js — Interp: 🟢 20 · avg +36.4% · Bytecode: 🔴 19, 1 unch. · avg -10.4%
jsx.jsx — Interp: 🟢 21 · avg +43.6% · Bytecode: 🔴 21 · avg -8.9%
modules.js — Interp: 🟢 9 · avg +39.3% · Bytecode: 🔴 9 · avg -14.7%
numbers.js — Interp: 🟢 11 · avg +42.8% · Bytecode: 🔴 11 · avg -6.7%
objects.js — Interp: 🟢 7 · avg +40.4% · Bytecode: 🔴 7 · avg -9.3%
promises.js — Interp: 🟢 12 · avg +38.2% · Bytecode: 🔴 7, 5 unch. · avg -5.4%
regexp.js — Interp: 🟢 11 · avg +26.2% · Bytecode: 🟢 5, 🔴 5, 1 unch. · avg -1.6%
strings.js — Interp: 🟢 19 · avg +38.8% · Bytecode: 🔴 19 · avg -10.2%
tsv.js — Interp: 🟢 9 · avg +43.1% · Bytecode: 🔴 9 · avg -8.7%
typed-arrays.js — Interp: 🟢 15, 🔴 5, 2 unch. · avg +21.9% · Bytecode: 🟢 2, 🔴 16, 4 unch. · avg -7.2%
uint8array-encoding.js — Interp: 🟢 18 · avg +41.1% · Bytecode: 🟢 11, 🔴 6, 1 unch. · avg +32.9%
weak-collections.js — Interp: 🟢 14, 1 unch. · avg +78.8% · Bytecode: 🔴 14, 1 unch. · avg -25.6%
Deterministic profile diffDeterministic profile diff: no significant changes. 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. |
test262 Conformance
Areas closest to 100%
Per-test deltas (+1 / -0)Newly passing (1):
Steady-state failures are non-blocking; regressions vs the cached main baseline (lower total pass count, or any PASS → non-PASS transition) fail the conformance gate. Measured on ubuntu-latest x64, bytecode mode. Areas grouped by the first two test262 path components; minimum 25 attempted tests, areas already at 100% excluded. Δ vs main compares against the most recent cached |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/app/GocciaBundler.dpr`:
- Around line 104-105: WriteSourceMapIfAvailable currently defaults
MapOutputPath from the original source path (AFileName/SourceName) which causes
.map files to be written beside sources instead of beside the emitted bytecode;
change the default MapOutputPath logic to derive from the resolved/emitted
bytecode output path (the same path ResolveOutputPath/EmitGBC or whatever
produces the .gbc uses) so the .map is written next to the generated .gbc;
update the call site that passes MapOutputPath (where
WriteSourceMapIfAvailable(ASourceMap, MapOutputPath, SourceName, ... ) is
invoked) to compute MapOutputPath from the resolved output filename for the
bytecode (not SourceName/AFileName) and ensure the code that constructs the
default map filename simply replaces the .gbc extension on that resolved output
path with .map.
🪄 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: CHILL
Plan: Pro
Run ID: 8d3547d0-e7e7-40e6-a6e4-cb149dd4e9cd
📒 Files selected for processing (9)
docs/architecture.mdsource/app/Goccia.CLI.SourceMaps.passource/app/Goccia.CLI.SourcePipelineResult.passource/app/GocciaBenchmarkRunner.dprsource/app/GocciaBundler.dprsource/app/GocciaREPL.dprsource/app/GocciaScriptLoader.dprsource/app/GocciaTestRunner.dprsource/units/Goccia.SourcePipeline.pas
| WriteSourceMapIfAvailable(ASourceMap, MapOutputPath, SourceName, | ||
| not GIsWorkerThread); |
There was a problem hiding this comment.
Default the .map path from the emitted bytecode path, not the source path.
With --source-map but no explicit path, this still derives the map from AFileName, so renamed outputs and directory outputs write .map files beside the source instead of beside the generated .gbc. That makes the delegated source-map policy inconsistent with ResolveOutputPath(...) and can fail when the source tree is not writable.
Suggested fix
procedure TBundlerApp.WriteSourceMapIfEnabled(
const ASourceMap: TGocciaSourceMap; const AFileName: string);
var
MapOutputPath, SourceName: string;
begin
if not FSourceMap.Present then
Exit;
+ SourceName := ResolveOutputPath(AFileName);
MapOutputPath := FSourceMap.ValueOr('');
if MapOutputPath = '' then
- begin
- if AFileName = STDIN_FILE_NAME then
- MapOutputPath := ResolveOutputPath(AFileName) + EXT_MAP
- else
- MapOutputPath := AFileName + EXT_MAP;
- end;
- SourceName := AFileName;
- if (SourceName = STDIN_FILE_NAME) and FOutputPath.Present then
- SourceName := FOutputPath.Value;
+ MapOutputPath := SourceName + EXT_MAP;
WriteSourceMapIfAvailable(ASourceMap, MapOutputPath, SourceName,
not GIsWorkerThread);
end;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@source/app/GocciaBundler.dpr` around lines 104 - 105,
WriteSourceMapIfAvailable currently defaults MapOutputPath from the original
source path (AFileName/SourceName) which causes .map files to be written beside
sources instead of beside the emitted bytecode; change the default MapOutputPath
logic to derive from the resolved/emitted bytecode output path (the same path
ResolveOutputPath/EmitGBC or whatever produces the .gbc uses) so the .map is
written next to the generated .gbc; update the call site that passes
MapOutputPath (where WriteSourceMapIfAvailable(ASourceMap, MapOutputPath,
SourceName, ... ) is invoked) to compute MapOutputPath from the resolved output
filename for the bytecode (not SourceName/AFileName) and ensure the code that
constructs the default map filename simply replaces the .gbc extension on that
resolved output path with .map.
Summary
Goccia.CLI.SourcePipelineResultas the CLI-owned wrapper around source pipeline parse results.Goccia.CLI.SourceMapsfor shared CLI source-map writing.CONTEXT.md, and document the CLI helper boundary indocs/architecture.md.Testing
Commands run:
./format.pas --checkgit diff --check./build.pas clean loader bundler testrunner benchmarkrunner repl./fixtures/ffi/build.sh./build/GocciaTestRunner tests --no-progress