Skip to content

Commit 0ab32c0

Browse files
fix(ci): rsr-antipattern.yml duplicate heredoc (#9)
* fix(ci): rsr-antipattern.yml duplicate heredoc **rsr-antipattern.yml**: deletes the orphan duplicate Python script (lines 274-428) that escapes the heredoc and exits 127. Mirrors hyperpolymath/rsr-template-repo#39. 🤖 Generated with [Claude Code](https://claude.com/claude-code) * fix(ci): repair corrupted rsr-antipattern.yml on this branch Repairs the corrupted `rsr-antipattern.yml` from the prior commit on this branch. See hyperpolymath/stapeln#34 for the full root-cause writeup — the original sweep built its canonical via `gh api --jq '.content'` piped through PowerShell, but `gh` line-wraps base64 in the terminal pipe, so each chunk was decoded separately and the rejoined file has mid-word line breaks (`# SPDX-License-Id\nentifier:`, `name: RSR A\nnti-Pattern`, etc.). GitHub Actions can't parse the resulting YAML — the workflow completes in 0 seconds with no jobs. This commit overwrites the file with the correct content, built via raw byte download (`Accept: application/vnd.github.raw`) and `[System.IO.File]::WriteAllBytes` so no pipe ever touches the bytes. Round-trip byte-verified against canonical.
1 parent 1e1c02a commit 0ab32c0

1 file changed

Lines changed: 16 additions & 79 deletions

File tree

.github/workflows/rsr-antipattern.yml

Lines changed: 16 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# RSR Anti-Pattern CI Check
3+
# SPDX-License-Identifier: PMPL-1.0-or-later
34
#
45
# Enforces: No TypeScript, No Go, No Python (except SaltStack), No npm
56
# Allows: ReScript, Deno, WASM, Rust, OCaml, Haskell, Guile/Scheme
67

78
name: RSR Anti-Pattern Check
9+
810
on:
911
push:
1012
branches: [main, master, develop]
1113
pull_request:
1214
branches: [main, master, develop]
15+
16+
17+
permissions:
18+
contents: read
19+
1320
jobs:
1421
antipattern-check:
1522
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
1625
steps:
17-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
1828
- name: Check for TypeScript
1929
run: |
2030
python3 << 'PYEOF'
@@ -128,82 +138,6 @@ jobs:
128138
print(f"✅ No TypeScript files outside allowlist ({len(exemption_patterns)} per-repo exemption(s) parsed).")
129139
PYEOF
130140
131-
# Universal builtin allowlist — bridges that need no per-repo declaration.
132-
# Files matching any of these patterns are always allowed.
133-
BUILTIN_GLOBS = [
134-
'*.d.ts',
135-
'**/bindings/**',
136-
'**/tests/**', '**/test/**',
137-
'**/scripts/**',
138-
'**/mcp-adapter/**',
139-
'**/*vscode*/**',
140-
'**/cli/**',
141-
'**/mod.ts',
142-
'**/lsp-server.ts', '**/lsp_server.ts', '**/lsp.ts', '**/*-lsp.ts',
143-
'**/deno-*/**',
144-
'**/node_modules/**',
145-
'**/vendor/**',
146-
'**/examples/**',
147-
'**/ffi/**',
148-
]
149-
150-
# Per-repo exemptions parsed from .claude/CLAUDE.md "TypeScript Exemptions" table.
151-
# Single source of truth — adding a row here unblocks CI for that path.
152-
# Format expected:
153-
# ### TypeScript Exemptions ...
154-
# | Path | Files | Rationale | Unblock condition |
155-
# |---|---|---|---|
156-
# | `path/to/file.ts` | 1 | ... | ... |
157-
# | `dir/*.ts` | 6 | ... | ... |
158-
exemptions = []
159-
claude_md = pathlib.Path('.claude/CLAUDE.md')
160-
if claude_md.exists():
161-
in_table = False
162-
for line in claude_md.read_text(encoding='utf-8').splitlines():
163-
if re.search(r'TypeScript [Ee]xemptions', line):
164-
in_table = True
165-
continue
166-
if in_table and line.startswith(('### ', '## ', '# ')):
167-
break
168-
if in_table and line.startswith('|'):
169-
m = re.match(r'\|\s*`([^`]+)`', line)
170-
if m:
171-
exemptions.append(m.group(1))
172-
173-
# Find all .ts and .tsx files
174-
found = []
175-
for ext in ('ts', 'tsx'):
176-
found.extend(str(p) for p in pathlib.Path('.').rglob(f'*.{ext}'))
177-
178-
def allowed(path):
179-
p = path.lstrip('./')
180-
for g in BUILTIN_GLOBS + exemptions:
181-
if fnmatch.fnmatchcase(p, g):
182-
return True
183-
# also treat glob ending with / as a directory prefix
184-
base = g.rstrip('/').rstrip('*').rstrip('/')
185-
if base and (p == base or p.startswith(base + '/')):
186-
return True
187-
return False
188-
189-
bad = sorted(f for f in found if not allowed(f))
190-
if bad:
191-
print("❌ TypeScript files detected outside the allowlist.\n")
192-
for f in bad:
193-
print(f" {f}")
194-
print()
195-
print("To resolve, either:")
196-
print(" (a) migrate the file to AffineScript")
197-
print(" (see Human_Programming_Guide.adoc migration chapter), OR")
198-
print(" (b) move it to an allowlisted bridge path")
199-
print(" (bindings/, tests/, scripts/, mcp-adapter/, *vscode*/, cli/, deno-*/, etc.), OR")
200-
print(" (c) add an entry to the 'TypeScript Exemptions' table in .claude/CLAUDE.md")
201-
print(" with rationale + unblock condition.")
202-
if exemptions:
203-
print(f"\n(Currently {len(exemptions)} exemption(s) parsed from .claude/CLAUDE.md.)")
204-
sys.exit(1)
205-
print(f"✅ No TypeScript files outside allowlist ({len(exemptions)} per-repo exemption(s) parsed).")
206-
PYEOF
207141
- name: Check for Go
208142
run: |
209143
if find . -name "*.go" | grep -q .; then
@@ -212,6 +146,7 @@ jobs:
212146
exit 1
213147
fi
214148
echo "✅ No Go files"
149+
215150
- name: Check for Python (non-SaltStack)
216151
run: |
217152
PY_FILES=$(find . -name "*.py" | grep -v salt | grep -v _states | grep -v _modules | grep -v pillar | grep -v venv | grep -v __pycache__ || true)
@@ -221,20 +156,23 @@ jobs:
221156
exit 1
222157
fi
223158
echo "✅ No non-SaltStack Python files"
159+
224160
- name: Check for npm lockfiles
225161
run: |
226162
if [ -f "package-lock.json" ] || [ -f "yarn.lock" ]; then
227163
echo "❌ npm/yarn lockfile detected - use Deno instead"
228164
exit 1
229165
fi
230166
echo "✅ No npm lockfiles"
167+
231168
- name: Check for tsconfig
232169
run: |
233170
if [ -f "tsconfig.json" ]; then
234171
echo "❌ tsconfig.json detected - use ReScript instead"
235172
exit 1
236173
fi
237174
echo "✅ No tsconfig.json"
175+
238176
- name: Verify Deno presence (if package.json exists)
239177
run: |
240178
if [ -f "package.json" ]; then
@@ -243,6 +181,7 @@ jobs:
243181
fi
244182
fi
245183
echo "✅ Deno configuration check complete"
184+
246185
- name: Summary
247186
run: |
248187
echo "╔════════════════════════════════════════════════════════════╗"
@@ -253,5 +192,3 @@ jobs:
253192
echo "║ ║"
254193
echo "║ Blocked: TypeScript, Go, npm, Python (non-Salt) ║"
255194
echo "╚════════════════════════════════════════════════════════════╝"
256-
permissions:
257-
contents: read

0 commit comments

Comments
 (0)