Skip to content

fix: replace broken "./" output default with a derived output path#4

Open
pnodet wants to merge 1 commit into
mainfrom
fix/default-output-path
Open

fix: replace broken "./" output default with a derived output path#4
pnodet wants to merge 1 commit into
mainfrom
fix/default-output-path

Conversation

@pnodet

@pnodet pnodet commented Jul 3, 2026

Copy link
Copy Markdown
Member

Bug

Args.output defaulted to "./", which is a directory. las::Writer::from_path("./") calls File::create("./"), which always fails with "Is a directory" — so every invocation without -o errored out. The default could never work.

Fix

  • output is now Option<PathBuf> with no default value. When omitted, the output path is derived from the input: same directory, file stem plus a .cleaned.las extension (e.g. -p /data/scan.las writes /data/scan.cleaned.las).
  • path is now PathBuf instead of String, and the Reader::from_path / Writer::from_path call sites pass references to the new types.
  • The --output help text documents the default behavior.

Verified with cargo build and a check that with_extension("cleaned.las") on scan.las yields scan.cleaned.las.

🤖 Generated with Claude Code

The default output value "./" is a directory, so File::create always
failed and every run without -o errored. Default now derives
<input>.cleaned.las next to the input file, and paths are PathBuf
instead of String.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@pnodet, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 322c2eb7-c3e7-4740-959a-1830c146c246

📥 Commits

Reviewing files that changed from the base of the PR and between e20b82b and 3fcbb42.

📒 Files selected for processing (1)
  • src/main.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/default-output-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pnodet

pnodet commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Thermo-nuclear code quality review

Scope: the CLI/path-boundary change only (streaming, dropped-point reporting, and uuid removal are owned by sibling PRs and were not re-judged here).

Verdict: approve. This is the right shape of fix, not a patch-over. The old "./" default was a lie at the type level — a directory string flowing into File::create. This PR fixes the boundary itself: path: PathBuf, output: Option<PathBuf> where None honestly models "user didn't choose", and the default is derived in exactly one place at the top of main. The Option + unwrap_or_else is the canonical clap pattern for a cross-arg-dependent default; no branching was added anywhere else. That meets the bar.

I verified with_extension("cleaned.las") semantics empirically rather than trusting the doc comment:

input derived output
scan.las scan.cleaned.las
scan (no ext) scan.cleaned.las
SCAN.LAS SCAN.cleaned.las
scan.tar.gz scan.tar.cleaned.las
scan.cleaned.las scan.cleaned.cleaned.las
.las (dotfile) .las.cleaned.las

All sensible, and structurally the derived path can never equal the input: Path::extension is the segment after the last dot and thus can't contain a dot, so no input's extension can already be cleaned.las. No silent input-overwrite case exists. Relative inputs with no parent dir also work (scan.lasscan.cleaned.las in cwd). The default is documented in --help. Verified with cargo build + running --help.

Two minor nits, neither blocking:

  1. args.output.clone() is a needless clone — args.output is never read again, so args.output.unwrap_or_else(|| args.path.with_extension("cleaned.las")) moves it out and args.path stays usable. Trivial, but the clone implies a reuse that doesn't exist.

  2. --path has no doc comment, so its help line is blank next to the now-documented --output. One line would finish the job.

  3. (Observation, not a demand) a .laz input derives an uncompressed .las output since the writer infers compression from the extension. If that's intentional, fine; worth a note if laz inputs are expected.

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