Skip to content

Commit e830dd3

Browse files
refactor: migrate all banned Python to Deno (clean history, replaces #59) (#60)
## Summary Clean-history replacement for #59 (closed). Eliminates the 4 remaining non-SaltStack Python files — the ones tripping the `Check for Banned Languages` / `antipattern-check` banned-language CI gates — by porting each to **Deno**, an allowed runtime. Delivered as a **single commit off `main`** so that no commit anywhere in this PR's history introduces the example credential-like strings. (On #59, an intermediate commit re-added pre-existing fake `token`/`signature` example literals; `gitleaks-action` scans per-commit, so a follow-up fix couldn't clear it. This branch carries the inert `EXAMPLE-*` placeholders from the first and only commit.) | Was (Python) | Now (Deno) | Notes | |---|---|---| | `a2ml/scripts/contractiles-a2ml-tool.py` | `…-tool.js` | JSON emit **byte-identical** to old `json.dumps(sort_keys=True, indent=2)` — verified against `tests/contractiles/expected/*.json`. Wrappers + a2ml docs call `deno run`. | | `avow-protocol/.../examples/python/stamp_example.py` | `examples/deno/stamp_example.js` | `ctypes` → `Deno.dlopen`; fake literals → inert `EXAMPLE-*`; zig FFI README updated. | | `consent-aware-http/.../python/{aibdp_middleware,example_server}.py` (+README/reqs) | `…/deno/` on `Deno.serve` | manifest moved, README ported, nodejs cross-link fixed. | Verified in-sandbox (Node shim; no Deno here): byte-identical emit, correct validate exit codes, `node --check` clean on all 4 files, no Python remains under either CI banned-language filter. CODEOWNERS policy (#58) is **not** included here — it already merged to `main`. ## Test plan - [ ] `gitleaks` passes (no fake secrets in any commit) - [ ] `Check for Banned Languages` / `antipattern-check` no longer fail on Python (pre-existing ReScript `.res` debt is separate/out of scope) - [ ] `cd a2ml && bash scripts/contractiles-a2ml-test.sh` (needs `deno`) - [ ] `deno run --allow-read --allow-net consent-aware-http/examples/reference-implementations/deno/example_server.js` + the curl checks https://claude.ai/code/session_01GTo7dz32ZgxuHXefv8BGqn --- _Generated by [Claude Code](https://claude.ai/code/session_01GTo7dz32ZgxuHXefv8BGqn)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0b68f3c commit e830dd3

20 files changed

Lines changed: 1296 additions & 1663 deletions

a2ml/docs/CONTRACTILES-A2ML-V1.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ The validator and emitter support explicit types:
109109

110110
[source,bash]
111111
----
112-
python3 scripts/contractiles-a2ml-tool.py validate --type mustfile tests/contractiles/fixtures/invalid-mustfile.a2ml
113-
python3 scripts/contractiles-a2ml-tool.py emit --type trustfile contractiles/trust/Trustfile.a2ml /tmp/trustfile.json
112+
deno run --allow-read --allow-write scripts/contractiles-a2ml-tool.js validate --type mustfile tests/contractiles/fixtures/invalid-mustfile.a2ml
113+
deno run --allow-read --allow-write scripts/contractiles-a2ml-tool.js emit --type trustfile contractiles/trust/Trustfile.a2ml /tmp/trustfile.json
114114
----

a2ml/docs/RELEASE-CHECKLIST-CONTRACTILES-A2ML-V1.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
== Pre-Release
66

77
- [ ] Specs updated: `docs/CONTRACTILES-A2ML-V1.adoc` and `contractiles/spec/contractiles-v1.json`
8-
- [ ] Validator/emitter tool updated: `scripts/contractiles-a2ml-tool.py`
8+
- [ ] Validator/emitter tool updated: `scripts/contractiles-a2ml-tool.js`
99
- [ ] Fixtures updated: `tests/contractiles/fixtures/*`
1010
- [ ] Expected outputs updated: `tests/contractiles/expected/*`
1111
- [ ] CI workflow present: `.github/workflows/contractiles-a2ml.yml`

a2ml/docs/RELEASE-NOTES-CONTRACTILES-A2ML-V1.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ just contractiles-k9-validate
3030

3131
* `docs/CONTRACTILES-A2ML-V1.adoc`
3232
* `contractiles/spec/contractiles-v1.json`
33-
* `scripts/contractiles-a2ml-tool.py`
33+
* `scripts/contractiles-a2ml-tool.js`
3434
* `tests/contractiles/fixtures/*`
3535
* `.github/workflows/contractiles-a2ml.yml`
3636

a2ml/scripts/contractiles-a2ml-emit.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
66
out_dir="${1:-$root/build/contractiles}"
77
mkdir -p "$out_dir"
88

9-
tool="$root/scripts/contractiles-a2ml-tool.py"
9+
tool="$root/scripts/contractiles-a2ml-tool.js"
10+
runtool() { deno run --quiet --allow-read --allow-write "$tool" "$@"; }
1011

11-
python3 "$tool" emit "$root/contractiles/must/Mustfile.a2ml" "$out_dir/mustfile.json"
12-
python3 "$tool" emit "$root/contractiles/trust/Trustfile.a2ml" "$out_dir/trustfile.json"
13-
python3 "$tool" emit "$root/contractiles/dust/Dustfile.a2ml" "$out_dir/dustfile.json"
14-
python3 "$tool" emit "$root/contractiles/lust/Intentfile.a2ml" "$out_dir/intentfile.json"
12+
runtool emit "$root/contractiles/must/Mustfile.a2ml" "$out_dir/mustfile.json"
13+
runtool emit "$root/contractiles/trust/Trustfile.a2ml" "$out_dir/trustfile.json"
14+
runtool emit "$root/contractiles/dust/Dustfile.a2ml" "$out_dir/dustfile.json"
15+
runtool emit "$root/contractiles/lust/Intentfile.a2ml" "$out_dir/intentfile.json"
1516

1617
echo "Wrote: $out_dir/mustfile.json"
1718
echo "Wrote: $out_dir/trustfile.json"

a2ml/scripts/contractiles-a2ml-test.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ set -euo pipefail
33

44
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
55

6-
tool="$root/scripts/contractiles-a2ml-tool.py"
6+
tool="$root/scripts/contractiles-a2ml-tool.js"
77
fixtures="$root/tests/contractiles/fixtures"
88
expected="$root/tests/contractiles/expected"
99

10-
python3 "$tool" validate \
10+
runtool() { deno run --quiet --allow-read --allow-write "$tool" "$@"; }
11+
12+
runtool validate \
1113
"$fixtures/Mustfile.a2ml" \
1214
"$fixtures/Trustfile.a2ml" \
1315
"$fixtures/Dustfile.a2ml" \
1416
"$fixtures/Intentfile.a2ml"
1517

16-
python3 "$tool" emit "$fixtures/Mustfile.a2ml" "$expected/mustfile.json.tmp"
17-
python3 "$tool" emit "$fixtures/Trustfile.a2ml" "$expected/trustfile.json.tmp"
18-
python3 "$tool" emit "$fixtures/Dustfile.a2ml" "$expected/dustfile.json.tmp"
19-
python3 "$tool" emit "$fixtures/Intentfile.a2ml" "$expected/intentfile.json.tmp"
18+
runtool emit "$fixtures/Mustfile.a2ml" "$expected/mustfile.json.tmp"
19+
runtool emit "$fixtures/Trustfile.a2ml" "$expected/trustfile.json.tmp"
20+
runtool emit "$fixtures/Dustfile.a2ml" "$expected/dustfile.json.tmp"
21+
runtool emit "$fixtures/Intentfile.a2ml" "$expected/intentfile.json.tmp"
2022

2123
diff -u "$expected/mustfile.json" "$expected/mustfile.json.tmp"
2224
diff -u "$expected/trustfile.json" "$expected/trustfile.json.tmp"
@@ -25,7 +27,7 @@ diff -u "$expected/intentfile.json" "$expected/intentfile.json.tmp"
2527

2628
expect_fail() {
2729
local file="$1"
28-
if python3 "$tool" validate "$file"; then
30+
if runtool validate "$file"; then
2931
echo "Expected validation failure: $file" >&2
3032
exit 1
3133
fi
@@ -34,7 +36,7 @@ expect_fail() {
3436
expect_fail_type() {
3537
local file="$1"
3638
local type="$2"
37-
if python3 "$tool" validate --type "$type" "$file"; then
39+
if runtool validate --type "$type" "$file"; then
3840
echo "Expected validation failure: $file ($type)" >&2
3941
exit 1
4042
fi

0 commit comments

Comments
 (0)