Skip to content

Prepare for v0.7.0 release - #20

Merged
mstdokumaci merged 5 commits into
mainfrom
prep-release
Aug 11, 2026
Merged

mstdokumaci merged 5 commits into
mainfrom
prep-release

Conversation

@mstdokumaci

@mstdokumaci mstdokumaci commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added the --bottom option for placing aliases at the bottom of output.
    • Improved alias resolution across direct identifiers and multi-step chains.
  • Bug Fixes
    • Cyclic and unresolved aliases are now excluded.
    • Aliases are ordered consistently relative to their resolved targets.
    • Improved handling of memory-allocation failures and comment preservation.
  • Documentation
    • Updated usage documentation and release information for version 0.7.0.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Version 0.7.0 adds direct alias-chain resolution, fallible formatting, direct FileJob state management, and updated release metadata.

Changes

Release and processing updates

Layer / File(s) Summary
Direct alias-chain resolution
src/ast_scan.zig, src/ast_scan_test.zig
Direct identifier aliases now resolve through alias chains to imported paths. Unresolved aliases are removed. Tests cover declaration order and resolved import metadata.
Fallible formatting and output
src/zsort.zig, src/zsort_test.zig
Formatting and diagnostic paths now propagate allocation errors. Comment emission and help formatting use updated helpers. Tests handle the fallible summary API.
Direct FileJob state management
src/zsort.zig
Parallel processing stores arenas, sources, results, and errors directly in FileJob. Setup cleanup, result collection, diff generation, and summary handling use these fields.
0.7.0 release metadata
CHANGELOG.md, README.md, build.zig.zon, src/version.zig, src/compat.zig
Release metadata identifies version 0.7.0. The callback documentation uses mutable *Job pointers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the version updates, changelog entry, and release preparation in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch prep-release

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Release initialized arenas if setup or parallel execution fails.

If allocator.create fails after an earlier iteration, the earlier FileJob.arena allocations leak. If compat.runParallel returns an error, every initialized arena leaks because cleanup registration starts only in the result loop.

Add an initialization-scope errdefer that deinitializes and destroys jobs[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

📥 Commits

Reviewing files that changed from the base of the PR and between f55430a and 27abf25.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • README.md
  • build.zig.zon
  • src/ast_scan.zig
  • src/compat.zig
  • src/version.zig
  • src/zsort.zig
  • src/zsort_test.zig

Comment thread src/ast_scan.zig

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/ast_scan_test.zig (1)

167-182: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a reverse-order direct-alias regression.

The test covers A → B → C in 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 with const C = B;, const B = A;, and const A = @import("a/b.zig");. Assert both aliases resolve and analysis.block_end equals source.len. This protects the alias data consumed by src/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

📥 Commits

Reviewing files that changed from the base of the PR and between 27abf25 and 402722e.

📒 Files selected for processing (3)
  • src/ast_scan.zig
  • src/ast_scan_test.zig
  • src/zsort.zig
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/zsort.zig

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/ast_scan_test.zig (1)

183-197: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover 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.zig at 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c48b7bba-23ea-41df-bdda-78a51bf70648

📥 Commits

Reviewing files that changed from the base of the PR and between 402722e and f76097e.

📒 Files selected for processing (1)
  • src/ast_scan_test.zig

@mstdokumaci
mstdokumaci merged commit 1108604 into main Aug 11, 2026
11 checks passed
@mstdokumaci
mstdokumaci deleted the prep-release branch August 11, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant