docs/dependency-vendoring.md
This project uses a Cargo-first vendoring model:
nikivdev/flow-vendor.flow pins vendored state by commit in vendor.lock.toml.flow uses [patch.crates-io] path overrides into lib/vendor/*.This gives direct dependency control without giving up Cargo behavior.
flow-vendor,flow,This model borrows the parts of Nix that matter most for dependency control:
vendor.lock.toml, Cargo.lock),vendor-repo.sh hydrate),vendor-manifest, strict verify),vendor-control.sh inhouse),Reference:
docs/vendor-nix-inspiration.mdflow uses.flow history: metadata/pins in flow, source churn in flow-vendor.vendor.lock.toml
Cargo.toml
[patch.crates-io] points selected crates to lib/vendor/<crate>.Cargo.lock
lib/vendor/<crate>
lib/vendor-manifest/<crate>.toml
scripts/vendor/*
flow repoflow-vendor repocrates/<crate>),manifests/<crate>.toml),Do not replace Cargo. Use Cargo as the system of record:
Cargo.lock,cargo update -p <crate> --precise <version> for deterministic lock rewrites,cargo check, cargo test --no-run),Recommended entrypoint:
~/code/rise/scripts/vendor-control.sh inhouse --project ~/code/flow <crate> [version]
What this does:
lib/vendor/<crate>.lib/vendor-history/<crate>.git.lib/vendor-manifest/<crate>.toml + UPSTREAM.toml.Cargo.lock to exact vendored version.scripts/vendor/apply-trims.sh)..vendor/flow-vendor.vendor.lock.toml to new vendor commit.Run after each vendoring step:
f update-deps --important
f vendor-trims
~/code/rise/scripts/vendor-control.sh verify --project ~/code/flow
python3 ./scripts/vendor/rough_edges_audit.py --project . --strict-warnings
cargo check -q
scripts/vendor/sync-all.sh --important --dry-run
For full dependency refresh (latest allowed by policy), run:
f update-deps
Useful flags:
f update-deps --dry-run
f update-deps --no-major
f update-deps --push-vendor
verify enforces:
vendor.lock.toml,Cargo.lock,Cargo.lock,vendor-rough-audit --strict-warnings additionally enforces warning-hygiene
regressions for known vendored crate hot spots (crossterm, portable-pty,
x25519-dalek, ratatui) so release builds stay quiet.
inhouse now records provenance fields in crate manifests:
registry_indexcargo_registry_checksumcrate_archive_sha256checksum_matchupstream_repositoryupstream_homepagehistory_headUse report mode:
~/code/rise/scripts/vendor-control.sh provenance --project ~/code/flow
Use stricter mode when migrating fully:
~/code/rise/scripts/vendor-control.sh verify --project ~/code/flow --strict-provenance
vendor-control.sh inhouse includes rollback protection by default:
Cargo.toml, Cargo.lock, vendor.lock.toml,Escape hatch (not recommended except debugging):
~/code/rise/scripts/vendor-control.sh inhouse --project ~/code/flow <crate> --no-rollback
Track updates:
scripts/vendor/check-upstream.sh --important
scripts/vendor/sync-all.sh --important --dry-run
Apply updates intentionally:
scripts/vendor/sync-all.sh --important
scripts/vendor/vendor-repo.sh import-local
git -C .vendor/flow-vendor push origin main
Policy:
--allow-minor, --allow-major).To make vendored code practical at scale, we index first-party + vendored sources into Typesense and query them fast during refactors and trim work.
This follows the same high-level pattern as opensrc:
.vendor/typesense/sources.json),Flow entrypoints:
f vendor-typesense-setup # one-time if Typesense is not installed locally
f vendor-typesense-up
f vendor-code-index
f vendor-code-search "Router"
f vendor-code-search "serde" --scope vendor --crate axum
f vendor-code-search-sources "ratatui"
Script used by tasks:
python3 ./scripts/vendor/typesense_code_index.py --help
Design goals:
--crate <name>),--scope vendor|firstparty),version, checksum, history_head),Reference:
docs/vendor-code-intelligence.md for architecture, commands, and operating loop.CI must hydrate vendored source from vendor.lock.toml before Cargo build:
scripts/vendor/vendor-repo.sh hydrate
Any CI build skipping hydrate can fail with missing lib/vendor/* path deps.
For each vendored crate:
flow (APIs/types called),Use:
scripts/vendor/offenders.sh
cargo tree -d
to rank impact and watch duplicate-version pressure.
Operational tooling for this loop:
f vendor-rough-auditf vendor-offendersf vendor-bench-iter -- --mode incremental --samples 3f vendor-optimize-loopReference:
docs/vendor-optimization-loop.mdflow: commit only lock/manifest/patch/docs/script changes.flow-vendor: commit source churn.flow-vendor first, then push flow pin updates.Inspect state:
scripts/vendor/vendor-repo.sh status
Re-hydrate local materialization from pinned commit:
scripts/vendor/vendor-repo.sh hydrate
Re-pin to known commit:
scripts/vendor/vendor-repo.sh pin <commit>
No. Cargo remains central. Vendoring is an ownership layer on top.
To keep main repo history focused on product changes while retaining full dependency source control.
Yes. check-upstream + sync-* + locked import flow is designed for repeatable upstream ingestion.