fix(install): copy sibling data dirs (schemas/ assets/ templates/ fixtures/ migrations/) in copy_rust_primitive

Ship-blocker found by Docker battle-test: install.sh --profile=full
only built 6/25 Rust binaries on fresh ubuntu:24.04 because
kei-artifact has sibling schemas/*.json files that src/schemas.rs
include_str!s at compile time. Prior copy_rust_primitive only copied
Cargo.toml + src/ + tests/ — schemas dir missing → 5 compile errors.

Fix: whitelist 5 common sibling data directories (schemas, assets,
templates, fixtures, migrations) — copy each if present. Keeps
target/, .git/, and other build artifacts out.

Battle-test (pre-fix):
  full profile: 6/25 Rust binaries built (kei-artifact + cascade fails)
  install exit 0 (soft-fail design), silent partial-install

Expected post-fix:
  full profile: 25/25 binaries (pending re-verification on Docker)

Affects: any future crate that uses include_str!('../<dir>/*') on
a sibling data folder. 5-item whitelist covers the patterns we know;
extend as needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Parfii-bot 2026-04-22 18:39:28 +08:00
parent 82689d108b
commit 340de0e2f6

View file

@ -40,7 +40,7 @@ remove_shell_primitive() {
}
copy_rust_primitive() {
local name="$1" crate src dst_root dst
local name="$1" crate src dst_root dst sibling
crate="$(primitive_field "$name" crate)"
[ -n "$crate" ] || { err "no 'crate' for rust primitive $name"; return 1; }
src="$KIT_DIR/_primitives/_rust/$crate"
@ -54,6 +54,15 @@ copy_rust_primitive() {
mkdir -p "$dst/tests"
cp -rf "$src/tests/"* "$dst/tests/" 2>/dev/null || true
fi
# v0.21: kei-artifact and future crates reference sibling data dirs via
# include_str!("../schemas/*.json") etc. Copy known sibling directories
# when present. Whitelist keeps target/, .git/, build artifacts out.
for sibling in schemas assets templates fixtures migrations; do
if [ -d "$src/$sibling" ]; then
mkdir -p "$dst/$sibling"
cp -rf "$src/$sibling/"* "$dst/$sibling/" 2>/dev/null || true
fi
done
say " + rust: $name (crate $crate)"
}