Skip to content

docs: point Rust adopters at the Rust pack instead of a bare compiler - #1838

Merged
gerchowl merged 7 commits into
devfrom
feature/1831-rust-pack-adopter-docs
Oct 5, 2026
Merged

gerchowl merged 7 commits into
devfrom
feature/1831-rust-pack-adopter-docs

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

The adopter docs never led a Rust consumer to the Rust pack, and docs/MIGRATION.md actively steered them away from it: it called rust an unshipped candidate and recommended extraPackages = [ pkgs.cargo pkgs.rustc ]. This PR fixes both passages, adds a Rust section the scaffold can link to, and has the scaffold print that link when a Rust repo's preserved files bypass the pack.

Stack 4/6 for #1833. Base: #1837 (feature/1496-rust-cold-adoption-entry).

Type of Change

  • docs -- Documentation only
  • feat -- New feature (the scaffold notice)
  • test -- Adding or updating tests

Changes Made

  • docs/MIGRATION.md
    • "Adding tools the image does not ship": Rust goes to the pack and C/C++ to native. The extraPackages example keeps only genuinely ad-hoc tools.
    • "The native-build contract": lists the modules that actually ship (native, node, docs, guardrails, rust), with rust used through mkRustProject.
    • New "Rust projects: the Rust pack" section: the check table; the new-repo path (nix flake init -t #rust, then install.sh) and what gets seeded; porting a repo scaffolded before it was Rust (pointers to assets/flake.d/rust.flake.nix and the cargo recipes); toolchainHash pinning; sandboxExcludes (mkRustProject: per-test exclusion seam for tests the Nix sandbox cannot run (PTY, signals, process groups) #1834); the base tool configs and advisories outside the sandbox.
    • "Declared project languages" names the new Rust seeds.
  • README.md (via docs/templates/README.md.j2 + just docs) and docs/SOLO_ADOPTION.md link to the section.
  • assets/init-workspace.sh: notice_rust_pack_bypass. In a Rust repo, it prints a notice when a preserved flake.nix doesn't use mkRustProject, or a preserved justfile.project never runs cargo. Each notice names the gap and links the MIGRATION section. It stays silent on a fresh scaffold, where Rust pack: L1/L4/L7 never shipped — the pack cannot be adopted cold #1496's seeds already landed. This is the issue's "print a notice when DEVKIT_LANGUAGES gains rust", scoped to the case that still needs it now that Rust pack: L1/L4/L7 never shipped — the pack cannot be adopted cold #1496 seeds automatically.

Changelog Entry

Changed

  • Rust adopters are pointed at the Rust pack, not a bare compiler (#1831)
    • docs/MIGRATION.md no longer calls rust an unshipped candidate module or recommends extraPackages = [ pkgs.cargo pkgs.rustc ]; a new "Rust projects: the Rust pack" section covers the new-repo path, porting a repo scaffolded before it was Rust, toolchain pinning, sandboxExcludes and the base tool configs. README.md and docs/SOLO_ADOPTION.md link to it
    • The scaffold prints a notice when a Rust repo keeps a preserved flake.nix that does not use mkRustProject, or a justfile.project that never runs cargo, naming the doc section that fixes it

Testing

  • 3 bats tests: the flake notice, the justfile notice, and no notice on a fresh Rust scaffold. They failed before the implementation.
  • test_bypass_notice_links_to_a_real_migration_heading: every docs/MIGRATION.md#… anchor in init-workspace.sh resolves to a real heading. It failed until the section existed.
  • All #1496|#1831 bats tests pass locally.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • I have added tests that prove my fix is effective or that my feature works

Refs: #1831, #1833

@gerchowl

gerchowl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-up: the notice's cargo detection now ignores comments. A justfile.project whose only mention of cargo is a comment still gets the notice. Tested. The MIGRATION text matches the new when-are-configs-seeded rule from #1837.

@gerchowl
gerchowl force-pushed the feature/1831-rust-pack-adopter-docs branch from b2fb0ab to 9683956 Compare October 5, 2026 19:41
Base automatically changed from feature/1496-rust-cold-adoption-entry to dev October 5, 2026 21:31
@gerchowl
gerchowl merged commit ee69dd8 into dev Oct 5, 2026
29 of 31 checks passed
@gerchowl
gerchowl deleted the feature/1831-rust-pack-adopter-docs branch October 5, 2026 21:32
gerchowl added a commit that referenced this pull request Oct 5, 2026
… ignore (#1839)

## Description

The `install.sh --force` preflight refused **any** untracked file. A
repo that had just gained a language, such as a Rust repo with `cargo
build` output in `target/`, therefore could not take the very upgrade
that adds the `.gitignore` fragment ignoring it. The workaround was to
move the build directory aside. Same for `node_modules/`, `.venv/` and
Nix `result` links.

**Stack 5/6** for #1833. Base: #1838
(`feature/1831-rust-pack-adopter-docs`).

## Type of Change

- [x] `fix` -- Bug fix
- [x] `test` -- Adding or updating tests

## Changes Made

The judgement moves to where the knowledge is. The host doesn't know the
gitignore fragments or the detected languages; the image does.

- **`install.sh`** (host): tracked changes still refuse, unchanged.
Untracked paths (`git ls-files --others --exclude-standard --directory`)
are no longer refused host-side. They are forwarded to the container as
`DEVKIT_PREFLIGHT_UNTRACKED`. New `--allow-untracked` flag skips that
check: it names the paths it leaves out, and tracked changes still
refuse.
- **`assets/init-workspace.sh`** (container):
`preflight_untracked_guard` runs right after language detection, before
any file is written. It assembles the root `.gitignore` this run will
write (template base + the detected languages' `gitignore.d` fragments +
`.gitignore.project`, the same parts `render_gitignore` uses) and
matches each path with git's own matcher (`check-ignore --no-index`) in
a scratch repo, because the workspace's `.git` may be an unmounted
worktree pointer. Covered paths are named and left in place. Any other
path refuses by name and hints `--allow-untracked` / `--skip-preflight`.
- Build output of a language that **isn't detected** is not excused
(`node_modules/` without a `package.json`), because its fragment won't
be in the upgraded `.gitignore`.
- `docs/MIGRATION.md` "Upgrade preflight guard and preview" documents
the rule and the flag.

## Changelog Entry

### Fixed
- **Untracked build output no longer blocks the upgrade that ignores
it** ([#1826](#1826))
- The `install.sh --force` preflight refused any untracked file, so a
repo that had just gained a language (a Rust repo with `target/`) could
not take the very upgrade that adds its `.gitignore` fragment. Untracked
paths are now matched against the `.gitignore` the upgrade will write;
covered ones are named and left in place, any other one still refuses,
by name
- New `--allow-untracked` flag runs the upgrade with untracked files
present; tracked changes still refuse

## Testing

- [x] `install.bats` (5 new, 1 rewritten): untracked paths are forwarded
rather than refused; a tracked change still refuses alongside `target/`;
`--allow-untracked` proceeds and forwards nothing; `--allow-untracked`
doesn't excuse a tracked change; a clean tree forwards nothing. All 30
`preflight` tests pass.
- [x] `init-workspace.bats` (4 new): a Rust repo's `target/` passes
while an untracked `Cargo.toml` is named; an uncovered path refuses
**before `.vig-os` or `justfile` exist**; `node_modules/` without
`package.json` refuses; `.gitignore.project` entries count as covered.
- The issue's repro (neutral scaffold, then `Cargo.toml` + `cargo
build`, then `install.sh --force`) is the first init-workspace test.

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] I have added tests that prove my fix is effective or that my
feature works

Refs: #1826, #1833
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant