Skip to content

perf: native cli - #10813

Open
zkochan wants to merge 1156 commits into
teambit:masterfrom
zkochan:rust-workspace-materialization
Open

zkochan wants to merge 1156 commits into
teambit:masterfrom
zkochan:rust-workspace-materialization

Conversation

@zkochan

@zkochan zkochan commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Adds a standalone Rust bit CLI, with compatible Node CLI fallback for paths still being ported. Native command execution does not imply independence from Bit's JavaScript runtime: retained host calls and remaining fallbacks are documented and tracked in the completion plan. Yarn is excluded from that plan.

  • Implements native workspace and scope inspection, tracking, dependency installation, snapshots, checkout, merge, lane/import/export and recovery paths. The command coverage table records supported modes and remaining boundaries.
  • Keeps the diff within native/, Rust documentation/tooling and the two Rust workflows. Upstream master is merged through 3754c4f57 (following Bit 2.2.160).
  • Matches upstream's pnpm 12.16 engine, including stale-symlink retry protection and symlinked-lockfile refusal. All engine Git dependencies advance together; native API adapters and lockfiles are updated.
  • Handles active-lane object refreshes and cross-scope hidden updates without promoting hidden entries. Workspace merges fetch hidden components' main history and retain histories already received in the same operation. Scope-side fixture production still uses the released CLI.
  • Scaffolds CI onboarding in Rust: repository-root workflows, comment-preserving configuration and backups, agent instructions, and GitHub/Enterprise setup guidance. Existing files and hand edits are preserved. Configured startup callbacks, active lanes, bitmap auto-sync and unsupported CI configuration still decline before effects.
  • Restores pre-merge main component models when aborting a lane merge, including retained-import proofs so later publication cannot replay the merged heads. The two new upstream assertions run natively; disabling the snapshot makes the regression fail. History traversal now uses indexed lookup while preserving insertion and traversal order.
  • Collects bare-scope garbage in Rust, retaining local ancestry, live/trashed lane roots and requested dependency versions. Unix backup/recovery preserves symlinks, overwrite rules, copy ordering and recoverable partial failures. Workspace collection plans before mutation and owns errors afterward. Bare verbose reports, workspace verbose text/JSON output and workspace legacy aliases are also native on the documented inputs. Windows nonempty collection/recovery, workspace verbose text with multiple deletions, complex bare verbose ordering, mixed-type workspace reports, larger batches and unqualified early-failure layouts still delegate before effects.
  • Owns configured HTTP export recovery and file pending-directory deletion in Rust. Generic actions, file persistence, runtime/provider replacement, full build/CI orchestration and long-running services remain tracked work.

Validation: formatting, Clippy, Dylint, rustdoc, generated porting/census/asset checks and all 1,809 workspace tests pass. Full E2E: 1,704 passed, two Bit Cloud setup failures and two existing skips. Both failed cases passed unchanged on a serial rerun. All 36 focused collection/recovery/installer cases pass.. The collection tests compare command bytes and complete filesystem effects, with negative controls for alias resolution and repeated lane counts. The main recovery regression proves the restored head and empty export staging. Repository Node lint cannot run locally because tsc is unavailable.

Bit 2.2.160 is not yet downloadable. The new upstream recovery semantics therefore have explicit native regression assertions, while component serialization retains the existing released-qualified projection. Differential qualification against 2.2.160 remains pending that release's availability.

The released Bit reference still bundles pnpm 12.13, so the E2E harness resolves its installer dependency to the integrity-pinned, published @pnpm/napi 12.16 addon. It does not replace Bit implementation code or change its installed files. Comparisons retain the new validation metadata and normalize only qualified clock fields. CI installs this isolated reference on Linux and Windows.

The Windows transfer fixture's setup snapshots use the released CLI explicitly; its native fetch, output and stored-object assertions remain required. The new onboarding cases also run in Windows provisioning CI. Windows provisioning exposed checkout line-ending and filesystem-error differences. The latest commit normalizes the bundled assets and Windows error paths/codes; all 12 onboarding cases also pass locally with CRLF assets. The final nested-workspace discrepancy came from Node preserving DOS short names while Rust expanded them. Path resolution now follows the released Node API, with a direct filesystem oracle and a negative control that fails under canonicalization. Windows provisioning now passes with the path fix. The Linux installer comparison also handles the observed redundant two-package startup redraw, only when the immediately following store banner repeats the same counters. Counter changes, other control sequences, intervening messages, later progress transitions and filesystem assertions remain checked. The recorded CI output fails the former comparison and passes the corrected one. The preceding Rust CI workflow is green on 726e5bc33, including Windows provisioning and all four Linux E2E shards. The collection/recovery commit 673e41df7 failed its generated-inventory check because GitHub merged it with newer upstream tests. This sync preserves that newer master and updates the inventory with both implemented assertions. All platform and E2E jobs on that prior head passed. CI for the new head is pending; Windows merge-history coverage now explicitly includes lane abort.

Latest validation (d88b3f1): the upstream history-merge set optimization is already implemented natively; added 40,000-row ordering/override and empty-input regressions. Fixed the Linux host fixture ETXTBSY race by using a checked-in immutable executable. All 60 CLI unit-suite stress runs at 64 threads pass. Formatting, Clippy, Dylint, rustdoc, generated checks and all 1,811 workspace tests pass. Full E2E: 1,703 passed, three failed, two existing skips. Two failures were Cloud setup requests; one was a dependency-capture freshness failure during environment-policy tagging. All three pass unchanged serially; the intermittent freshness failure remains under investigation. Windows merge-history CI on the preceding head passed, including lane abort. CI for this head is pending.

zkochan added a commit that referenced this pull request Oct 15, 2026
…LI (#10814)

## Proposed Changes

- **What changes:** a pull request that changes only the Rust CLI and
docs no longer runs the e2e suites. The Rust CLI paths are `native/`,
`scripts/rust/`, `.github/workflows/rust.yml` and
`.github/workflows/rust-scope.yml`; see #10813. The Rust CLI has its own
workflow (`.github/workflows/rust.yml`), and the e2e suites never run
it, so for such a PR they only cost CI time. It extends the existing
docs-only skip:
- **GitHub Actions (`e2e-tests.yml`):** those paths are left out of the
`pull_request` path filter, so the workflow doesn't start.
- **CircleCI (`e2e_test`):** the `skip_when_doc_only` step treats those
paths like doc files and halts the job, which counts as a success.
- **What's unchanged:**
- `setup_harmony`, `lint` and `generate_and_check_types` still run, and
`bit_merge` still gates on the type check;
- on master, or with a missing merge base or an unreadable diff, the
full suite runs as before;
  - doc files under `e2e/` still count as test changes;
  - a PR that also touches any other file runs everything.
- **Checks I ran:**
  - Both YAML files parse.
  - I ran the step's filter on #10813's 858 files: it halts.
- A Rust + docs diff halts; adding one `scopes/` file, an `e2e/` doc or
another workflow file runs the full suite.
  - Every file in #10813 is excluded by the new path patterns.
- I couldn't run `circleci config validate` locally (no CLI installed);
this PR's own CircleCI run validates the config.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
zkochan added a commit that referenced this pull request Oct 26, 2026
The invalid branch-name guard test invoked the shared Git client's real
status and remote queries before reaching the guard. On a slow checkout
it exceeded Mocha's two-second timeout, failing the CI component's unit
suite.

Stub those two queries for this test and restore the shared client in
`finally`. The guard assertion and timeout are unchanged.

Validation:
- All 405 CI component unit tests pass locally using Mocha and Babel
with installed Bit dependencies.
- With status delayed by 2.5 seconds, the original test reproduces the
2000 ms timeout; the fixed test passes (all seven tests in its file).
- Prettier and `git diff --check` pass.
- CircleCI PR build passes, including all 405 CI component tests (533
ms). CI lint and the full workspace type check pass; all four GitHub E2E
shards pass.

Fixes the CircleCI unit-test failure blocking #10813.
@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Default-environment formatting now owns component selection, source loading, dependency/history/documentation caches, reports and single-file writes in Rust. Prettier remains an external Node tool; the execution test rejects Bit runtime module loads. This does not claim a Rust implementation of Prettier or a runtime-independent distribution.

Nine released-CLI comparisons cover JSON/text/CI checks, changed-only selection, new/tagged/exported identities, empty workspaces, configured names, nested source ordering, successful writes, repeated clean results and owned read-only-file errors. Full workspace/cache/remote state remains compared. Only duration and a qualified two-component cached completion-order permutation are normalized. Disabling native dispatch or documentation-cache publication makes the corresponding regression fail.

Custom environments/providers, rich documentation cache misses, larger cached batches, concurrent source writes and unsupported tool inputs still decline before effects. Windows CI includes the formatter cases, and nested output paths use platform separators. The broader implementation work remains tracked in zkochan#395.

Validation: all 1,811 workspace tests and all 1,715 active end-to-end cases pass (two existing skips), along with formatting, Clippy, Dylint, rustdoc, generated inventory/census/assets and scope checks. An earlier Bit Cloud setup failure passed unchanged before the final full run. Repository Node lint cannot start locally because tsc is unavailable. Platform CI for this new head is pending.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Merged upstream master through c15f6da17510cea3057b29faa6b25cb1c5fbef24 (2.2.162) and ported the new status partition: components awaiting import are no longer duplicated in the invalid-components list. Other invalid errors and input order are preserved.

The mixed-error unit regression fails when the old classification is restored. The real-workspace JSON/text regression explicitly asserts the older released CLI's duplicate row/section before applying the exact upstream delta; all other fields, messages, exit status and stderr stay compared. The released 2.2.162 artifact was unavailable during qualification, so this does not claim a newer released oracle was tested.

Validation: formatting, Clippy, Dylint, rustdoc and all 1,812 workspace tests pass. Full E2E: 1,714 passed, one Bit Cloud request failed during released-CLI MDX environment setup, and two existing cases were skipped. The failed fixture passed unchanged on a serial rerun. Generated inventory/census/assets and scope checks pass. Local repository Node lint remains unavailable because tsc is missing. CI for this new head is pending.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Implemented in 9616d164a.

Rust now owns the qualified default-environment lint flow: component selection/loading, dependency/history/documentation caches, generated TypeScript config, diagnostic totals, text/JSON/CI/color reports and single-file fixes. ESLint remains an external Node tool. The built-in configuration is embedded; execution tests reject Bit runtime and configuration-module imports. Installed tool/config metadata is still required, and this does not claim a runtime-independent distribution.

Released-CLI comparisons retain raw ESLint diagnostics and full workspace/cache/remote state, including config filenames, bytes and permissions. They cover clean/cached runs, warnings, errors, autofixes, changed/new selection, empty/configured workspaces, nested sources, CI/colors, read-only source/config failures and pre-effect guards. Only validated duration fields are normalized. Disabling native dispatch fails the ownership assertion; changing the generated config filename fails the filesystem comparison. Comparison fixtures now restore directory permissions lost during copying.

This also fixes Windows formatter CI: formatted files retain Prettier's LF bytes, and preload tests use quoted forward-slash paths so Node does not consume Windows backslashes. Formatting retains new components in changed-only selection and declines ignored file extensions before effects. Windows provisioning CI covers both services.

Multiple components, concurrent fixes, custom environments/providers, rich documentation cache misses, noncanonical generated configs and unqualified built-in lint config versions remain explicit boundaries in issue zkochan#395. No broad completion claim is inferred from these cases.

Validation: formatting, Clippy, Dylint, rustdoc, generated plan/census/asset and
scope checks pass; all 1,814 workspace tests pass. Full E2E: 1,725 passed, two
existing skips and one Bit Cloud request failure during released-CLI fixture
setup. That case passed unchanged on a serial rerun. All 20 focused service and
fixture-permission cases pass. Negative controls catch disabled native dispatch
and incorrect generated config filenames. Windows CI for this batch is pending.
Repository Node lint remains unavailable because tsc is missing.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Implemented in 8528e011a.

Built-in React formatting and linting now use Rust-owned environment facts and component loading. The scoped service mode supplies React policy, file patterns and compiler facts without starting the published Bit host; other operations retain their existing provider lifecycle. Service failures report the selected environment. Custom providers, mixed environment groups, unsupported dependency syntax and the existing documentation-cache boundaries still decline before effects.

Eight new differential cases cover repeated caches, changed selection, dependency metadata, diagnostics, fixes, CI/colors and read-only writes. The no-Bit-module preload passes with React too. A tagged dependency-bearing regression proves the peer policy matters: changing React's range makes an unchanged component incorrectly appear in changed-only lint results, and the regression fails.

ESLint and Prettier remain external Node tools and their installed package metadata is still needed. The broader runtime, compiler, build and service work in issue #395 remains open.

Validation: all 1,814 workspace tests and formatting, Clippy, Dylint, rustdoc,
generated plan/census/asset and scope checks pass. Full E2E: 1,729 passed, two
existing skips and five external request failures (two Bit Cloud fixture setup
requests and three registry timeouts in existing Yarn cases). All five passed
unchanged in a serial rerun. All eight new React comparisons pass; the peer-policy
negative control fails as intended. Yarn implementation remains excluded.
Windows provisioning passed on the preceding lint/formatter revision, confirming
its platform fixes; CI for this React batch is pending. Local Node lint still
requires the unavailable tsc.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Implemented in c21307b33.

Capsule fixture network verification

The remaining-core-environment capsule comparison now configures five built-in
environments directly in its fixture. Independent released-CLI replay confirmed
that these are the exact component config entries written by environment
assignment and that all five resulting capsule manifests are identical. The
comparison still runs the actual released capsule command, requires native
ownership and compares complete manifest bytes and command output. A preload
rejects JavaScript HTTP/HTTPS/fetch requests during these five comparisons.

The versioned custom-aspect environment retains released assignment and metadata
import: replacing it with an unversioned entry changes a manifest dependency,
and the correctly versioned entry needs imported objects. It therefore remains
a network-dependent fixture. No retry, timeout or assertion was weakened; this
removes only unrelated remote verification from the five built-in setups.

Validation: formatting, Clippy, Dylint, rustdoc, all 1,814 workspace tests and
generated plan/census/asset/scope checks pass. Full E2E: 1,733 passed, two existing
skips and one Bit Cloud request failure in the unchanged React Native capsule
comparison. That case passed unchanged on a serial rerun. The revised remaining
core-environment comparison passed both focused and full runs. Platform CI is
pending; local Node lint remains unavailable because tsc is missing.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Implemented in 652441e39.

Upstream history indexing sync

Merged upstream through 7c0228a4f (Bit 2.2.163), following c15f6da17.
The delta contains history/export lookup indexing, the version bump and stale
TypeScript suppression removal. Rust history queries now index supplied versions
once per walk, preserve the first object for duplicate hashes and use indexed
stop boundaries. History population indexes existing hashes and accumulated
versions, preserving insertion order while replacing duplicate accumulated rows.

The upstream population change has one observable delta: full traversal of a
merge diamond now returns each shared ancestor once. Running the actual method
extracted from both upstream revisions confirmed this difference and unchanged
default traversal. The Rust regression failed on the previous implementation
and passes after the port. Additional regressions preserve first-object lookup,
stop boundaries and missing-parent results. These are explicit upstream-delta
checks; the released CLI remains the oracle for unchanged behavior.

Existing native export/history collection already uses indexed visited sets.
The upstream export filtering/index reuse and removed suppressions introduce no
additional command contract. Existing native bounds and pre-effect guards remain;
this sync does not claim arbitrary provider or compiler support. The generated
E2E plan follows the upstream source-line change.

Validation: all 1,816 workspace tests, formatting, Clippy, Dylint, rustdoc and
generated plan/census/asset/scope checks pass. Full E2E: 1,733 passed, two existing
skips and one Bit Cloud fetch failure during released-CLI setup for the existing
nonstandard-main capsule case. That case passed unchanged on a serial rerun.
The regenerated plan also fixes the prior PR lint job's stale graph-test line
reference when GitHub combines the branch with the updated upstream master.
Platform CI for this sync is pending; local Node lint still lacks tsc.

@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Delivered in commit 0b874a04e5ac475ee17f0a2d044b700d29f40e8e on upstream PR #10813.

Replaced the qualified built-in compiler path's handwritten transpiler with Rust-owned selection, dependency/documentation cache publication, output planning, package linking and reporting around the external TypeScript tool.

Fourteen differential cases compare emitted JavaScript/source-map bytes, diagnostics, repeated compilation, changed selection, copied files and line endings, injected/root packages, optional dependency metadata, CI/colors and partial writes. Cold documentation caches after dependency rewiring now have an AST proof for bounded data-only console logging; a negative control catches loss of native execution. Further negative controls catch missing loading output and corrupted source maps. Preload tests reject Bit runtime imports for valid compilation and syntax diagnostics.

The external TypeScript/parser tools still resolve through installed distribution metadata. Custom environments/providers, type generation, rich documentation misses, colliding/binary outputs and unqualified concurrent report/failure ordering remain open. This is partial progress on zkochan/bit#395, not completion of the Rust port. Windows provisioning now includes the compiler suite.

Validation: formatting, Clippy, Dylint, rustdoc, generated-file/asset/scope checks and all 1,814 workspace tests pass. All 17 focused cases pass. Final full E2E: 1,746 passed, two released-command Bit Cloud failures, two existing skips. Both failures passed unchanged on a serial rerun. Local Node lint still lacks tsc; platform CI is pending for this head.

The preceding head's E2E shard 3 failed on a timed pnpm progress frame. Independent Node-only replay reproduces that variation; its narrowly bounded comparison fix follows separately.

@zkochan

zkochan commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Delivered in commit b7117193bd456eae5b4bb8cbe593858ae4189f8d on upstream PR #10813.

The E2E shard 3 failure on the preceding head came from one timed pnpm progress frame: the native run printed “resolved 1” before the two-package store banner, while the Node control coalesced that first frame.

Independent Node-only replays of the same restored fixture reproduce both outputs under different scheduling. Apart from elapsed times and that initial frame, the full outputs are identical. The comparison now recognizes this specific zero-added one-to-two resolution advance and the released padded/unpadded banner forms. It retains every later transition, final counter, error, report, provider assertion and filesystem comparison. Other advances, reverse counters, transfer/addition changes and malformed terminal controls remain exact.

Negative controls using both the complete Node replays and the recorded CI failure fail with the old comparison and pass with the fix. No production command behavior, retries or timeouts were changed.

Validation: formatting, Clippy, Dylint, rustdoc, generated-file/asset/scope checks and all 1,814 workspace tests pass. All 17 focused progress/provider cases pass. Full E2E: 1,749 passed, one Bit Cloud fixture-creation failure, two existing skips. The failed case passed unchanged on a serial rerun. Local Node lint still lacks tsc; new-head platform CI is pending.

@zkochan

zkochan commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Commit: 887a5ce35.

Rust now owns built-in Node/React single-component JSON test orchestration: selection, loader caches, test discovery, reports, coverage-report consumption and command history. Jest and Babel remain external tools with explicit JavaScript configuration adapters; the installed distribution still provides tool metadata.

Twenty differential cases cover TypeScript/TSX, snapshots, exclusions, assertion failures, pending/todo tests, exit codes, direct process exit, process arguments, existing/test-created coverage and cleanup failures without replay. A separate fixture regression prevents read-only directories from retaining reference-run output. Independent Node replays qualify the two possible completion orders in the parallel-file fixture; other output and filesystem assertions remain exact apart from start/duration fields.

The Windows compiler report now normalizes emitted-path separators, addressing the preceding head's provisioning failures. Windows provisioning also runs the tester comparisons.

Validation: formatting, Clippy, Dylint, rustdoc and all 1,816 workspace tests pass. All 20 focused tester cases pass. Full E2E: 1,769 passed, two Bit Cloud failures in existing fixtures and two existing skips; both failed cases pass unchanged on serial rerun. Generated plan/census, asset, scope and public-data checks pass. Local Node lint lacks tsc. Platform CI for this batch is pending.

Text reporting, multiple component/environment groups, explicit test files, coverage collection flags, JUnit, snapshot-update flags, custom providers and watch/debug modes remain open. This is a checkpoint toward issue 395, not completion of the remaining runtime milestones. Yarn remains excluded.

@zkochan
zkochan force-pushed the rust-workspace-materialization branch 2 times, most recently from d86c464 to 0babf88 Compare November 1, 2026 07:40
…es, test, update, validate, version, version-history, watch, whoami, and workspace-command modules (slices 16362-16481)
…ient-transfer, bit-dependency-scanner, bit-ignore, and bit-install modules (slices 16482-16601)
@zkochan
zkochan marked this pull request as ready for review November 3, 2026 19:32
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add a hybrid Rust Bit CLI with native workspace and scope operations

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🐞 Bug fix 🕐 40+ Minutes

Grey Divider

AI Description

• Adds a Rust bit CLI for supported commands while preserving Node CLI fallback.
Diagram

graph TD
  User["Bit user"] --> CLI["Rust CLI"] --> Dispatch["Native dispatch"] --> Commands["Rust commands"] --> Store["Workspace and scope"]
  Dispatch --> Fallback["Node CLI"]
  Commands --> Installer["pnpm engine"]
  Commands --> Transport["Scope transport"]
  Transport --> Store
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Retain Node as the sole command runtime
  • ➕ Avoids duplicating Bit behavior during the transition.
  • ➖ Cannot deliver the native command paths and performance sought by this PR.
2. Require complete Rust command coverage before release
  • ➕ Would present a simpler runtime boundary to users.
  • ➖ Delays usable native commands and requires replacing unsupported Bit integrations at once.

Recommendation: The incremental hybrid approach is appropriate for this scope: explicit declines preserve access to existing commands while native behavior gains parity coverage. Reviewers should treat the command table as coverage of dispatch, not proof of independence from the JavaScript host; the documented boundary census remains important.

Files changed (57) +12922 / -0

Enhancement (25) +6316 / -0
main.rsIntroduce the Rust bit executable +53/-0

Introduce the Rust bit executable

• Runs supported commands in process and invokes Node CLI discovery and delegation otherwise.

native/cli/src/main.rs

commands.rsRegister native command handlers +262/-0

Register native command handlers

• Maps command names and aliases to Rust implementations across workspace, scope, and tooling operations.

native/cli/src/commands.rs

native.rsImplement guarded native dispatch +107/-0

Implement guarded native dispatch

• Supports explicit native opt-out and returns declined inputs to the Node fallback with diagnostic warnings.

native/cli/src/native.rs

delegate.rsPreserve Node CLI behavior on fallback +120/-0

Preserve Node CLI behavior on fallback

• Executes the discovered Node CLI with the original arguments and environment, accounting for Unix and Windows process behavior.

native/cli/src/delegate.rs

discovery.rsFind an installed Node Bit CLI +317/-0

Find an installed Node Bit CLI

• Locates an existing CLI through configured, checkout, bvm, and PATH locations without installing one.

native/cli/src/discovery.rs

host.rsBridge retained JavaScript host operations +316/-0

Bridge retained JavaScript host operations

• Provides Rust-side access to Bit host behavior still needed by selected native command paths.

native/cli/src/host.rs

host.jsExpose Bit host operations to Rust +1314/-0

Expose Bit host operations to Rust

• Implements the JavaScript side of the hybrid CLI's retained host integrations.

native/cli/src/host/host.js

gc.rsRoute native garbage collection and restoration +346/-0

Route native garbage collection and restoration

• Handles supported bare-scope and workspace collection inputs and declines unsupported configurations before collection effects.

native/cli/src/commands/gc.rs

graph.rsTrace bare-scope collection roots +354/-0

Trace bare-scope collection roots

• Builds object reachability for scope garbage collection while retaining referenced histories and versions.

native/cli/src/commands/gc/bare/graph.rs

restore.rsRestore collected scope objects +199/-0

Restore collected scope objects

• Adds native backup-restoration handling, including overwrite controls and filesystem checks.

native/cli/src/commands/gc/restore.rs

init.rsScaffold CI onboarding natively +206/-0

Scaffold CI onboarding natively

• Plans repository onboarding, checks supported workspace configuration, and coordinates workflow and agent-file generation.

native/cli/src/commands/ci/init.rs

recovery.rsHandle merge abort in the native workspace engine +397/-0

Handle merge abort in the native workspace engine

• Coordinates component and lane merge-abort options, restoration, reporting, and optional installation.

native/cli/src/commands/recovery.rs

resume_export.rsRoute native pending-export recovery +102/-0

Route native pending-export recovery

• Introduces command handling for resuming or cleaning up supported export states.

native/cli/src/commands/resume_export.rs

removal.rsDelete pending file-remote transfer directories +127/-0

Delete pending file-remote transfer directories

• Adds native handling for supported pending-directory cleanup actions.

native/cli/src/commands/remote_action/file/removal.rs

lib.rsIntroduce shared scope transport +39/-0

Introduce shared scope transport

• Exposes file and HTTP remote transport, object transfer, tar, resolution, configuration, and cancellation modules.

native/client-transfer/src/lib.rs

http.rsImplement HTTP scope communication +377/-0

Implement HTTP scope communication

• Adds the HTTP transport used by native scope operations.

native/client-transfer/src/http.rs

lib.rsIntroduce native dependency scanning +314/-0

Introduce native dependency scanning

• Provides shared scanning and classification facilities for workspace dependency handling.

native/dependency-scanner/src/lib.rs

lib.rsIntroduce shared ignore-rule handling +99/-0

Introduce shared ignore-rule handling

• Provides native ignore matching for workspace file discovery.

native/ignore/src/lib.rs

lib.rsIntroduce the installation crate +28/-0

Introduce the installation crate

• Exposes installation, dependency, workspace, manifest, linking, and policy modules to native commands.

native/install/src/lib.rs

engine_call.rsRun the pinned pnpm engine from Rust +274/-0

Run the pinned pnpm engine from Rust

• Executes installation on a dedicated engine thread and returns installation statistics and build requirements.

native/install/src/engine/run/engine_call.rs

lib.rsIntroduce native object and workspace operations +112/-0

Introduce native object and workspace operations

• Exports the object-import crate's component history, materialization, transfer, and workspace-engine facilities.

native/object-import/src/lib.rs

visibility.rsPreserve lane component visibility +339/-0

Preserve lane component visibility

• Handles lane visibility when reconciling components, including hidden entries.

native/object-import/src/workspace/engine/command/lane_context/visibility.rs

merge_history.rsExpose native history-merge operations +166/-0

Expose native history-merge operations

• Provides the object-history merge interface used by native command paths.

native/object-import/src/merge_history.rs

jsonc.rsPreserve editable workspace JSONC +169/-0

Preserve editable workspace JSONC

• Introduces document handling for configuration with comments and formatting-sensitive edits.

native/workspace-config/src/jsonc.rs

lib.rsExpose workspace configuration utilities +179/-0

Expose workspace configuration utilities

• Provides reusable configuration, path, scope, and variant facilities to the native crates.

native/workspace-config/src/lib.rs

Bug fix (4) +706 / -0
virtual_store_guard.rsGuard virtual-store installation state +115/-0

Guard virtual-store installation state

• Adds checks around installation state before the native engine proceeds.

native/install/src/engine/virtual_store_guard.rs

lockfile_attrs.rsInspect lockfile filesystem attributes +102/-0

Inspect lockfile filesystem attributes

• Supports installation safety checks for lockfile conditions, including symlinked lockfiles.

native/install/src/engine/lockfile_attrs.rs

main.rsRestore main models on lane merge abort +131/-0

Restore main models on lane merge abort

• Validates saved main-component objects and republishes them during recovery rather than leaving merged heads in place.

native/object-import/src/workspace/engine/command/recovery/restore/main.rs

hidden.rsProtect hidden lane entries during export +358/-0

Protect hidden lane entries during export

• Keeps hidden cross-scope updates distinct from promoted lane components.

native/object-import/src/workspace/engine/command/outbound/lane_model/hidden.rs

Tests (9) +1824 / -0
main_tests.rsTest main-model recovery validation +43/-0

Test main-model recovery validation

• Exercises validation for the saved component objects used during merge abort.

native/object-import/src/workspace/engine/command/recovery/restore/main_tests.rs

tests.rsExercise history merge ordering and scale +424/-0

Exercise history merge ordering and scale

• Adds history-merge regressions, including ordering and larger-input cases.

native/object-import/src/merge_history/tests.rs

main.rsRegister native end-to-end suites +17/-0

Register native end-to-end suites

• Establishes the entry point for ported Bit CLI E2E coverage.

native/cli/tests/e2e/main.rs

helper.rsProvide differential E2E fixtures +542/-0

Provide differential E2E fixtures

• Adds shared setup and command helpers for comparisons with the released Bit CLI.

native/cli/tests/e2e/helper.rs

gc.rsCompare native collection behavior +278/-0

Compare native collection behavior

• Adds end-to-end coverage for garbage collection and restoration paths.

native/cli/tests/e2e/commands/gc.rs

native.rsVerify native CI onboarding +278/-0

Verify native CI onboarding

• Checks onboarding output and filesystem effects, including platform-sensitive paths.

native/cli/tests/e2e/harmony/ci_sync/onboarding/native.rs

abort_merge_lane.rsRegress lane merge-abort restoration +131/-0

Regress lane merge-abort restoration

• Tests restoration of bitmap, lane objects, source files, and newly introduced component directories.

native/cli/tests/e2e/harmony/lanes/abort_merge_lane.rs

bench-native-command.pyBenchmark native command execution +101/-0

Benchmark native command execution

• Adds repeatable measurements for comparing native command behavior and performance.

scripts/rust/bench-native-command.py

preload.cjsAlign the released installer reference +10/-0

Align the released installer reference

• Resolves the E2E reference installer to the published pnpm 12.16 addon without replacing Bit implementation files.

scripts/rust/pnpm-oracle/preload.cjs

Documentation (6) +2684 / -0
rust-cli.mdDocument native command coverage and fallback +776/-0

Document native command coverage and fallback

• Explains setup, dispatch, supported command modes, and remaining boundaries of the hybrid CLI.

docs/rust-cli.md

native-boundaries.mdInventory native runtime boundaries +550/-0

Inventory native runtime boundaries

• Records generated call-site evidence for declines, host use, process launches, and JavaScript runtime dependencies.

docs/rust/native-boundaries.md

native-install.mdDocument native installation behavior +302/-0

Document native installation behavior

• Describes the installation port and its compatibility boundaries.

docs/rust/native-install.md

upstream-sync-2026-10-26.mdRecord upstream synchronization +908/-0

Record upstream synchronization

• Documents the upstream changes incorporated into the Rust port and their qualification context.

docs/rust/upstream-sync-2026-10-26.md

AGENTS.mdGuide contributors working on the native CLI +147/-0

Guide contributors working on the native CLI

• Adds repository-specific development and validation instructions.

native/AGENTS.md

CLAUDE.mdLink native agent guidance +1/-0

Link native agent guidance

• Adds a short entry point for the native development instructions.

native/CLAUDE.md

Other (13) +1392 / -0
rust.ymlValidate the Rust CLI across platforms +394/-0

Validate the Rust CLI across platforms

• Adds formatting, lint, documentation, workspace-test, E2E, and distribution CI jobs for the native workspace.

.github/workflows/rust.yml

rust-scope.ymlAdd scope-focused Rust CI +33/-0

Add scope-focused Rust CI

• Adds a dedicated workflow for native scope validation.

.github/workflows/rust-scope.yml

Cargo.tomlDefine the multi-crate Rust workspace +122/-0

Define the multi-crate Rust workspace

• Registers the CLI and supporting crates, pins pnpm engine Git dependencies, and configures lint and build profiles.

native/Cargo.toml

config.tomlConfigure Cargo for the native project +8/-0

Configure Cargo for the native project

• Supplies the Cargo configuration used by the pnpm-managed Rust workspace.

native/.cargo/config.toml

rust-toolchain.tomlPin the Rust toolchain +3/-0

Pin the Rust toolchain

• Records the toolchain version for reproducible native builds.

native/rust-toolchain.toml

package.jsonExpose native build and validation scripts +28/-0

Expose native build and validation scripts

• Defines pnpm project settings and scripts for building and checking the Rust workspace.

native/package.json

pnpm-workspace.yamlEnable pnpm-managed Cargo workspace setup +5/-0

Enable pnpm-managed Cargo workspace setup

• Configures pnpm workspace integration for the native project.

native/pnpm-workspace.yaml

pnpm-lock.yamlLock native pnpm project dependencies +319/-0

Lock native pnpm project dependencies

• Records resolved dependencies for the new native pnpm project.

native/pnpm-lock.yaml

bit-sync.ymlProvide a CI sync workflow template +111/-0

Provide a CI sync workflow template

• Adds a bundled workflow asset for native CI onboarding.

native/cli/src/commands/ci/init/bit-sync.yml

bit-release.ymlProvide a release workflow template +65/-0

Provide a release workflow template

• Adds a bundled release workflow asset for native CI onboarding.

native/cli/src/commands/ci/init/bit-release.yml

native-boundaries.mjsGenerate the runtime-boundary census +70/-0

Generate the runtime-boundary census

• Produces and checks the documented inventory of remaining native-to-JavaScript boundaries.

scripts/rust/native-boundaries.mjs

e2e-port-plan.mjsCheck E2E porting inventory +203/-0

Check E2E porting inventory

• Maintains generated coverage accounting for cases ported into the native test suite.

scripts/rust/e2e-port-plan.mjs

check-ci-scaffold.mjsValidate bundled onboarding assets +31/-0

Validate bundled onboarding assets

• Checks that the CI scaffolding shipped with the native CLI remains consistent.

scripts/rust/check-ci-scaffold.mjs

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider


Action required

1. A failed move leaves components misplaced 🐞 Bug ☼ Reliability ⭐ New
Description
run_workspace moves component sources before calling the fallible linker, without restoring them
if linking fails. When that call errors, the command exits before committing the bitmap, leaving it
pointed at the component’s old location.
Code

native/cli/src/commands/move_paths.rs[R83-86]

+        let identities = plan.identities();
+        if !identities.is_empty() {
+            output.status(&format!("loading {} component(s)", identities.len()));
+            linker.link(root, plan.bitmap(), &identities, false, chalk)?;
Evidence
The move is a filesystem rename; linking can fail afterward, and bitmap publication occurs only
after linking succeeds.

native/cli/src/commands/move_paths.rs[82-93]
native/object-import/src/component_move.rs[79-90]
native/cli/src/commands/add/mutation.rs[136-164]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A linker failure after `move_sources` leaves component directories moved while the bitmap retains their old paths.

## Fix Focus Areas
- native/cli/src/commands/move_paths.rs[82-93]
- native/object-import/src/component_move.rs[79-90]

## Recommended Fix
Make the source move and subsequent linking/bitmap publication a recoverable operation. On every failure after a rename, restore the original source locations and any linker changes before returning the error.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Config generation can write outside workspaces 🐞 Bug ⛨ Security ⭐ New
Description
write_extending_in_dir joins bitmap-derived component directories to the workspace root without
checking their resolved containment. With ws-config write --no-dedupe, a rootDir such as
../outside makes generated configuration files land outside the workspace.
Code

native/cli/src/commands/ws_config/write.rs[R338-348]

Evidence
Bitmap loading retains rootDir without traversal validation; the no-dedupe path keeps it as a
target, and the writer creates directories and files beneath an unchecked join.

native/install/src/workspace/bitmap.rs[262-280]
native/cli/src/commands/ws_config/clean.rs[198-209]
native/cli/src/commands/ws_config/write.rs[176-194]
native/cli/src/commands/ws_config/write.rs[330-349]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Bitmap component directories can contain traversal segments, and config generation writes to those paths without enforcing workspace containment.

## Fix Focus Areas
- native/cli/src/commands/ws_config/clean.rs[198-209]
- native/cli/src/commands/ws_config/write.rs[176-194]
- native/cli/src/commands/ws_config/write.rs[338-348]

## Recommended Fix
Reject component directories containing traversal or absolute-path components before planning writes. Check resolved destinations, including existing symlink ancestors, remain within the workspace before creating directories or writing files.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Restoration can delete a live object 🐞 Bug ☼ Reliability
Description
copy_file removes an existing destination before attempting the fallible backup copy when
--restore-overwrite is set. If the copy fails, restoration rolls back the backup staging directory
but does not restore the deleted destination object.
Code

native/cli/src/commands/gc/restore/copy.rs[R92-94]


View high (24)
4. Failed exports leave local refs advanced 🐞 Bug ☼ Reliability
Description
complete_export calls commandOutboundStage, which writes objects and remote refs, before running
fallible package work and finalization. A package callback or linking failure exits without
publishing the remaining export controls or rolling back those staged local changes.
Code

native/cli/src/commands/export.rs[R201-205]


5. A remote can poison imported objects 🐞 Bug ⛨ Security
Description
write_object trusts an archive entry's hash when persisting its compressed object, while parse
ignores the hash and size in that object's header. A remote supplying forged bytes under a known
object name can therefore place mismatched data in the local store, including a component model
under another component's identity.
Code

native/install/src/import/objects.rs[R36-50]


6. Failure tests reject their expected errors 📎 Requirement gap ≡ Correctness
Description
The merge failure tests assert that actual.status.success() even when the fixture deliberately
triggers a rejected package callback or builder error. Those callbacks throw or return errors, so
the tests stop at the success assertion before comparing failure status and persisted-state parity.
Code

native/cli/tests/e2e/harmony/merge_callbacks/package.rs[R15-18]


7. PR preparation can leave source files changed 🐞 Bug ≡ Correctness
Description
execute_pr restores only .bitmap, scope.json, and index.json after snap_and_export_pr
switches to an existing lane. If that lane has different component files, success or failure cleanup
leaves those files checked out while restoring metadata for the original lane.
Code

native/cli/src/commands/ci/pr.rs[R196-202]


8. PR checks can be skipped despite user flags 🐞 Bug ≡ Correctness
Description
execute_pr records --build, --strict, and --skip-tasks but never uses them when it invokes
snap --skip-tests. A caller requesting those controls can receive a successful PR result after
only the ad-hoc failing-spec scan, without the requested pipeline behavior.
Code

native/cli/src/commands/ci/pr.rs[R289-298]


9. Failed checkout does not stop CI merge 🐞 Bug ≡ Correctness
Description
execute_merge discards an error from git checkout -B but still records the requested branch as
target_branch. If checkout fails, tagging and committing continue on the branch that remained
checked out, and the later push still targets the requested branch name.
Code

native/cli/src/commands/ci/merge.rs[R150-156]


10. Unreadable staging records risk deletion 🐞 Bug ☼ Reliability
Description
load_staged_snaps returns an empty root list for every staged-snaps read error, including an
unreadable existing file. Workspace garbage collection then proceeds without retaining versions
named only by that staging record and can select their settled objects for deletion.
Code

native/cli/src/commands/gc/graph/models.rs[R129-132]


11. Malformed merge records risk deletion 🐞 Bug ☼ Reliability
Description
load_unmerged_roots accepts valid JSON that is not an array as an empty set of pending-merge
roots. If unmerged.json has that invalid shape, collection continues without its merge-history
protection instead of stopping at the malformed recovery record.
Code

native/cli/src/commands/gc/graph/models.rs[R203-205]


12. Feature branches can expose sync credentials 🐞 Bug ⛨ Security
Description
bit-sync.yml runs on pushes to nearly every branch and gives that job write permissions, a
checkout token, and the Bit service token. A contributor who can push a feature branch can change
the workflow on that branch and have its push run with those credentials before the change is
merged.
Code

native/cli/src/commands/ci/init/bit-sync.yml[R24-28]


13. Garbage collection can remove outside files 🐞 Bug ⛨ Security
Description
Both object inventories accept a symlinked objects/ directory, while collection later reconstructs
paths beneath that bucket without checking its resolved location. When an unreachable object is
found through such a link, workspace collection can unlink the outside file and backup-enabled
collection can move it outside its original directory.
Code

native/cli/src/commands/gc/bare/repository.rs[R25-29]


14. Export cleanup can delete outside the scope 🐞 Bug ⛨ Security
Description
pending_path joins a validated client ID beneath pending-objects, but file::prepare never
checks whether that parent is a symlink. With a linked parent, resume-export --delete --force can
recursively remove a matching directory at the link target rather than a pending directory in the
configured file remote.
Code

native/cli/src/commands/remote_action/file.rs[89]


15. Pull requests can bypass the scope check 🐞 Bug ⛨ Security
Description
The Rust scope workflow executes check-scope.sh from the checked-out pull-request revision rather
than from a trusted revision. Because the checker's allowlist permits changes under scripts/rust/,
a pull request can alter the checker to pass while also changing forbidden paths.
Code

.github/workflows/rust-scope.yml[33]


16. Archives ship without a clean-install test 📎 Requirement gap ☼ Reliability
Description
The distribution workflow builds and uploads archives but never installs or executes the produced
package without the installed Node Bit CLI. The non-musl archives bundle the released Node CLI,
while the musl archive explicitly requires a separately installed CLI and compatible Node runtime,
so distribution independence is not verified.
Code

.github/workflows/rust.yml[R389-392]


17. Known failures still count as qualification 📎 Requirement gap ≡ Correctness
Description
The upstream synchronization record calls a run validation while recording two skipped cases, two
Bit Cloud fixture failures, and Windows differential tests still awaiting CI. Those gaps leave
required platform and assertion coverage unverified even though the record presents the run as the
latest qualification.
Code

docs/rust/upstream-sync-2026-10-26.md[R806-809]


18. Bare cleanup deletes orphaned versions 🐞 Bug ≡ Correctness
Description
local_components seeds the bare collector from component heads and detached heads, but not from
orphanedVersions. When an orphaned version is reachable through none of those heads or a lane or
dependency reference, cleanup classifies its object and referenced files as unreachable and moves
them out of the scope.
Code

native/cli/src/commands/gc/bare/graph.rs[R95-99]


19. File-remote cleanup deletes local exports 🐞 Bug ≡ Correctness
Description
file::prepare replaces a configured file-remote path beneath a workspace with that workspace's own
scope path before checking the remote directory. If a user runs resume-export --delete for such a
remote and its export ID matches a local pending directory, the removal action targets that local
directory instead of the remote's.
Code

native/cli/src/commands/remote_action/file.rs[R21-24]


20. A package name can redirect installer writes 🐞 Bug ⛨ Security
Description
component_package_name accepts a configured package-name template without checking whether it is a
safe path component, and link_component joins that value beneath node_modules. When a workspace
supplies a name such as ../../outside or an absolute path, installation writes a generated
manifest and links outside the intended package directory.
Code

native/install/src/links/components.rs[R183-186]


21. Lane imports overwrite known main heads 🐞 Bug ≡ Correctness
Description
persist writes every fetched component head to the MAIN remote-ref file, even when the fetch
selected a lane head. A later main import reads that ref as its known main head, so a lane-only
version can become the baseline for fetching main history.
Code

native/install/src/import/persist.rs[R91-96]


22. Restored objects stay absent from the index 🐞 Bug ≡ Correctness
Description
bare::restore rebuilds a missing scope index from the current objects and writes it before
restoring backup contents. If the backup contains a component or lane object, that object is copied
into objects afterward but has no entry in the newly written index.
Code

native/cli/src/commands/gc/bare.rs[R189-190]


23. Merge reports success after a failed push 🐞 Bug ☼ Reliability
Description
finalize_git_after_tag discards failures from the bitmap commit, push, pull/rebase, and retry
push. When any required Git operation remains unsuccessful, execute_merge nevertheless returns a
successful report saying the pull request was merged, leaving the remote branch unreconciled.
Code

native/cli/src/commands/ci/merge.rs[R270-272]


24. Merge ignores the requested conflict choice 🐞 Bug ≡ Correctness
Description
ensure_on_main_lane always switches with --force-ours and does not consult the validated
auto-merge resolution option. When a caller requests theirs or manual and switching encounters
conflicts, the native merge instead selects ours.
Code

native/cli/src/commands/ci/merge.rs[R189-197]


25. A failed switch leaves lane state unfinished 🐞 Bug ☼ Reliability
Description
install_and_report applies the target lane's workspace changes before calling fallible
installation code, then runs lane completion only if that code succeeds. If provider setup,
workspace projection, or the compile callback returns an error, the command exits after publishing
files but before finalizing lane metadata.
Code

native/cli/src/commands/switch.rs[R176-183]


26. Later restoration failures disappear 🐞 Bug ◔ Observability
Description
report::merge combines only components and addedComponents from the second lane-restoration
phase. If that phase records an installation or compilation failure, or reports failed components or
conflicts, the final text and JSON report retains only the first phase's corresponding fields.
Code

native/cli/src/commands/lane/restoration/report.rs[R134-143]


27. A failed compile can erase prior output 🐞 Bug ☼ Reliability
Description
open_batch opens every generated artifact before writing any of them, and open_file uses
File::create, which immediately truncates an existing file. If opening a later artifact fails, the
command returns an error while earlier artifacts in the batch have already lost their previous
contents.
Code

native/cli/src/commands/compile_cmd/runner/write.rs[R105-109]



Remediation recommended

28. A refused package build reports success 🐞 Bug ≡ Correctness ⭐ New
Description
try_pack returns a successful exit status and report code regardless of errors in the pack result.
If the output archive already exists without --override, packaging is skipped but callers still
receive a successful command result.
Code

native/cli/src/commands/pack_cmd/packer.rs[R58-63]

Evidence
The existing-file branch adds an error and prevents archive creation, while both output modes still
use success codes.

native/cli/src/commands/pack_cmd/packer.rs[52-64]
native/cli/src/commands/pack_cmd/packer.rs[299-324]
native/cli/src/commands/pack_cmd.rs[57-63]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An existing output archive prevents packaging, but `bit pack` exits successfully.

## Fix Focus Areas
- native/cli/src/commands/pack_cmd/packer.rs[52-64]
- native/cli/src/commands/pack_cmd/packer.rs[299-324]

## Recommended Fix
Derive the command exit status and text report code from the pack result's errors. Preserve the error details in JSON and text output while returning failure when no archive was produced.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


29. Remote diagnostics inspect the local scope 🐞 Bug ≡ Correctness ⭐ New
Description
doctor::remote::file uses the selected file remote only for the scope-object check and runs every
other diagnosis against the original local context. A requested remote diagnosis can therefore
report the checkout’s condition rather than the selected remote’s condition.
Code

native/cli/src/commands/doctor/remote.rs[R170-176]

Evidence
The file-remote branch passes path to one diagnosis but passes the unchanged context to all
others; those results become the command output.

native/cli/src/commands/doctor/remote.rs[156-184]
native/cli/src/commands/doctor.rs[120-145]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
File-remote doctor checks other than scope-object validation use the caller's local context.

## Fix Focus Areas
- native/cli/src/commands/doctor/remote.rs[156-184]

## Recommended Fix
Run diagnoses that support remote execution against the selected remote context. Decline unsupported remote diagnoses rather than returning a result computed from the local checkout.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


30. Logout can leave credentials in place 🐞 Bug ☼ Reliability ⭐ New
Description
clear_auth_config converts config read and parse failures into Ok(()) without removing
authentication fields. Following a transient read failure, logout prints a success message and
records successful history although the token remains in the config file.
Code

native/cli/src/commands/logout.rs[R91-96]

Evidence
The helper returns success on read or parse failure, and the caller unconditionally emits the
success message after that return.

native/cli/src/commands/logout.rs[37-46]
native/cli/src/commands/logout.rs[88-106]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Logout reports success when it could not read or parse the credential store and therefore did not clear it.

## Fix Focus Areas
- native/cli/src/commands/logout.rs[37-46]
- native/cli/src/commands/logout.rs[88-106]

## Recommended Fix
Treat failures to read or parse an existing config file as logout failures, and report success only after the authentication fields have been cleared or the file is confirmed absent.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (25)
31. Dry-run cleanup still changes scope files 🐞 Bug ≡ Correctness ⭐ New
Description
Workspace collection writes a rebuilt index.json before Plan::execute checks the dry-run flag,
and bare-scope collection likewise writes its index before its dry-run guard. When the index is
missing, bit gc --dry-run can create it despite the request not to mutate the scope.
Code

native/cli/src/commands/gc.rs[R136-143]

Evidence
Both collection paths write the index before their dry-run checks, and the index writer persists it
to scope/index.json.

native/cli/src/commands/gc.rs[136-147]
native/cli/src/commands/gc/collector/publication.rs[70-75]
native/cli/src/commands/gc/bare.rs[150-163]
native/cli/src/commands/gc/bare/index.rs[66-74]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Both garbage-collection modes can persist a rebuilt index before applying their dry-run guards.

## Fix Focus Areas
- native/cli/src/commands/gc.rs[136-147]
- native/cli/src/commands/gc/bare.rs[150-163]

## Recommended Fix
Keep any rebuilt index in memory for planning and reporting. Write it only on a non-dry-run execution path in both workspace and bare-scope collection.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


32. A failed update can delete the lockfile silently 🐞 Bug ☼ Reliability ⭐ New
Description
When --update is used, install deletes pnpm-lock.yaml through remove_for_update. If the
engine then fails, the code calls restore_after_failure as let _ = ... and discards its result.
If the restore write also fails (for example, permission denied or disk full), the original lockfile
is gone, only the engine error is shown, and nothing tells the user their lockfile was lost. The
Node reference lynx.ts awaits restoreWantedLockfile() without catching it, so a restore failure
is reported there.
Code

native/install/src/engine/run.rs[R44-51]

Evidence
The Rust code throws away the restore result. The upstream TypeScript awaits the restore inside the
catch block, so a restore failure is thrown rather than swallowed. restore_after_failure does a
fallible fs::write.

native/install/src/engine/run.rs[43-51]
native/install/src/engine/lockfile_attrs.rs[75-102]
scopes/dependencies/pnpm/lynx.ts[466-487]
scopes/dependencies/pnpm/lynx.ts[528-545]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
After a failed `--update` install, the error from restoring the deleted `pnpm-lock.yaml` is discarded, so the lockfile can be lost with no notice.

## Fix Focus Areas
- native/install/src/engine/run.rs[46-51]

## Recommended Fix
Replace `let _ = lockfile_attrs::restore_after_failure(...)` with `lockfile_attrs::restore_after_failure(root, removed_lockfile)?;` before `return Err(error);`. This matches the Node reference, where the restore error is thrown. If you want to keep both errors, combine the restore error with the engine error instead.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


33. A failed checkout can delete source files 🐞 Bug ☼ Reliability
Description
publish_sources removes planned workspace files before writing any replacements and has no
rollback for those removals. If a later removal or materialization fails, checkout returns an error
after earlier files have already been deleted.
Code

native/object-import/src/workspace/engine/command/apply_command.rs[R82-89]


34. Onboarding can write outside the repository 🐞 Bug ⛨ Security
Description
workflows constructs paths beneath .github without checking whether that directory is a symlink,
and the agent-instructions writer likewise follows an existing AGENTS.md symlink. Running
onboarding in a repository containing either link can create workflow files or update instructions
at its external target.
Code

native/cli/src/commands/ci/init/files.rs[R43-47]


35. Large remote replies can exhaust memory 🐞 Bug ⛨ Security
Description
Network::graphql, Network::list, and the action path parse successful remote replies with
Response::json() without a response-size ceiling. A configured or compromised remote can return an
arbitrarily large body to any of these requests, exhausting client memory before JSON validation
completes.
Code

native/client-transfer/src/http.rs[R317-326]


36. Concurrent edits can be lost during format 🐞 Bug ☼ Reliability
Description
write::validate checks formatter inputs before the command callback, but publish later checks
only that each path is still a regular file. An edit made after validation and before publication is
overwritten by formatter output derived from the older source text.
Code

native/cli/src/commands/format_cmd/runner/write.rs[R84-88]


37. Hard delete on a file remote can remove nested components 🐞 Bug ≡ Correctness
Description
wildcard in the hard-delete selector lets * match any byte, including /, so scope/ui/*
matches scope/ui/form/button as well as scope/ui/button. Over HTTP the server filters the list
before this matcher runs. A file remote is filtered only by this matcher, so `bit delete --hard
'scope/ui/*'` against a file remote deletes components in deeper namespaces that the user's pattern
was not meant to select.
Code

native/cli/src/commands/delete/hard/select.rs[R124-127]


38. PR lane preservation is ignored 🐞 Bug ≡ Correctness
Description
snap_and_export_pr never reads opts.keep_lane and attempts lane creation followed by an ordinary
switch when creation fails. With bit ci pr --keep-lane, an existing remote lane therefore takes
the non-preserving path instead of the lane-reuse flow requested by the caller.
Code

native/cli/src/commands/ci/pr.rs[R281-287]


39. A failed policy write leaves an import 🐞 Bug ☼ Reliability
Description
Prepared::commit invokes policy.commit() only after its file, history, and bitmap rollback scope
has completed. If that separate policy write fails, import returns an error while the component
files and bitmap have already been published.
Code

native/object-import/src/workspace/engine/command/inbound/write/publication.rs[R49-55]


40. Moved components keep stale file links 🐞 Bug ≡ Correctness
Description
plan_file_links treats any existing symlink as reusable without comparing its destination to the
current component file. After a component path or file mapping changes, installation skips rewiring
that link and reports it as existing even when it still points to the old path.
Code

native/install/src/links/components.rs[R224-230]


41. Release archives can bundle poisoned code 🐞 Bug ⛨ Security
Description
The distribution job downloads a base BVM archive and passes it to package-bvm.py without checking
its digest against a trusted value. If the download origin serves a substituted but structurally
valid archive, the uploaded native package incorporates its modified Node fallback, which users can
later execute on delegated commands.
Code

.github/workflows/rust.yml[R427-428]


42. Lane deletes silently skip required dependency pins 🐞 Bug ≡ Correctness
Description
prepare_policy turns every error from Policy::prepare_many into "no policy edit" with
.ok().flatten(), so the delete command commits the component deletion without the
workspace.jsonc pins its own plan requires. This happens when there are pins (components deleted
from a lane that still have dependents in the workspace) and workspace.jsonc fails to read or
parse, a pin's version is not semver or a hash, the save prefix can't be resolved or a package name
is empty. The command still reports success and prints no "pinned deleted components" section, so
dependents can no longer install the deleted component from main.
Code

native/cli/src/commands/delete/preparation.rs[R64-70]


43. End-to-end jobs run pure clock tests 📘 Rule violation ➹ Performance
Description
The clock_phase, output, history_oracle/raw, and history/clock test files place unit cases
for helper calculations, assert_errors, snapshot validation, and timestamp comparisons under the
E2E test hierarchy. Because the cases use only literal or in-memory inputs and never launch the CLI
or use a workspace, they add E2E job overhead instead of running as focused unit tests.
Code

native/cli/tests/e2e/commands/add/support/clock_phase/tests.rs[R1-5]


44. Native commands still need Node 📎 Requirement gap ≡ Correctness
Description
Host::start launches the Node.js CLI's own executable and the embedded host loads modules from the
published @teambit/bit package. Any supported native command that reaches a host callback
therefore remains dependent on the installed Node Bit runtime, so it cannot satisfy Rust-owned
service completion.
Code

native/cli/src/host.rs[R1-4]


45. Dependency edits can overwrite outside files 🐞 Bug ⛨ Security
Description
component_json_path uses a .bitmap entry's root_dir without checking containment, and its
is_file() check accepts symlink targets. A dependency mutation selecting an entry with a
traversing root directory or linked component.json then writes the edited configuration to that
outside path.
Code

native/cli/src/commands/deps/mutation.rs[R142-143]


46. Bare-scope cleanup can delete versions still in use 🐞 Bug ≡ Correctness
Description
Collector::history in the bare-scope collector walks only a Version's parents array and never
queues unrelated.head. A version reachable only through that edge, along with the files and
artifacts it references, is left out of retained, so gc deletes it once it is older than the
write-protection margin, even though the workspace collector and the version-history builder both
treat that edge as ancestry.
Code

native/cli/src/commands/gc/bare/graph.rs[R166-171]


47. Generated CI runs mutable privileged code 🐞 Bug ⛨ Security
Description
Both generated workflows run bit-tasks/init@v2 by a mutable tag even though their jobs grant
repository and pull-request write permissions. If that tag is moved to malicious action code, the
next authorized sync or merged-PR release run executes it with a write-capable workflow token before
the SHA-pinned action runs.
Code

native/cli/src/commands/ci/init/bit-sync.yml[90]


48. Failed test discovery can pass CI 🐞 Bug ☼ Reliability
Description
The end-to-end job captures cargo test --list through Bash process substitution, whose failure
status is not propagated to mapfile. If discovery exits after producing a partial list, the job
runs only the discovered test filters and can finish successfully without running the rest of that
shard.
Code

.github/workflows/rust.yml[R198-202]


49. Login token is exposed in the process list 🐞 Bug ⛨ Security
Description
Resolver::run passes the global user.token to the spawned node -e resolver as a plain
command-line argument (.arg(self.token...)). Any workspace whose scope sets resolverPath sends
the bearer token through argv on every remote resolution, so other local users and process monitors
can read it via ps or /proc//cmdline while the child runs. The Node CLI calls the resolver
in-process and never puts the token in argv.
Code

native/client-transfer/src/resolver.rs[R111-114]


50. Scope cleanup can delete versions still in use 🐞 Bug ☼ Reliability
Description
collect_flattened_deps returns an empty list whenever the flattenedDependenciesRef object is
missing, unreadable (any I/O error), or not a JSON array. Because of that, gc never marks those
dependency versions as live and can permanently delete Version/Source objects that a kept
version still depends on. A transient read error or corrupt ref is treated as "no dependencies" when
it should stop the collection.
Code

native/cli/src/commands/gc/graph.rs[R365-370]


51. Abandoned tests leave workspaces behind 📘 Rule violation ⚙ Maintainability
Description
runs_dir stores each end-to-end process under a shared bit-native-e2e directory instead of using
a cleanup-scoped temporary workspace. Failed or interrupted runs remain on disk until the six-hour
stale-entry sweep, so test artifacts survive after the test process exits.
Code

native/cli/tests/e2e/helper/setup.rs[R53-56]


52. Mutable actions can gain release access 🐞 Bug ⛨ Security
Description
Both generated workflows execute bit-tasks/init@v2 by a mutable tag in jobs granted repository
write permissions. If that tag is retargeted, the replacement action runs in the sync or release
job, where the workflows also provide GitHub and Bit credentials.
Code

native/cli/src/commands/ci/init/bit-sync.yml[90]


53. Rebuilds can include deleted component files 🐞 Bug ≡ Correctness
Description
populate_single_capsule copies current workspace and distribution files into an existing capsule
without removing files absent from the source. On a later build using the same capsule path, a
deleted source or old distribution file remains available to build steps.
Code

native/cli/src/commands/build_cmd/runner.rs[R250-260]


54. Unrelated text disables dependency caching 🐞 Bug ➹ Performance
Description
no_fs_cache searches raw configuration bytes for the substring no-fs-cache rather than reading a
feature-list value. A comment or unrelated setting containing that text makes status perform fresh
dependency detection and suppress subsequent cache writes.
Code

native/cli/src/commands/status/cache.rs[R37-42]


55. A hostile remote can exhaust client memory on import 🐞 Bug ⛨ Security
Description
parse inflates each fetched object with ZlibDecoder::read_to_end into an unbounded Vec, and
never checks the output against the size declared in the object header or against any limit. The
transfer layer caps only compressed bytes (MAX_OBJECT_BYTES = 128 MiB per entry, 512 MiB per
archive), so a malicious or compromised remote scope can send a small zlib bomb that
persist::write_object inflates during bit import/fetch until the process runs out of memory.
Code

native/install/src/import/objects.rs[R36-39]



Informational

56. A symlink loop in an env folder crashes bit script 🐞 Bug ☼ Reliability
Description
collect_source_files uses path.is_dir(), which follows symlinks, and recurses into every
directory through collect_subdir_files. It never tracks visited paths and never skips symlinked
directories. If an environment component directory contains a symlink back to itself or to an
ancestor (e.g. loop -> .), parse_env_scripts_in_dir recurses until the stack overflows and the
CLI aborts, not just fails with an error.
Code

native/cli/src/commands/script/parser.rs[R71-74]


57. Non-UTF-8 arguments crash the native CLI 🐞 Bug ☼ Reliability
Description
Host::configure builds BIT_NATIVE_HOST_ARGUMENTS with env::args(), and progress_mode also
iterates env::args(). Both panic if any process argument is not valid UTF-8, even though main
deliberately collects args_os() so it can pass such arguments through. Any native command that
starts the JavaScript host with such an argument (for example a non-UTF-8 path on Unix) aborts with
a panic instead of declining to the Node CLI; install.rs, install/request.rs and
status/autosync.rs use the same pattern.
Code

native/cli/src/host.rs[R143-145]


58. Config writer comment wrongly claims atomic writes 🐞 Bug ⚙ Maintainability
Description
The module docs and write() say stores are persisted "atomically", but global() opens
config.json with truncate(true) and writes in place, and the scope path uses fs::write. A
later maintainer who trusts that comment can assume a failed config set or logout cannot leave a
truncated config.json that has lost user.token, which is not true.
Code

native/cli/src/commands/config/stores/writing.rs[R110-116]


View low (1)
59. Issue reports hardcode a divider symbol 📘 Rule violation ⚙ Maintainability
Description
report builds the bit component-issues presentation with a literal Unicode divider and applies
color directly to that string instead of using the shared output formatting toolkit. Every text
report repeats this hardcoded separator, making its section styling inconsistent with
toolkit-managed CLI output.
Code

native/cli/src/commands/component_issues.rs[R24-25]


Grey Divider

⚠️ Warning | Comment size exceeded, inner finding content trimmed Learn more
⚠️ Warning | Comment size exceeded, non finding content trimmed Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider


Action required

1. A package name can redirect installer writes 🐞 Bug ⛨ Security ⭐ New
Description
component_package_name accepts a configured package-name template without checking whether it is a
safe path component, and link_component joins that value beneath node_modules. When a workspace
supplies a name such as ../../outside or an absolute path, installation writes a generated
manifest and links outside the intended package directory.
Code

native/install/src/links/components.rs[R183-186]

Evidence
The configured template becomes the component package name without path validation, then is
interpreted as a filesystem path for manifest and link creation.

native/install/src/workspace/package_name.rs[53-65]
native/install/src/workspace.rs[250-270]
native/install/src/links/components.rs[177-208]
native/install/src/links/root.rs[179-199]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Configured package names can escape the install destination and redirect generated filesystem writes.
## Fix Focus Areas
- native/install/src/workspace/package_name.rs[53-65]
- native/install/src/links/components.rs[183-208]
- native/install/src/links/root.rs[179-199]
## Recommended Fix
Reject absolute paths, parent components, and names that are not valid package identifiers before any package-directory creation or linking. Apply the validation at every filesystem consumer of configured package names.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Lane imports overwrite known main heads 🐞 Bug ≡ Correctness ⭐ New
Description
persist writes every fetched component head to the MAIN remote-ref file, even when the fetch
selected a lane head. A later main import reads that ref as its known main head, so a lane-only
version can become the baseline for fetching main history.
Code

native/install/src/import/persist.rs[R91-96]

Evidence
Lane fetches select lane versions, but persistence uses the literal main ref; subsequent main fetch
planning reads that same ref.

native/install/src/import/plan.rs[76-81]
native/install/src/import/fs_remote.rs[103-115]
native/install/src/import/persist.rs[87-96]
native/install/src/import/persist.rs[147-168]
native/install/src/import/plan.rs[117-139]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Lane-selected component heads are recorded as main remote heads and can misdirect subsequent main imports.
## Fix Focus Areas
- native/install/src/import/persist.rs[91-96]
- native/install/src/import/plan.rs[76-81]
- native/install/src/import/lane.rs[140-159]
## Recommended Fix
Carry the fetch's main-versus-lane context into persistence. Update main refs only from main responses and store lane heads in the appropriate lane-specific refs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Restored objects stay absent from the index 🐞 Bug ≡ Correctness ⭐ New
Description
bare::restore rebuilds a missing scope index from the current objects and writes it before
restoring backup contents. If the backup contains a component or lane object, that object is copied
into objects afterward but has no entry in the newly written index.
Code

native/cli/src/commands/gc/bare.rs[R189-190]

Evidence
The index builder enumerates only the supplied objects; restoration copies backup entries only after
the caller has written that index.

native/cli/src/commands/gc/bare.rs[182-214]
native/cli/src/commands/gc/bare/index.rs[10-30]
native/cli/src/commands/gc/restore.rs[73-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A pre-restore index rebuild omits component and lane objects restored from the backup.
## Fix Focus Areas
- native/cli/src/commands/gc/bare.rs[182-214]
- native/cli/src/commands/gc/bare/index.rs[10-30]
## Recommended Fix
Rebuild the index from the resulting object directory after a successful restore, with an explicit failure/recovery path if indexing fails. Do not publish an index derived solely from pre-restore objects.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View high (9)
4. Merge reports success after a failed push 🐞 Bug ☼ Reliability ⭐ New
Description
finalize_git_after_tag discards failures from the bitmap commit, push, pull/rebase, and retry
push. When any required Git operation remains unsuccessful, execute_merge nevertheless returns a
successful report saying the pull request was merged, leaving the remote branch unreconciled.
Code

native/cli/src/commands/ci/merge.rs[R270-272]

Evidence
Git command failures are converted to errors by run_git, but these results are ignored before the
unconditional success report.

native/cli/src/commands/ci/merge.rs[173-181]
native/cli/src/commands/ci/merge.rs[249-273]
native/cli/src/commands/ci.rs[320-329]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
CI merge declares success even when its required bitmap commit or branch push fails.
## Fix Focus Areas
- native/cli/src/commands/ci/merge.rs[173-181]
- native/cli/src/commands/ci/merge.rs[249-273]
## Recommended Fix
Return a result from Git finalization, distinguish harmless no-change cases from failures, and propagate commit, rebase, and final push failures so the merge report cannot claim success.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Merge ignores the requested conflict choice 🐞 Bug ≡ Correctness ⭐ New
Description
ensure_on_main_lane always switches with --force-ours and does not consult the validated
auto-merge resolution option. When a caller requests theirs or manual and switching encounters
conflicts, the native merge instead selects ours.
Code

native/cli/src/commands/ci/merge.rs[R189-197]

Evidence
The option is accepted and stored, but the switch command uses a fixed conflict flag; the existing
CI implementation maps the option to checkout behavior.

native/cli/src/commands/ci.rs[104-109]
native/cli/src/commands/ci/merge.rs[184-200]
scopes/git/ci/ci.main.runtime.ts[1629-1636]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
CI merge resolves lane-switch conflicts with ours regardless of the caller's selected strategy.
## Fix Focus Areas
- native/cli/src/commands/ci/merge.rs[184-200]
- native/cli/src/commands/ci.rs[104-109]
## Recommended Fix
Pass the validated strategy into the lane switch and preserve manual conflict reporting instead of forcing ours for every invocation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. A failed switch leaves lane state unfinished 🐞 Bug ☼ Reliability ⭐ New
Description
install_and_report applies the target lane's workspace changes before calling fallible
installation code, then runs lane completion only if that code succeeds. If provider setup,
workspace projection, or the compile callback returns an error, the command exits after publishing
files but before finalizing lane metadata.
Code

native/cli/src/commands/switch.rs[R176-183]

Evidence
Apply commits the workspace, installation has propagated error paths, and completion is invoked only
afterward.

native/cli/src/commands/switch.rs[169-188]
native/cli/src/commands/workspace_command/switch.rs[10-31]
native/cli/src/commands/switch/installation.rs[24-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An installation error after applying a switch skips the operation that finalizes lane state.
## Fix Focus Areas
- native/cli/src/commands/switch.rs[169-188]
- native/cli/src/commands/workspace_command/switch.rs[10-31]
## Recommended Fix
Arrange a supported completion or rollback path for every failure after `switch::apply`. Preserve the installation error while ensuring files and lane metadata cannot be left in different states.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Later restoration failures disappear 🐞 Bug ◔ Observability ⭐ New
Description
report::merge combines only components and addedComponents from the second lane-restoration
phase. If that phase records an installation or compilation failure, or reports failed components or
conflicts, the final text and JSON report retains only the first phase's corresponding fields.
Code

native/cli/src/commands/lane/restoration/report.rs[R134-143]

Evidence
The session merges phase results through this function, but rendering reads failure fields that the
merge never copies from the later phase.

native/cli/src/commands/lane/restoration/session.rs[59-74]
native/cli/src/commands/lane/restoration/installation.rs[39-45]
native/cli/src/commands/lane/restoration/report.rs[16-101]
native/cli/src/commands/lane/restoration/report.rs[131-143]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The second restoration phase's failures and conflict state are dropped from the command result.
## Fix Focus Areas
- native/cli/src/commands/lane/restoration/report.rs[16-101]
- native/cli/src/commands/lane/restoration/report.rs[131-143]
- native/cli/src/commands/lane/restoration/session.rs[59-74]
## Recommended Fix
Combine all result fields used by text and JSON rendering, with explicit handling for arrays, error values, and conflict flags. Test failures originating in the second phase.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. A failed compile can erase prior output 🐞 Bug ☼ Reliability ⭐ New
Description
open_batch opens every generated artifact before writing any of them, and open_file uses
File::create, which immediately truncates an existing file. If opening a later artifact fails, the
command returns an error while earlier artifacts in the batch have already lost their previous
contents.
Code

native/cli/src/commands/compile_cmd/runner/write.rs[R105-109]

Evidence
Batch opening continues across files and returns the first error only after prior successful opens;
each successful File::create has already truncated its destination.

native/cli/src/commands/compile_cmd/runner/write.rs[65-75]
native/cli/src/commands/compile_cmd/runner/write.rs[87-109]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Opening an output batch truncates valid prior artifacts before the batch is known to be writable.
## Fix Focus Areas
- native/cli/src/commands/compile_cmd/runner/write.rs[65-109]
## Recommended Fix
Write generated content to temporary sibling files first, validate the batch, and replace destination artifacts only after successful writes. Preserve existing outputs on an open or write failure.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Archives ship without a clean-install test 📎 Requirement gap ☼ Reliability
Description
The distribution workflow builds and uploads archives but never installs or executes the produced
package without the installed Node Bit CLI. The non-musl archives bundle the released Node CLI,
while the musl archive explicitly requires a separately installed CLI and compatible Node runtime,
so distribution independence is not verified.
Code

.github/workflows/rust.yml[R389-392]

Evidence
The workflow's final distribution step only uploads artifacts, while the release documentation
states that most archives combine the native executable with the released Node CLI and that the musl
artifact requires a separately installed Node CLI. Together these citations show that the required
clean-install independence test is absent.

Distribution independent of the installed Node Bit CLI
.github/workflows/rust.yml[389-392]
docs/rust-cli.md[710-715]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The distribution workflow uploads binaries without installing and executing the produced archives in an environment where the installed Node Bit CLI and host entry points are unavailable. This leaves the distribution-independence requirement unverified, especially because the musl artifact explicitly requires a separately installed Node CLI.
## Fix Focus Areas
- .github/workflows/rust.yml[363-394]
- docs/rust-cli.md[710-727]
## Recommended Fix
Add a distribution validation step for each supported artifact that installs the archive into a clean temporary environment, removes or masks the installed Node Bit CLI and host entry points, runs representative native commands, and fails on any fallback or missing-asset dependency. Keep the documented Node compatibility mode as a separate explicitly qualified test.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Known failures still count as qualification 📎 Requirement gap ≡ Correctness
Description
The upstream synchronization record calls a run validation while recording two skipped cases, two
Bit Cloud fixture failures, and Windows differential tests still awaiting CI. Those gaps leave
required platform and assertion coverage unverified even though the record presents the run as the
latest qualification.
Code

docs/rust/upstream-sync-2026-10-26.md[R806-809]

Evidence
The synchronization record explicitly reports existing skips and Cloud fixture failures, then states
that the actual Windows differential tests await PR CI. The workflow's E2E job runs on Ubuntu and
uses a released Node CLI reference, so it does not itself close the pending Windows and distribution
completion gaps.

Failure safety, platform validation, and completion gate
docs/rust/upstream-sync-2026-10-26.md[806-812]
.github/workflows/rust.yml[141-207]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The qualification record treats runs with skipped cases, external fixture failures, and pending Windows differential coverage as validation for the completed port. This does not satisfy the required completion gate for platform coverage and unskipped assertions.
## Fix Focus Areas
- docs/rust/upstream-sync-2026-10-26.md[806-812]
- .github/workflows/rust.yml[141-207]
## Recommended Fix
Separate exploratory qualification results from completion evidence, mark failed or pending runs as non-qualifying, and record a completion result only after required platform jobs and assertions pass. Add explicit CI status links and keep external-service failures separately identified without counting them toward completion.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Bare cleanup deletes orphaned versions 🐞 Bug ≡ Correctness
Description
local_components seeds the bare collector from component heads and detached heads, but not from
orphanedVersions. When an orphaned version is reachable through none of those heads or a lane or
dependency reference, cleanup classifies its object and referenced files as unreachable and moves
them out of the scope.
Code

native/cli/src/commands/gc/bare/graph.rs[R95-99]

Evidence
Orphaned versions are separate metadata references, and the workspace collector retains them. The
bare collector does not traverse them and deletes objects absent from its retained set.

native/object-import/src/command_import/merge.rs[221-234]
native/cli/src/commands/gc/bare/graph.rs[74-105]
native/cli/src/commands/gc/bare/graph.rs[145-176]
native/cli/src/commands/gc/collector.rs[173-182]
native/cli/src/commands/gc/bare.rs[45-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Bare-scope garbage collection omits orphaned component versions from its retention roots, so it can delete versions still named by component metadata.
## Fix Focus Areas
- native/cli/src/commands/gc/bare/graph.rs[81-105]
- native/cli/src/commands/gc/bare/graph.rs[145-176]
## Recommended Fix
Include each local component's `orphanedVersions` hashes in bare collection and traverse their version references before planning deletion. Add a case whose orphaned version is not reachable from any other root and verify both its version and referenced objects survive.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. File-remote cleanup deletes local exports 🐞 Bug ≡ Correctness
Description
file::prepare replaces a configured file-remote path beneath a workspace with that workspace's own
scope path before checking the remote directory. If a user runs resume-export --delete for such a
remote and its export ID matches a local pending directory, the removal action targets that local
directory instead of the remote's.
Code

native/cli/src/commands/remote_action/file.rs[R21-24]

Evidence
Configured file paths reach file::prepare; ancestor workspace discovery wins over the remote's own
scope. The resulting scope is used directly to construct and recursively remove the pending
directory.

native/client-transfer/src/remotes.rs[75-86]
native/cli/src/commands/remote_action.rs[151-185]
native/cli/src/commands/remote_action/file.rs[20-41]
native/cli/src/commands/remote_action/file.rs[50-63]
native/cli/src/commands/resume_export/deletion.rs[108-128]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A file remote located beneath a workspace resolves to the workspace's local scope, allowing pending-export deletion to target the wrong directory.
## Fix Focus Areas
- native/cli/src/commands/remote_action/file.rs[20-41]
- native/cli/src/commands/remote_action/file.rs[50-63]
## Recommended Fix
Resolve and validate the configured file-remote scope without substituting an enclosing workspace's scope. Test a remote scope nested beneath a workspace with distinct pending IDs in the remote and local scopes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

13. Abandoned tests leave workspaces behind 📘 Rule violation ⚙ Maintainability ⭐ New
Description
runs_dir stores each end-to-end process under a shared bit-native-e2e directory instead of using
a cleanup-scoped temporary workspace. Failed or interrupted runs remain on disk until the six-hour
stale-entry sweep, so test artifacts survive after the test process exits.
Code

native/cli/tests/e2e/helper/setup.rs[R53-56]

Evidence
The changed setup code derives the root from a fixed bit-native-e2e directory and documents that
process directories are left behind; the same file only removes entries older than six hours. This
conflicts with the requirement that E2E workspaces be created through helpers that clean them up.

CLAUDE.md: Use Temporary Workspaces in End-to-End Tests
native/cli/tests/e2e/helper/setup.rs[53-79]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The E2E harness creates process workspaces beneath a shared fixed temporary-directory path and intentionally retains them for up to six hours, so interrupted tests leave workspace artifacts behind.

Fix Focus Areas
- native/cli/tests/e2e/helper/setup.rs[53-79]

Recommended Fix
Create the E2E root with a cleanup-scoped temporary-directory helper and retain only the lifetime needed by the test process. Ensure cleanup also runs when setup or a test fails, while keeping the root outside the repository's pnpm workspace.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Mutable actions can gain release access 🐞 Bug ⛨ Security ⭐ New
Description
Both generated workflows execute bit-tasks/init@v2 by a mutable tag in jobs granted repository
write permissions. If that tag is retargeted, the replacement action runs in the sync or release
job, where the workflows also provide GitHub and Bit credentials.
Code

native/cli/src/commands/ci/init/bit-sync.yml[90]

Evidence
Each template grants write access and runs the tagged initialization action; the later sync action
is SHA-pinned while the initialization action is not.

native/cli/src/commands/ci/init/bit-sync.yml[38-40]
native/cli/src/commands/ci/init/bit-sync.yml[83-107]
native/cli/src/commands/ci/init/bit-release.yml[22-24]
native/cli/src/commands/ci/init/bit-release.yml[42-61]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The generated write-capable workflows execute a third-party action through a movable tag.
## Fix Focus Areas
- native/cli/src/commands/ci/init/bit-sync.yml[90-93]
- native/cli/src/commands/ci/init/bit-release.yml[47-50]
## Recommended Fix
Replace both `bit-tasks/init@v2` references with a reviewed full commit SHA and update the scaffold checks accordingly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Rebuilds can include deleted component files 🐞 Bug ≡ Correctness ⭐ New
Description
populate_single_capsule copies current workspace and distribution files into an existing capsule
without removing files absent from the source. On a later build using the same capsule path, a
deleted source or old distribution file remains available to build steps.
Code

native/cli/src/commands/build_cmd/runner.rs[R250-260]

Evidence
The build uses a stable capsule directory, while the copy routine visits only present source entries
and never removes destination-only entries.

native/cli/src/commands/build_cmd/runner.rs[176-212]
native/cli/src/commands/build_cmd/runner.rs[246-268]
native/cli/src/commands/build_cmd/runner.rs[309-326]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Reused build capsules retain files removed from the workspace or prior distribution.
## Fix Focus Areas
- native/cli/src/commands/build_cmd/runner.rs[176-212]
- native/cli/src/commands/build_cmd/runner.rs[246-326]
## Recommended Fix
Recreate or safely reconcile each capsule's source and distribution trees before copying current files, preserving only intentionally persistent capsule metadata.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (6)
16. Unrelated text disables dependency caching 🐞 Bug ➹ Performance ⭐ New
Description
no_fs_cache searches raw configuration bytes for the substring no-fs-cache rather than reading a
feature-list value. A comment or unrelated setting containing that text makes status perform fresh
dependency detection and suppress subsequent cache writes.
Code

native/cli/src/commands/status/cache.rs[R37-42]

Evidence
The raw-byte match sets the cache flag, which forces detection and prevents committing the resulting
dependency cache.

native/cli/src/commands/status/cache.rs[17-60]
native/cli/src/commands/status/capture/dependencies.rs[43-48]
native/cli/src/commands/status/capture/commit.rs[47-50]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A raw substring match treats comments and unrelated configuration values as the cache-disabling feature.
## Fix Focus Areas
- native/cli/src/commands/status/cache.rs[17-60]
## Recommended Fix
Read the relevant configuration feature fields and test delimited feature tokens, as the environment-variable path already does. Ignore comments and unrelated values.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. A hostile remote can exhaust client memory on import 🐞 Bug ⛨ Security ⭐ New
Description
parse inflates each fetched object with ZlibDecoder::read_to_end into an unbounded Vec, and
never checks the output against the size declared in the object header or against any limit. The
transfer layer caps only compressed bytes (MAX_OBJECT_BYTES = 128 MiB per entry, 512 MiB per
archive), so a malicious or compromised remote scope can send a small zlib bomb that
persist::write_object inflates during bit import/fetch until the process runs out of memory.
Code

native/install/src/import/objects.rs[R36-39]

Evidence
tar.rs only bounds the compressed entry size and passes the compressed bytes on unchanged.
persist.rs calls parse(&item.compressed) on every remote item before writing it. parse
decompresses with read_to_end and has no cap on output size. The decompression step is the only
one in the import pipeline with no limit, even though the transfer layer was given explicit
compressed limits.

native/client-transfer/src/tar.rs[22-27]
native/install/src/import/persist.rs[98-106]
native/install/src/import/objects.rs[35-51]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`parse` in native/install/src/import/objects.rs inflates remote objects with `read_to_end` and no output limit. The transfer layer bounds only compressed bytes, so a crafted zlib stream from a remote scope can use up memory during import.

## Fix Focus Areas
- native/install/src/import/objects.rs[35-51]
- native/client-transfer/src/tar.rs[22-27]

## Recommended Fix
Wrap the decoder in `Read::take(LIMIT + 1)` and use a limit that matches the transfer budget, for example a shared `MAX_INFLATED_OBJECT_BYTES` constant. Return an `InvalidData` error if more than `LIMIT` bytes come out. You can also parse the `<kind> <hash> <size>` header first and reject the object if the inflated content length differs from the declared size. Add a unit test that feeds a small, highly compressible payload that inflates past the limit and check that it is rejected without allocating the full output.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Generated CI runs mutable privileged code 🐞 Bug ⛨ Security
Description
Both generated workflows run bit-tasks/init@v2 by a mutable tag even though their jobs grant
repository and pull-request write permissions. If that tag is moved to malicious action code, the
next authorized sync or merged-PR release run executes it with a write-capable workflow token before
the SHA-pinned action runs.
Code

native/cli/src/commands/ci/init/bit-sync.yml[90]

Evidence
Both templates grant write permissions and invoke the mutable action; the following action is
pinned, so its pin does not constrain code executed by the preceding step. The installer copies
these templates into customer repositories.

native/cli/src/commands/ci/init/bit-sync.yml[38-40]
native/cli/src/commands/ci/init/bit-sync.yml[89-93]
native/cli/src/commands/ci/init/bit-release.yml[22-24]
native/cli/src/commands/ci/init/bit-release.yml[46-50]
native/cli/src/commands/ci/init/files.rs[20-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Generated write-privileged workflows execute `bit-tasks/init` through a mutable tag.
## Fix Focus Areas
- native/cli/src/commands/ci/init/bit-sync.yml[89-93]
- native/cli/src/commands/ci/init/bit-release.yml[46-50]
## Recommended Fix
Replace `bit-tasks/init@v2` in both templates with a reviewed immutable commit SHA, as done for the following sync action, and update any asset-byte expectations.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. Failed test discovery can pass CI 🐞 Bug ☼ Reliability
Description
The end-to-end job captures cargo test --list through Bash process substitution, whose failure
status is not propagated to mapfile. If discovery exits after producing a partial list, the job
runs only the discovered test filters and can finish successfully without running the rest of that
shard.
Code

.github/workflows/rust.yml[R198-202]

Evidence
The listing pipeline runs inside process substitution, while the next command immediately runs only
the resulting array as exact test filters; no discovery-status or completeness check intervenes.

.github/workflows/rust.yml[193-204]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The end-to-end shard step can ignore a failed test-list command and run an incomplete selection.
## Fix Focus Areas
- .github/workflows/rust.yml[198-204]
## Recommended Fix
Capture the discovery pipeline in a command whose exit status the shell checks under `pipefail`, then populate `shard_tests` from its successful output. Fail the step if discovery fails or the expected shard selection is empty.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Login token is exposed in the process list 🐞 Bug ⛨ Security
Description
Resolver::run passes the global user.token to the spawned node -e resolver as a plain
command-line argument (.arg(self.token...)). Any workspace whose scope sets resolverPath sends
the bearer token through argv on every remote resolution, so other local users and process monitors
can read it via ps or /proc//cmdline while the child runs. The Node CLI calls the resolver
in-process and never puts the token in argv.
Code

native/client-transfer/src/resolver.rs[R111-114]

Evidence
configured reads user.token from the global config (lines 70-76). run then appends it as the
fourth positional argument to node -e SCRIPT (lines 111-114), and SCRIPT reads it back from
process.argv (line 34). The secret therefore sits in the child's visible argument vector for the
whole resolver run.

native/client-transfer/src/resolver.rs[30-42]
native/client-transfer/src/resolver.rs[60-84]
native/client-transfer/src/resolver.rs[100-118]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The custom remote resolver child process gets `user.token` as a positional argv entry, which other local processes can see.
## Fix Focus Areas
- native/client-transfer/src/resolver.rs[30-42]
- native/client-transfer/src/resolver.rs[100-118]
## Recommended Fix
Remove the token from `.arg(...)`. Pass it to the child through an environment variable (e.g. `.env("BIT_NATIVE_RESOLVER_TOKEN", token)`, with `.env_remove` when it is absent) or write it to the child's stdin. In `SCRIPT`, read it from `process.env` or stdin instead of `process.argv`, and shift the positional indexes to match.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Scope cleanup can delete versions still in use 🐞 Bug ☼ Reliability
Description
collect_flattened_deps returns an empty list whenever the flattenedDependenciesRef object is
missing, unreadable (any I/O error), or not a JSON array. Because of that, gc never marks those
dependency versions as live and can permanently delete Version/Source objects that a kept
version still depends on. A transient read error or corrupt ref is treated as "no dependencies" when
it should stop the collection.
Code

native/cli/src/commands/gc/graph.rs[R365-370]

Evidence
Both the read failure (Err or Ok(None)) and the parse failure go to return Vec::new().
version_dependencies uses that result to seed which dependency versions are kept, and the
collector then deletes every unkept version. In a destructive operation this lookup fails open: a
lookup that should block deletion instead allows it.

native/cli/src/commands/gc/graph.rs[345-384]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
GC treats a missing, unreadable or malformed flattened-dependencies object as having no dependencies, so it can delete dependency versions that are still referenced.
## Fix Focus Areas
- native/cli/src/commands/gc/graph.rs[345-384]
## Recommended Fix
Change `collect_flattened_deps` (and `version_dependencies`) to return `io::Result<Vec<CompIdSpec>>`. Return an error when `read_raw_scope_object` fails or returns `None`, or when the body is not a JSON array, and pass that error up so the GC plan aborts (or declines) before any deletion.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

22. Issue reports hardcode a divider symbol 📘 Rule violation ⚙ Maintainability ⭐ New
Description
report builds the bit component-issues presentation with a literal Unicode divider and applies
color directly to that string instead of using the shared output formatting toolkit. Every text
report repeats this hardcoded separator, making its section styling inconsistent with
toolkit-managed CLI output.
Code

native/cli/src/commands/component_issues.rs[R24-25]

Evidence
The changed file defines a literal heavy Unicode divider and report colors and interpolates it
directly into the output. The compliance rule expressly prohibits hardcoded Unicode symbols in
modified CLI output.

CLAUDE.md: Use the Shared CLI Output Formatting Toolkit
native/cli/src/commands/component_issues.rs[24-25]
native/cli/src/commands/component_issues.rs[282-301]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The component-issues text report defines and emits a literal Unicode divider instead of obtaining section titles and symbols from the shared CLI output formatting toolkit.

Fix Focus Areas
- native/cli/src/commands/component_issues.rs[24-25]
- native/cli/src/commands/component_issues.rs[282-301]

Recommended Fix
Replace `DIVIDER_LINE` and its direct colored rendering with the repository's shared formatting helper for section separators and titles. Preserve the existing report content while allowing the toolkit to control symbols and presentation consistently.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


23. Non-UTF-8 arguments crash the native CLI 🐞 Bug ☼ Reliability
Description
Host::configure builds BIT_NATIVE_HOST_ARGUMENTS with env::args(), and progress_mode also
iterates env::args(). Both panic if any process argument is not valid UTF-8, even though main
deliberately collects args_os() so it can pass such arguments through. Any native command that
starts the JavaScript host with such an argument (for example a non-UTF-8 path on Unix) aborts with
a panic instead of declining to the Node CLI; install.rs, install/request.rs and
status/autosync.rs use the same pattern.
Code

native/cli/src/host.rs[R143-145]

Evidence
main.rs reads arguments with env::args_os() and native::run only checks that the command name
is UTF-8. The host later calls env::args(), which the standard library documents as panicking on
invalid Unicode in any argument.

native/cli/src/main.rs[19-27]
native/cli/src/native.rs[42-48]
native/cli/src/host.rs[140-146]
native/cli/src/host.rs[305-312]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`env::args()` panics on non-UTF-8 arguments, and the host uses it while `main` accepts `OsString` arguments.
## Fix Focus Areas
- native/cli/src/host.rs[140-146]
- native/cli/src/host.rs[305-312]
- native/cli/src/commands/install.rs[283-283]
- native/cli/src/commands/install/request.rs[68-68]
- native/cli/src/commands/status/autosync.rs[208-208]
## Recommended Fix
Replace `env::args()` with `env::args_os()`. Convert each item with `into_string()` and return an error (or have the command decline before any effects) when the conversion fails, instead of panicking.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


24. Config writer comment wrongly claims atomic writes 🐞 Bug ⚙ Maintainability
Description
The module docs and write() say stores are persisted "atomically", but global() opens
config.json with truncate(true) and writes in place, and the scope path uses fs::write. A
later maintainer who trusts that comment can assume a failed config set or logout cannot leave a
truncated config.json that has lost user.token, which is not true.
Code

native/cli/src/commands/config/stores/writing.rs[R110-116]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs say config stores are written atomically, but the implementation truncates the file and writes in place.
## Fix Focus Areas
- native/cli/src/commands/config/stores/writing.rs[1-42]
- native/cli/src/commands/config/stores/writing.rs[109-125]
## Recommended Fix
Either change the doc comments so they no longer say "atomically" (if matching Node's in-place write is intended), or write to a sibling temp file created with mode 0600 and `rename` it over the target.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

⚠️ Warning | Comment size exceeded, inner finding content trimmed Learn more
⚠️ Warning | Comment size exceeded, non finding content trimmed Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit da76287

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 538d1ed

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit bdb9daf

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit dfb67e5

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 45ee567

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants