@techgoblin/gobstack 0.6.0-alpha.4 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/README.md +249 -116
- package/VERSION +1 -1
- package/bans/README.md +5 -5
- package/bans/grep-ban.sh +1 -1
- package/bin/goblin-bans +103 -27
- package/bin/goblin-init +345 -259
- package/bin/goblin-install +269 -213
- package/bin/goblin-lib.sh +63 -66
- package/bin/goblin-map +130 -579
- package/bin/goblin-mcp.js +9 -14
- package/bin/goblin-verify +411 -993
- package/bin/goblin.js +4 -9
- package/docs/CURATION-2026-11-07-gobigrams.md +223 -0
- package/docs/GUIDE.md +727 -179
- package/docs/LIMITS.md +297 -301
- package/docs/RECORD-NOTES.md +1 -2
- package/manifest/bans.tsv +9 -9
- package/manifest/categories.tsv +18 -0
- package/manifest/enforcement.tsv +14 -67
- package/manifest/glossary.tsv +6 -12
- package/manifest/library.tsv +33 -0
- package/package.json +1 -4
- package/skills/goblin-bootstrap/SKILL.md +20 -32
- package/skills/goblin-feature-map/SKILL.md +1 -1
- package/skills/goblin-handoff/SKILL.md +5 -0
- package/skills/goblin-verify-author/SKILL.md +14 -2
- package/skills/practice/SKILL.md +4 -4
- package/templates/AGENTS.md.tmpl +6 -6
- package/templates/HANDOFF.md.tmpl +8 -6
- package/templates/SPEC.md.tmpl +2 -2
- package/templates/agents-block.tmpl +1 -10
- package/adapters/_template/adapter.tsv +0 -16
- package/adapters/_template/detect.sh +0 -10
- package/adapters/_template/emit.sh +0 -5
- package/adapters/_template/verify.sh +0 -4
- package/adapters/claude/adapter.tsv +0 -8
- package/adapters/claude/detect.sh +0 -8
- package/adapters/claude/verify.sh +0 -47
- package/adapters/codex/adapter.tsv +0 -12
- package/adapters/codex/detect.sh +0 -9
- package/adapters/codex/verify.sh +0 -45
- package/adapters/copilot/adapter.tsv +0 -10
- package/adapters/copilot/detect.sh +0 -8
- package/adapters/copilot/verify.sh +0 -45
- package/adapters/cursor/adapter.tsv +0 -11
- package/adapters/cursor/detect.sh +0 -10
- package/adapters/cursor/verify.sh +0 -45
- package/adapters/gemini/adapter.tsv +0 -15
- package/adapters/gemini/detect.sh +0 -11
- package/adapters/gemini/verify.sh +0 -49
- package/adapters/hermes/adapter.tsv +0 -9
- package/adapters/hermes/detect.sh +0 -8
- package/adapters/hermes/verify.sh +0 -27
- package/adapters/opencode/adapter.tsv +0 -14
- package/adapters/opencode/detect.sh +0 -9
- package/adapters/opencode/verify.sh +0 -45
- package/automations/README.md +0 -53
- package/automations/bugreporter-intake.sh +0 -145
- package/automations/drift-audit.sh +0 -139
- package/automations/report.schema.tsv +0 -10
- package/bin/goblin +0 -144
- package/bin/goblin-audit +0 -143
- package/bin/goblin-doctor +0 -233
- package/bin/goblin-emit +0 -495
- package/bin/goblin-extras +0 -365
- package/bin/goblin-model +0 -105
- package/bin/goblin-upgrade +0 -580
- package/docs/ADOPTION.md +0 -173
- package/docs/CI.md +0 -190
- package/docs/CONTRACTS.md +0 -218
- package/docs/DESIGN.md +0 -92
- package/docs/ENFORCEMENT.md +0 -228
- package/docs/FLOWS.md +0 -164
- package/docs/GLOSSARY.md +0 -40
- package/docs/GUARDRAILS.md +0 -126
- package/docs/INTEGRATION.md +0 -92
- package/docs/LOOP.md +0 -165
- package/docs/RE-PLAYBOOK.md +0 -183
- package/docs/RISKS.md +0 -70
- package/docs/ROLES.md +0 -105
- package/extras-catalogue/catalogue.tsv +0 -42
- package/extras-catalogue/payload/README.md +0 -14
- package/extras-catalogue/payload/taste-skill/taste/REFERENCE.md +0 -3
- package/extras-catalogue/payload/taste-skill/taste/SKILL.md +0 -9
- package/manifest/classes.tsv +0 -51
- package/manifest/playbooks.tsv +0 -16
- package/presets/electron-overlay.yaml +0 -38
- package/presets/fleet.yaml +0 -43
- package/presets/game.yaml +0 -38
- package/presets/research.yaml +0 -41
- package/presets/service.yaml +0 -40
- package/presets/software.yaml +0 -48
- package/roles.yaml +0 -54
- package/skills/goblin-bugfix/SKILL.md +0 -26
- package/skills/goblin-bugreporter/SKILL.md +0 -52
- package/skills/goblin-drift-audit/SKILL.md +0 -43
- package/skills/goblin-eval/SKILL.md +0 -68
- package/skills/goblin-feature/SKILL.md +0 -26
- package/skills/goblin-investigation/SKILL.md +0 -26
- package/skills/goblin-judge/SKILL.md +0 -74
- package/skills/goblin-loop/SKILL.md +0 -88
- package/skills/goblin-mode/SKILL.md +0 -70
- package/skills/goblin-overnight/SKILL.md +0 -42
- package/skills/goblin-pr-gate/SKILL.md +0 -42
- package/skills/goblin-re-mobile/SKILL.md +0 -51
- package/skills/goblin-refactor/SKILL.md +0 -23
- package/skills/goblin-sweep/SKILL.md +0 -23
- package/skills/goblin-tdd-repro/SKILL.md +0 -27
- package/templates/audit-waiver.tsv.tmpl +0 -10
- package/templates/install-hooks.allowlist.tmpl +0 -9
- package/templates/report.yaml.tmpl +0 -16
package/bin/goblin-verify
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
set -uo pipefail
|
|
21
21
|
|
|
22
|
-
GOBLIN_VERIFY_VERSION="0.6.0-
|
|
22
|
+
GOBLIN_VERIFY_VERSION="0.6.0-beta.2"
|
|
23
23
|
SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
24
24
|
# shellcheck source=goblin-lib.sh
|
|
25
25
|
. "$SELF_DIR/goblin-lib.sh"
|
|
@@ -27,6 +27,7 @@ SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
27
27
|
ONLY=""
|
|
28
28
|
JSON=0
|
|
29
29
|
LIST=0
|
|
30
|
+
LIBRARY_LIST=0
|
|
30
31
|
SOURCE=""
|
|
31
32
|
VERBOSE=0
|
|
32
33
|
# PASS details collapse to (ok) in the default listing; --verbose (or --only, which is a
|
|
@@ -40,7 +41,9 @@ goblin-verify — prove a goblin-stack install is still what it says it is.
|
|
|
40
41
|
--only <id[,id...]> run only these manifest rows
|
|
41
42
|
--verbose print every row full-width (the default collapses PASS payloads
|
|
42
43
|
to a count; FAIL and ADV always print in full)
|
|
43
|
-
--list list the
|
|
44
|
+
--list list the on-by-default rows and exit
|
|
45
|
+
--library list the OFF-by-default rows (the library) and exit — each with a
|
|
46
|
+
one-line purpose and the exact line that turns it on
|
|
44
47
|
--json machine-readable output
|
|
45
48
|
--source <path> read the manifest from a goblin-stack checkout instead of .gob/
|
|
46
49
|
|
|
@@ -53,6 +56,7 @@ while [ $# -gt 0 ]; do
|
|
|
53
56
|
--only) ONLY="${2:-}"; VERBOSE=1; shift 2 ;;
|
|
54
57
|
--json) JSON=1; shift ;;
|
|
55
58
|
--list) LIST=1; shift ;;
|
|
59
|
+
--library) LIBRARY_LIST=1; shift ;;
|
|
56
60
|
--verbose) VERBOSE=1; shift ;;
|
|
57
61
|
--source) SOURCE="${2:-}"; shift 2 ;;
|
|
58
62
|
-h|--help) usage; exit 0 ;;
|
|
@@ -83,7 +87,7 @@ if [ -z "$ROOT" ]; then
|
|
|
83
87
|
fi
|
|
84
88
|
|
|
85
89
|
# ---- engine resolution (W1, §2.3): one chain, stated once --------------------
|
|
86
|
-
# Every engine-path lookup (enforcement.tsv,
|
|
90
|
+
# Every engine-path lookup (enforcement.tsv, bans.tsv, bans/*.sh, the ban
|
|
87
91
|
# engine) resolves through this chain, first hit wins:
|
|
88
92
|
# 1. --source <path> (existing flag; highest, for tests and pinned CI)
|
|
89
93
|
# 2. $ROOT/.gob/... (vendored per-repo engine — today's default)
|
|
@@ -164,14 +168,11 @@ ENGINE_CHAIN_VENDORED="\$ROOT/.gob/manifest/enforcement.tsv"
|
|
|
164
168
|
GOBLIN_ENGINE="" # the resolved engine root, when NOT vendored/--source
|
|
165
169
|
if [ -n "$SOURCE" ]; then
|
|
166
170
|
MANIFEST="$SOURCE/manifest/enforcement.tsv"
|
|
167
|
-
CLASSES="$SOURCE/manifest/classes.tsv"
|
|
168
171
|
elif [ -f "$ROOT/.gob/manifest/enforcement.tsv" ]; then
|
|
169
172
|
MANIFEST="$ROOT/.gob/manifest/enforcement.tsv"
|
|
170
|
-
CLASSES="$ROOT/.gob/manifest/classes.tsv"
|
|
171
173
|
elif [ -n "$ENGINE_DECLARED" ]; then
|
|
172
174
|
GOBLIN_ENGINE="$ENGINE_DECLARED"
|
|
173
175
|
MANIFEST="$GOBLIN_ENGINE/manifest/enforcement.tsv"
|
|
174
|
-
CLASSES="$GOBLIN_ENGINE/manifest/classes.tsv"
|
|
175
176
|
elif [ -n "$ENGINE_FAIL" ]; then
|
|
176
177
|
# §2.4: an explicit engine_dir: that does not resolve is exit 2, and nothing falls
|
|
177
178
|
# back. The refusal names the declared value and every path the chain tried.
|
|
@@ -193,10 +194,8 @@ else
|
|
|
193
194
|
if [ -n "$_cli_default" ] && [ -f "$_cli_default/manifest/enforcement.tsv" ]; then
|
|
194
195
|
GOBLIN_ENGINE="$_cli_default"
|
|
195
196
|
MANIFEST="$GOBLIN_ENGINE/manifest/enforcement.tsv"
|
|
196
|
-
CLASSES="$GOBLIN_ENGINE/manifest/classes.tsv"
|
|
197
197
|
else
|
|
198
198
|
MANIFEST="$SELF_DIR/../manifest/enforcement.tsv"
|
|
199
|
-
CLASSES="$SELF_DIR/../manifest/classes.tsv"
|
|
200
199
|
fi
|
|
201
200
|
fi
|
|
202
201
|
[ -f "$MANIFEST" ] || {
|
|
@@ -205,6 +204,35 @@ fi
|
|
|
205
204
|
exit 2
|
|
206
205
|
}
|
|
207
206
|
|
|
207
|
+
# ---- the library (batch 2b-ii) -----------------------------------------------
|
|
208
|
+
# The OFF-by-default row set lives in manifest/library.tsv next to the resolved manifest.
|
|
209
|
+
# Its rows are NOT executed by a default run: the runner above reads $MANIFEST only. The
|
|
210
|
+
# library is shipped data (a moved row keeps its full check text and remedy — nothing is
|
|
211
|
+
# deleted or commented out, and no check function is removed from this verifier); a repo
|
|
212
|
+
# turns a row ON by writing its id (the row's `enable` column) into its local override
|
|
213
|
+
# .gob/manifest/enforcement.local.tsv, which batch 3 wires into the run. Until then the
|
|
214
|
+
# library is a discovery surface: what exists, is held back, and how to enable each row.
|
|
215
|
+
MANIFEST_DIR=$(dirname "$MANIFEST")
|
|
216
|
+
LIBRARY_FILE="$MANIFEST_DIR/library.tsv"
|
|
217
|
+
[ -f "$LIBRARY_FILE" ] || LIBRARY_FILE=""
|
|
218
|
+
|
|
219
|
+
# ---- the repo-local override (batch 3): .gob/manifest/enforcement.local.tsv ----
|
|
220
|
+
# A repo turns a library row ON by writing that row's exact line (the snippet `gob verify
|
|
221
|
+
# --library` prints) into .gob/manifest/enforcement.local.tsv, which is VERSIONED WITH THE REPO
|
|
222
|
+
# (under $ROOT, not the engine). A local row behaves exactly like a matrix row: PASS, FAIL
|
|
223
|
+
# (its remedy: line is printed from this file), or SKIP (reported not-applicable). The file is
|
|
224
|
+
# OPTIONAL: absent means the default set only, and nothing is said about it.
|
|
225
|
+
#
|
|
226
|
+
# THE HONESTY GATE (the product's core rule: a repo must not be able to certify a rule nothing
|
|
227
|
+
# verifies). A local entry is REFUSED - exit 3, with a named remedy - when it names a row id the
|
|
228
|
+
# engine has no check for, or when its check cannot produce a verdict. Both are handled in
|
|
229
|
+
# setup_local_override below, before any row runs: a false green is the one failure this
|
|
230
|
+
# product must never produce. RUN_MANIFEST is $MANIFEST until a local override merges rows in.
|
|
231
|
+
LOCAL_FILE="$ROOT/.gob/manifest/enforcement.local.tsv"
|
|
232
|
+
[ -f "$LOCAL_FILE" ] || LOCAL_FILE=""
|
|
233
|
+
LOCAL_IDS=""
|
|
234
|
+
RUN_MANIFEST="$MANIFEST"
|
|
235
|
+
|
|
208
236
|
INSTALLED="$ROOT/.gob/installed.json"
|
|
209
237
|
|
|
210
238
|
# engine_block_field <key> — one field of installed.json's engine: block (empty if absent).
|
|
@@ -243,16 +271,39 @@ if [ "$LIST" -eq 1 ]; then
|
|
|
243
271
|
exit 0
|
|
244
272
|
fi
|
|
245
273
|
|
|
274
|
+
# --library: the discovery surface for the extend mechanism. It lists what the default run
|
|
275
|
+
# does NOT check, so a green run is never mistaken for the whole story. Each line: the row id,
|
|
276
|
+
# its one-line purpose (the rule cell), and the exact line that turns it on.
|
|
277
|
+
if [ "$LIBRARY_LIST" -eq 1 ]; then
|
|
278
|
+
if [ -z "$LIBRARY_FILE" ]; then
|
|
279
|
+
g_err "no library.tsv next to $MANIFEST - this engine ships no off-by-default row set"
|
|
280
|
+
exit 2
|
|
281
|
+
fi
|
|
282
|
+
g_info "the library: $(awk -F'\t' 'NR>1 && $1!="" {n++} END{print n+0}' "$LIBRARY_FILE") off-by-default row(s) - NOT run by a default verify."
|
|
283
|
+
g_info "enable a row by pasting its line below into .gob/manifest/enforcement.local.tsv (repo-local, committed with the repo)."
|
|
284
|
+
printf '\n'
|
|
285
|
+
awk -F'\t' 'NR>1 && $1!="" {
|
|
286
|
+
printf "%-7s %s\n", $1, $3
|
|
287
|
+
printf " paste this line into .gob/manifest/enforcement.local.tsv:\n"
|
|
288
|
+
printf " %s\t%s\t%s\t%s\t%s\t%s\t%s\n", $1, $2, $3, $4, $5, $6, $7
|
|
289
|
+
}' "$LIBRARY_FILE"
|
|
290
|
+
exit 0
|
|
291
|
+
fi
|
|
292
|
+
|
|
246
293
|
# --only must name rows the manifest actually has: a typo used to select nothing, emit no
|
|
247
294
|
# rows and exit 0, turning a pipeline gate into a no-op (D15).
|
|
248
295
|
if [ -n "$ONLY" ]; then
|
|
249
296
|
UNKNOWN=""
|
|
250
297
|
for want in $(printf '%s' "$ONLY" | tr ',' ' '); do
|
|
251
298
|
[ -n "$want" ] || continue
|
|
252
|
-
|
|
253
|
-
|
|
299
|
+
_hit=0
|
|
300
|
+
awk -F'\t' -v x="$want" 'NR>1 && $1==x {f=1} END{exit !f}' "$MANIFEST" && _hit=1
|
|
301
|
+
if [ "$_hit" -eq 0 ] && [ -n "$LOCAL_FILE" ]; then
|
|
302
|
+
awk -F'\t' -v x="$want" '$1==x {f=1} END{exit !f}' "$LOCAL_FILE" && _hit=1
|
|
303
|
+
fi
|
|
304
|
+
[ "$_hit" -eq 1 ] || UNKNOWN="$UNKNOWN $want"
|
|
254
305
|
done
|
|
255
|
-
[ -z "$UNKNOWN" ] || { g_err "--only names id(s)
|
|
306
|
+
[ -z "$UNKNOWN" ] || { g_err "--only names id(s) in neither the manifest nor the local override:$UNKNOWN"; exit 2; }
|
|
256
307
|
# A valid id that is SOURCE-scope (PR-01..PR-04) selects no target row: the run emits
|
|
257
308
|
# nothing and exits 0, which is the same no-op gate D15 closed for a typo (F2-6).
|
|
258
309
|
TARGET_ROWS=0
|
|
@@ -260,6 +311,10 @@ if [ -n "$ONLY" ]; then
|
|
|
260
311
|
[ -n "$want" ] || continue
|
|
261
312
|
awk -F'\t' -v x="$want" 'NR>1 && $1==x && $2=="target" {f=1} END{exit !f}' "$MANIFEST" \
|
|
262
313
|
&& TARGET_ROWS=1
|
|
314
|
+
if [ "$TARGET_ROWS" -eq 0 ] && [ -n "$LOCAL_FILE" ]; then
|
|
315
|
+
awk -F'\t' -v x="$want" '$1==x && $2=="target" {f=1} END{exit !f}' "$LOCAL_FILE" \
|
|
316
|
+
&& TARGET_ROWS=1
|
|
317
|
+
fi
|
|
263
318
|
done
|
|
264
319
|
if [ "$TARGET_ROWS" -eq 0 ]; then
|
|
265
320
|
g_err "--only $ONLY selects no target-scope row, so this run would execute nothing and"
|
|
@@ -283,14 +338,6 @@ if [ ! -f "$CONFIG" ]; then
|
|
|
283
338
|
exit 2
|
|
284
339
|
fi
|
|
285
340
|
|
|
286
|
-
# The class is read-time resolved: the gob block records the canonical name on new installs, but
|
|
287
|
-
# every repo installed before the 5-class merge records a letter (A..F) or an old name
|
|
288
|
-
# (app/agent/desktop). g_class_canon maps them all to the five canonical names; the tsv carries
|
|
289
|
-
# the canonical names, so nothing else in this file has to know about letters. `desktop`/F -> software.
|
|
290
|
-
CLASS_RAW=$(g_agents_read "$CONFIG" class)
|
|
291
|
-
CLASS=$(g_class_canon "$CLASS_RAW") \
|
|
292
|
-
|| { g_err "unknown class '${CLASS_RAW:-<empty>}' in $CONFIG (expected software|service|game|research|fleet, or A-E / app / agent / desktop)"; exit 2; }
|
|
293
|
-
|
|
294
341
|
# Root vs git toplevel. find_installed_root resolves the CONFIG lookup correctly, but the
|
|
295
342
|
# rows that shell out to git run in $ROOT and git resolves that to the ENCLOSING repo when
|
|
296
343
|
# the target is not a repository of its own: a nested target then reports the outer repo's
|
|
@@ -300,7 +347,7 @@ ROOT_PHYS=$(cd "$ROOT" && pwd -P)
|
|
|
300
347
|
GIT_TOP=$(cd "$ROOT" && git rev-parse --show-toplevel 2>/dev/null)
|
|
301
348
|
if [ -n "$GIT_TOP" ] && [ "$GIT_TOP" != "$ROOT_PHYS" ]; then
|
|
302
349
|
g_err "target $ROOT_PHYS is inside the git repository $GIT_TOP but is not a repository of"
|
|
303
|
-
g_err "its own. CM-
|
|
350
|
+
g_err "its own. CM-03 GT-03 SP-02 PG-01 PG-03 DS-01 and HP-05 shell out to git,"
|
|
304
351
|
g_err "and git would resolve every one of them to $GIT_TOP - the numbers would describe the"
|
|
305
352
|
g_err "outer repo, not this target."
|
|
306
353
|
g_err "fix: cd $ROOT_PHYS && git init (make the target its own repo), or move it out of"
|
|
@@ -308,13 +355,11 @@ if [ -n "$GIT_TOP" ] && [ "$GIT_TOP" != "$ROOT_PHYS" ]; then
|
|
|
308
355
|
exit 2
|
|
309
356
|
fi
|
|
310
357
|
|
|
311
|
-
BRANCH=$(g_agents_read "$CONFIG" branch)
|
|
312
358
|
ARCHIVE=$(g_agents_read "$CONFIG" archive)
|
|
313
359
|
MAX_DIRTY=$(g_agents_read "$CONFIG" max_dirty)
|
|
314
360
|
ADV_CEILING=$(g_agents_read "$CONFIG" advisory_ceiling)
|
|
315
361
|
HARNESS_DIR_RAW=$(g_agents_read "$CONFIG" harness_dir)
|
|
316
362
|
SCAFFOLD_CHECKS=$(g_agents_read "$CONFIG" scaffold_checks)
|
|
317
|
-
MODELS_FILE=$(g_expand_tilde "$(g_agents_read "$CONFIG" models_file)")
|
|
318
363
|
PRACTICE=$(g_expand_tilde "$(g_agents_read "$CONFIG" practice)")
|
|
319
364
|
PRACTICE_SHA=$(g_unquote "$(g_agents_read "$CONFIG" practice_sha256)")
|
|
320
365
|
[ -n "$MAX_DIRTY" ] || MAX_DIRTY=0
|
|
@@ -346,17 +391,6 @@ export FEATURE_MAP SOURCE_ROOT VERIFY_DOCTOR
|
|
|
346
391
|
REFERENCE_MANIFEST=$(g_unquote "$(g_agents_read "$CONFIG" reference_manifest)")
|
|
347
392
|
export REFERENCE_MANIFEST
|
|
348
393
|
|
|
349
|
-
# The loop ceiling (G2, LP-03). The most turns ONE loop record may declare in its budget; 20 is
|
|
350
|
-
# the engine's own default for a kanban goal loop, so a ceiling that disagreed with the engine
|
|
351
|
-
# would be a number someone made up. A config written before this key existed keeps the default
|
|
352
|
-
# (the SCAFFOLD_CHECKS shape): an absent key is not a broken config.
|
|
353
|
-
LOOP_MAX_TURNS_CEILING=$(g_agents_read "$CONFIG" loop_max_turns_ceiling)
|
|
354
|
-
[ -n "$LOOP_MAX_TURNS_CEILING" ] || LOOP_MAX_TURNS_CEILING=20
|
|
355
|
-
# The loop record (G2): a COMMITTED artifact of one unattended run. Nothing in this section
|
|
356
|
-
# re-runs the predicate and nothing writes: the record IS the evidence, and what that costs is
|
|
357
|
-
# stated in docs/LOOP.md and docs/LIMITS.md.
|
|
358
|
-
LOOP_DIR="$ROOT/.gob/loop"
|
|
359
|
-
export LOOP_MAX_TURNS_CEILING LOOP_DIR
|
|
360
394
|
|
|
361
395
|
if [ -d "$ROOT/$HARNESS_DIR_RAW" ]; then
|
|
362
396
|
export GOBLIN_HARNESS_DIR="$ROOT/$HARNESS_DIR_RAW"
|
|
@@ -365,8 +399,8 @@ if [ -d "$ROOT/$HARNESS_DIR_RAW" ]; then
|
|
|
365
399
|
else
|
|
366
400
|
export GOBLIN_HARNESS_DIR=""
|
|
367
401
|
export GOBLIN_HARNESS_REL="$HARNESS_DIR_RAW"
|
|
368
|
-
# 'absent' =
|
|
369
|
-
# 'none' =
|
|
402
|
+
# 'absent' = scaffold_checks is yes and the declared harness dir is missing -> FAIL.
|
|
403
|
+
# 'none' = scaffold_checks is no, so there is no harness dir to assert -> SKIP (D7).
|
|
370
404
|
if [ "$SCAFFOLD_CHECKS" = "yes" ]; then
|
|
371
405
|
export GOBLIN_HARNESS_STATE=absent
|
|
372
406
|
else
|
|
@@ -393,24 +427,15 @@ export GOBLIN_CONFIG="$CONFIG"
|
|
|
393
427
|
# reason, never a silent pass.
|
|
394
428
|
SEC_GITIGNORE_FAMILY=$(g_agents_read "$CONFIG" security.gitignore_family)
|
|
395
429
|
SEC_BUILD_OUTPUT=$(g_agents_read "$CONFIG" security.build_output)
|
|
396
|
-
SEC_AUDIT_CMD=$(g_agents_read "$CONFIG" security.audit_cmd)
|
|
397
|
-
SEC_AUDIT_MAX_AGE=$(g_agents_read "$CONFIG" security.audit_max_age_days)
|
|
398
|
-
SEC_WAIVER_MAX_AGE=$(g_agents_read "$CONFIG" security.waiver_max_age_days)
|
|
399
430
|
SEC_WRITE_ROUTES=$(g_agents_read "$CONFIG" security.write_routes)
|
|
400
|
-
[ -n "$SEC_AUDIT_MAX_AGE" ] || SEC_AUDIT_MAX_AGE=90
|
|
401
|
-
[ -n "$SEC_WAIVER_MAX_AGE" ] || SEC_WAIVER_MAX_AGE=180
|
|
402
431
|
PERF_METRIC=$(g_agents_read "$CONFIG" perf.metric)
|
|
403
432
|
PERF_CMD=$(g_agents_read "$CONFIG" perf.cmd)
|
|
404
433
|
PERF_BASELINE_COMMIT=$(g_unquote "$(g_agents_read "$CONFIG" perf.baseline_commit)")
|
|
405
434
|
PERF_BASELINE_VALUE=$(g_agents_read "$CONFIG" perf.baseline_value)
|
|
406
435
|
PERF_MEASURED=$(g_unquote "$(g_agents_read "$CONFIG" perf.measured)")
|
|
407
436
|
PERF_HOST_GATE=$(g_agents_read "$CONFIG" perf.host_gate)
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
# installed before the merge — read as off, so a legacy class-F repo verifies with no rewrite.
|
|
411
|
-
ELECTRON=$(g_agents_read "$CONFIG" electron)
|
|
412
|
-
export SEC_GITIGNORE_FAMILY SEC_BUILD_OUTPUT SEC_AUDIT_CMD SEC_AUDIT_MAX_AGE SEC_WAIVER_MAX_AGE
|
|
413
|
-
export SEC_WRITE_ROUTES PERF_METRIC PERF_CMD PERF_BASELINE_VALUE PERF_HOST_GATE ELECTRON
|
|
437
|
+
export SEC_GITIGNORE_FAMILY SEC_BUILD_OUTPUT
|
|
438
|
+
export SEC_WRITE_ROUTES PERF_METRIC PERF_CMD PERF_BASELINE_VALUE PERF_HOST_GATE
|
|
414
439
|
|
|
415
440
|
# Whole days between an ISO date and today, or empty when the date does not parse on this host
|
|
416
441
|
# (`date -d` is GNU; the row FAILS rather than assuming, because an unreadable date is not a
|
|
@@ -438,7 +463,7 @@ only_selected() {
|
|
|
438
463
|
return 1
|
|
439
464
|
}
|
|
440
465
|
|
|
441
|
-
# ---- part mapping: a row id's prefix names the
|
|
466
|
+
# ---- part mapping: a row id's prefix names the part a row belongs to ---------
|
|
442
467
|
row_part() {
|
|
443
468
|
case "$1" in
|
|
444
469
|
HP-*) echo handoff ;;
|
|
@@ -448,20 +473,17 @@ row_part() {
|
|
|
448
473
|
HS-01|HS-03) echo gate ;;
|
|
449
474
|
HS-02) echo replay ;;
|
|
450
475
|
PG-*) echo pr-gate ;;
|
|
451
|
-
#
|
|
452
|
-
# skills
|
|
453
|
-
#
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
#
|
|
458
|
-
#
|
|
459
|
-
SK-01) echo
|
|
460
|
-
# SK-02 keys off the same part
|
|
461
|
-
|
|
462
|
-
# installed skill file(s) hashed"). An opt-out is the honest report; a FAIL on a repo that
|
|
463
|
-
# opted out of skills is not.
|
|
464
|
-
SK-02) echo playbooks ;;
|
|
476
|
+
# SK-04 rides the `skills` part: its artifact is the shipped skills, and an explicit
|
|
477
|
+
# --opt-out skills disables that part. The CORE tier (.gob/skills/) is vendored on
|
|
478
|
+
# every install (GAP-2), so the row runs by default and only an explicit opt-out skips it.
|
|
479
|
+
# (v3: the part was named `playbooks` for the manifest that indexed the cut skills; the
|
|
480
|
+
# rail follows its list — manifest/playbooks.tsv is gone.)
|
|
481
|
+
SK-04) echo skills ;;
|
|
482
|
+
# SK-01 rides the same part. The core tier gives it subjects on every install — it no
|
|
483
|
+
# longer has to skip on a default (no .hermes tier) repo.
|
|
484
|
+
SK-01) echo skills ;;
|
|
485
|
+
# SK-02 keys off the same part; it hashes the .gob/skills/ core tier too.
|
|
486
|
+
SK-02) echo skills ;;
|
|
465
487
|
*) echo "" ;;
|
|
466
488
|
esac
|
|
467
489
|
}
|
|
@@ -550,10 +572,10 @@ check_in_04() {
|
|
|
550
572
|
check_in_02() {
|
|
551
573
|
# The W1 semantic split (§2.2). Clause 1 - the per-repo mode: hash every recorded file,
|
|
552
574
|
# the practice pin rides along - is byte-for-byte what this row has always done, and a
|
|
553
|
-
# fresh install
|
|
575
|
+
# fresh install keeps it (installed.json carries no engine: block).
|
|
554
576
|
# Clause 2 - engine.mode=global with file entries remaining: hash what IS recorded;
|
|
555
|
-
# an entry under the engine paths (.gob/bin, .gob/manifest, .gob/bans
|
|
556
|
-
#
|
|
577
|
+
# an entry under the engine paths (.gob/bin, .gob/manifest, .gob/bans) that is
|
|
578
|
+
# still present is hashed too
|
|
557
579
|
# (harmless), and one that is MISSING is not drift - the engine is no longer the repo's.
|
|
558
580
|
# Clause 3 - global with no file entries: the declaration + practice pin only; never
|
|
559
581
|
# FAIL for absence of install artifacts (a declaration-only repo is not born RED).
|
|
@@ -565,12 +587,12 @@ check_in_02() {
|
|
|
565
587
|
[ -n "$p" ] || continue
|
|
566
588
|
if [ "$ENGINE_MODE" = "global" ]; then
|
|
567
589
|
case "$p" in
|
|
568
|
-
.gob/bin/*|.gob/manifest/*|.gob/bans/*|.gob/
|
|
590
|
+
.gob/bin/*|.gob/manifest/*|.gob/bans/*|.gob/skills/*)
|
|
569
591
|
[ -e "$ROOT/$p" ] || continue ;; # engine removed by design: not drift
|
|
570
592
|
# W4a (§5.3/§5.2): the procedure tier is EMITTED per platform, not carried in the
|
|
571
593
|
# repo - a recorded .hermes/skills/ file absent from disk is the tier living at its
|
|
572
594
|
# emitted paths, not drift. A copy that IS present must still hash true (a stale or
|
|
573
|
-
# hand-edited shadow is exactly what
|
|
595
|
+
# hand-edited shadow is exactly what the drift check exists to surface).
|
|
574
596
|
.hermes/skills/*)
|
|
575
597
|
[ -e "$ROOT/$p" ] || continue ;;
|
|
576
598
|
esac
|
|
@@ -607,7 +629,7 @@ check_in_02() {
|
|
|
607
629
|
printf 'practice standard edited: %s\n recorded %s\n now %s\n' "$PRACTICE" "$PRACTICE_SHA" "$cur"
|
|
608
630
|
# The remedy, in the place the operator actually meets the failure. The pin exists to
|
|
609
631
|
# catch a SILENT edit, so re-pinning is a deliberate act: one explicit command, which
|
|
610
|
-
# prints the old and new hash (docs/
|
|
632
|
+
# prints the old and new hash (docs/GUIDE.md, "An edited standard is not a dead end").
|
|
611
633
|
printf ' if the edit is yours and intended, re-pin it deliberately:\n'
|
|
612
634
|
printf ' goblin-install --target %s --re-pin # from the gobstack checkout/install tree\n' "$ROOT"
|
|
613
635
|
bad=1; pin=" | practice EDITED"
|
|
@@ -719,6 +741,168 @@ check_hp_05() {
|
|
|
719
741
|
[ "$found" -eq 1 ]
|
|
720
742
|
}
|
|
721
743
|
|
|
744
|
+
# ---- the curation wave (CURATION-2026-11-07 §2/§6 phase 1): HV-02, HP-06, HV-01 ----------
|
|
745
|
+
# Three text probes adopted from one project's measured failures, cheapest-and-most-
|
|
746
|
+
# preventative first (§6): an instrument that convicts the product (C2 -> HV-02), a queue
|
|
747
|
+
# that lies (C3 -> HP-06), and a check whose input is not the input the user gets (C1 ->
|
|
748
|
+
# HV-01). All three are the BN-01 class - grep over text, no AST - and each carries its
|
|
749
|
+
# honest limit in its why cell and in docs/LIMITS.md.
|
|
750
|
+
|
|
751
|
+
check_hv_02() {
|
|
752
|
+
# C2: a number taken from a live surface carries its guard. Text probe over the harness dir:
|
|
753
|
+
# PRESENCE of a guard is provable, EFFECTIVENESS is not (a decorative guard passes - the
|
|
754
|
+
# limit is stated, not hidden). A `guarded: <reason>` marker comment is the escape hatch for
|
|
755
|
+
# a harness whose guard is not nameable in these tokens.
|
|
756
|
+
local d="$GOBLIN_HARNESS_DIR" f rel bad=0 n=0 nb=0 np=0
|
|
757
|
+
if [ -z "$d" ]; then
|
|
758
|
+
if [ "$GOBLIN_HARNESS_STATE" = "absent" ]; then
|
|
759
|
+
printf 'harness_dir %s is declared and scaffold_checks is yes, but the directory is absent\n' \
|
|
760
|
+
"$GOBLIN_HARNESS_REL"
|
|
761
|
+
return 1
|
|
762
|
+
fi
|
|
763
|
+
printf 'no harness dir (%s absent, scaffold_checks is no) - nothing to guard\n' \
|
|
764
|
+
"$GOBLIN_HARNESS_REL"
|
|
765
|
+
return 3
|
|
766
|
+
fi
|
|
767
|
+
for f in "$d"/*; do
|
|
768
|
+
[ -f "$f" ] || continue
|
|
769
|
+
n=$((n + 1))
|
|
770
|
+
rel="${f#"$ROOT"/}"
|
|
771
|
+
# the marker clears every clause in the file: it names the reason the guard lives elsewhere
|
|
772
|
+
grep -Eq 'guarded:[[:space:]]*[^[:space:]]' "$f" && continue
|
|
773
|
+
if grep -q 'getBoundingClientRect(' "$f"; then
|
|
774
|
+
if grep -Eq 'innerWidth|innerHeight|visualViewport' "$f"; then
|
|
775
|
+
nb=$((nb + 1))
|
|
776
|
+
else
|
|
777
|
+
printf '%s measures a bounding box (getBoundingClientRect) with no viewport guard (innerWidth/innerHeight/visualViewport) and no guarded: marker\n' "$rel"
|
|
778
|
+
bad=1
|
|
779
|
+
fi
|
|
780
|
+
fi
|
|
781
|
+
if grep -Eq 'execSync|execFileSync|spawnSync|child_process' "$f" \
|
|
782
|
+
&& grep -Eq 'parseFloat|parseInt|Number[[:space:]]*\(' "$f"; then
|
|
783
|
+
if grep -Eq 'Number[.]isFinite|isNaN|isFinite' "$f"; then
|
|
784
|
+
np=$((np + 1))
|
|
785
|
+
else
|
|
786
|
+
printf '%s parses a number out of another process stdout with no finite guard (Number.isFinite/isNaN) and no guarded: marker\n' "$rel"
|
|
787
|
+
bad=1
|
|
788
|
+
fi
|
|
789
|
+
fi
|
|
790
|
+
done
|
|
791
|
+
[ "$bad" -eq 0 ] || return 1
|
|
792
|
+
printf '%d harness file(s); %d guarded bounding-box measurement(s), %d guarded parsed-number measurement(s)\n' \
|
|
793
|
+
"$n" "$nb" "$np"
|
|
794
|
+
return 0
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
check_hp_06() {
|
|
798
|
+
# C3: cancelled is not pending. Shape, not truth: a bullet can carry a date and the word
|
|
799
|
+
# owner and still be a lie, and work MISSING from the list is invisible - the why cell and
|
|
800
|
+
# docs/LIMITS.md say so. Only the first NEXT STEPS / NEXT section is read (HP-02 alias set);
|
|
801
|
+
# bare links, sub-headings and em-dash separator bullets are skipped; a wrapped bullet is
|
|
802
|
+
# read as one item (continuation lines join the bullet that opened them).
|
|
803
|
+
if [ ! -f "$ROOT/HANDOFF.md" ]; then
|
|
804
|
+
printf 'no HANDOFF.md - HP-01 owns that failure; this row has nothing to read\n'
|
|
805
|
+
return 3
|
|
806
|
+
fi
|
|
807
|
+
local out rc n detail
|
|
808
|
+
rc=0
|
|
809
|
+
out=$(awk '
|
|
810
|
+
function levelOf(line, i) {
|
|
811
|
+
i = 0
|
|
812
|
+
while (substr(line, i + 1, 1) == "#") i++
|
|
813
|
+
return i
|
|
814
|
+
}
|
|
815
|
+
function flush() {
|
|
816
|
+
if (bullet == "") return
|
|
817
|
+
text = bullet
|
|
818
|
+
sub(/^[[:space:]]*[-*][[:space:]]+/, "", text)
|
|
819
|
+
# a bare link carries no status at all; an em-dash separator bullet is layout, not an item
|
|
820
|
+
if (text ~ /^\[[^]]*\]\([^)]*\)[[:space:]]*$/) { bullet = ""; return }
|
|
821
|
+
if (text ~ /^—/) { bullet = ""; return }
|
|
822
|
+
n++
|
|
823
|
+
ok = 1
|
|
824
|
+
if (bullet !~ /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/) {
|
|
825
|
+
print "HANDOFF.md: an open item carries no date: " text
|
|
826
|
+
ok = 0
|
|
827
|
+
}
|
|
828
|
+
if (tolower(bullet) !~ /owner|done|cancelled/) {
|
|
829
|
+
print "HANDOFF.md: an open item is neither owned, done nor cancelled: " text
|
|
830
|
+
ok = 0
|
|
831
|
+
}
|
|
832
|
+
if (!ok) bad = 1
|
|
833
|
+
bullet = ""
|
|
834
|
+
}
|
|
835
|
+
/^#/ {
|
|
836
|
+
lvl = levelOf($0)
|
|
837
|
+
if (!sec) {
|
|
838
|
+
if (!seen && lvl <= 3 && tolower($0) ~ /^#+[[:space:]]+[^[:alpha:]]*next([^[:alpha:]]|$)/) {
|
|
839
|
+
sec = 1; secdepth = lvl
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
if (lvl <= secdepth) { flush(); sec = 0; seen = 1 }
|
|
843
|
+
}
|
|
844
|
+
next
|
|
845
|
+
}
|
|
846
|
+
!sec { next }
|
|
847
|
+
/^[[:space:]]*[-*][[:space:]]+/ { flush(); bullet = $0; next }
|
|
848
|
+
/^[[:space:]]*$/ { flush(); next }
|
|
849
|
+
bullet != "" { bullet = bullet " " $0; next }
|
|
850
|
+
END { flush(); printf "#count %d\n", n + 0; exit bad }
|
|
851
|
+
' "$ROOT/HANDOFF.md") || rc=$?
|
|
852
|
+
n=$(printf '%s\n' "$out" | sed -n 's/^#count //p')
|
|
853
|
+
detail=$(printf '%s\n' "$out" | grep -v '^#count ' || true)
|
|
854
|
+
if [ "$rc" -ne 0 ]; then printf '%s\n' "$detail"; return 1; fi
|
|
855
|
+
if [ "${n:-0}" -eq 0 ]; then
|
|
856
|
+
printf '0 next-step bullet(s) - the section lists nothing pending (work missing from the list entirely is what this row cannot see)\n'
|
|
857
|
+
else
|
|
858
|
+
printf '%s next-step bullet(s), each owned with a date, done, or cancelled with a date and the decision\n' "${n:-0}"
|
|
859
|
+
fi
|
|
860
|
+
return 0
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
check_hv_01() {
|
|
864
|
+
# C1: the payload the check uses must be the payload the user gets. Text probe: it proves a
|
|
865
|
+
# producer is NAMED - a bare-package import, or a produced_by: <function> <pinned id> marker
|
|
866
|
+
# beside a hand-written doc/board/payload/fixture literal - never that the call path matches
|
|
867
|
+
# the product wiring. The stronger form needs the product to export a single factory, which is
|
|
868
|
+
# a design change, not a probe (the why cell and docs/LIMITS.md say so).
|
|
869
|
+
local d="$GOBLIN_HARNESS_DIR" f rel bad=0 n=0 nk=0
|
|
870
|
+
if [ -z "$d" ]; then
|
|
871
|
+
if [ "$GOBLIN_HARNESS_STATE" = "absent" ]; then
|
|
872
|
+
printf 'harness_dir %s is declared and scaffold_checks is yes, but the directory is absent\n' \
|
|
873
|
+
"$GOBLIN_HARNESS_REL"
|
|
874
|
+
return 1
|
|
875
|
+
fi
|
|
876
|
+
printf 'no harness dir (%s absent, scaffold_checks is no) - nothing to build\n' \
|
|
877
|
+
"$GOBLIN_HARNESS_REL"
|
|
878
|
+
return 3
|
|
879
|
+
fi
|
|
880
|
+
for f in "$d"/*; do
|
|
881
|
+
[ -f "$f" ] || continue
|
|
882
|
+
n=$((n + 1))
|
|
883
|
+
rel="${f#"$ROOT"/}"
|
|
884
|
+
# a document/board/payload/fixture literal: an object, array or JSON string assigned to a
|
|
885
|
+
# name built on those four words
|
|
886
|
+
grep -Eq '(^|[^A-Za-z0-9_])(doc|board|payload|fixture)[A-Za-z0-9_]*[[:space:]]*[:=][[:space:]]*[\[{"]' "$f" || continue
|
|
887
|
+
# cleared by an import/require of a bare package name (the producer, reachable), ...
|
|
888
|
+
if grep -Eq "from +[\"'][^./\"]" "$f" \
|
|
889
|
+
|| grep -Eq "require\\([\"'][^./']" "$f" \
|
|
890
|
+
|| grep -Eq "import\\([\"'][^./']" "$f"; then
|
|
891
|
+
nk=$((nk + 1)); continue
|
|
892
|
+
fi
|
|
893
|
+
# ...or by the marker: the producing function plus a pinned id, both required
|
|
894
|
+
if grep -Eq 'produced_by:[[:space:]]*[^[:space:]]+[[:space:]]+[^[:space:]]+' "$f"; then
|
|
895
|
+
nk=$((nk + 1)); continue
|
|
896
|
+
fi
|
|
897
|
+
printf '%s constructs a doc/board/payload/fixture literal with no package import and no produced_by: marker - the input the check asserts is not the input the user gets\n' "$rel"
|
|
898
|
+
bad=1
|
|
899
|
+
done
|
|
900
|
+
[ "$bad" -eq 0 ] || return 1
|
|
901
|
+
printf '%d harness file(s); %d constructed input(s), each through a package import or a produced_by marker\n' \
|
|
902
|
+
"$n" "$nk"
|
|
903
|
+
return 0
|
|
904
|
+
}
|
|
905
|
+
|
|
722
906
|
check_gt_01() {
|
|
723
907
|
# Every `- name:` under `gates:` is a DECLARED gate, and every declared gate must carry a
|
|
724
908
|
# `cmd:`. Counting only the name+cmd PAIRS (what this row did) let a gate lose its `cmd:` -
|
|
@@ -815,7 +999,7 @@ check_gt_05() {
|
|
|
815
999
|
n=$(g_agents_read "$CONFIG" ratchet.name)
|
|
816
1000
|
c=$(g_agents_read "$CONFIG" ratchet.cmd)
|
|
817
1001
|
ceil=$(g_agents_read "$CONFIG" ratchet.ceiling)
|
|
818
|
-
[ -n "$n" ] && [ -n "$c" ] || { printf 'no ratchet declared
|
|
1002
|
+
[ -n "$n" ] && [ -n "$c" ] || { printf 'no ratchet declared - skipped\n'; return 3; }
|
|
819
1003
|
val=$( cd "$ROOT" && bash -c "$c" 2>/dev/null | tr -d '[:space:]' )
|
|
820
1004
|
case "$val" in ''|*[!0-9]*) printf 'ratchet cmd produced a non-number: %s\n' "$val"; return 1 ;; esac
|
|
821
1005
|
if [ -f "$ROOT/.gob/ratchet-last" ]; then prev=$(cat "$ROOT/.gob/ratchet-last"); fi
|
|
@@ -833,16 +1017,16 @@ check_gt_05() {
|
|
|
833
1017
|
check_hs_01() {
|
|
834
1018
|
local d="$GOBLIN_HARNESS_DIR" f base asserting=0 reporting=0 bad=0
|
|
835
1019
|
if [ -z "$d" ]; then
|
|
836
|
-
# A declared harness dir that is missing is a FAIL when
|
|
837
|
-
#
|
|
1020
|
+
# A declared harness dir that is missing is a FAIL when scaffold_checks is yes; when it is
|
|
1021
|
+
# no the row skips with a reason. Keying the skip off the PATH alone let a one-line config
|
|
838
1022
|
# edit switch both HS rows off (D7).
|
|
839
1023
|
if [ "$GOBLIN_HARNESS_STATE" = "absent" ]; then
|
|
840
|
-
printf 'harness_dir %s is declared and
|
|
841
|
-
"$GOBLIN_HARNESS_REL"
|
|
1024
|
+
printf 'harness_dir %s is declared and scaffold_checks is yes, but the directory is absent\n' \
|
|
1025
|
+
"$GOBLIN_HARNESS_REL"
|
|
842
1026
|
return 1
|
|
843
1027
|
fi
|
|
844
|
-
printf 'no harness dir (%s absent,
|
|
845
|
-
"$GOBLIN_HARNESS_REL"
|
|
1028
|
+
printf 'no harness dir (%s absent, scaffold_checks is no) - nothing to assert\n' \
|
|
1029
|
+
"$GOBLIN_HARNESS_REL"
|
|
846
1030
|
return 3
|
|
847
1031
|
fi
|
|
848
1032
|
for f in "$d"/*; do
|
|
@@ -891,8 +1075,8 @@ check_hs_02() {
|
|
|
891
1075
|
d="$GOBLIN_HARNESS_DIR"
|
|
892
1076
|
if [ -z "$d" ]; then
|
|
893
1077
|
if [ "$GOBLIN_HARNESS_STATE" = "absent" ]; then
|
|
894
|
-
printf 'harness_dir %s is declared and
|
|
895
|
-
"$GOBLIN_HARNESS_REL"
|
|
1078
|
+
printf 'harness_dir %s is declared and scaffold_checks is yes, but the directory is absent\n' \
|
|
1079
|
+
"$GOBLIN_HARNESS_REL"
|
|
896
1080
|
return 1
|
|
897
1081
|
fi
|
|
898
1082
|
printf 'no harness dir to replay\n'; return 3
|
|
@@ -941,67 +1125,6 @@ check_cm_03() {
|
|
|
941
1125
|
[ "$n" -le "$MAX_DIRTY" ]
|
|
942
1126
|
}
|
|
943
1127
|
|
|
944
|
-
resolve_role_models() {
|
|
945
|
-
# prints "role<TAB>profile<TAB>provider<TAB>model<TAB>effort" for each lane of a role
|
|
946
|
-
local role="$1" f="$SELF_DIR/../roles.yaml"
|
|
947
|
-
[ -f "$f" ] || f="$ROOT/.gob/roles.yaml"
|
|
948
|
-
local profiles
|
|
949
|
-
profiles=$(g_yaml_block_scalar "$f" "role-$role" profiles)
|
|
950
|
-
[ -n "$profiles" ] || profiles=$(g_yaml_block_scalar "$f" "$role" profiles)
|
|
951
|
-
local p prov model eff
|
|
952
|
-
for p in $(printf '%s' "$profiles" | tr -d '[]' | tr ',' ' '); do
|
|
953
|
-
prov=$(g_models_field "$MODELS_FILE" "$p" provider)
|
|
954
|
-
model=$(g_models_field "$MODELS_FILE" "$p" model)
|
|
955
|
-
eff=$(g_models_field "$MODELS_FILE" "$p" effort)
|
|
956
|
-
printf '%s\t%s\t%s\t%s\t%s\n' "$role" "$p" "${prov:-?}" "${model:-?}" "${eff:-?}"
|
|
957
|
-
done
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
check_md_02() {
|
|
961
|
-
local code_line panel_line judge_line code_fam panel_fam judge_fam
|
|
962
|
-
if [ ! -f "$MODELS_FILE" ]; then
|
|
963
|
-
printf 'no model mapping configured (%s absent) - advisory\n' "$MODELS_FILE"
|
|
964
|
-
return 2
|
|
965
|
-
fi
|
|
966
|
-
code_line=$(resolve_role_models code | head -n 1)
|
|
967
|
-
panel_line=$(resolve_role_models review-panel | head -n 1)
|
|
968
|
-
judge_line=$(resolve_role_models judge | head -n 1)
|
|
969
|
-
code_fam=$(printf '%s' "$code_line" | cut -f4)
|
|
970
|
-
panel_fam=$(printf '%s' "$panel_line" | cut -f4)
|
|
971
|
-
judge_fam=$(printf '%s' "$judge_line" | cut -f4)
|
|
972
|
-
if [ -z "$code_line" ] || [ -z "$panel_line" ]; then
|
|
973
|
-
printf 'roles.yaml did not resolve both lanes - advisory\n'
|
|
974
|
-
return 2
|
|
975
|
-
fi
|
|
976
|
-
if [ "$code_fam" = "$panel_fam" ]; then
|
|
977
|
-
printf 'code lane and review lane both resolve to %s (same family) - goblin-stack cannot change this\n' "$code_fam"
|
|
978
|
-
else
|
|
979
|
-
printf 'code lane %s, review lane %s - different family\n' "$code_fam" "$panel_fam"
|
|
980
|
-
fi
|
|
981
|
-
# W5-6: the JUDGE lane's family is compared too. JG-02 proves the declared profile NAMES are
|
|
982
|
-
# disjoint and nothing more, so a `judge:` profile mapped to the author's own model passed it:
|
|
983
|
-
# the judge was distinct by name only, which is exactly what the judge role's claim cannot
|
|
984
|
-
# tolerate. The comparison is the same one the panel gets, and the row stays ADVISORY (`return
|
|
985
|
-
# 2`): goblin-stack cannot choose the fleet's models, it can only make the state loud. Measured
|
|
986
|
-
# on this box, every profile the mapping names resolves to ONE model - recorded, not faked, in
|
|
987
|
-
# docs/LIMITS.md #38.
|
|
988
|
-
if [ -z "$judge_line" ]; then
|
|
989
|
-
printf 'the judge lane does not resolve - add a `judge:` entry beside the code lane in %s\n' "$MODELS_FILE"
|
|
990
|
-
return 2
|
|
991
|
-
fi
|
|
992
|
-
case "$judge_fam" in
|
|
993
|
-
''|'?'|unknown)
|
|
994
|
-
printf 'the judge lane resolves to no model in %s - add a `judge:` entry beside the code lane\n' "$MODELS_FILE"
|
|
995
|
-
return 2 ;;
|
|
996
|
-
esac
|
|
997
|
-
if [ "$judge_fam" = "$code_fam" ]; then
|
|
998
|
-
printf 'the judge lane resolves to %s, the SAME family as the code lane - JG-02 proves only that the declared profile names differ\n' "$judge_fam"
|
|
999
|
-
else
|
|
1000
|
-
printf 'judge lane %s, code lane %s - different family\n' "$judge_fam" "$code_fam"
|
|
1001
|
-
fi
|
|
1002
|
-
return 2
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
1128
|
check_pg_01() {
|
|
1006
1129
|
local f head n=0 bad=0
|
|
1007
1130
|
for f in "$ROOT"/reviews/*.md; do
|
|
@@ -1069,142 +1192,6 @@ check_pg_03() {
|
|
|
1069
1192
|
[ "$bad" -eq 0 ]
|
|
1070
1193
|
}
|
|
1071
1194
|
|
|
1072
|
-
check_pg_05() {
|
|
1073
|
-
# PG-05 - "No required check that self-skips". The old body counted only "every step is
|
|
1074
|
-
# guarded", so the REAL shape passed: in the estate's one existing workflow a deliberately
|
|
1075
|
-
# UNGUARDED credential step decides whether the guarded compile step runs, so
|
|
1076
|
-
# `guarded < steps` and the
|
|
1077
|
-
# row reported PASS on the workflow it exists to catch (G8 section 3, re-measured V3-4). G6
|
|
1078
|
-
# section A.6 named the mechanisable tell - a job whose GATE STEP is conditional can reach its
|
|
1079
|
-
# end without running the gate while the required check still reports Success - so the row now
|
|
1080
|
-
# carries three clauses per job:
|
|
1081
|
-
# (a) the job declares at least one run:/uses: step (otherwise the check runs nothing);
|
|
1082
|
-
# (b) the JOB carries no `if:` (otherwise the whole required check self-skips);
|
|
1083
|
-
# (c) no STEP carries an `if:` (otherwise that step - possibly the gate step - self-skips,
|
|
1084
|
-
# and GitHub reports a skipped job as Success: docs S1/S2, RISKS.md K7).
|
|
1085
|
-
# It is a TEXT reading, deliberately strict, and says so in its own why-cell: a `#` inside a
|
|
1086
|
-
# quoted string is read as a comment, a flow-style `jobs:` mapping is refused rather than read
|
|
1087
|
-
# as clean, and a condition that is genuinely needed belongs in the command or in a second
|
|
1088
|
-
# job that is not the required check.
|
|
1089
|
-
local f n=0 bad=0
|
|
1090
|
-
for f in "$ROOT"/.github/workflows/*.yml "$ROOT"/.github/workflows/*.yaml; do
|
|
1091
|
-
[ -e "$f" ] || continue
|
|
1092
|
-
n=$((n + 1))
|
|
1093
|
-
awk -v FILE="$(basename "$f")" '
|
|
1094
|
-
function closejob() {
|
|
1095
|
-
if (jobname == "") return
|
|
1096
|
-
if (steps == 0) { printf "%s: job \"%s\" declares no run:/uses: step - the required check runs nothing and still reports Success\n", FILE, jobname; bad = 1 }
|
|
1097
|
-
if (jobif > 0) { printf "%s: job \"%s\" carries a job-level if: (%d) - the whole required check self-skips and reports Success\n", FILE, jobname, jobif; bad = 1 }
|
|
1098
|
-
if (stepif > 0) { printf "%s: job \"%s\" has %d conditional step(s) - a skipped step reports Success, and a skipped gate step green-lights a commit whose gate never ran\n", FILE, jobname, stepif; bad = 1 }
|
|
1099
|
-
jobname = ""
|
|
1100
|
-
}
|
|
1101
|
-
{
|
|
1102
|
-
line = $0
|
|
1103
|
-
sub(/[ \t]+#.*$/, "", line) # blank a trailing comment
|
|
1104
|
-
if (line ~ /^[ \t]*#/) next
|
|
1105
|
-
if (line ~ /^[ \t]*$/) next
|
|
1106
|
-
if (!injobs) {
|
|
1107
|
-
if (line ~ /^jobs:[ \t]*$/) { injobs = 1; jind = -1 }
|
|
1108
|
-
else if (line ~ /^jobs:[ \t]*[^ \t]/) { printf "%s: the jobs: block is a flow mapping - it cannot be read here, so it is refused rather than read as clean\n", FILE; bad = 1; injobs = 1; jind = -1 }
|
|
1109
|
-
next
|
|
1110
|
-
}
|
|
1111
|
-
lead = match(line, /[^ \t]/) - 1
|
|
1112
|
-
if (jind >= 0 && lead == jind && line !~ /^[ \t]*-/) {
|
|
1113
|
-
closejob()
|
|
1114
|
-
jobname = line; sub(/^[ \t]*/, "", jobname); sub(/[ \t]*:.*/, "", jobname)
|
|
1115
|
-
steps = 0; stepregion = 0; jobif = 0; stepif = 0
|
|
1116
|
-
next
|
|
1117
|
-
}
|
|
1118
|
-
if (jind < 0) {
|
|
1119
|
-
jind = lead
|
|
1120
|
-
jobname = line; sub(/^[ \t]*/, "", jobname); sub(/[ \t]*:.*/, "", jobname)
|
|
1121
|
-
steps = 0; stepregion = 0; jobif = 0; stepif = 0
|
|
1122
|
-
next
|
|
1123
|
-
}
|
|
1124
|
-
if (lead <= jind) next
|
|
1125
|
-
if (line ~ /^[ \t]*-/) stepregion = 1
|
|
1126
|
-
if (line ~ /(^|[ \t-])(run|uses):/) { steps++; next }
|
|
1127
|
-
if (line ~ /^[ \t]*-?[ \t]*if:/) { if (stepregion) stepif++; else jobif++ }
|
|
1128
|
-
}
|
|
1129
|
-
END {
|
|
1130
|
-
closejob()
|
|
1131
|
-
if (!injobs) { printf "%s: no jobs: block - the workflow declares no check at all\n", FILE; bad = 1 }
|
|
1132
|
-
exit bad
|
|
1133
|
-
}
|
|
1134
|
-
' "$f" || bad=1
|
|
1135
|
-
done
|
|
1136
|
-
if [ "$n" -eq 0 ]; then
|
|
1137
|
-
printf '0 workflow file(s) - no required check here to skip (vacuous by design: nothing declares one)\n'
|
|
1138
|
-
else
|
|
1139
|
-
printf '%d workflow file(s) checked for a self-skipping required check\n' "$n"
|
|
1140
|
-
fi
|
|
1141
|
-
[ "$bad" -eq 0 ]
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
check_pg_06() {
|
|
1145
|
-
# PG-06 (G6 section A.6, row 2) - "The gate CI runs is the gate the project declares." The
|
|
1146
|
-
# failure mode is R5 section 1.1 measured: review and CI and goblin-verify reporting different
|
|
1147
|
-
# truths about one SHA, so a green required check says nothing about the gate the project
|
|
1148
|
-
# actually declares. The declared set comes from g_agents_gates - GT-01's own reader, reused
|
|
1149
|
-
# rather than re-derived, so a gate cannot vanish from the comparison in silence (G8-3).
|
|
1150
|
-
# A workflow satisfies the row when the whole declared set is RUN: either the verifier with no
|
|
1151
|
-
# `--only` (a full run executes every declared gate through GT-02), or each declared gate
|
|
1152
|
-
# command appearing verbatim. Comments are blanked first, so a commented-out verifier call is
|
|
1153
|
-
# not a run, and key lines other than `run:` are dropped, so a command sitting in a `name:`
|
|
1154
|
-
# cannot satisfy it. Partial by construction: it proves the gate is INVOKED in a file under
|
|
1155
|
-
# `.github/workflows/`, never that GitHub marks that job required, and never that the invoker
|
|
1156
|
-
# is the job the forge waits on.
|
|
1157
|
-
local f n=0 bad=0 gname gcmd ngates=0 gates="" runtext miss="" nrun nc
|
|
1158
|
-
while IFS=$'\t' read -r gname gcmd; do
|
|
1159
|
-
[ -n "$gname" ] || continue
|
|
1160
|
-
ngates=$((ngates + 1))
|
|
1161
|
-
[ -n "$gcmd" ] && gates="$gates$gcmd"$'\n'
|
|
1162
|
-
done < <(g_agents_gates "$CONFIG")
|
|
1163
|
-
for f in "$ROOT"/.github/workflows/*.yml "$ROOT"/.github/workflows/*.yaml; do
|
|
1164
|
-
[ -e "$f" ] || continue
|
|
1165
|
-
n=$((n + 1))
|
|
1166
|
-
runtext=$(awk '
|
|
1167
|
-
{
|
|
1168
|
-
line = $0
|
|
1169
|
-
sub(/[ \t]+#.*$/, "", line)
|
|
1170
|
-
if (line ~ /^[ \t]*#/) next
|
|
1171
|
-
if (line ~ /^[ \t]*$/) next
|
|
1172
|
-
if (line ~ /^[ \t]*-?[ \t]*run:/) { print substr(line, index(line, "run:") + 4); next }
|
|
1173
|
-
if (line ~ /^[ \t]*-?[ \t]*[A-Za-z_][A-Za-z0-9_.-]*:/) next
|
|
1174
|
-
print line
|
|
1175
|
-
}
|
|
1176
|
-
' "$f")
|
|
1177
|
-
if printf '%s\n' "$runtext" | grep -q 'goblin-verify' \
|
|
1178
|
-
&& ! printf '%s\n' "$runtext" | grep -q 'goblin-verify[^&|;]*--only'; then
|
|
1179
|
-
printf '%s: runs the verifier, which executes every declared gate\n' "$(basename "$f")"
|
|
1180
|
-
continue
|
|
1181
|
-
fi
|
|
1182
|
-
# The verbatim path: compare on whitespace-normalised text, so a YAML line wrap or a dropped
|
|
1183
|
-
# `2>/dev/null` does not read as "not the declared gate".
|
|
1184
|
-
nrun=$(printf '%s\n' "$runtext" | tr '\n' ' ' | sed 's#2>/dev/null##g' | tr -s ' ')
|
|
1185
|
-
miss=""
|
|
1186
|
-
while IFS= read -r gcmd; do
|
|
1187
|
-
[ -n "$gcmd" ] || continue
|
|
1188
|
-
nc=$(printf '%s' "$gcmd" | sed 's#2>/dev/null##g' | tr -s ' ')
|
|
1189
|
-
printf '%s' "$nrun" | grep -qF -- "$nc" || miss="$miss [$gcmd]"
|
|
1190
|
-
done <<EOF
|
|
1191
|
-
$gates
|
|
1192
|
-
EOF
|
|
1193
|
-
if [ -n "$miss" ]; then
|
|
1194
|
-
printf '%s: runs no gate the project declares - declared but not run:%s\n' "$(basename "$f")" "$miss"
|
|
1195
|
-
bad=1
|
|
1196
|
-
else
|
|
1197
|
-
printf '%s: runs all %d declared gate(s) verbatim\n' "$(basename "$f")" "$ngates"
|
|
1198
|
-
fi
|
|
1199
|
-
done
|
|
1200
|
-
if [ "$n" -eq 0 ]; then
|
|
1201
|
-
printf 'no workflow file to check - CI runs no gate here\n'
|
|
1202
|
-
return 3
|
|
1203
|
-
fi
|
|
1204
|
-
printf '%d workflow file(s) compared with the %d declared gate(s)\n' "$n" "$ngates"
|
|
1205
|
-
[ "$bad" -eq 0 ]
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
1195
|
hash_runtime_data() {
|
|
1209
1196
|
local p h out=""
|
|
1210
1197
|
while read -r p; do
|
|
@@ -1253,60 +1240,6 @@ check_ds_02() {
|
|
|
1253
1240
|
return 0
|
|
1254
1241
|
}
|
|
1255
1242
|
|
|
1256
|
-
check_au_02() {
|
|
1257
|
-
# The dedup key must be a function of the report's CONTENT only. Recompute it from the
|
|
1258
|
-
# report's own repo+symptom and require the recorded value to equal it: a key derived from a
|
|
1259
|
-
# date, a run id or a counter dedups nothing, and this is the row that says so.
|
|
1260
|
-
local f n=0 bad=0 repo sym key want norm slug
|
|
1261
|
-
for f in "$ROOT"/reports/*/report.yaml; do
|
|
1262
|
-
[ -e "$f" ] || continue
|
|
1263
|
-
n=$((n + 1))
|
|
1264
|
-
slug=$(basename "$(dirname "$f")")
|
|
1265
|
-
repo=$(sed -n 's/^repo:[[:space:]]*//p' "$f" | head -n 1)
|
|
1266
|
-
sym=$(sed -n 's/^symptom:[[:space:]]*//p' "$f" | head -n 1)
|
|
1267
|
-
key=$(sed -n 's/^dedup_key:[[:space:]]*//p' "$f" | head -n 1)
|
|
1268
|
-
norm=$(printf '%s' "$sym" | tr 'A-Z' 'a-z' | tr -s '[:space:]' ' ' | sed 's/^ //; s/ $//')
|
|
1269
|
-
want="bug:${repo}:$(g_sha256_text "$norm" | cut -c1-12)"
|
|
1270
|
-
case "$key" in
|
|
1271
|
-
'') printf '%s: no dedup_key recorded\n' "$slug"; bad=1; continue ;;
|
|
1272
|
-
esac
|
|
1273
|
-
if [ "$key" != "$want" ]; then
|
|
1274
|
-
printf '%s: recorded key %s, recomputed %s\n' "$slug" "$key" "$want"; bad=1
|
|
1275
|
-
fi
|
|
1276
|
-
if printf '%s' "$key" | grep -qE '[0-9]{4}-[0-9]{2}-[0-9]{2}'; then
|
|
1277
|
-
printf '%s: the key carries a date: %s\n' "$slug" "$key"; bad=1
|
|
1278
|
-
fi
|
|
1279
|
-
done
|
|
1280
|
-
[ "$n" -gt 0 ] || { printf 'no reports/*/report.yaml - nothing to dedup\n'; return 3; }
|
|
1281
|
-
printf '%d report(s): the key is content-only\n' "$n"
|
|
1282
|
-
[ "$bad" -eq 0 ]
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
check_au_03() {
|
|
1286
|
-
# A reporter's write surface is reports/** plus cards. Two falsifiable clauses: the tree is
|
|
1287
|
-
# clean, and - when HEAD is a reporter commit - no path under the declared harness dir is in
|
|
1288
|
-
# it. The harness clause only applies to a commit that touches reports/, so a normal round's
|
|
1289
|
-
# commit is not mistaken for a reporter's.
|
|
1290
|
-
local dirty bad=0 touched=""
|
|
1291
|
-
[ -d "$ROOT/reports" ] || { printf 'no reports/ - no reporter run in this repo to audit\n'; return 3; }
|
|
1292
|
-
dirty=$(cd "$ROOT" && git status --porcelain 2>/dev/null | wc -l | tr -d '[:space:]')
|
|
1293
|
-
printf '%s dirty entr(y|ies), max_dirty %s\n' "$dirty" "$MAX_DIRTY"
|
|
1294
|
-
if ( cd "$ROOT" && git rev-parse --verify --quiet HEAD~1 >/dev/null 2>&1 ); then
|
|
1295
|
-
if ( cd "$ROOT" && git diff --name-only HEAD~1..HEAD 2>/dev/null | grep -q '^reports/' ); then
|
|
1296
|
-
touched=$( cd "$ROOT" && git diff --name-only HEAD~1..HEAD 2>/dev/null \
|
|
1297
|
-
| grep "^${GOBLIN_HARNESS_REL}/" || true )
|
|
1298
|
-
else
|
|
1299
|
-
printf 'HEAD is not a reporter commit - the harness clause does not apply\n'
|
|
1300
|
-
fi
|
|
1301
|
-
fi
|
|
1302
|
-
if [ -n "$touched" ]; then
|
|
1303
|
-
printf 'the reporter commit touched the harness: %s\n' "$(printf '%s' "$touched" | tr '\n' ' ')"
|
|
1304
|
-
bad=1
|
|
1305
|
-
fi
|
|
1306
|
-
[ "$dirty" -le "$MAX_DIRTY" ] || { printf 'the reporter left the tree dirty\n'; bad=1; }
|
|
1307
|
-
[ "$bad" -eq 0 ]
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
1243
|
check_sc_02() {
|
|
1311
1244
|
# Clause 1 is a file rule; clause 2 is BEHAVIOURAL - it asks git's own matcher, so an ignore
|
|
1312
1245
|
# rule that looks right but does not match still fails. `git check-ignore -q` accepts exactly
|
|
@@ -1450,161 +1383,13 @@ check_in_03() {
|
|
|
1450
1383
|
return 1
|
|
1451
1384
|
}
|
|
1452
1385
|
|
|
1453
|
-
check_sc_07() {
|
|
1454
|
-
# Offline by construction: the record is written by .gob/bin/goblin-audit, run ONCE,
|
|
1455
|
-
# deliberately. A verify-time network call would break the offline dependency contract
|
|
1456
|
-
# (docs/RISKS.md K4). The record and the waiver table are repo-local by design (W1 §2.5);
|
|
1457
|
-
# only the SKIP remedy names the runner, and global mode names the CLI verb - the record
|
|
1458
|
-
# is the repo's, the tool that produced it is wherever the engine resolves (chain §2.3).
|
|
1459
|
-
[ -n "$SEC_AUDIT_CMD" ] || { printf 'this class declares no audit command (security.audit_cmd is empty)\n'; return 3; }
|
|
1460
|
-
local rec="$ROOT/.gob/audit.tsv" wfile="$ROOT/.gob/audit-waiver.tsv"
|
|
1461
|
-
if [ ! -f "$rec" ]; then
|
|
1462
|
-
if [ "$ENGINE_MODE" = "global" ]; then
|
|
1463
|
-
printf 'no audit record yet. Run `gob audit` once, deliberately, then commit\n.gob/audit.tsv: SC-07 reads the record and never the network\n'
|
|
1464
|
-
else
|
|
1465
|
-
printf 'no audit record yet. Run .gob/bin/goblin-audit once, deliberately, then commit\n.gob/audit.tsv: SC-07 reads the record and never the network\n'
|
|
1466
|
-
fi
|
|
1467
|
-
return 3
|
|
1468
|
-
fi
|
|
1469
|
-
local d age lines=0 waivers=0 pkg sev id bad=0 wl wd
|
|
1470
|
-
d=$(sed -n 's/^measured[[:space:]]*//p' "$rec" | head -n 1)
|
|
1471
|
-
if [ -z "$d" ]; then printf 'the audit record carries no `measured` date\n'; return 1; fi
|
|
1472
|
-
age=$(age_days "$d") || { printf 'the recorded date does not parse on this host: %s\n' "$d"; return 1; }
|
|
1473
|
-
if [ "$age" -gt "$SEC_AUDIT_MAX_AGE" ]; then
|
|
1474
|
-
printf 'the audit record is %s days old (max %s): run goblin-audit again\n' "$age" "$SEC_AUDIT_MAX_AGE"
|
|
1475
|
-
bad=1
|
|
1476
|
-
fi
|
|
1477
|
-
while IFS=$'\t' read -r pkg sev id rest; do
|
|
1478
|
-
[ -n "$pkg" ] || continue
|
|
1479
|
-
case "$pkg" in \#*) continue ;; esac
|
|
1480
|
-
case "$sev" in high|critical) : ;; *) continue ;; esac
|
|
1481
|
-
lines=$((lines + 1))
|
|
1482
|
-
wl=""
|
|
1483
|
-
if [ -f "$wfile" ]; then
|
|
1484
|
-
wl=$(awk -F'\t' -v p="$pkg" -v i="$id" '$1==p && ($3==i || $3=="*") { print $4; exit }' "$wfile")
|
|
1485
|
-
fi
|
|
1486
|
-
if [ -z "$wl" ]; then
|
|
1487
|
-
printf 'unwaived %s advisory: %s %s\n' "$sev" "$pkg" "$id"; bad=1; continue
|
|
1488
|
-
fi
|
|
1489
|
-
waivers=$((waivers + 1))
|
|
1490
|
-
wd=$(age_days "$wl") || { printf 'the waiver for %s carries an unparseable date: %s\n' "$pkg" "$wl"; bad=1; continue; }
|
|
1491
|
-
[ "$wd" -le "$SEC_WAIVER_MAX_AGE" ] \
|
|
1492
|
-
|| { printf 'the waiver for %s is %s days old (max %s): re-decide it\n' "$pkg" "$wd" "$SEC_WAIVER_MAX_AGE"; bad=1; }
|
|
1493
|
-
done < "$rec"
|
|
1494
|
-
printf 'audit measured %s (%s days old): %s high|critical line(s), %s matched waiver(s), %s unwaived\n' \
|
|
1495
|
-
"$d" "$age" "$lines" "$waivers" "$((lines - waivers))"
|
|
1496
|
-
[ "$bad" -eq 0 ]
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
check_sc_08() {
|
|
1500
|
-
# An install hook is arbitrary code that runs on every `npm ci`. Only npm's lockfile records
|
|
1501
|
-
# it (`hasInstallScript`); pnpm/yarn do not, so the row SKIPs with that reason rather than
|
|
1502
|
-
# passing vacuously.
|
|
1503
|
-
local lock="$ROOT/package-lock.json"
|
|
1504
|
-
if [ ! -f "$lock" ]; then
|
|
1505
|
-
if [ -f "$ROOT/pnpm-lock.yaml" ] || [ -f "$ROOT/yarn.lock" ]; then
|
|
1506
|
-
printf 'a pnpm/yarn lockfile carries no hasInstallScript field - nothing to enumerate\n'; return 3
|
|
1507
|
-
fi
|
|
1508
|
-
printf 'no package-lock.json - there is no install-hook surface to enumerate\n'; return 3
|
|
1509
|
-
fi
|
|
1510
|
-
local pkgs n=0 ok=0 bad=0 p
|
|
1511
|
-
# Z2-2: this reader is line-anchored, so a MINIFIED (one-line) lockfile - valid JSON, and what a
|
|
1512
|
-
# tool that writes without pretty-printing leaves behind - matched NOTHING and the row printed
|
|
1513
|
-
# `0 install hook(s), 0 allowlisted` as a PASS, exit 0. That is a vacuous PASS: the exact defect
|
|
1514
|
-
# family (D6/PR-03) this harness exists to prevent, and the one shape the pnpm/yarn branch above
|
|
1515
|
-
# already reports honestly. The text is normalised into the pretty shape first - break after
|
|
1516
|
-
# every `{`, `}` and `,` - which is a TEXT transform, not a JSON parse: no npm, no jq, no parser
|
|
1517
|
-
# (docs/CONTRACTS.md). The anchor accepts `": {` (what npm writes) and `":{` (minified), and the
|
|
1518
|
-
# per-line state machine still attributes `hasInstallScript` to the key line it followed.
|
|
1519
|
-
pkgs=$(awk '
|
|
1520
|
-
{
|
|
1521
|
-
gsub(/\{/, "{\n"); gsub(/\}/, "}\n"); gsub(/,/, ",\n")
|
|
1522
|
-
n = split($0, L, "\n")
|
|
1523
|
-
for (i = 1; i <= n; i++) {
|
|
1524
|
-
s = L[i]
|
|
1525
|
-
if (s ~ /^[[:space:]]*"node_modules\/[^"]+":[[:space:]]*\{/) {
|
|
1526
|
-
k = s; sub(/^[[:space:]]*"/, "", k); sub(/":[[:space:]]*\{.*/, "", k); sub(/^node_modules\//, "", k)
|
|
1527
|
-
}
|
|
1528
|
-
if (s ~ /"hasInstallScript"[[:space:]]*:[[:space:]]*true/ && k != "") print k
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
' "$lock" | sort -u)
|
|
1532
|
-
for p in $pkgs; do
|
|
1533
|
-
n=$((n + 1))
|
|
1534
|
-
if [ -f "$ROOT/.gob/install-hooks.allowlist" ] \
|
|
1535
|
-
&& grep -qxF "$p" "$ROOT/.gob/install-hooks.allowlist"; then
|
|
1536
|
-
ok=$((ok + 1))
|
|
1537
|
-
else
|
|
1538
|
-
printf 'an install-time script is not on the allowlist: %s\n' "$p"; bad=1
|
|
1539
|
-
fi
|
|
1540
|
-
done
|
|
1541
|
-
printf '%s install hook(s), %s allowlisted\n' "$n" "$ok"
|
|
1542
|
-
[ "$bad" -eq 0 ]
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
1386
|
# ---- W1 §2.5, the SK/automation split ----------------------------------------
|
|
1546
|
-
# In global mode the procedure tier (skills
|
|
1387
|
+
# In global mode the procedure tier (skills) is served from the
|
|
1547
1388
|
# engine, not emitted in the repo - emission is W4's. Hashing a global copy from a repo's
|
|
1548
1389
|
# verify would make one machine's skill set answer for every repo, so the per-repo rows
|
|
1549
1390
|
# SKIP with that reason instead of FAILing on the absent copies. SK-03 runs unchanged:
|
|
1550
1391
|
# it reads the manifest, which resolves via the chain either way.
|
|
1551
1392
|
|
|
1552
|
-
# au01_producer_count — the producers an AU-01 run can see, engine-first in global mode.
|
|
1553
|
-
# In global mode the first glob resolves under the engine dir (chain §2.3); the repo-local
|
|
1554
|
-
# globs stay. In vendored mode this is exactly today's three globs.
|
|
1555
|
-
au01_globs() {
|
|
1556
|
-
if [ "$ENGINE_MODE" = "global" ]; then
|
|
1557
|
-
printf '%s\n' "$GOBLIN_ENGINE/automations/*.sh" "$ROOT/automations/*.sh" "$ROOT/automations/*/*.sh"
|
|
1558
|
-
else
|
|
1559
|
-
printf '%s\n' "$ROOT/.gob/automations/*.sh" "$ROOT/automations/*.sh" "$ROOT/automations/*/*.sh"
|
|
1560
|
-
fi
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
check_au_01() {
|
|
1564
|
-
# One control loop over the producer globs. The new clause (W1 §2.5, Q2's narrow form):
|
|
1565
|
-
# a repo that declares NO automations and has no producer anywhere SKIPs with the reason
|
|
1566
|
-
# - the measured M9 FAIL was a born-RED artifact of the glob, and a repo that never
|
|
1567
|
-
# adopted automations must not be failed for it. A repo that DECLARES automations (its
|
|
1568
|
-
# own, repo-local) but has no producer still FAILs: the SKIP is only for repos that
|
|
1569
|
-
# declare none.
|
|
1570
|
-
local f n=0 own=0 glob
|
|
1571
|
-
# The repo's OWN producers: anything under a root automations/ directory (the engine's
|
|
1572
|
-
# payload lives under .gob/automations/ in vendored mode, engine_dir in global mode;
|
|
1573
|
-
# neither is a declaration by this repo).
|
|
1574
|
-
for f in "$ROOT"/automations/*.sh "$ROOT"/automations/*/*.sh; do
|
|
1575
|
-
[ -e "$f" ] || continue
|
|
1576
|
-
own=$((own + 1))
|
|
1577
|
-
done
|
|
1578
|
-
while IFS= read -r glob; do
|
|
1579
|
-
for f in $glob; do
|
|
1580
|
-
[ -e "$f" ] || continue
|
|
1581
|
-
n=$((n + 1))
|
|
1582
|
-
if grep -nE "^[[:space:]]*(curl|wget|gh[[:space:]]|npm[[:space:]]|npx[[:space:]])" "$f" >/dev/null 2>&1; then
|
|
1583
|
-
printf 'a network or forge verb opens a line of the producer:\n'
|
|
1584
|
-
grep -nE "^[[:space:]]*(curl|wget|gh[[:space:]]|npm[[:space:]]|npx[[:space:]])" "$f"
|
|
1585
|
-
return 1
|
|
1586
|
-
fi
|
|
1587
|
-
done
|
|
1588
|
-
done < <(au01_globs)
|
|
1589
|
-
# The declaration clause: a root automations/ directory that holds NO .sh producer is
|
|
1590
|
-
# a declaration whose producer is gone (the files were deleted, not never written).
|
|
1591
|
-
local declared=0
|
|
1592
|
-
for f in "$ROOT"/automations/* "$ROOT"/automations/*/; do
|
|
1593
|
-
[ -e "$f" ] || continue
|
|
1594
|
-
declared=1
|
|
1595
|
-
done
|
|
1596
|
-
if [ "$declared" -eq 1 ] && [ "$own" -eq 0 ]; then
|
|
1597
|
-
printf 'automations are declared but no producer exists - the producer is gone\n'
|
|
1598
|
-
return 1
|
|
1599
|
-
fi
|
|
1600
|
-
if [ "$n" -eq 0 ]; then
|
|
1601
|
-
printf 'no automation producer found (repo or engine)\n'
|
|
1602
|
-
return 3
|
|
1603
|
-
fi
|
|
1604
|
-
printf '%d automation producer(s) scanned, none opens with a network or forge verb\n' "$n"
|
|
1605
|
-
return 0
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
1393
|
check_bn_00() {
|
|
1609
1394
|
# The coherence row: the ban table and the matrix must agree in BOTH directions, every ban
|
|
1610
1395
|
# must name a replacement, and the table must not be empty. IN-03's shape applied to
|
|
@@ -1645,7 +1430,7 @@ check_bn_run() {
|
|
|
1645
1430
|
# closed (the engine's own exit 2 = the table is missing/empty, which is not a pass).
|
|
1646
1431
|
# W1 §2.5: the engine is <resolved engine>/bin/goblin-bans (chain §2.3). The hard-FAIL
|
|
1647
1432
|
# stays for the vendored mode; in global mode the engine's own existence was already
|
|
1648
|
-
# checked at resolution (§1.2 item 4), so an absent ban engine is
|
|
1433
|
+
# checked at resolution (§1.2 item 4), so an absent ban engine is a config error, but it
|
|
1649
1434
|
# is still reported FAIL-closed here rather than silently skipped - the ban lane must
|
|
1650
1435
|
# never read clean because a binary went missing.
|
|
1651
1436
|
local id="$1" engine out rc detail
|
|
@@ -1684,15 +1469,8 @@ check_pf_01() {
|
|
|
1684
1469
|
# to ignore it.
|
|
1685
1470
|
local rname bad=0
|
|
1686
1471
|
rname=$(g_agents_read "$CONFIG" ratchet.name)
|
|
1687
|
-
# The electron opt-in's done-definition: an Electron repo declares its host gate (the FPS /
|
|
1688
|
-
# main_thread_busy_pct number a hermetic rule cannot measure). `electron: true` with no host
|
|
1689
|
-
# gate is a repo missing half its definition — FAIL, before the baseline skip below can mask it.
|
|
1690
|
-
if [ "$ELECTRON" = "true" ] && [ -z "$PERF_HOST_GATE" ]; then
|
|
1691
|
-
printf 'electron: true requires a declared perf.host_gate — declare the host-gate probe (the number no hermetic rule can measure) or drop electron: true\n'
|
|
1692
|
-
return 1
|
|
1693
|
-
fi
|
|
1694
1472
|
[ -n "$PERF_METRIC" ] || {
|
|
1695
|
-
printf '
|
|
1473
|
+
printf 'no perf metric is declared (perf.metric is empty). The ratchet still carries\n%s; declare metric/cmd here the day you pick one\n' "${rname:-nothing}"
|
|
1696
1474
|
return 3
|
|
1697
1475
|
}
|
|
1698
1476
|
[ -n "$PERF_BASELINE_COMMIT" ] || {
|
|
@@ -1751,7 +1529,7 @@ sk_proc_skip() {
|
|
|
1751
1529
|
# without it, a global repo with no skills passes the loop vacuously — a green that proves
|
|
1752
1530
|
# nothing, exactly the shape §2.5 exists to kill).
|
|
1753
1531
|
sk01_cell() {
|
|
1754
|
-
n=0; for f in .hermes/skills/*/SKILL.md; do [ -e "$f" ] || continue; n=$((n+1)); head -n 1 "$f" | grep -qx -- '---' || exit 1; awk 'NR==1{next} /^---/{exit} /^name:/{a=1} /^description:/{b=1} END{exit !(a&&b)}' "$f" || exit 1; done; [ "$n" -gt 0 ] || { echo "no installed skill found"; exit 1; }; exit 0
|
|
1532
|
+
n=0; for f in .gob/skills/*/SKILL.md .hermes/skills/*/SKILL.md; do [ -e "$f" ] || continue; n=$((n+1)); head -n 1 "$f" | grep -qx -- '---' || exit 1; awk 'NR==1{next} /^---/{exit} /^name:/{a=1} /^description:/{b=1} END{exit !(a&&b)}' "$f" || exit 1; done; [ "$n" -gt 0 ] || { echo "no installed skill found"; exit 1; }; exit 0
|
|
1755
1533
|
}
|
|
1756
1534
|
|
|
1757
1535
|
check_sk_01() {
|
|
@@ -1762,7 +1540,7 @@ check_sk_01() {
|
|
|
1762
1540
|
# sk04_cell — SK-04's original check cell. Kept verbatim so the row's declared text and
|
|
1763
1541
|
# its executed behaviour stay the same thing; the builtin only adds the mode clause.
|
|
1764
1542
|
sk04_cell() {
|
|
1765
|
-
n=0; for f in .hermes/skills/*/SKILL.md; do [ -e "$f" ] || continue; n=$((n+1)); grep -q "^## What this cannot see" "$f" || { echo "missing cannot-see section: $f"; exit 1; }; done; [ "$n" -gt 0 ] || { echo "no installed skill found"; exit 1; }; exit 0
|
|
1543
|
+
n=0; for f in .gob/skills/*/SKILL.md .hermes/skills/*/SKILL.md; do [ -e "$f" ] || continue; n=$((n+1)); grep -q "^## What this cannot see" "$f" || { echo "missing cannot-see section: $f"; exit 1; }; done; [ "$n" -gt 0 ] || { echo "no installed skill found"; exit 1; }; exit 0
|
|
1766
1544
|
}
|
|
1767
1545
|
|
|
1768
1546
|
check_sk_04() {
|
|
@@ -1770,22 +1548,11 @@ check_sk_04() {
|
|
|
1770
1548
|
( cd "$ROOT" && sk04_cell )
|
|
1771
1549
|
}
|
|
1772
1550
|
|
|
1773
|
-
# au04_cell — AU-04's original check cell (the installed automation skills carry a
|
|
1774
|
-
# `## Write surface` section); the builtin only adds the mode clause.
|
|
1775
|
-
au04_cell() {
|
|
1776
|
-
n=0; for f in .hermes/skills/goblin-bugreporter/SKILL.md .hermes/skills/goblin-drift-audit/SKILL.md; do [ -e "$f" ] || continue; n=$((n+1)); grep -q "^## Write surface" "$f" || { echo "missing write surface: $f"; exit 1; }; done; [ "$n" -gt 0 ] || { echo "no automation skill found"; exit 1; }; exit 0
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
check_au_04() {
|
|
1780
|
-
sk_proc_skip && return 3
|
|
1781
|
-
( cd "$ROOT" && au04_cell )
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
1551
|
check_sk_02() {
|
|
1785
1552
|
sk_proc_skip && return 3
|
|
1786
1553
|
local p h cur n=0 bad=0
|
|
1787
1554
|
while IFS=$'\t' read -r p h; do
|
|
1788
|
-
case "$p" in .hermes/skills/*) ;; *) continue ;; esac
|
|
1555
|
+
case "$p" in .gob/skills/*|.hermes/skills/*) ;; *) continue ;; esac
|
|
1789
1556
|
n=$((n + 1))
|
|
1790
1557
|
cur=$(g_sha256_file "$ROOT/$p")
|
|
1791
1558
|
[ "$cur" = "$h" ] || { printf 'skill drift: %s\n' "$p"; bad=1; }
|
|
@@ -1804,11 +1571,11 @@ check_sk_03() {
|
|
|
1804
1571
|
''|*[!0-9]*) printf 'advisory_ceiling is not a number: %s\n' "${ADV_CEILING:-<empty>}"; return 1 ;;
|
|
1805
1572
|
esac
|
|
1806
1573
|
# Count what the run counts: a row is advisory if its check column says so OR its enforced_by
|
|
1807
|
-
# does (
|
|
1574
|
+
# does (an advisory-labelled row can carry a builtin marker in its check column). Counting only
|
|
1808
1575
|
# the literal column printed 7 while the summary printed 8 (D13).
|
|
1809
|
-
k=$(awk -F'\t' 'NR>1 && ($4=="advisory" || $6=="advisory") {n++} END{print n+0}' "$MANIFEST")
|
|
1576
|
+
k=$(awk -F'\t' 'NR>1 && ($4=="advisory" || $6=="advisory") {n++} END{print n+0}' "${RUN_MANIFEST:-$MANIFEST}")
|
|
1810
1577
|
# The REMAINING BUDGET is reported, not implied: the ceiling is the one scarce resource a rule
|
|
1811
|
-
# author spends
|
|
1578
|
+
# author spends. A count with
|
|
1812
1579
|
# no arithmetic leaves the next author to work it out (G8-5).
|
|
1813
1580
|
free=$((ADV_CEILING - k))
|
|
1814
1581
|
plural=""; [ "$free" -eq 1 ] || plural="s"
|
|
@@ -1822,113 +1589,11 @@ check_sk_03() {
|
|
|
1822
1589
|
[ "$k" -le "$ADV_CEILING" ]
|
|
1823
1590
|
}
|
|
1824
1591
|
|
|
1825
|
-
check_pt_02() {
|
|
1826
|
-
local cur
|
|
1827
|
-
cur=$(cd "$ROOT" && git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
1828
|
-
printf 'declared %s, actual %s\n' "$BRANCH" "$cur"
|
|
1829
|
-
if [ "$cur" != "$BRANCH" ]; then
|
|
1830
|
-
printf 'fix: set branch: %s in %s, or check out %s\n' "$cur" "$CONFIG" "$BRANCH"
|
|
1831
|
-
return 1
|
|
1832
|
-
fi
|
|
1833
|
-
return 0
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
class_part_artifact() {
|
|
1837
|
-
# prints 0 (present) or 1 (absent) for the part's artifact
|
|
1838
|
-
case "$1" in
|
|
1839
|
-
handoff) [ -f "$ROOT/HANDOFF.md" ] ;;
|
|
1840
|
-
spec) ls "$ROOT"/*-SPEC.md >/dev/null 2>&1 ;;
|
|
1841
|
-
gate) [ "$(g_agents_gates "$CONFIG" | grep -c . || true)" -ge 1 ] ;;
|
|
1842
|
-
replay) [ -n "$(g_agents_read "$CONFIG" replay.env)" ] && [ -n "$(g_agents_read "$CONFIG" replay.cmd)" ] ;;
|
|
1843
|
-
ratchet) [ -n "$(g_agents_read "$CONFIG" ratchet.name)" ] ;;
|
|
1844
|
-
pr-gate) [ -d "$ROOT/reviews" ] ;;
|
|
1845
|
-
review-panel) [ -d "$ROOT/reviews" ] ;;
|
|
1846
|
-
# The W4a re-point (W4A-SPEC §5.3): the artifact test accepts the goblin-mode skill
|
|
1847
|
-
# at ANY path in the W4a emitted set, or a record in the emissions ledger. The old
|
|
1848
|
-
# probe hardcoded the Hermes project path and FAILed the first emitted-only repo
|
|
1849
|
-
# (declaration + emit, no goblin-install). Rule text, class table and enforced_by
|
|
1850
|
-
# are untouched - this is the W1 §2.5 re-point precedent.
|
|
1851
|
-
playbooks)
|
|
1852
|
-
# The first platform's dir name is ASSEMBLED at run time from fragments (the MD_SLUG
|
|
1853
|
-
# precedent in tests/run-tests.sh): the tool's own name, literal or inside a variable's
|
|
1854
|
-
# name, would trip MD-01's pattern in every vendored copy of this file. W4b added the
|
|
1855
|
-
# four remaining platforms' emitted roots; the last one's dir name is assembled too.
|
|
1856
|
-
# The global-scope probes are gated on GOBLIN_GLOBAL=1: a global path under the real
|
|
1857
|
-
# $HOME is not evidence about THIS repo, and letting it count made the T6 RED control
|
|
1858
|
-
# pass vacuously on any machine whose operator emits globally (measured 2026-10-01:
|
|
1859
|
-
# new_home() isolates GOBLIN_EMISSIONS but not HOME, so the fallbacks reached the
|
|
1860
|
-
# operator's real ~/.hermes). GOBLIN_GLOBAL=1 is set by an operator who wants the
|
|
1861
|
-
# global tier to count; tests that need isolation leave it unset.
|
|
1862
|
-
local _cl_1 _cl_2 _cl_3 _g1 _g2
|
|
1863
|
-
_cl_1="$(printf '%s' '.cl')"; _cl_2="$(printf '%s' 'a')"; _cl_3="$(printf '%s' 'ude')"
|
|
1864
|
-
_g1="$(printf '%s' '.gem')"; _g2="$(printf '%s' 'ini')"
|
|
1865
|
-
[ -f "$ROOT/.hermes/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1866
|
-
[ -f "$ROOT/$_cl_1$_cl_2$_cl_3/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1867
|
-
[ -f "$ROOT/.github/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1868
|
-
[ -f "$ROOT/.cursor/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1869
|
-
[ -f "$ROOT/.opencode/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1870
|
-
[ -f "$ROOT/.agents/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1871
|
-
[ -f "$ROOT/$_g1$_g2/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1872
|
-
if [ "${GOBLIN_GLOBAL:-0}" = "1" ]; then
|
|
1873
|
-
[ -f "${HOME:-$ROOT}/.copilot/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1874
|
-
[ -f "${HOME:-$ROOT}/$_cl_1$_cl_2$_cl_3/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1875
|
-
[ -f "${HOME:-$ROOT}/.cursor/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1876
|
-
[ -f "${HOME:-$ROOT}/.opencode/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1877
|
-
[ -f "${HOME:-$ROOT}/.agents/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1878
|
-
[ -f "${HOME:-$ROOT}/.hermes/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1879
|
-
[ -f "${HOME:-$ROOT}/$_g1$_g2/skills/goblin-mode/SKILL.md" ] && return 0
|
|
1880
|
-
fi
|
|
1881
|
-
[ -f "${GOBLIN_EMISSIONS:-${HOME:-}/.goblin-stack/emissions.tsv}" ] \
|
|
1882
|
-
&& awk -F'\t' -v r="$ROOT" 'NR>1 && index($3, r) == 1 { found=1 } END { exit !found }' \
|
|
1883
|
-
"${GOBLIN_EMISSIONS:-${HOME:-}/.goblin-stack/emissions.tsv}" && return 0
|
|
1884
|
-
return 1 ;;
|
|
1885
|
-
tokens) [ -f "$ROOT/.gob/tokens.yaml" ] ;;
|
|
1886
|
-
# ci-gate: the part is GONE from the product (v2). Every class carries need="-" in
|
|
1887
|
-
# classes.tsv, and the artifact can never be written again — so the probe is a
|
|
1888
|
-
# constant ABSENT and the CL-01 "-" branch (forbids, artifact absent) always passes.
|
|
1889
|
-
ci-gate) return 1 ;;
|
|
1890
|
-
# The CI lane's artifact is the workflow goblin-stack WRITES, not the directory: a repo is
|
|
1891
|
-
# allowed to have its own workflows, and `-` on this part means "goblin-stack must not have
|
|
1892
|
-
# placed one here", not "this repo may not have CI" (G6 A.6).
|
|
1893
|
-
*) return 0 ;;
|
|
1894
|
-
esac
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
check_cl_01() {
|
|
1898
|
-
local part need present bad=0
|
|
1899
|
-
while read -r part; do
|
|
1900
|
-
[ -n "$part" ] || continue
|
|
1901
|
-
need=$(g_class_need "$CLASSES" "$CLASS" "$part")
|
|
1902
|
-
class_part_artifact "$part"; present=$?
|
|
1903
|
-
# A class-forbidden part is forbidden whether or not the installer pre-disabled it: the
|
|
1904
|
-
# opt-out branch used to mask the '-' branch for every part the class turns off, so only
|
|
1905
|
-
# review-panel was ever enforced (D10).
|
|
1906
|
-
if [ "$need" = "-" ]; then
|
|
1907
|
-
if [ "$present" -eq 0 ]; then printf 'class %s forbids part %s, artifact present\n' "$CLASS" "$part"; bad=1; fi
|
|
1908
|
-
continue
|
|
1909
|
-
fi
|
|
1910
|
-
if g_agents_part_disabled "$CONFIG" "$part"; then
|
|
1911
|
-
printf 'part %s: opt-out\n' "$part"
|
|
1912
|
-
continue
|
|
1913
|
-
fi
|
|
1914
|
-
case "$need" in
|
|
1915
|
-
R)
|
|
1916
|
-
if [ "$ARCHIVE" = "true" ]; then
|
|
1917
|
-
printf 'part %s: waived (archive: true)\n' "$part"
|
|
1918
|
-
elif [ "$present" -ne 0 ]; then
|
|
1919
|
-
printf 'class %s requires part %s, artifact absent\n' "$CLASS" "$part"; bad=1
|
|
1920
|
-
fi ;;
|
|
1921
|
-
O) printf 'part %s: optional, %s\n' "$part" "$([ "$present" -eq 0 ] && echo present || echo absent)" ;;
|
|
1922
|
-
esac
|
|
1923
|
-
done < <(awk -F'\t' 'NR>1 {print $2}' "$CLASSES" | sort -u)
|
|
1924
|
-
[ "$bad" -eq 0 ]
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
1592
|
check_cl_02() {
|
|
1928
1593
|
# The archive flag is a switch with a contract, so it must be checkable (D6 - the old body
|
|
1929
1594
|
# printed a sentence and returned 0 in both branches, so the row could never be RED).
|
|
1930
1595
|
# Two falsifiable clauses: the value must be a boolean, and it must agree with what the
|
|
1931
|
-
# install recorded - otherwise flipping `archive:` by hand silently waives the
|
|
1596
|
+
# install recorded - otherwise flipping `archive:` by hand silently waives the checks.
|
|
1932
1597
|
case "$ARCHIVE" in
|
|
1933
1598
|
true|false) ;;
|
|
1934
1599
|
*) printf 'archive: must be true or false, got "%s"\n' "${ARCHIVE:-<empty>}"; return 1 ;;
|
|
@@ -1943,7 +1608,7 @@ check_cl_02() {
|
|
|
1943
1608
|
if [ "$ARCHIVE" = "true" ]; then
|
|
1944
1609
|
printf 'archive: true (matches the install record) - HP-*/GT-*/SP-* skipped, no HANDOFF or gates required\n'
|
|
1945
1610
|
else
|
|
1946
|
-
printf 'archive: false - the full
|
|
1611
|
+
printf 'archive: false - the full requirement applies\n'
|
|
1947
1612
|
fi
|
|
1948
1613
|
return 0
|
|
1949
1614
|
}
|
|
@@ -2016,7 +1681,7 @@ fm_feature_files() {
|
|
|
2016
1681
|
|
|
2017
1682
|
check_fm_01() {
|
|
2018
1683
|
[ -n "$FEATURE_MAP" ] || {
|
|
2019
|
-
printf 'feature_map: is empty -
|
|
1684
|
+
printf 'feature_map: is empty - this state is UNREACHABLE through `gob init --write`, which always declares a live map; the repo was installed by the low-level goblin-install, or hand-edited. There is nothing to index.\n'
|
|
2020
1685
|
return 3
|
|
2021
1686
|
}
|
|
2022
1687
|
local readme; readme=$(fm_readme)
|
|
@@ -2057,7 +1722,7 @@ check_fm_01() {
|
|
|
2057
1722
|
|
|
2058
1723
|
check_fm_02() {
|
|
2059
1724
|
[ -n "$FEATURE_MAP" ] || {
|
|
2060
|
-
printf 'feature_map: is empty -
|
|
1725
|
+
printf 'feature_map: is empty - this state is UNREACHABLE through `gob init --write`, which always declares a live map; the repo was installed by the low-level goblin-install, or hand-edited. There are no entry paths to resolve.\n'
|
|
2061
1726
|
return 3
|
|
2062
1727
|
}
|
|
2063
1728
|
local readme; readme=$(fm_readme)
|
|
@@ -2136,321 +1801,6 @@ check_va_01() {
|
|
|
2136
1801
|
return 0
|
|
2137
1802
|
}
|
|
2138
1803
|
|
|
2139
|
-
# ---- the judge and the loop (G2): JG-01..JG-03, LP-01..LP-05 --------------------------------
|
|
2140
|
-
# A loop record is the committed artifact of ONE unattended run:
|
|
2141
|
-
#
|
|
2142
|
-
# .gob/loop/predicate one shell command - the loop's own exit condition
|
|
2143
|
-
# .gob/loop/predicate.sha256 its digest, recorded at loop start (the pin); after a close, the
|
|
2144
|
-
# chain follows on `previous: <digest>` lines (W5-7)
|
|
2145
|
-
# .gob/loop/first-run "exit=<n> ts=<ISO8601>" - run BEFORE iteration 1
|
|
2146
|
-
# .gob/loop/budget the turn budget the loop declared
|
|
2147
|
-
# .gob/loop/decisions.tsv one row per iteration: ts phase decision why evidence result
|
|
2148
|
-
# .gob/loop/stuck.md the write-up when the loop ended without its predicate green
|
|
2149
|
-
# .gob/loop/closed-<date>/ a relaxed predicate AND the pin it was closed under, archived;
|
|
2150
|
-
# the live pin names its digest, so the close is auditable
|
|
2151
|
-
#
|
|
2152
|
-
# Nothing here re-runs the predicate and nothing here writes: the record is the evidence, and
|
|
2153
|
-
# what that costs is stated in docs/LOOP.md and docs/LIMITS.md.
|
|
2154
|
-
|
|
2155
|
-
loop_present() { [ -d "$LOOP_DIR" ]; }
|
|
2156
|
-
|
|
2157
|
-
# The one reason every LP row skips: no loop has run here, so there is nothing to audit.
|
|
2158
|
-
loop_no_record() { printf 'no loop has run in this repo\n'; return 3; }
|
|
2159
|
-
|
|
2160
|
-
# The verdict rows, in order: "<rownum><TAB><decision><TAB><evidence><TAB><result>".
|
|
2161
|
-
loop_decision_rows() {
|
|
2162
|
-
awk -F'\t' 'NR > 1 && NF >= 6 { print NR "\t" $3 "\t" $5 "\t" $6 }' "$LOOP_DIR/decisions.tsv" 2>/dev/null
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
# A row with fewer columns than the header is a malformed record, and a malformed record is a
|
|
2166
|
-
# FAIL: a row the reader silently skipped is a row nothing checked.
|
|
2167
|
-
loop_malformed_rows() {
|
|
2168
|
-
awk -F'\t' 'NR > 1 && NF > 0 && NF < 6 { print NR }' "$LOOP_DIR/decisions.tsv" 2>/dev/null
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
# Does ONE evidence token resolve? The typed handles are sha:<hex> (a commit `git rev-list
|
|
2172
|
-
# --all` knows), file:<path> (a path under the root) and sha256:<hex> (the digest of a file
|
|
2173
|
-
# under .gob/loop/); a bare token resolves when it names an existing path. A `cmd:` token
|
|
2174
|
-
# resolves NOTHING on purpose: the command ran, its output is not in the record, and a verdict
|
|
2175
|
-
# that rests on it is exactly the self-report JG-01 exists to refuse.
|
|
2176
|
-
loop_token_resolves() {
|
|
2177
|
-
local t="$1" h p
|
|
2178
|
-
case "$t" in
|
|
2179
|
-
*..*) return 1 ;;
|
|
2180
|
-
esac
|
|
2181
|
-
case "$t" in
|
|
2182
|
-
sha:*)
|
|
2183
|
-
h=${t#sha:}
|
|
2184
|
-
case "$h" in ''|*[!0-9a-fA-F]*) return 1 ;; esac
|
|
2185
|
-
[ "${#h}" -ge 7 ] || return 1
|
|
2186
|
-
# NOT `git rev-list --all | grep -qi` : grep -q exits on the first match, git dies of
|
|
2187
|
-
# SIGPIPE (141), and with `set -o pipefail` the pipeline reports FAILURE for a commit that
|
|
2188
|
-
# IS in the repo. Measured: a seeded record's own HEAD resolved as false, rc 141. grep -c
|
|
2189
|
-
# reads to the end of the stream, so the count is what is compared.
|
|
2190
|
-
case "$( cd "$ROOT" && git rev-list --all 2>/dev/null | grep -ci "^$h" )" in
|
|
2191
|
-
''|0) return 1 ;;
|
|
2192
|
-
esac
|
|
2193
|
-
return 0 ;;
|
|
2194
|
-
sha256:*)
|
|
2195
|
-
h=${t#sha256:}
|
|
2196
|
-
case "$h" in ''|*[!0-9a-fA-F]*) return 1 ;; esac
|
|
2197
|
-
[ "${#h}" -eq 64 ] || return 1
|
|
2198
|
-
for p in "$LOOP_DIR"/* "$LOOP_DIR"/closed-*/*; do
|
|
2199
|
-
[ -f "$p" ] || continue
|
|
2200
|
-
[ "$(g_sha256_file "$p")" = "$h" ] && return 0
|
|
2201
|
-
done
|
|
2202
|
-
return 1 ;;
|
|
2203
|
-
file:*)
|
|
2204
|
-
p=${t#file:}
|
|
2205
|
-
[ -n "$p" ] && [ -e "$ROOT/$p" ] && return 0
|
|
2206
|
-
return 1 ;;
|
|
2207
|
-
cmd:*|verdict:*|predicate:*|ts:*)
|
|
2208
|
-
return 1 ;;
|
|
2209
|
-
*)
|
|
2210
|
-
[ -n "$t" ] && [ -e "$ROOT/$t" ] && return 0
|
|
2211
|
-
return 1 ;;
|
|
2212
|
-
esac
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
check_jg_01() {
|
|
2216
|
-
local f="$LOOP_DIR/decisions.tsv" n=0 bad=0 rn dec ev res tok hit mal
|
|
2217
|
-
[ -f "$f" ] || { printf 'no loop record in this repo - no judge verdict to check\n'; return 3; }
|
|
2218
|
-
mal=$(loop_malformed_rows | head -n 3 | paste -sd' ' -)
|
|
2219
|
-
if [ -n "$mal" ]; then
|
|
2220
|
-
printf 'decisions.tsv row(s) %s carry fewer columns than the header - a row nothing reads is a row nothing checks\n' "$mal"
|
|
2221
|
-
bad=1
|
|
2222
|
-
fi
|
|
2223
|
-
while IFS=$'\t' read -r rn dec ev res; do
|
|
2224
|
-
[ -n "$rn" ] || continue
|
|
2225
|
-
case "$dec" in verdict:*) ;; *) continue ;; esac
|
|
2226
|
-
n=$((n + 1))
|
|
2227
|
-
hit=0
|
|
2228
|
-
for tok in $(printf '%s' "$ev" | tr ',' ' '); do
|
|
2229
|
-
if loop_token_resolves "$tok"; then hit=1; break; fi
|
|
2230
|
-
done
|
|
2231
|
-
if [ "$hit" -eq 0 ]; then
|
|
2232
|
-
printf 'row %s: %s cites no handle that resolves: "%s"\n' "$rn" "$dec" "${ev:-<empty>}"
|
|
2233
|
-
printf ' a handle is sha:<hex> (a commit in this repo), file:<path>, sha256:<hex> (a file under .gob/loop/), or an existing path\n'
|
|
2234
|
-
bad=1
|
|
2235
|
-
fi
|
|
2236
|
-
done < <(loop_decision_rows)
|
|
2237
|
-
[ "$bad" -eq 0 ] || return 1
|
|
2238
|
-
printf '%d judge verdict row(s), each citing a handle the repo resolves\n' "$n"
|
|
2239
|
-
return 0
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
# The profiles a role resolves to (one per lane), or nothing when the role has no lane.
|
|
2243
|
-
role_lane_profiles() {
|
|
2244
|
-
resolve_role_models "$1" | awk -F'\t' 'NF >= 2 && $2 != "" { print $2 }' | sort -u
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
# Non-zero when ANY lane of the role has no provider/model. BOTH sentinels count as unresolved:
|
|
2248
|
-
# the installed path prints `?` (resolve_role_models, `${prov:-?}`) and the checkout path prints
|
|
2249
|
-
# `unknown` - a check that greps for one of them passes on the other.
|
|
2250
|
-
role_unresolved() {
|
|
2251
|
-
local line p prov model
|
|
2252
|
-
while IFS=$'\t' read -r line p prov model _; do
|
|
2253
|
-
[ -n "$p" ] || continue
|
|
2254
|
-
case "$prov" in '?'|unknown|'') return 0 ;; esac
|
|
2255
|
-
case "$model" in '?'|unknown|'') return 0 ;; esac
|
|
2256
|
-
done < <(resolve_role_models "$1")
|
|
2257
|
-
return 1
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
check_jg_02() {
|
|
2261
|
-
local judge_profiles code_profiles shared judge_unres code_unres
|
|
2262
|
-
if [ ! -f "$MODELS_FILE" ]; then
|
|
2263
|
-
printf 'no model mapping configured (%s absent) - advisory\n' "$MODELS_FILE"
|
|
2264
|
-
printf 'remedy: add a `judge:` entry beside the code lane in the file declared as models_file: in %s\n' "$CONFIG"
|
|
2265
|
-
return 2
|
|
2266
|
-
fi
|
|
2267
|
-
judge_profiles=$(role_lane_profiles judge)
|
|
2268
|
-
code_profiles=$(role_lane_profiles code)
|
|
2269
|
-
if [ -z "$judge_profiles" ] || [ -z "$code_profiles" ]; then
|
|
2270
|
-
printf 'roles.yaml did not resolve both lanes (judge: %s, code: %s) - advisory\n' \
|
|
2271
|
-
"${judge_profiles:-none}" "${code_profiles:-none}"
|
|
2272
|
-
printf 'remedy: role-judge needs a profiles: list and a profile for it in the mapping file\n'
|
|
2273
|
-
return 2
|
|
2274
|
-
fi
|
|
2275
|
-
role_unresolved judge; judge_unres=$?
|
|
2276
|
-
role_unresolved code; code_unres=$?
|
|
2277
|
-
if [ "$judge_unres" -eq 0 ] || [ "$code_unres" -eq 0 ]; then
|
|
2278
|
-
printf 'unresolved lane - advisory (judge: %s, code: %s)\n' \
|
|
2279
|
-
"$([ "$judge_unres" -eq 0 ] && printf 'no provider/model' || printf 'ok')" \
|
|
2280
|
-
"$([ "$code_unres" -eq 0 ] && printf 'no provider/model' || printf 'ok')"
|
|
2281
|
-
printf 'remedy: add the missing profile to the file declared as models_file: in %s - goblin-stack reads that file and never writes it\n' "$CONFIG"
|
|
2282
|
-
return 2
|
|
2283
|
-
fi
|
|
2284
|
-
shared=$(printf '%s\n' "$judge_profiles" | grep -Fxf <(printf '%s\n' "$code_profiles") | head -n 1)
|
|
2285
|
-
if [ -n "$shared" ]; then
|
|
2286
|
-
printf 'the judge lane and the author (code) lane share the profile "%s" - the judge is the author\n' "$shared"
|
|
2287
|
-
return 1
|
|
2288
|
-
fi
|
|
2289
|
-
printf 'judge lane [%s] and code lane [%s] are disjoint\n' \
|
|
2290
|
-
"$(printf '%s' "$judge_profiles" | paste -sd, -)" "$(printf '%s' "$code_profiles" | paste -sd, -)"
|
|
2291
|
-
return 0
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
check_lp_01() {
|
|
2295
|
-
if ! loop_present; then loop_no_record; return 3; fi
|
|
2296
|
-
local p="$LOOP_DIR/predicate" f="$LOOP_DIR/first-run" n fr fr_ts row1_ts a b
|
|
2297
|
-
[ -f "$p" ] || { printf 'no .gob/loop/predicate - the loop declared no exit condition\n'; return 1; }
|
|
2298
|
-
n=$(grep -cvE '^[[:space:]]*(#|$)' "$p")
|
|
2299
|
-
if [ "$n" -ne 1 ]; then
|
|
2300
|
-
printf 'the predicate must be exactly ONE command; found %s non-blank non-comment line(s)\n' "$n"
|
|
2301
|
-
return 1
|
|
2302
|
-
fi
|
|
2303
|
-
[ -f "$f" ] || { printf 'no .gob/loop/first-run - the predicate was never run before iteration 1\n'; return 1; }
|
|
2304
|
-
fr=$(head -n 1 "$f")
|
|
2305
|
-
case "$fr" in
|
|
2306
|
-
"exit="[0-9]*" ts="*) ;;
|
|
2307
|
-
*) printf 'first-run must read "exit=<n> ts=<ISO8601>", got "%s"\n' "$fr"; return 1 ;;
|
|
2308
|
-
esac
|
|
2309
|
-
fr_ts=$(printf '%s' "$fr" | sed -n 's/.* ts=//p')
|
|
2310
|
-
case "$fr_ts" in
|
|
2311
|
-
[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*) ;;
|
|
2312
|
-
*) printf 'first-run ts is not an ISO8601 timestamp: "%s"\n' "$fr_ts"; return 1 ;;
|
|
2313
|
-
esac
|
|
2314
|
-
row1_ts=$(awk -F'\t' 'NR > 1 && NF >= 6 { print $1; exit }' "$LOOP_DIR/decisions.tsv" 2>/dev/null)
|
|
2315
|
-
if [ -n "$row1_ts" ]; then
|
|
2316
|
-
a=$fr_ts; b=$row1_ts
|
|
2317
|
-
if [ "$a" \> "$b" ]; then
|
|
2318
|
-
printf 'the recorded first run (%s) is AFTER the first log row (%s) - it did not run before iteration 1\n' "$fr_ts" "$row1_ts"
|
|
2319
|
-
return 1
|
|
2320
|
-
fi
|
|
2321
|
-
fi
|
|
2322
|
-
printf 'one predicate command; first run (%s) is at or before the first log row\n' "$fr"
|
|
2323
|
-
return 0
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
check_lp_02() {
|
|
2327
|
-
if ! loop_present; then loop_no_record; return 3; fi
|
|
2328
|
-
local p="$LOOP_DIR/predicate" pin="$LOOP_DIR/predicate.sha256" want have bad=0
|
|
2329
|
-
[ -f "$p" ] || { printf 'no .gob/loop/predicate to pin\n'; return 1; }
|
|
2330
|
-
[ -f "$pin" ] || { printf 'no .gob/loop/predicate.sha256 - the predicate was never pinned at loop start\n'; return 1; }
|
|
2331
|
-
want=$(head -n 1 "$pin" | tr -d '[:space:]')
|
|
2332
|
-
have=$(g_sha256_file "$p")
|
|
2333
|
-
if [ "$want" != "$have" ]; then
|
|
2334
|
-
printf 'the predicate changed after the loop was pinned\n pinned %s\n now %s\n' "$want" "$have"
|
|
2335
|
-
printf 'remedy: close this loop - commit the green state, archive the predicate AND its pin under .gob/loop/closed-<date>/, then open a new loop and re-record the pin with a `previous: <archived digest>` line. Never automatic.\n'
|
|
2336
|
-
return 1
|
|
2337
|
-
fi
|
|
2338
|
-
# W5-7: the close-and-reopen path. The pin covers the predicate file on disk, so a loop could
|
|
2339
|
-
# archive its old bar, write a weaker one, re-pin, and pass LP-02 and LP-05 with nothing in the
|
|
2340
|
-
# record - a relaxed predicate was indistinguishable from a legitimate re-scope. The chain below
|
|
2341
|
-
# cannot judge whether a predicate is WEAKER (nothing in bash can, docs/LIMITS.md #39); what it
|
|
2342
|
-
# can do is make the supersession RECORDED: the archive must be intact (its own pin agrees with
|
|
2343
|
-
# its own predicate) and the current pin must name the archived digest on a `previous:` line. So
|
|
2344
|
-
# a silent relaxation is caught, and a real re-scope costs one line.
|
|
2345
|
-
local d arcdig adig
|
|
2346
|
-
for d in "$LOOP_DIR"/closed-*; do
|
|
2347
|
-
[ -d "$d" ] || continue
|
|
2348
|
-
if [ ! -f "$d/predicate" ] || [ ! -f "$d/predicate.sha256" ]; then
|
|
2349
|
-
printf '%s: a closed loop must archive its predicate AND its pin - an archive that records nothing is not a close\n' "$(basename "$d")"
|
|
2350
|
-
bad=1; continue
|
|
2351
|
-
fi
|
|
2352
|
-
arcdig=$(head -n 1 "$d/predicate.sha256" | tr -d '[:space:]')
|
|
2353
|
-
adig=$(g_sha256_file "$d/predicate")
|
|
2354
|
-
if [ "$arcdig" != "$adig" ]; then
|
|
2355
|
-
printf '%s: the archived pin does not match the archived predicate\n pinned %s\n now %s\n' "$(basename "$d")" "$arcdig" "$adig"
|
|
2356
|
-
bad=1; continue
|
|
2357
|
-
fi
|
|
2358
|
-
if ! awk -v want="$adig" '
|
|
2359
|
-
NR > 1 { line = $0; sub(/^previous:[[:space:]]*/, "", line); sub(/[[:space:]]+$/, "", line); if (line == want) found = 1 }
|
|
2360
|
-
END { exit !found }
|
|
2361
|
-
' "$pin"; then
|
|
2362
|
-
printf '%s: the current pin does not name the superseded predicate\n archived %s\n add a `previous: %s` line to %s - a close-and-reopen that records nothing is a silent relaxation\n' \
|
|
2363
|
-
"$(basename "$d")" "$adig" "$adig" "$pin"
|
|
2364
|
-
bad=1
|
|
2365
|
-
fi
|
|
2366
|
-
done
|
|
2367
|
-
[ "$bad" -eq 0 ] || return 1
|
|
2368
|
-
printf 'predicate pin ok (%s)%s\n' "$have" \
|
|
2369
|
-
"$([ -n "$(ls -d "$LOOP_DIR"/closed-* 2>/dev/null)" ] && printf ', every archived predicate named by a previous: line' || printf '')"
|
|
2370
|
-
return 0
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
check_lp_03() {
|
|
2374
|
-
if ! loop_present; then loop_no_record; return 3; fi
|
|
2375
|
-
local f="$LOOP_DIR/budget" b ceil n bad=0
|
|
2376
|
-
[ -f "$f" ] || { printf 'no .gob/loop/budget - the loop declared no turn budget\n'; return 1; }
|
|
2377
|
-
b=$(head -n 1 "$f" | tr -d '[:space:]')
|
|
2378
|
-
case "$b" in
|
|
2379
|
-
''|*[!0-9]*) printf 'budget must be a positive integer, got "%s"\n' "$b"; return 1 ;;
|
|
2380
|
-
esac
|
|
2381
|
-
[ "$b" -gt 0 ] || { printf 'budget must be a positive integer, got "%s"\n' "$b"; return 1; }
|
|
2382
|
-
ceil=$LOOP_MAX_TURNS_CEILING
|
|
2383
|
-
case "$ceil" in ''|*[!0-9]*) ceil=20 ;; esac
|
|
2384
|
-
if [ "$b" -gt "$ceil" ]; then
|
|
2385
|
-
printf 'budget %s exceeds loop_max_turns_ceiling %s in the config\n' "$b" "$ceil"
|
|
2386
|
-
bad=1
|
|
2387
|
-
fi
|
|
2388
|
-
if [ ! -f "$LOOP_DIR/decisions.tsv" ]; then
|
|
2389
|
-
printf 'no decisions.tsv - the loop declared a budget and kept no record\n'
|
|
2390
|
-
return 1
|
|
2391
|
-
fi
|
|
2392
|
-
n=$(awk -F'\t' 'NR > 1 && NF >= 6 && $3 ~ /^verdict:/ { c++ } END { print c+0 }' "$LOOP_DIR/decisions.tsv")
|
|
2393
|
-
if [ "$n" -gt "$b" ]; then
|
|
2394
|
-
printf 'the record holds %s verdict row(s) against a declared budget of %s\n' "$n" "$b"
|
|
2395
|
-
bad=1
|
|
2396
|
-
fi
|
|
2397
|
-
[ "$bad" -eq 0 ] || return 1
|
|
2398
|
-
printf 'budget %s (ceiling %s), %s verdict row(s) recorded\n' "$b" "$ceil" "$n"
|
|
2399
|
-
return 0
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
check_lp_04() {
|
|
2403
|
-
if ! loop_present; then loop_no_record; return 3; fi
|
|
2404
|
-
[ -f "$LOOP_DIR/decisions.tsv" ] || { printf 'no decisions.tsv to read\n'; return 1; }
|
|
2405
|
-
local prev_ev="" streak=0 nums="" rn dec ev res
|
|
2406
|
-
while IFS=$'\t' read -r rn dec ev res; do
|
|
2407
|
-
[ -n "$rn" ] || continue
|
|
2408
|
-
case "$dec" in verdict:*) ;; *) continue ;; esac
|
|
2409
|
-
if [ -n "$ev" ] && [ "$ev" = "$prev_ev" ] && [ "$res" != "predicate:green" ]; then
|
|
2410
|
-
streak=$((streak + 1))
|
|
2411
|
-
nums="$nums $rn"
|
|
2412
|
-
else
|
|
2413
|
-
streak=1
|
|
2414
|
-
nums=" $rn"
|
|
2415
|
-
fi
|
|
2416
|
-
prev_ev="$ev"
|
|
2417
|
-
if [ "$streak" -ge 3 ]; then
|
|
2418
|
-
printf 'no progress: rows%s share the evidence pointer "%s" and none reached predicate:green\n' "$nums" "$ev"
|
|
2419
|
-
printf ' a loop making no progress stops and writes up why; it does not spend its budget thrashing\n'
|
|
2420
|
-
return 1
|
|
2421
|
-
fi
|
|
2422
|
-
done < <(loop_decision_rows)
|
|
2423
|
-
printf 'no three consecutive verdict rows share an evidence pointer without reaching predicate:green\n'
|
|
2424
|
-
return 0
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
check_lp_05() {
|
|
2428
|
-
if ! loop_present; then loop_no_record; return 3; fi
|
|
2429
|
-
[ -f "$LOOP_DIR/decisions.tsv" ] || { printf 'no decisions.tsv to read\n'; return 1; }
|
|
2430
|
-
local last rn res s n
|
|
2431
|
-
last=$(awk -F'\t' 'NR > 1 && NF >= 6 && $3 ~ /^verdict:/ { rn = NR; res = $6 } END { if (rn) print rn "\t" res }' "$LOOP_DIR/decisions.tsv")
|
|
2432
|
-
if [ -z "$last" ]; then
|
|
2433
|
-
printf 'the record holds no verdict row - there is no closing state to audit\n'
|
|
2434
|
-
return 3
|
|
2435
|
-
fi
|
|
2436
|
-
rn=${last%%$'\t'*}
|
|
2437
|
-
res=${last#*$'\t'}
|
|
2438
|
-
if [ "$res" = "predicate:green" ]; then
|
|
2439
|
-
printf 'the last verdict row (row %s) reached predicate:green - no write-up required\n' "$rn"
|
|
2440
|
-
return 0
|
|
2441
|
-
fi
|
|
2442
|
-
s="$LOOP_DIR/stuck.md"
|
|
2443
|
-
[ -f "$s" ] || { printf 'the loop ended at "%s" (row %s) and left no .gob/loop/stuck.md\n' "${res:-<empty>}" "$rn"; return 1; }
|
|
2444
|
-
n=$(grep -c '[^[:space:]]' "$s")
|
|
2445
|
-
if [ "$n" -lt 3 ]; then
|
|
2446
|
-
printf 'stuck.md holds %s non-blank line(s); a write-up needs at least 3\n' "$n"
|
|
2447
|
-
return 1
|
|
2448
|
-
fi
|
|
2449
|
-
grep -q 'predicate' "$s" || { printf 'stuck.md does not name the predicate it failed to satisfy\n'; return 1; }
|
|
2450
|
-
printf 'the loop ended at "%s" (row %s) and stuck.md names the predicate in %s line(s)\n' "$res" "$rn" "$n"
|
|
2451
|
-
return 0
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
1804
|
# ---- the reference corpus (P15): RC-01..RC-04 ------------------------------------------------
|
|
2455
1805
|
# P15's machine half. All four read DECLARED values - `reference_manifest:` and the
|
|
2456
1806
|
# `security: build_output:` block SC-03 clause 2 already reads - and never infer a path from the
|
|
@@ -2645,7 +1995,7 @@ check_rc_03() {
|
|
|
2645
1995
|
scripts/*|notes/*|manifests/*) continue ;;
|
|
2646
1996
|
# The harness's own directories and the .gitignore block it appends are the install, not the
|
|
2647
1997
|
# lab's content - the same exclusion FM-02 makes for the same reason (W5-4). That set is the
|
|
2648
|
-
# one the
|
|
1998
|
+
# one the install contract creates: .gob/, .hermes/, the .gitignore block, the
|
|
2649
1999
|
# declared harness_dir (checks/ by default), reviews/, and the CI scaffold .github/. A payload
|
|
2650
2000
|
# hidden in any of them is still caught by clause 2 (the sha256 sweep below).
|
|
2651
2001
|
.gob/*|.hermes/*|.gitignore|.github/*|reviews/*) continue ;;
|
|
@@ -2732,23 +2082,11 @@ rc_hdr_field() {
|
|
|
2732
2082
|
}
|
|
2733
2083
|
|
|
2734
2084
|
# ---- the day-one framing (review 1, scope 3) ----------------------------------
|
|
2735
|
-
#
|
|
2736
|
-
#
|
|
2737
|
-
#
|
|
2738
|
-
#
|
|
2739
|
-
#
|
|
2740
|
-
# banner line after the verdict. Commit count only: an mtime comparison against the
|
|
2741
|
-
# reflog fired after every ordinary GT-02 write, so the banner lingered on aged repos
|
|
2742
|
-
# (the verify itself refreshes last-gate-line forever); a repo under 3 commits is the
|
|
2743
|
-
# only unambiguous fresh-clone shape.
|
|
2744
|
-
owner_mismatch() {
|
|
2745
|
-
[ -f "$CONFIG" ] || return 1
|
|
2746
|
-
local declared cur
|
|
2747
|
-
declared=$(g_agents_read "$CONFIG" owner_email | tr -d '"')
|
|
2748
|
-
cur=$(cd "$ROOT" && git config user.email 2>/dev/null)
|
|
2749
|
-
[ -n "$declared" ] && [ -n "$cur" ] && [ "$declared" != "$cur" ]
|
|
2750
|
-
}
|
|
2751
|
-
|
|
2085
|
+
# One shape is an undeserved red for a person who just cloned a repo: the repo looks freshly
|
|
2086
|
+
# cloned (.gob committed, but fewer than 3 commits) -> one banner line after the verdict.
|
|
2087
|
+
# Commit count only: an mtime comparison against the reflog fired after every ordinary GT-02
|
|
2088
|
+
# write, so the banner lingered on aged repos (the verify itself refreshes last-gate-line
|
|
2089
|
+
# forever); a repo under 3 commits is the only unambiguous fresh-clone shape.
|
|
2752
2090
|
fresh_clone() {
|
|
2753
2091
|
[ -f "$INSTALLED" ] || return 1
|
|
2754
2092
|
[ -d "$ROOT/.git" ] || return 1
|
|
@@ -2760,6 +2098,82 @@ fresh_clone() {
|
|
|
2760
2098
|
|
|
2761
2099
|
# ================================================================ runner ======
|
|
2762
2100
|
|
|
2101
|
+
# ---- the repo-local override (batch 3) ---------------------------------------
|
|
2102
|
+
# Read .gob/manifest/enforcement.local.tsv, validate it (THE HONESTY GATE), and merge its rows
|
|
2103
|
+
# into the run. Placed here, after every builtin is defined, so a `goblin-verify --only <ID>`
|
|
2104
|
+
# marker cell can be checked against the builtins that actually exist.
|
|
2105
|
+
is_local_id() { case " $LOCAL_IDS " in *" $1 "*) return 0 ;; esac; return 1; }
|
|
2106
|
+
|
|
2107
|
+
# LOCAL_NO_VERDICT — set at run time when a LOCAL row's check COULD NOT EXECUTE (exit 126/127/137:
|
|
2108
|
+
# not found / not executable / killed by a signal). Such a check "exited without producing a
|
|
2109
|
+
# verdict": it is REFUSED at the end of the run, never read as a pass.
|
|
2110
|
+
LOCAL_NO_VERDICT=""
|
|
2111
|
+
setup_local_override() {
|
|
2112
|
+
[ -n "$LOCAL_FILE" ] || return 0
|
|
2113
|
+
local tmp _n=0 _id _scope _rule _eby _art _check _why _nf _hit _fn _line
|
|
2114
|
+
tmp=$(mktemp) || { g_err "mktemp failed"; exit 2; }
|
|
2115
|
+
cp "$MANIFEST" "$tmp"
|
|
2116
|
+
while IFS= read -r _line || [ -n "$_line" ]; do
|
|
2117
|
+
_line=${_line%$'\r'}
|
|
2118
|
+
case "$_line" in ''|'#'*) continue ;; esac
|
|
2119
|
+
_nf=$(printf '%s' "$_line" | awk -F'\t' '{print NF}')
|
|
2120
|
+
_id=${_line%%$'\t'*}
|
|
2121
|
+
if [ "$_nf" -lt 7 ]; then
|
|
2122
|
+
g_err "local override: '$_id' names a row id with no check."
|
|
2123
|
+
g_err " a local row must carry the full 7-cell line; get it with: gob verify --library"
|
|
2124
|
+
g_err " (an LX-* rule must supply its own check cell - a rule nothing verifies is refused)."
|
|
2125
|
+
exit 3
|
|
2126
|
+
fi
|
|
2127
|
+
IFS=$'\t' read -r _id _scope _rule _eby _art _check _why <<< "$_line"
|
|
2128
|
+
# the id must name a check the engine can run: a matrix row, a library row, or an LX-* rule.
|
|
2129
|
+
_hit=0
|
|
2130
|
+
awk -F'\t' -v x="$_id" 'NR>1 && $1==x {f=1} END{exit !f}' "$MANIFEST" && _hit=1
|
|
2131
|
+
if [ "$_hit" -eq 0 ] && [ -n "$LIBRARY_FILE" ]; then
|
|
2132
|
+
awk -F'\t' -v x="$_id" 'NR>1 && $1==x {f=1} END{exit !f}' "$LIBRARY_FILE" && _hit=1
|
|
2133
|
+
fi
|
|
2134
|
+
case "$_id" in LX-*) _hit=1 ;; esac
|
|
2135
|
+
if [ "$_hit" -eq 0 ]; then
|
|
2136
|
+
g_err "local override: '$_id' names no row the engine ships - it is in neither"
|
|
2137
|
+
g_err " .gob/manifest/enforcement.tsv nor .gob/manifest/library.tsv."
|
|
2138
|
+
g_err " a local row may only turn on a shipped row (see: gob verify --library) or declare"
|
|
2139
|
+
g_err " an LX-* rule with its own check cell."
|
|
2140
|
+
exit 3
|
|
2141
|
+
fi
|
|
2142
|
+
# a builtin-marker check must have a builtin, or it can never produce a verdict.
|
|
2143
|
+
case "$_check" in
|
|
2144
|
+
"goblin-verify --only "*)
|
|
2145
|
+
_fn="check_$(printf '%s' "$_id" | tr 'A-Z' 'a-z' | tr '-' '_')"
|
|
2146
|
+
if ! declare -F "$_fn" >/dev/null 2>&1; then
|
|
2147
|
+
g_err "local override: '$_id' names a check the engine has no builtin for ($_fn)."
|
|
2148
|
+
g_err " a local row cannot certify a rule nothing verifies."
|
|
2149
|
+
exit 3
|
|
2150
|
+
fi ;;
|
|
2151
|
+
"")
|
|
2152
|
+
case "$_eby" in
|
|
2153
|
+
advisory) ;;
|
|
2154
|
+
*) g_err "local override: '$_id' carries no check and is not advisory - nothing verifies it."
|
|
2155
|
+
exit 3 ;;
|
|
2156
|
+
esac ;;
|
|
2157
|
+
esac
|
|
2158
|
+
# a row the matrix already runs by default is a no-op here (never a duplicate).
|
|
2159
|
+
if awk -F'\t' -v x="$_id" 'NR>1 && $1==x {f=1} END{exit !f}' "$MANIFEST"; then
|
|
2160
|
+
g_info "local override: '$_id' is already on by default - ignored."
|
|
2161
|
+
continue
|
|
2162
|
+
fi
|
|
2163
|
+
printf '%s\n' "$_line" >> "$tmp"
|
|
2164
|
+
LOCAL_IDS="$LOCAL_IDS $_id"
|
|
2165
|
+
_n=$((_n + 1))
|
|
2166
|
+
done < "$LOCAL_FILE"
|
|
2167
|
+
if [ "$_n" -gt 0 ]; then
|
|
2168
|
+
RUN_MANIFEST="$tmp"
|
|
2169
|
+
_GOB_MANIFEST="$tmp"
|
|
2170
|
+
export _GOB_MANIFEST
|
|
2171
|
+
else
|
|
2172
|
+
rm -f "$tmp"
|
|
2173
|
+
fi
|
|
2174
|
+
}
|
|
2175
|
+
setup_local_override
|
|
2176
|
+
|
|
2763
2177
|
PASS=0; FAIL=0; ADV=0; SKIP=0; BAD=0
|
|
2764
2178
|
JSON_ROWS=""
|
|
2765
2179
|
|
|
@@ -2795,21 +2209,6 @@ while IFS=$'\t' read -r id scope rule enforced_by artifact check why; do
|
|
|
2795
2209
|
only_selected "$id" || continue
|
|
2796
2210
|
|
|
2797
2211
|
part=$(row_part "$id")
|
|
2798
|
-
# W6 neutral-first: in global engine mode AU-01's subject is the PRODUCER glob, which
|
|
2799
|
-
# global mode reads from the engine dir — the row must run there even when the repo's
|
|
2800
|
-
# skills opt-out (playbooks) is set, or the W1 control below it is skip-masked. This
|
|
2801
|
-
# clause precedes the opt-out branch on purpose. SK-01/SK-02/SK-04 and AU-02..AU-04 keep
|
|
2802
|
-
# their opt-out semantics.
|
|
2803
|
-
if [ "$id" = "AU-01" ] && [ "$ENGINE_MODE" = "global" ]; then
|
|
2804
|
-
out=$(check_au_01 2>&1); rc=$?
|
|
2805
|
-
case "$rc" in
|
|
2806
|
-
0) PASS=$((PASS + 1)); emit "$id" PASS "$out" ;;
|
|
2807
|
-
1) FAIL=$((FAIL + 1)); emit "$id" FAIL "$out" ;;
|
|
2808
|
-
2) ADV=$((ADV + 1)); emit "$id" ADV "$out" ;;
|
|
2809
|
-
3) SKIP=$((SKIP + 1)); emit "$id" SKIP "$out" ;;
|
|
2810
|
-
esac
|
|
2811
|
-
continue
|
|
2812
|
-
fi
|
|
2813
2212
|
if [ -n "$part" ] && g_agents_part_disabled "$CONFIG" "$part"; then
|
|
2814
2213
|
SKIP=$((SKIP + 1)); emit "$id" SKIP "$rule (opt-out: $part)"; continue
|
|
2815
2214
|
fi
|
|
@@ -2834,6 +2233,15 @@ while IFS=$'\t' read -r id scope rule enforced_by artifact check why; do
|
|
|
2834
2233
|
;;
|
|
2835
2234
|
*)
|
|
2836
2235
|
detail=$( cd "$ROOT" && bash -c "$check" 2>&1 ); rc=$?
|
|
2236
|
+
# A LOCAL row whose check could not execute (126 not executable / 127 not found /
|
|
2237
|
+
# 137 killed by a signal) exited WITHOUT producing a verdict: record it for the refusal
|
|
2238
|
+
# at the end of the run, rather than folding it into a FAIL a reader could mistake for a
|
|
2239
|
+
# verdict. A matrix row keeps the old fold (its checks are shipped and known).
|
|
2240
|
+
if is_local_id "$id"; then
|
|
2241
|
+
case "$rc" in
|
|
2242
|
+
126|127|137) LOCAL_NO_VERDICT="$LOCAL_NO_VERDICT $id(exit $rc)" ;;
|
|
2243
|
+
esac
|
|
2244
|
+
fi
|
|
2837
2245
|
# A shell check has no advisory state: anything non-zero is a FAIL. Only builtins
|
|
2838
2246
|
# (the 'goblin-verify --only <ID>' marker rows) may return 2 = advisory or 3 = skip.
|
|
2839
2247
|
if [ "$rc" -eq 0 ]; then
|
|
@@ -2859,44 +2267,65 @@ while IFS=$'\t' read -r id scope rule enforced_by artifact check why; do
|
|
|
2859
2267
|
3) SKIP=$((SKIP + 1)); emit "$id" SKIP "$detail" ;;
|
|
2860
2268
|
*) FAIL=$((FAIL + 1)); emit "$id" FAIL "$detail (exit $rc)" ;;
|
|
2861
2269
|
esac
|
|
2862
|
-
done < "$
|
|
2270
|
+
done < "$RUN_MANIFEST"
|
|
2271
|
+
|
|
2272
|
+
# ---- the honesty gate, run-time half: a local check that produced no verdict ----------------
|
|
2273
|
+
# A local row's check that could not execute (exit 126/127/137) never produced a verdict, so it
|
|
2274
|
+
# is REFUSED - exit 3, with the ids named - rather than reported as the FAIL the fold above made
|
|
2275
|
+
# of it. Nothing about such a row is green.
|
|
2276
|
+
if [ -n "$LOCAL_NO_VERDICT" ]; then
|
|
2277
|
+
g_err "local override: a check could not execute, so it produced NO verdict:$LOCAL_NO_VERDICT"
|
|
2278
|
+
g_err " a local row's check must be runnable - a command that is not found (127), not"
|
|
2279
|
+
g_err " executable (126), or killed by a signal (137) cannot verify the rule it names."
|
|
2280
|
+
g_err " fix the check cell, or remove the row from .gob/manifest/enforcement.local.tsv."
|
|
2281
|
+
exit 3
|
|
2282
|
+
fi
|
|
2863
2283
|
|
|
2864
2284
|
if [ "$JSON" -eq 1 ]; then
|
|
2865
|
-
|
|
2866
|
-
|
|
2285
|
+
_lib_n=0
|
|
2286
|
+
[ -n "$LIBRARY_FILE" ] && _lib_n=$(awk -F'\t' 'NR>1 && $1!="" {n++} END{print n+0}' "$LIBRARY_FILE")
|
|
2287
|
+
printf '{"root":"%s","passed":%d,"failed":%d,"advisory":%d,"skipped":%d,"library":%d,"rows":[%s]}\n' \
|
|
2288
|
+
"$(json_escape "$ROOT")" "$PASS" "$FAIL" "$ADV" "$SKIP" "$_lib_n" "${JSON_ROWS%,}"
|
|
2867
2289
|
else
|
|
2868
2290
|
printf ' %d passed, %d failed, %d advisory, %d skipped\n' "$PASS" "$FAIL" "$ADV" "$SKIP"
|
|
2869
|
-
# Day-one framing
|
|
2870
|
-
# repo expects, under the verdict, before the row detail. One line, no exit semantics.
|
|
2871
|
-
if [ "$FAIL" -gt 0 ] && owner_mismatch; then
|
|
2872
|
-
_owner_declared=$(g_agents_read "$CONFIG" owner_email | tr -d '"')
|
|
2873
|
-
printf ' note: this repo records a different owner (you are probably new here) — commit with --author or update owner_email: %s\n' "$_owner_declared"
|
|
2874
|
-
unset _owner_declared
|
|
2875
|
-
fi
|
|
2876
|
-
# Day-one framing, part (b): a fresh clone is not your debt. One banner line, after the
|
|
2291
|
+
# Day-one framing: a fresh clone is not your debt. One banner line, after the
|
|
2877
2292
|
# verdict; counts and exit codes untouched.
|
|
2878
2293
|
if [ "$FAIL" -gt 0 ] && fresh_clone; then
|
|
2879
2294
|
printf ' fresh clone detected: some of these fails are not yours — see docs/GUIDE.md §9 (day one for a new teammate)\n'
|
|
2880
2295
|
fi
|
|
2881
|
-
# Z1-7: the advisory number above counts
|
|
2882
|
-
# advisory
|
|
2883
|
-
#
|
|
2884
|
-
#
|
|
2885
|
-
|
|
2886
|
-
adv_labelled=$(awk -F'\t' 'NR>1 && ($4=="advisory" || $6=="advisory") {n++} END{print n+0}' "$MANIFEST")
|
|
2296
|
+
# Z1-7: the advisory number above counts the rows the matrix LABELS advisory; a row that is
|
|
2297
|
+
# not advisory-labelled can also report ADV by design when its lane cannot be resolved here.
|
|
2298
|
+
# SK-03 counts the labelled rows, the ADV lines on screen are both, so a reader comparing
|
|
2299
|
+
# `advisory N of ceiling C` with more ADV lines sees the arithmetic. Print it.
|
|
2300
|
+
adv_labelled=$(awk -F'\t' 'NR>1 && ($4=="advisory" || $6=="advisory") {n++} END{print n+0}' "${RUN_MANIFEST:-$MANIFEST}")
|
|
2887
2301
|
if [ "$ADV" -ne "$adv_labelled" ]; then
|
|
2888
2302
|
printf ' of those %d advisory: the matrix labels %d row(s) advisory; the difference is the non-advisory row(s) reporting ADV by design (an unresolved lane) and any labelled row skipped by an opt-out\n' \
|
|
2889
2303
|
"$ADV" "$adv_labelled"
|
|
2304
|
+
else
|
|
2305
|
+
printf ' of those %d advisory: the matrix labels %d row(s) advisory\n' \
|
|
2306
|
+
"$ADV" "$adv_labelled"
|
|
2307
|
+
fi
|
|
2308
|
+
# The library census (batch 2b-ii). A green default run must never read as the whole story:
|
|
2309
|
+
# the rows this run did NOT check are counted here, with the surface that lists them. The
|
|
2310
|
+
# count is read from library.tsv, so it tracks the shipped row set rather than a typed number.
|
|
2311
|
+
if [ -n "$LIBRARY_FILE" ]; then
|
|
2312
|
+
_lib_n=$(awk -F'\t' 'NR>1 && $1!="" {n++} END{print n+0}' "$LIBRARY_FILE")
|
|
2313
|
+
printf ' library: %d off-by-default row(s) held but NOT run - discover them with `gob verify --library`\n' \
|
|
2314
|
+
"$_lib_n"
|
|
2315
|
+
fi
|
|
2316
|
+
# The local-override census (batch 3): a row turned ON through .gob/manifest/enforcement.local.tsv
|
|
2317
|
+
# is named here, so a reader can tell the locally-enabled rows apart from the default set.
|
|
2318
|
+
if [ -n "$LOCAL_IDS" ]; then
|
|
2319
|
+
printf ' enabled-locally: %d row(s) added by .gob/manifest/enforcement.local.tsv:%s\n' \
|
|
2320
|
+
"$(printf '%s' "$LOCAL_IDS" | wc -w | tr -d ' ')" "$LOCAL_IDS"
|
|
2890
2321
|
fi
|
|
2891
2322
|
# The collapsed listing keeps one line per row (a SKIP's reason is the row's whole
|
|
2892
2323
|
# point and scripts read them by id); the width discipline lives in the lib's printers.
|
|
2893
2324
|
if [ "$VERBOSE" -eq 1 ]; then
|
|
2894
2325
|
cat <<'SEE'
|
|
2895
2326
|
cannot see: whether a check in the harness dir tests the right path rather than
|
|
2896
|
-
merely passing; whether the forge is bound by the workflow
|
|
2897
|
-
read the diff;
|
|
2898
|
-
whether the model mapping names a family that actually differs (MD-02 reports it
|
|
2899
|
-
and cannot change it); and whether .gob/installed.json — the record every drift
|
|
2327
|
+
merely passing; whether the forge is bound by the workflow the repo declares found; whether a human
|
|
2328
|
+
read the diff; and whether .gob/installed.json — the record every drift
|
|
2900
2329
|
check trusts — was itself rewritten. It is not signed, so one edit to it (with the
|
|
2901
2330
|
matching edit to the file it protects) defeats IN-02, SK-02 and HS-01 at once
|
|
2902
2331
|
(docs/LIMITS.md #18). The ban lane carries the same blind spot and two of its own:
|
|
@@ -2905,17 +2334,7 @@ else
|
|
|
2905
2334
|
`Record<string, any>` is missed and a `: any` inside a string is reported
|
|
2906
2335
|
(docs/LIMITS.md #27); and no check here can reach a ban IN CONTEXT — the row proves
|
|
2907
2336
|
the forbidden path fails mechanically, never that the ban reached the agent that
|
|
2908
|
-
wrote the line. The
|
|
2909
|
-
it proves a handle, a pin, a budget and a pointer exist — never that the loop made
|
|
2910
|
-
progress (a changed pointer is a proxy, docs/LIMITS.md #33), never which lane returned
|
|
2911
|
-
a verdict, and never that the predicate was the right one or was really run. The CI lane
|
|
2912
|
-
adds its own: PG-05 and PG-06 read a workflow's TEXT, so PG-05 sees a job whose gate step is
|
|
2913
|
-
conditional and cannot see branch protection, the required-check list, or a forge that never
|
|
2914
|
-
ran the job at all, and PG-06 proves a declared gate is INVOKED in a file under
|
|
2915
|
-
.github/workflows/ — never that the forge marks that job required, never that it is the job
|
|
2916
|
-
the forge waits on, and never that the workflow can fail (that is PG-05). A required check
|
|
2917
|
-
that reports Success after skipping its gate is a green light for a commit whose gate never
|
|
2918
|
-
ran (docs/CI.md). The reference-corpus lane adds its own: RC-01 matches EXACT sha256 only,
|
|
2337
|
+
wrote the line. The reference-corpus lane adds its own: RC-01 matches EXACT sha256 only,
|
|
2919
2338
|
so a resized, recoloured or re-encoded reference asset, or copied text inside a shipped
|
|
2920
2339
|
string, passes it unseen; RC-02 proves the manifest is well-shaped, never that its entries
|
|
2921
2340
|
are the right hashes (as strong as tamper hashing, and installed.json is unsigned); RC-03
|
|
@@ -2929,8 +2348,8 @@ SEE
|
|
|
2929
2348
|
cat <<'SEE'
|
|
2930
2349
|
cannot see: whether a check tests the right path rather than merely passing; whether a
|
|
2931
2350
|
human read the diff; whether the unsigned install record (.gob/installed.json — it is
|
|
2932
|
-
not signed) was rewritten; and the per-lane blind spots of the ban
|
|
2933
|
-
reference lanes. Full statement: `goblin-verify --verbose`, docs/LIMITS.md #18 #27 #28 #
|
|
2351
|
+
not signed) was rewritten; and the per-lane blind spots of the ban and
|
|
2352
|
+
reference lanes. Full statement: `goblin-verify --verbose`, docs/LIMITS.md #18 #27 #28 #43.
|
|
2934
2353
|
SEE
|
|
2935
2354
|
fi
|
|
2936
2355
|
# ---- the sign-off (locked v2 decision) ----------------------------------------
|
|
@@ -2972,9 +2391,8 @@ SEE
|
|
|
2972
2391
|
if [ "$ENGINE_MODE" = "global" ]; then
|
|
2973
2392
|
_shadow_n=0
|
|
2974
2393
|
for _f in "$ROOT"/.gob/bin/goblin-verify "$ROOT"/.gob/bin/goblin-lib.sh \
|
|
2975
|
-
"$ROOT"/.gob/bin/goblin-
|
|
2976
|
-
"$ROOT"/.gob/manifest/* "$ROOT"/.gob/bans
|
|
2977
|
-
"$ROOT"/.gob/automations/* "$ROOT"/.gob/roles.yaml; do
|
|
2394
|
+
"$ROOT"/.gob/bin/goblin-bans \
|
|
2395
|
+
"$ROOT"/.gob/manifest/* "$ROOT"/.gob/bans/*; do
|
|
2978
2396
|
[ -e "$_f" ] || continue
|
|
2979
2397
|
_shadow_n=$((_shadow_n + 1))
|
|
2980
2398
|
done
|