Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/scripts/check-production-line-limit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
# before their production code (e.g. pkgs/id/src/world_session/mod.rs
# declares its test modules at the top) — Codex finding on PR #4709.
# Test files are out of scope entirely: files under a tests/
# directory and files named tests.rs are skipped.
# directory and files named tests.rs are skipped. Build output is
# out of scope too: target/ directories are pruned at any depth
# under the scanned roots (matching the repo's **/target ignore),
# so a built tree's generated .rs files are never counted.
#
# Grandfather list: files that already exceeded the limit when the
# guard landed. Each entry names the issue that removes it; when the
Expand Down Expand Up @@ -199,7 +202,7 @@ for base in pkgs apps; do
fail=1
fi
fi
done < <(find "$ROOT/$base" -name "*.rs" -type f -print0 | sort -z)
done < <(find "$ROOT/$base" -type d -name target -prune -o -name "*.rs" -type f -print0 | sort -z)
done

echo "production-line-guard: checked $checked production .rs files, limit $LIMIT"
Expand Down
24 changes: 24 additions & 0 deletions .github/scripts/check-production-line-limit.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,28 @@ bash "$SCRIPT" "$TMP/tests" >"$TMP/tests.out"
grep -q "checked 0 production" "$TMP/tests.out"
echo "pass: test files are not counted"

# Build output is out of scope (#6960): an over-limit generated file
# under a target/ directory (any depth) is not counted, and does not
# mask a real over-limit source file in the same tree.
mkdir -p "$TMP/target/pkgs/demo/src" "$TMP/target/pkgs/demo/target/debug/build/gen-abc/out"
gen "$TMP/target/pkgs/demo/src/lib.rs" 10
gen "$TMP/target/pkgs/demo/target/debug/build/gen-abc/out/generated.rs" 2600
bash "$SCRIPT" "$TMP/target" >"$TMP/target.out"
grep -q "checked 1 production" "$TMP/target.out"
echo "pass: over-limit build output under target/ is not counted"

mkdir -p "$TMP/targetmask/pkgs/demo/src" "$TMP/targetmask/pkgs/demo/target/release/build/gen-x/out"
gen "$TMP/targetmask/pkgs/demo/src/huge.rs" 2600
gen "$TMP/targetmask/pkgs/demo/target/release/build/gen-x/out/generated.rs" 2600
if bash "$SCRIPT" "$TMP/targetmask" >"$TMP/targetmask.out" 2>&1; then
echo "FAIL: guard passed a tree with an over-limit source file" >&2
exit 1
fi
grep -q "OVER LIMIT pkgs/demo/src/huge.rs" "$TMP/targetmask.out"
if grep -q "generated.rs" "$TMP/targetmask.out"; then
echo "FAIL: guard reported build output under target/" >&2
exit 1
fi
echo "pass: target/ exclusion does not mask over-limit sources"

echo "check-production-line-limit.test.sh: all contract tests passed"
Loading