Skip to content

refactor(cli): make the whole migrate module Unix-only - #1153

Merged
chappie-daemon merged 4 commits into
rewrite/mainfrom
fix/1121-migrate-module-cfg
Nov 16, 2026
Merged

chappie-daemon merged 4 commits into
rewrite/mainfrom
fix/1121-migrate-module-cfg

Conversation

@chappie-daemon

Copy link
Copy Markdown
Collaborator

Description

#1148 gated run and every helper it could reach individually. Rust still type-checks a function nothing on the platform can call, so the Windows job it added then failed on eleven dead-code errors — PostgresBackend in the imports, records_progress, describe_source, is_url_with_host, without_credentials, probe_budget, no_store, store_present, check_resume_store, open_target, open_existing_target — all reachable only from the #[cfg(unix)] run().

This takes the shape the issue asked for instead of more attributes:

  • crates/nostream-cli/src/commands/mod.rs — #[cfg(unix)] pub mod migrate; and, on the other platform, #[cfg(not(unix))] #[path = "migrate_unsupported.rs"] pub mod migrate;
  • crates/nostream-cli/src/commands/migrate_unsupported.rs — the same MigrateOptions and a run that writes migrate pg-to-lmdb is unsupported on this platform and answers exit code 1.
  • main.rs needs no cfg arm: both modules answer the same names.

migrate.rs keeps its internal gates (they are inert inside a Unix-only module) and loses the now-duplicate #[cfg(not(unix))] run.

Related Issue

Closes #1121

How Has This Been Tested?

The non-Unix arm is compiled on Linux by swapping the two module attributes in a scratch copy, which is exactly the configuration the Windows runner builds:

cargo clippy -p nostream-cli --no-default-features --lib --bins -- -D warnings   # clean
cargo fmt --all --check                                                        # clean
cargo build -p nostream-cli --no-default-features                              # clean
cargo test -p nostream-cli --lib --no-default-features                         # 8 passed
cargo test -p nostream-cli --test migrate_cli --no-default-features            # 42 passed
cargo clippy -p nostream-cli --no-default-features --all-targets -- -D warnings # clean

The windows-latest job in checks.yml, added by #1148, is the platform proof; migrate_cli_unsupported.rs pins the refusal and that job runs it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Non-functional change (docs, style, minor refactor)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Gating `run` left every helper it called compiled but unreachable on
Windows, and `-D warnings` makes each one a dead-code error: eleven of
them, from `PostgresBackend` in the imports down to `open_existing_target`.

The issue's own shape is the fix: `commands::migrate` is `#[cfg(unix)]`,
and the other platform gets `migrate_unsupported.rs` at the same path,
carrying the same `MigrateOptions` and a `run` that refuses. `main.rs`
stays free of a `cfg` arm because both modules answer the same names.

Verified by compiling the non-Unix arm on Linux: a scratch copy with the
module cfgs swapped passes `cargo clippy -p nostream-cli
--no-default-features --lib --bins -- -D warnings`, which is the check
the Windows runner was failing.
@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 32d278a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3093c57-3796-490f-8405-512ffb542f68

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

`migrate_unsupported.rs` is behind `#[cfg(not(unix))]`, so on Linux
`cargo fmt --all` never visits it — and CI's `cargo fmt --all --check`
runs on Linux, which is why the crate root's own listing decides what is
formatted. Formatted by name instead.
`cargo fmt --all` formats the modules the crate root reaches, and the
root's `cfg` picks one of the two `migrate` files per platform. Linux
therefore never formats `migrate_unsupported.rs` and Windows never
formats `migrate.rs`; a check on each platform covers both. This caught
a wrapped signature in the unreachable file on the run before.
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Makes the full migration implementation Unix-only while keeping the command available elsewhere.

  • The migration command builds on Windows and clearly refuses to run there.

Reviews (1) · Last reviewed commit: "ci: check formatting on Windows too, whe..." · Reviewed by Greptile

@chappie-daemon
chappie-daemon merged commit 0f202f1 into rewrite/main Nov 16, 2026
19 of 20 checks passed
@chappie-daemon
chappie-daemon deleted the fix/1121-migrate-module-cfg branch November 16, 2026 04:17
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 43802699298

Coverage decreased (-0.006%) to 77.582%

Details

  • Coverage decreased (-0.006%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12081
Covered Lines: 9792
Line Coverage: 81.05%
Relevant Branches: 6342
Covered Branches: 4501
Branch Coverage: 70.97%
Branches in Coverage %: Yes
Coverage Strength: 758.84 hits per line

💛 - Coveralls

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.

2 participants