34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
"""CHECK: troupe-standup git-tracked-file LOC census.
|
|
|
|
Re-derives the expected value straight from the live git index
|
|
(`git ls-files` count) and compares it against the artifact's data-row
|
|
count. Exit 0 => artifact row count matches reality (correct); nonzero
|
|
=> mismatch (wrong). Read-only with respect to the repo.
|
|
"""
|
|
import subprocess
|
|
import sys
|
|
|
|
REPO = "/root/troupe-standup"
|
|
ARTIFACT = REPO + "/wizard-work/ledger/troupe-gitfile-loc-census.tsv"
|
|
|
|
|
|
def main():
|
|
r = subprocess.run(
|
|
["git", "ls-files"], cwd=REPO, check=True, capture_output=True, text=True
|
|
)
|
|
expected = len(r.stdout.splitlines())
|
|
|
|
with open(ARTIFACT, encoding="utf-8") as fh:
|
|
lines = fh.read().splitlines()
|
|
|
|
assert lines[0] == "track,path,size_bytes,line_count", "bad header: %r" % lines[0]
|
|
actual = len(lines) - 1
|
|
if actual != expected:
|
|
print("MISMATCH artifact_rows=%d git_tracked_files=%d" % (actual, expected))
|
|
sys.exit(1)
|
|
print("OK artifact_rows=%d git_tracked_files=%d" % (actual, expected))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|