Repository navigation
refactor(abi): one ABI tree — module-path layout, JanusKey casing, symlink farm retired (JNK-01, A of 3) #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell | ||
| # One ABI tree. Fails when the Idris2 ABI surface is duplicated, symlinked, | ||
| # mis-cased or inconsistent with its package file. Pure shell: runs without | ||
| # idris2, so it can gate PRs on hosts that cannot typecheck. | ||
| set -euo pipefail | ||
| cd "$(dirname "$0")/.." | ||
| fail=0 | ||
| say() { echo "[check-abi-tree] $*"; } | ||
|
|
||
| # 1. The symlink farm (PR #140, src/idris-abi/) is retired. | ||
| if [ -e src/idris-abi ]; then say "FAIL: src/idris-abi exists (retired symlink farm)"; fail=1; fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # 2. Exactly one package file, and it is the one the gates name. | ||
| n=$(find src/abi -name '*.ipkg' | wc -l) | ||
| if [ "$n" -ne 1 ]; then say "FAIL: expected 1 .ipkg under src/abi, found $n"; fail=1; fi | ||
| if [ ! -f src/abi/januskey-abi.ipkg ]; then say "FAIL: src/abi/januskey-abi.ipkg missing"; fail=1; fi | ||
|
|
||
| # 3. Exactly one Foreign.idr under src/ (the FFI surface is declared once). | ||
| n=$(find src -name 'Foreign.idr' | wc -l) | ||
| if [ "$n" -ne 1 ]; then say "FAIL: expected 1 Foreign.idr under src/, found $n"; fail=1; fi | ||
|
|
||
| # 4. No symlinks under src/abi. | ||
| n=$(find src/abi -type l | wc -l) | ||
| if [ "$n" -ne 0 ]; then say "FAIL: $n symlink(s) under src/abi"; fail=1; fi | ||
|
|
||
| # 5. Every module declaration matches its path (this is what caught the | ||
| # Januskey/JanusKey casing split). | ||
| while IFS= read -r f; do | ||
| rel=${f#src/abi/}; want=${rel%.idr}; want=${want//\//.} | ||
| have=$(grep -m1 -E '^module ' "$f" | awk '{print $2}') | ||
| if [ "$have" != "$want" ]; then say "FAIL: $f declares module '$have'; path says '$want'"; fail=1; fi | ||
| done < <(find src/abi -name '*.idr' | sort) | ||
|
|
||
| # 6. Every module the package lists has a file; every file is listed. | ||
| listed=$(sed -n '/^modules *=/,/^[^ ,]/p' src/abi/januskey-abi.ipkg | tr ',' '\n' | sed 's/^modules *=//; s/^[ ,]*//; s/[ ,]*$//' | grep -E '^[A-Z]' || true) | ||
| for m in $listed; do | ||
| p="src/abi/${m//./\/}.idr" | ||
| if [ ! -f "$p" ]; then say "FAIL: ipkg lists $m but $p is missing"; fail=1; fi | ||
| done | ||
| while IFS= read -r f; do | ||
| rel=${f#src/abi/}; mod=${rel%.idr}; mod=${mod//\//.} | ||
| if ! grep -qx "$mod" <<< "$listed"; then say "FAIL: $f is not listed in src/abi/januskey-abi.ipkg"; fail=1; fi | ||
| done < <(find src/abi -name '*.idr' | sort) | ||
|
|
||
| # 7. Report, do not fail, on generated trees: they are not part of this gate. | ||
| if [ -d generated/idrisiser ]; then | ||
| say "note: generated/idrisiser is present and is NOT part of the ABI gate (its modules do not typecheck; see PROOF-NEEDS.adoc)" | ||
| fi | ||
|
|
||
| if [ "$fail" -ne 0 ]; then say "FAIL"; exit 1; fi | ||
| say "OK: one ABI tree ($(find src/abi -name '*.idr' | wc -l) modules, 1 package)" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| -- SPDX-License-Identifier: MPL-2.0 | ||
| -- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell | ||
| -- | ||
| -- Idris2 package for the JanusKey ABI layer. | ||
| -- | ||
| -- Sources live under src/abi/JanusKey/ABI/<Module>.idr, laid out by module | ||
| -- name, so `idris2 --typecheck src/abi/januskey-abi.ipkg` reaches them | ||
| -- directly. The former src/idris-abi/ symlink farm (PR #140) and the | ||
| -- Januskey/JanusKey casing split it worked around are gone; the tree | ||
| -- invariants are enforced by scripts/check-abi-tree.sh (just abi-tree-check). | ||
| -- | ||
| -- Run: idris2 --typecheck src/abi/januskey-abi.ipkg (or: just test-proofs) | ||
| package januskey-abi | ||
|
|
||
| sourcedir = "." | ||
|
|
||
| modules = JanusKey.ABI.Types | ||
| , JanusKey.ABI.Layout | ||
| , JanusKey.ABI.Foreign | ||
| , JanusKey.ABI.Proofs |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.