Skip to content

Commit 184772c

Browse files
hyperpolymathclaude
andcommitted
fix(check-trusted-base): scan ALL proof-debt docs, not just first
Previous logic stopped at the first found candidate (docs/proof-debt.md > docs/proof-debt.adoc > PROOF-NEEDS.md), which meant a repo with BOTH files (e.g. standards itself) would only have its docs/proof-debt.md consulted. Markers documented only in PROOF-NEEDS.md got flagged as undocumented. Fixed: collect all matching docs into an array; iterate over all of them when checking each marker. A marker is documented if mentioned in ANY of them. This unblocks standards itself (which has 11 a2ml markers documented in docs/proof-debt.md + 4 lol/postulate markers documented in PROOF-NEEDS.md) — now passes the check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7f294d7 commit 184772c

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

scripts/check-trusted-base.sh

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,20 @@ echo "[INFO] Found $marker_count soundness-relevant escape hatch(es)."
173173
# - enumerated in docs/proof-debt.md (substring match on file:line OR on the
174174
# identifier captured)
175175
# ─────────────────────────────────────────────────────────────────────────────
176-
debt_doc=""
176+
debt_docs=()
177177
for cand in docs/proof-debt.md docs/proof-debt.adoc PROOF-NEEDS.md docs/PROOF-NEEDS.md; do
178178
if [ -f "$cand" ]; then
179-
debt_doc="$cand"
180-
break
179+
debt_docs+=("$cand")
181180
fi
182181
done
183182

184-
if [ -z "$debt_doc" ]; then
183+
if [ ${#debt_docs[@]} -eq 0 ]; then
185184
echo "[ERROR] No docs/proof-debt.md (or equivalent) found, but $marker_count escape hatches exist."
186185
echo "[ERROR] Seed one per the schema at hyperpolymath/standards/docs/TRUSTED-BASE-REDUCTION-POLICY.adoc."
187186
exit 1
188187
fi
189188

190-
echo "[OK] proof-debt document found: $debt_doc"
189+
echo "[OK] proof-debt document(s) found: ${debt_docs[*]}"
191190

192191
# For each marker, check documentation
193192
undocumented=0
@@ -202,30 +201,39 @@ while IFS=$'\t' read -r f ln kind ctx; do
202201
continue
203202
fi
204203

205-
# 2. Mention in proof-debt document — match on `<file>:<line>` substring,
206-
# or on the file path alone (in which case we accept any reference)
207-
if grep -qF "$f_clean:$ln" "$debt_doc" 2>/dev/null; then
208-
continue
209-
fi
210-
if grep -qF "$f_clean" "$debt_doc" 2>/dev/null; then
204+
# 2. Mention in ANY of the proof-debt documents — match on `<file>:<line>`
205+
# substring, or on the file path alone (in which case we accept any
206+
# reference).
207+
documented_in=""
208+
for doc in "${debt_docs[@]}"; do
209+
if grep -qF "$f_clean:$ln" "$doc" 2>/dev/null; then
210+
documented_in="$doc"
211+
break
212+
fi
213+
if grep -qF "$f_clean" "$doc" 2>/dev/null; then
214+
documented_in="$doc"
215+
break
216+
fi
217+
done
218+
if [ -n "$documented_in" ]; then
211219
continue
212220
fi
213221

214222
# Undocumented.
215223
echo "[ERROR] Undocumented escape hatch at $f_clean:$ln ($kind):"
216224
echo " $ctx"
217225
echo " Annotate with a 'TRUSTED:' or 'AXIOM:' leading comment, or"
218-
echo " enumerate in $debt_doc per the schema."
226+
echo " enumerate in any of: ${debt_docs[*]}"
219227
undocumented=$((undocumented + 1))
220228
done < "$markers_tsv"
221229

222230
if [ "$undocumented" -gt 0 ]; then
223231
echo ""
224232
echo "[ERROR] $undocumented/$marker_count escape hatch(es) are undocumented."
225-
echo "[ERROR] Each must be annotated inline OR enumerated in $debt_doc."
233+
echo "[ERROR] Each must be annotated inline OR enumerated in one of: ${debt_docs[*]}"
226234
echo "[ERROR] See https://github.com/hyperpolymath/standards/blob/main/docs/TRUSTED-BASE-REDUCTION-POLICY.adoc"
227235
exit 1
228236
fi
229237

230-
echo "[OK] All $marker_count escape hatch(es) are documented (inline annotation or $debt_doc entry)."
238+
echo "[OK] All $marker_count escape hatch(es) are documented (inline annotation or entry in: ${debt_docs[*]})."
231239
exit 0

0 commit comments

Comments
 (0)