mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 21:07:09 +01:00
Two invariants had been established by hand and left ungated, which is the
"a remedy that only works if someone remembers" pattern:
- scripts/check_ignore_consistency.sh fails the commit if any TRACKED file
is also gitignored. .binary-allowlist used to *instruct* the reader to
re-run that check; now it is enforced. Verified both ways -- passes on the
tree, and fails when an ignored file is force-added.
DOCS-runnability.md now really has two columns. Each environment writes only
its own gates/runnability-<env>.tsv and the doc renders from both, so a CI run
cannot clobber the local results. The ci tsv is gitignored: committing a copy
generated here would label this machine's capabilities as the runner's.
Rendering it surfaced a classic bug -- awk's NR==FNR idiom silently swallows
the SECOND file when the first is empty, so the table came out with a header
and no rows. It compares FILENAME instead.
runnability.yml deliberately does NOT diff against a committed baseline. A
status is a property of the machine, so `runnable` locally and `blocked` on a
runner is correct rather than drift, and diffing would make the workflow red
by construction. It fails on `error` instead -- a runner that crashes or
reports an unknown kind.
Then five more courses were actually run, because EADS alone had produced four
real bugs and one sample proves nothing:
- ECOAR and EPFU build (nasm + 32-bit gcc, and gcc respectively).
- ECOTE's 17 test modules could not run AT ALL. Its package is named `code/`,
which shadows the standard library: pytest's debugging plugin imports pdb,
pdb imports code, and it got this directory instead, so the suite died
with an INTERNALERROR before collecting a single test. Renamed to
translator/ with all 17 imports updated -- 26 tests now pass.
- A LaTeX report builds. That one exposed a hazard rather than a bug:
latexmk wrote its PDF beside the source, and in a course where the built
name matches the submitted one it would have silently overwritten a
tracked deliverable. Both the LaTeX and C++ runners now build into a
gitignored build/, and rebuilding ECOGR leaves `git status` empty.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================================================
|
|
# Fail if any TRACKED file is also matched by a .gitignore rule.
|
|
#
|
|
# That combination fails silently: `git add` on such a file is not an error,
|
|
# the edit simply never lands. This repo had 130 of them -- dist/ swallowing
|
|
# the vendored jQuery bundle, and the LaTeX template's man-page patterns
|
|
# (*.[1-9]) eating EPFU's date-named doc/21.11/ directory along with its
|
|
# report.pdf.
|
|
#
|
|
# They were fixed by hand once. This is the gate that keeps them fixed, so
|
|
# that .binary-allowlist can stop *instructing* the reader to re-run a command
|
|
# and just have it enforced instead.
|
|
#
|
|
# Usage: scripts/check_ignore_consistency.sh
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
main() {
|
|
local offenders
|
|
offenders="$(git ls-files | git check-ignore --stdin --no-index 2>/dev/null || true)"
|
|
|
|
if [[ -z "$offenders" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "Tracked files that .gitignore also matches:" >&2
|
|
printf '%s\n' "$offenders" | sed 's/^/ /' >&2
|
|
cat >&2 <<'MSG'
|
|
|
|
Each of these fails SILENTLY on `git add` -- not an error, the edit just
|
|
never lands. Fix by either:
|
|
1. adding a "!" override in .gitignore (if the file belongs in the repo), or
|
|
2. `git rm --cached` it (if it is build output that should never have been
|
|
tracked; --cached keeps it on disk).
|
|
MSG
|
|
exit 1
|
|
}
|
|
|
|
main "$@"
|