Repository navigation
feat(rust): move stash save and restoration into the native client - #272
Merged
Merged
Conversation
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves
stash save/s,list, andload/popinto the native client. Rust captures and persists detached Versions and file Sources, writes stash metadata, resets modified components, and removes included new components. Load restores saved new roots before merging tracked components against the detached Version's first parent, and consumes the stash only after success. Component heads and tracked bitmap versions stay unchanged.The operation shares native checkout, dependency/import, configuration, package and removal engines. Harmony adapters supply registered environment/load/dependency facts and component-add/compile callbacks; source bodies, graph projection, serialization and VCS publication stay in Rust. No Node CLI sources changed and no documentation was added under
docs/rust.Parity preserves published Bit 2.2.94 behavior: lexical stash numbering, four-space metadata without a trailing newline, pre-allocation graph IDs and omitted graph Sources, existing-log restoration after modification checks, cached aspect facts during new-component cleanup, and pre-persistence rejection of unversioned dependencies. Retained source/repository/control/manifest proofs prevent stale publication. Metadata reads have byte and entry limits.
Missing existing version histories are persisted during status checks before selection, including no-op saves.
Strict released-CLI tests cover all 13 original stash cases plus aliases, messages, empty and malformed arguments, force/manual strategies, numbering rollover, binary/CRLF sources, dependency graphs, configured callbacks and startup errors, package/configuration/staged cleanup, embedded scopes, ID collisions and stale-source rejection. A dedicated Windows stash parity group repeats these cases.
Compatibility boundaries decline before publication: unsupported grammar, the published boolean pattern/empty-message quirks, unsafe or corrupt metadata, missing/re-added tracked components and canonical path recovery, unavailable dependencies and explicit resource limits.
Targets
rust-workspace-materializationso it feeds into teambit#10813. Completes the stash chunk of #73; tracking/move/rename/deprecation, remaining command modes and safe TypeScript retirement remain open.Validation: all seven required gates pass, plus focused export checks: 1,299 workspace tests (one existing ignored), 557 end-to-end tests including 26 stash oracles, 17 export package tests and five export callback tests. Release workspace build passes with warnings denied.
Complete-command measurements: 90 stash pairs (six workloads × five alternating pairs × non-TTY/TTY/CI) and 45 status/checkout/export regression pairs pass against the same release binary. Controlled Linux warm-metadata fixtures; no first-use or cross-platform speedup claim.
The checked-in records include binary/source/helper/fixture fingerprints and normalization details. They preserve exact history objects, package manifests, baseline backups and ordered backup reasons; only adjacent identical bitmap snapshots are deduplicated for the published same-second filename collision. Global builtin facts are validated and seeded identically outside timing. No broad cache or object exclusions.
Windows qualification fixes preserve exact Node CRLF bytes and check parent emptiness before deletion, including
.DS_Storebehavior. Stash retained state is boxed to avoid inflating every workspace session: the Windows lane-import stack overflow was reproduced on Linux with a 1 MiB limit and all three affected cases pass after the fix. Linux CI now enforces that limit.The final 90 + 45 pairs use the fixed binary. Peak host CPU usage was 17.3%; contended samples are retained and explicitly excluded from speedup evidence. Rust medians were faster in all measured modes; new restoration remains near parity (1.01–1.08×).