From 6262a9745eb22b70ea74120b48e439248ac2b6f0 Mon Sep 17 00:00:00 2001 From: VirtualMachinist Date: Wed, 23 Sep 2026 21:22:34 -0400 Subject: [PATCH] test: G2c scan the plugin surface as raw text Verification rejected the previous revision: it stripped `//` comments before matching, so a comment containing GEODE_TOKEN would still exit 0. - Drop the comment stripper. Model.js, BarWidget.qml, manifest.json and README.md are now scanned as raw text, so a red-line string fails wherever it appears -- source, JSON, prose, or comment. - The clean tree stays green because the comment cleanup (PR #5) removed those substrings from Model.js's comments; a comment that reintroduces `GEODE_TOKEN` fails the tree again. - Unchanged: case-insensitive fixed-string match on agent serve / GTOK / GEODE_TOKEN / tui --token / agent token; a missing guarded file exits 1 so a rename cannot leave the guard vacuously green; cwd-independent; no geode subprocess, no socket, no Omarchy. --- tests/no_agent_token_surface.sh | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/tests/no_agent_token_surface.sh b/tests/no_agent_token_surface.sh index 369ea19..3962a1d 100755 --- a/tests/no_agent_token_surface.sh +++ b/tests/no_agent_token_surface.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# SPEC-omarchy red lines (backend, G2): the shipped plugin surface must never +# SPEC-omarchy red lines (backend, G2c): the shipped plugin surface must never # advertise or use a Geode agent / token interface. ci.yml already runs every # tests/*.sh under `set -e`, so a non-zero exit here fails the tree. # @@ -10,15 +10,13 @@ # Matched substrings (case-insensitive): # agent serve · GTOK · GEODE_TOKEN · tui --token · agent token # -# `//` line comments are stripped before matching -- in the JS and the QML -# source alike. Model.js documents these very red lines in comments ("Red -# lines (SPEC-omarchy G0): no `--token`, no `GEODE_TOKEN` written by ..."), -# and documentation of the prohibition is not a usage of it. manifest.json has -# no comment syntax and README.md is shipped prose, so both are matched -# verbatim. Block comments are NOT stripped: no guarded source uses one, so a -# red-line string inside one fails loudly instead of passing silently. +# The four files are scanned as RAW TEXT: no comment stripping, no escaping, no +# exclusions. A red-line string is a red line wherever it appears -- source, +# JSON, prose, or a `//` comment. Comment cleanup (PR #5) removed these +# substrings from Model.js's comments, which is what keeps the clean tree +# green; a comment that reintroduces `GEODE_TOKEN` fails it again. # -# No `geode` subprocess, no socket, no Omarchy: awk + grep over four files. +# No `geode` subprocess, no socket, no Omarchy: grep over four files. # # Exit 0 when the tree is clean, 1 on any hit or missing guarded file. @@ -39,22 +37,11 @@ for f in "${files[@]}"; do fi done -# Comment-stripped view of one source file. One output line per input line, so -# reported line numbers stay the file's own. -strip_line_comments() { - awk '{ sub(/\/\/.*/, ""); print }' "$1" -} - status=0 for f in "${files[@]}"; do - case "$f" in - *.js | *.qml) view=$(strip_line_comments "$f") ;; - *) view=$(cat -- "$f") ;; - esac - for p in "${patterns[@]}"; do - if found=$(printf '%s\n' "$view" | grep -inF -- "$p"); then - echo "FAIL: $f carries the red-line string \"$p\" outside comments:" >&2 + if found=$(grep -inF -- "$p" "$f"); then + echo "FAIL: $f carries the red-line string \"$p\":" >&2 printf '%s\n' "$found" | awk '{ print " " $0 }' >&2 status=1 fi