Repository navigation
Prepare for v0.7.0 release - #20
Conversation
📝 WalkthroughWalkthroughVersion 0.7.0 adds direct alias-chain resolution, fallible formatting, direct ChangesRelease and processing updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/zsort.zig (1)
1095-1108: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winRelease initialized arenas if setup or parallel execution fails.
If
allocator.createfails after an earlier iteration, the earlierFileJob.arenaallocations leak. Ifcompat.runParallelreturns an error, every initialized arena leaks because cleanup registration starts only in the result loop.Add an initialization-scope
errdeferthat deinitializes and destroysjobs[0..initialized].Proposed cleanup scope
const jobs = try allocator.alloc(FileJob, files.items.len); defer allocator.free(jobs); -for (jobs, files.items) |*job, file_path| { - const file_arena = try allocator.create(std.heap.ArenaAllocator); - file_arena.* = std.heap.ArenaAllocator.init(std.heap.page_allocator); - job.* = .{ - .arena = file_arena, - .path = file_path, - .banned = parsed.banned_prefixes.items, - .bottom = parsed.bottom, - }; -} - -try compat.runParallel(io, allocator, FileJob, processFileJob, jobs); +{ + var initialized: usize = 0; + errdefer for (jobs[0..initialized]) |*job| { + job.arena.deinit(); + allocator.destroy(job.arena); + }; + + for (jobs, files.items) |*job, file_path| { + const file_arena = try allocator.create(std.heap.ArenaAllocator); + file_arena.* = std.heap.ArenaAllocator.init(std.heap.page_allocator); + job.* = .{ + .arena = file_arena, + .path = file_path, + .banned = parsed.banned_prefixes.items, + .bottom = parsed.bottom, + }; + initialized += 1; + } + + try compat.runParallel(io, allocator, FileJob, processFileJob, jobs); +}🤖 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 `@src/zsort.zig` around lines 1095 - 1108, Add an initialization-scope errdefer around the FileJob setup loop that tracks the number of successfully initialized jobs and, on setup or compat.runParallel failure, deinitializes each arena and destroys its allocation. Ensure cleanup covers only jobs in jobs[0..initialized] and remains compatible with the existing successful execution cleanup.
🤖 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 `@src/ast_scan.zig`:
- Around line 153-155: Update classifyDecl in src/ast_scan.zig to recognize
direct identifier aliases such as const B = A, allowing the fixed-point resolver
to resolve chained aliases like A → B → C; add a regression test covering this
chain. In CHANGELOG.md lines 20-23, retain the v0.7.0 alias-chain claim only
after the implementation and test support direct aliases.
---
Outside diff comments:
In `@src/zsort.zig`:
- Around line 1095-1108: Add an initialization-scope errdefer around the FileJob
setup loop that tracks the number of successfully initialized jobs and, on setup
or compat.runParallel failure, deinitializes each arena and destroys its
allocation. Ensure cleanup covers only jobs in jobs[0..initialized] and remains
compatible with the existing successful execution cleanup.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: d14f48d4-35c7-499c-871d-eebc40078f4f
📒 Files selected for processing (8)
CHANGELOG.mdREADME.mdbuild.zig.zonsrc/ast_scan.zigsrc/compat.zigsrc/version.zigsrc/zsort.zigsrc/zsort_test.zig
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/ast_scan_test.zig (1)
167-182: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a reverse-order direct-alias regression.
The test covers
A → B → Cin declaration order. The resolver also claims order-independent fixed-point resolution. The existing reverse-order test covers dotted aliases, not the new direct-identifier path. Add a case withconst C = B;,const B = A;, andconst A =@import("a/b.zig");. Assert both aliases resolve andanalysis.block_endequalssource.len. This protects the alias data consumed bysrc/zsort.zig.🤖 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 `@src/ast_scan_test.zig` around lines 167 - 182, The direct-identifier alias tests need reverse-order coverage. Add a regression test alongside “analyze: direct identifier alias chain resolves” using declarations C = B, B = A, and A = `@import`("a/b.zig"), then assert both aliases resolve to the imported path and analysis.block_end equals source.len.
🤖 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.
Nitpick comments:
In `@src/ast_scan_test.zig`:
- Around line 167-182: The direct-identifier alias tests need reverse-order
coverage. Add a regression test alongside “analyze: direct identifier alias
chain resolves” using declarations C = B, B = A, and A = `@import`("a/b.zig"),
then assert both aliases resolve to the imported path and analysis.block_end
equals source.len.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a88e2e09-0631-4756-92e6-9ec4aa3dac38
📒 Files selected for processing (3)
src/ast_scan.zigsrc/ast_scan_test.zigsrc/zsort.zig
🚧 Files skipped from review as they are similar to previous changes (1)
- src/zsort.zig
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/ast_scan_test.zig (1)
183-197: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover direct-alias failure paths.
This test covers only successful resolution. The existing cycle test at Lines 216-225 uses dotted bases. It does not exercise the direct-identifier branch in
src/ast_scan.zigat Lines 351-364. Add cases for a direct cycle and a direct unresolved base. (raw.githubusercontent.com)🤖 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 `@src/ast_scan_test.zig` around lines 183 - 197, Extend the analyzer tests near “analyze: direct identifier alias chain resolves regardless of decl order” with separate cases for a direct identifier alias cycle and a direct identifier alias whose base is unresolved. Assert each failure path’s expected analysis result, targeting the direct-identifier resolution logic in analyze rather than dotted-base handling.
🤖 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.
Nitpick comments:
In `@src/ast_scan_test.zig`:
- Around line 183-197: Extend the analyzer tests near “analyze: direct
identifier alias chain resolves regardless of decl order” with separate cases
for a direct identifier alias cycle and a direct identifier alias whose base is
unresolved. Assert each failure path’s expected analysis result, targeting the
direct-identifier resolution logic in analyze rather than dotted-base handling.
Summary by CodeRabbit
--bottomoption for placing aliases at the bottom of output.