fix: tool bugs found in review audit
repl: env var was dead code (hardcoded 2s), empty frame gave misleading error check-tangle: show full SBCL output on compile failure, not filtered verify-repl: blacklist now configurable via VERIFY_REPL_EXCLUDE env var; regex tightened to ';; +REPL-VERIFIED:' from ';;.REPL.VERIFIED:' (ambiguous) org-eval: 1-based indexing to match repl-block; errors on out-of-range; errors on <1
This commit is contained in:
@@ -69,7 +69,7 @@ if echo "$OUTPUT" | grep -q ":OK"; then
|
|||||||
echo "OK: $ORG_FILE compiles cleanly" >&2
|
echo "OK: $ORG_FILE compiles cleanly" >&2
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "$OUTPUT" | grep -v '^;' | grep -v '^$' | head -5
|
|
||||||
echo "FAIL: $ORG_FILE — compilation error" >&2
|
echo "FAIL: $ORG_FILE — compilation error" >&2
|
||||||
|
echo "$OUTPUT"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Evaluate an org src block using Emacs batch mode
|
# Evaluate an org src block using Emacs batch mode
|
||||||
# Usage: org-eval <org-file> [block-index]
|
# Usage: org-eval <org-file> [block-index]
|
||||||
# If block-index is not provided, evaluates all blocks
|
# block-index is 1-based (first block = 1).
|
||||||
|
# If omitted, evaluates ALL blocks.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: org-eval <org-file> [block-index]"
|
echo "Usage: org-eval <org-file> [block-index]"
|
||||||
echo " Evaluates src blocks in the org file"
|
echo " Evaluates src blocks in the org file"
|
||||||
echo " If block-index is omitted, evaluates ALL blocks"
|
echo " block-index is 1-based (first block = 1)"
|
||||||
|
echo " If omitted, evaluates ALL blocks"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -23,15 +25,23 @@ fi
|
|||||||
echo "Evaluating: $ORG_FILE"
|
echo "Evaluating: $ORG_FILE"
|
||||||
|
|
||||||
if [ -n "$BLOCK_INDEX" ]; then
|
if [ -n "$BLOCK_INDEX" ]; then
|
||||||
|
# 1-based indexing: subtract 1 for Emacs' dotimes (0-based)
|
||||||
|
if [ "$BLOCK_INDEX" -lt 1 ]; then
|
||||||
|
echo "Error: block-index must be 1 or greater" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
SKIP=$((BLOCK_INDEX - 1))
|
||||||
# Evaluate specific block
|
# Evaluate specific block
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
--load org \
|
--load org \
|
||||||
--eval "(setq org-confirm-babel-evaluate nil)" \
|
--eval "(setq org-confirm-babel-evaluate nil)" \
|
||||||
--eval "(with-current-buffer (find-file-noselect \"$ORG_FILE\") \
|
--eval "(with-current-buffer (find-file-noselect \"$ORG_FILE\") \
|
||||||
(goto-char (point-min)) \
|
(goto-char (point-min)) \
|
||||||
(dotimes (_ $BLOCK_INDEX) \
|
(dotimes (_ $SKIP) \
|
||||||
(org-babel-next-src-block)) \
|
(org-babel-next-src-block)) \
|
||||||
(org-babel-execute-src-block))"
|
(if (org-in-src-block-p t) \
|
||||||
|
(org-babel-execute-src-block) \
|
||||||
|
(error \"Block $BLOCK_INDEX not found\")))"
|
||||||
else
|
else
|
||||||
# Evaluate all blocks
|
# Evaluate all blocks
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ my $sock = IO::Socket::INET->new(
|
|||||||
PeerHost => $HOST,
|
PeerHost => $HOST,
|
||||||
PeerPort => $PORT,
|
PeerPort => $PORT,
|
||||||
Proto => "tcp",
|
Proto => "tcp",
|
||||||
Timeout => 2
|
Timeout => $TIMEOUT
|
||||||
) or die "Cannot connect to $HOST:$PORT: $!\n";
|
) or die "Cannot connect to $HOST:$PORT: $!\n";
|
||||||
|
|
||||||
sub read_frame {
|
sub read_frame {
|
||||||
@@ -58,7 +58,11 @@ write_frame($sock, $msg);
|
|||||||
|
|
||||||
# Read response
|
# Read response
|
||||||
my $response = read_frame($sock);
|
my $response = read_frame($sock);
|
||||||
if ($response) {
|
if (defined $response) {
|
||||||
|
if ($response eq "") {
|
||||||
|
print STDERR "Daemon returned empty response\n";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
if ($response =~ /:VALUE "([^"]*)"/s) {
|
if ($response =~ /:VALUE "([^"]*)"/s) {
|
||||||
print "$1\n";
|
print "$1\n";
|
||||||
} elsif ($response =~ /:message "([^"]*)"/s) {
|
} elsif ($response =~ /:message "([^"]*)"/s) {
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ VIOLATIONS=0
|
|||||||
FILES_CHECKED=0
|
FILES_CHECKED=0
|
||||||
|
|
||||||
# Blacklist: files exempt from REPL verification (core infrastructure, tests)
|
# Blacklist: files exempt from REPL verification (core infrastructure, tests)
|
||||||
BLACKLIST=(
|
# Override with $VERIFY_REPL_EXCLUDE (space-separated filenames).
|
||||||
|
# Example: VERIFY_REPL_EXCLUDE="setup.org package.lisp" verify-repl org/
|
||||||
|
DEFAULT_BLACKLIST=(
|
||||||
"core-defpackage.org"
|
"core-defpackage.org"
|
||||||
"core-manifest.org"
|
"core-manifest.org"
|
||||||
"core-skills.org"
|
"core-skills.org"
|
||||||
@@ -31,6 +33,12 @@ BLACKLIST=(
|
|||||||
"setup.org"
|
"setup.org"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [ -n "${VERIFY_REPL_EXCLUDE:-}" ]; then
|
||||||
|
IFS=' ' read -ra BLACKLIST <<< "$VERIFY_REPL_EXCLUDE"
|
||||||
|
else
|
||||||
|
BLACKLIST=("${DEFAULT_BLACKLIST[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
is_blacklisted() {
|
is_blacklisted() {
|
||||||
local fname
|
local fname
|
||||||
fname=$(basename "$1")
|
fname=$(basename "$1")
|
||||||
@@ -75,7 +83,8 @@ check_file() {
|
|||||||
def_count=0
|
def_count=0
|
||||||
has_repl_verify=0
|
has_repl_verify=0
|
||||||
# Check for REPL-VERIFIED comment on previous line(s)
|
# Check for REPL-VERIFIED comment on previous line(s)
|
||||||
if echo "$prev_line" | grep -qE ';;.REPL.VERIFIED:'; then
|
# Matches ";; REPL-VERIFIED:" or ";; REPL-VERIFIED:" etc.
|
||||||
|
if echo "$prev_line" | grep -qE ';; +REPL[-_]VERIFIED:'; then
|
||||||
has_repl_verify=1
|
has_repl_verify=1
|
||||||
fi
|
fi
|
||||||
# Check for prose requirement: was there a headline before this block?
|
# Check for prose requirement: was there a headline before this block?
|
||||||
|
|||||||
Reference in New Issue
Block a user