Skip to content

chore - 1480 incan_driver is a crate - #1581

Open
dannymeijer wants to merge 16 commits into
0.6.0-dev.5from
chore/1480-incan-driver-crate
Open

dannymeijer wants to merge 16 commits into
0.6.0-dev.5from
chore/1480-incan-driver-crate

Conversation

@dannymeijer

Copy link
Copy Markdown
Member

Summary

The driver becomes the crate LAYOUT names as the root crate's closest successor. loaves/compiler/incan_driver is src/driver/ as its root — sessions, module collection, typecheck orchestration, Cargo policy, the lock and test-discovery logic, the build pipeline behind the cli feature — with backend/ (the generated project, the shadow comparison, c_abi, and the backend::ir shim over incan_ir/incan_emit), inspect/ (the codegraph and closure analyses), generated_cache, replacement_compatibility and its frozen v0.5 baselines as its modules. cli/commands/shadow_support.rs comes along as shadow_support: it was driver glue that happened to live under the CLI, and the shadow tests calling its prepare_shadow_legacy_materialization were the last backend → cli reach; the CLI keeps a one-line re-export of compare_source_observable for the run command.

The root re-exports every module under its old path — driver, backend, inspect, generated_cache, replacement_compatibility — so the 131 crate::driver::… references in the CLI, the 8 in the LSP, and every incan::driver::…, incan::backend::… and incan::replacement_compatibility::… in tests/ are untouched. Inside the crate the spellings became its own: crate::driver::crate::, crate::provider::incan_provider::, crate::oven:: → the store or the baker crate, crate::lockfile::oven_model::lock::, and the super:: chains that climbed to the old root are absolute paths now.

Facts the split carries, each fixed here:

  • The CLI's test runner reads the driver's project-lock collection metrics (reset_project_lock_collection_metrics, project_lock_collection_counts) and its build tests borrow driver::build::test_support; both were cfg(test) and ride the crate's test_support feature now, which the root's dev-dependency turns on. The feature also forwards the provider's, emission's, the frontend's, rust-inspect's and the Oven crates' test-support features, so one flag lights the whole stack.
  • driver/lock has a submodule named rust_inspect, so the crate's paths to the rust_inspect crate are spelled ::rust_inspect.
  • Seven CARGO_MANIFEST_DIR anchors meant the checkout root (the generated Cargo.toml tests' crates/… paths, the prepare-project test's Cargo.lock, the replacement-compatibility corpus root); they anchor at oven_model::toolchain_layout::development_root(). Two include_str! paths that climbed out of src/ climb three more levels.
  • The crate's features mirror the root's, cli included in its defaults: the build pipeline, the report and test-output derives, and the compatibility corpus's checked collection are behind it (12 tests need it), and the root's defaults had it. cargo test -p incan_driver wants CARGO_BIN_EXE_incan pointing at a built CLI, as the root's unit tests always did; the Oven suite exports it for every root.
  • The replacement-compatibility registry names repository paths as evidence, and the 3b/3c moves had left them stale (src/frontend/…, src/backend/replacement/…) — something only the generator and committed_projections_match_the_validated_registry see, which the light lane never runs. Re-rooted here with the frozen v0.5 snapshot (its constant, the baseline manifest.json, tests/example_capability_coverage.rs), and the docs inventory regenerated with generate_replacement_compatibility_inventory.
  • The CLI layering baseline loses its shadow_support.rs entry; the semantic-string audit classifies fourteen driver-crate files for the first time (backend/{c_abi,project,shadow}, generated_cache, inspect/, replacement_compatibility with its 40 identifier sites, shadow_support) and refreshes one fingerprint whose site now spells oven_rustc::loaf::OVEN_LOAF_ENV.
  • The rustdoc prose in the moved files fills the 120-column width (119 once indented, which is where rustfmt re-wraps), as on the earlier PRs in this stack.
  • The semantic-string audit's roots and fixture entries follow the files (src/driver, src/backend, src/inspect, src/generated_cache.rs, src/replacement_compatibility*, shadow_support.rs → the crate).

backend/project/{plan,lock_projection,cargo_toml,runner}.rs stay in the driver for now: their moves into oven_rustc and oven_cargo_compat need inversions of their own (the runner's cfg-gated rust-inspect hook, the generated-project stdlib baseline as plan facts) and are the Oven ring's next step, not this crate's.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/RFCs/*)

Area(s)

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)
  • Editor integration (LSP/VS Code extension)
  • Runtime / Core crates (stdlib/core/derive)
  • Documentation

Key details

  • User-facing behavior: none; codegen snapshots unchanged.
  • Internals: one new workspace member of 57k lines, depending on every compiler-ring crate below it, the three Oven crates, incan_codegraph, rust_inspect, clap (optional), serde/toml/toml_edit, sha1/sha2/hex, semver, rustix, tempfile, thiserror, tracing. Cargo.lock gains it. What remains in the root crate is the CLI, the LSP, the binaries and tests/ — the next two steps.
  • Risks: the blanket pub is wider than the crate's eventual surface.

Testing / verification

  • cargo check -p incan in the six feature configurations; cargo clippy --all-targets default and --all-features with -D warnings; rustdoc gate last
  • cargo test -p incan_driver with the CLI built — 412/413, the one miss the macOS TMPDIR canonicalization case (canonical_frames_reenter_the_entry_module_through_a_checked_cycle, identical on dev.5)
  • cargo test --test cli_layering_guardrails --test vocab_guardrails --test layering_guard
  • cargo test --test codegen_snapshot_tests — 266 unchanged
  • make check-oven-ring
  • root unit tests with the CLI built for cli::commands::{build,run,oven,tools,lock}, cli::test_runner, lsp — 112/116, the four misses the prewarmed-store build_library_*/inspect_registry_* class that fails identically on the base tree
  • one exact Oven root: make test-one TEST_ROOT=tests/cli_surface_tests.rs TEST_EXACT=a_cargo_manifest_beside_a_loaf_manifest_warns_without_stopping_the_build — bake + build

Docs impact

  • No docs changes needed (the crate README says what moved and what waits; the ring documentation is step 6)
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Part of #1480 (slice 5, #1478). Builds on #1577, #1578, #1579 and #1580: the branch carries their commits, so the diff shows every step until they land and merge-commit syncs narrow it to this one.

@incan-triage-bot incan-triage-bot Bot added incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) tooling Suggestions, features, or bugs related to the Tooling (CLI/formatter/test runner) labels Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) tooling Suggestions, features, or bugs related to the Tooling (CLI/formatter/test runner)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant