Skip to content

Commit f345718

Browse files
claudehyperpolymath
authored andcommitted
feat(coordinator-boundary): advisory tier for prose / pasted-spec leakage
The structural guard catches language *files* and re-vendored language dirs, but not a grammar, typing rules, or a whole language spec pasted into a narrative doc (how "TypeFix Zero" ended up inside README.adoc). This adds a NON-blocking advisory scan to hooks/validate-coordinator-boundary.sh: - Scope: the coordinator's narrative surface (top-level *.md/*.adoc + docs/, minus docs/disambiguation/). It does NOT scan wiki/ (where rust/ocaml/agda/ebnf teaching snippets legitimately live) or extraction-queue/ (staged content). - Flags: grammar/proof code fences (agda/lean/coq/idris/ebnf/bnf/antlr/g4), implementation-language fences (rust/ocaml/reason/rescript), and unfenced spec tells (BNF ::=, sequents, universe/fixpoint typing judgments). - WARNS only — never fails the build (heuristic; false positives must not block). Emits GitHub Actions ::warning:: annotations so findings surface on PRs. Verified: passes clean on the current tree; flags a planted TF0-style spec (fix : (A -> A), an agda fence, a ::= production) as 3 warnings while staying exit 0; structural leaks still hard-fail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MWPX7iyvHf5AuwBAn1sJPy
1 parent 95e05a7 commit f345718

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

hooks/validate-coordinator-boundary.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,55 @@ for lang in $LANGS; do
5757
fi
5858
done
5959

60+
# ---------------------------------------------------------------------------
61+
# Advisory tier (NON-blocking): catch *prose* language-spec leakage that the
62+
# structural checks above cannot — a grammar, typing rules, or a whole language
63+
# spec pasted into a narrative doc (how "TypeFix Zero" ended up inside README).
64+
# This is heuristic, so it only WARNS; it never fails the build.
65+
#
66+
# Scope = the coordinator's NARRATIVE surface (top-level *.md/*.adoc + docs/,
67+
# minus the cross-language disambiguation notes). It deliberately does NOT scan
68+
# wiki/, where illustrative rust/ocaml/agda/ebnf *teaching* snippets legitimately
69+
# live, nor extraction-queue/ (content already staged for relocation).
70+
# ---------------------------------------------------------------------------
71+
WARN=0
72+
in_gha() { [ -n "${GITHUB_ACTIONS:-}" ]; }
73+
74+
narrative_files() {
75+
find . -maxdepth 1 -type f \( -name '*.md' -o -name '*.adoc' \)
76+
find docs -type f \( -name '*.md' -o -name '*.adoc' \) ! -path 'docs/disambiguation/*' 2>/dev/null
77+
}
78+
79+
advise() { # $1=regex $2=message
80+
local f ln
81+
while IFS= read -r f; do
82+
[ -f "$f" ] || continue
83+
while IFS= read -r ln; do
84+
[ -n "$ln" ] || continue
85+
in_gha && echo "::warning file=${f#./},line=${ln}::$2"
86+
printf ' WARN %s:%s — %s\n' "${f#./}" "$ln" "$2"
87+
WARN=$((WARN + 1))
88+
done < <({ grep -nE "$1" "$f" 2>/dev/null || true; } | cut -d: -f1)
89+
done < <(narrative_files)
90+
}
91+
92+
# grammar/proof code blocks have no place in a coordinator narrative doc
93+
advise '^[[:space:]]*(```|----)[[:space:]]*(agda|lean|coq|idris2?|ebnf|bnf|antlr|g4)\b' \
94+
'grammar/proof code block in a coordinator narrative doc — belongs in the language repo'
95+
# implementation-language code blocks: a coordinator describes, it does not implement
96+
advise '^[[:space:]]*(```|----)[[:space:]]*(rust|ocaml|reason|rescript)\b' \
97+
'implementation-language code block in a coordinator narrative doc — describe, do not implement here'
98+
# unfenced spec tells: BNF productions, sequents, universe/fixpoint typing judgments
99+
advise '::=|⊢|Type[[:space:]]+[0-9a-z][[:space:]]*:[[:space:]]*Type|(^|[^A-Za-z])fix[[:space:]]*:[[:space:]]*\(' \
100+
'typing-judgment / grammar-production notation — looks like a pasted language spec'
101+
102+
if [ "$WARN" -gt 0 ]; then
103+
echo ""
104+
echo "coordinator-boundary: $WARN advisory warning(s) — possible prose/spec leakage (NON-blocking)."
105+
echo " If a language spec was pasted in, move it to that language's hyperpolymath/<lang> repo."
106+
echo " If it is legitimate cross-language prose, ignore — advisory checks never fail the build."
107+
fi
108+
60109
if [ "$ERRORS" -gt 0 ]; then
61110
echo ""
62111
echo "Coordinator-boundary check FAILED ($ERRORS violation(s))."

0 commit comments

Comments
 (0)