Skip to content

fix(ci): repair aspect_tests.sh grep-count bash bug (baseline rot) - #118

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/ci-baseline-rot-mechanical
May 20, 2026
Merged

fix(ci): repair aspect_tests.sh grep-count bash bug (baseline rot)#118
hyperpolymath merged 2 commits into
mainfrom
fix/ci-baseline-rot-mechanical

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Restores the Aspect — Thread Safety + ABI Contract + SPDX check to green. The check has been red on main for some time, gating every PR.

Root cause

tests/aspect_tests.sh: line 77: [[: 0
0: syntax error in expression (error token is "0")

The pattern has_export=$(grep -c 'pattern' file 2>/dev/null || echo "0") is broken: grep -c always prints the count (including 0 for no matches) and exits non-zero when there are no matches. So || echo "0" also fires, and has_export ends up "0\n0". The next line — [[ "$has_export" -gt 0 ]] — chokes on the embedded newline in arithmetic context.

Fix

Swap || echo "0"|| true at all 4 call-sites (lines 74, 75, 98, 99). grep -c already prints 0 cleanly; the || true just suppresses the exit code so set -euo pipefail doesn't abort the script.

What's held out of this PR

The companion .github/workflows/e2e.yml fix — bump Zig 0.15.00.15.1 (matches .tool-versions, retired upstream) and refresh the denoland/setup-deno SHA pin (5fae568d… no longer resolves; repointing to v2.0.4's 667a34cd… SHA which publish.yml already uses) — is held out because the current OAuth token lacks the workflow scope GitHub requires for workflow-file edits. Will land in a follow-up PR once the token is rotated, or you can apply those 4 line-edits directly.

The governance / Language / package anti-pattern policy failure is also red on main, but a parallel session is already diagnosing it under the Estate-drift-remediation 2026-05 campaign. Not touched here per [[parallel-session-branch-drift]].

Test plan

  • bash -n tests/aspect_tests.sh — syntax clean.
  • CI runs Aspect — Thread Safety + ABI Contract + SPDX green on this PR.
  • No regression in the test's pass/fail logic for repos that should fail it (cartridges with C-ABI exports + no Mutex).

🤖 Generated with Claude Code

`Aspect — Thread Safety + ABI Contract + SPDX` has been red on `main`,
gating every PR on these lines:

  tests/aspect_tests.sh: line 77: [[: 0
  0: syntax error in expression (error token is "0")

Root cause: `grep -c 'pattern' file 2>/dev/null || echo "0"`.  When
`grep -c` finds zero matches it outputs `0` to stdout **and** exits
non-zero, which then triggers `|| echo "0"` — `has_export` ends up
`"0\n0"`, and `[[ "0\n0" -gt 0 ]]` chokes on the embedded newline in
arithmetic context.  Swapped the `|| echo "0"` for `|| true` on all
four call-sites; `grep -c` already prints `0` cleanly, the `|| true`
just suppresses the exit code for `set -euo pipefail`.

Verification: `bash -n tests/aspect_tests.sh` clean.

(The companion `.github/workflows/e2e.yml` fix — Zig 0.15.0 → 0.15.1
and the `denoland/setup-deno` SHA refresh — is held out because the
current OAuth token lacks the `workflow` scope GitHub requires for
workflow-file edits.  Will land separately once the token is rotated
or via a token with the right scope.)

Out of scope and deliberately not touched:
  - `governance / Language / package anti-pattern policy` — also red
    on main, but a parallel session is already diagnosing it under the
    Estate-drift-remediation 2026-05 campaign (parent standards#66).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 30 issues detected

Severity Count
🔴 Critical 18
🟠 High 5
🟡 Medium 7

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stale AI session file -- delete",
    "type": "stale",
    "file": "GEMINI.md",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "medium"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/sanctify-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/fireflag-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/bofig-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/hesiod-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath merged commit a557d7b into main May 20, 2026
16 of 20 checks passed
@hyperpolymath
hyperpolymath deleted the fix/ci-baseline-rot-mechanical branch May 20, 2026 09:02
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 30 issues detected

Severity Count
🔴 Critical 18
🟠 High 5
🟡 Medium 7

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stale AI session file -- delete",
    "type": "stale",
    "file": "GEMINI.md",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "medium"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/sanctify-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/fireflag-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/bofig-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/hesiod-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

hyperpolymath added a commit that referenced this pull request May 20, 2026
Both merged after PR #126 was opened.

CHANGELOG.md `[Unreleased]` Fixed:
  - Added bullet for SafeAPIKey `logSafeBounded` rebuild (#116, MERGED
    2026-05-20T08:46Z).
  - Added bullet for `tests/aspect_tests.sh` grep-count bash bug (#118,
    MERGED 2026-05-20T09:02Z).

.machine_readable/6a2/STATE.a2ml session-history:
  - Updated the 2026-05-20 entry to mark #116 and #118 MERGED inline,
    rather than the stale OPEN/OPEN-DRAFT status they carried when the
    entry was written.

#123 (e2e.yml Zig + Deno pin refresh) remains OPEN — listed in
session-history with its current status.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 20, 2026
## Summary

Restores three CI checks to green by repairing two unrelated upstream
pin issues in `.github/workflows/e2e.yml`. All three had been red on
`main`, gating every PR:

- `E2E — Full REST + MCP Bridge`
- `E2E — Order Ticket (FFI layer)`
- `Bench — FFI Catalogue + Mount/Unmount + Hash`

## Fixes

1. **Zig `0.15.0` retired upstream.** All three `setup-zig` steps failed
on `Error: Could not find version 0.15.0 for platform x86_64-linux`.
Bumped to `0.15.1` to match `.tool-versions` (the canonical estate
declaration). `release.yml` runs `0.15.2` via `mlugg/setup-zig`; either
point on the 0.15.x line is fine.

2. **`denoland/setup-deno` SHA `5fae568d…` no longer resolves.** GitHub
Actions: `Unable to resolve action
denoland/setup-deno@5fae568`. Repointed
to the same v2.0.4 SHA already in use by `publish.yml`
(`667a34cdef165d8d2b2e98dde39547c9daac7282`), verified via the GitHub
API.

## Relationship to #118

Companion to **#118** (`tests/aspect_tests.sh` grep-count fix). The two
were originally one commit but workflow-file edits need the `workflow`
OAuth scope to push, so they're split.

## Out of scope (deliberately)

`governance / Language / package anti-pattern policy` is also red on
main, but a parallel session is already diagnosing it under the
Estate-drift-remediation 2026-05 campaign (parent standards#66). Not
touched here per the parallel-session-branch-drift guardrail.

## Test plan

- [ ] CI on this PR: the three previously-red checks (E2E Full, E2E
Order Ticket, Bench) come back green.
- [ ] No new reds introduced by the Zig version bump.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 20, 2026
…eep (#126)

## Summary

Human + machine documentation close-out for the 2026-05-20 epic #87 Tier
C session and follow-on baseline-rot sweep. No code, no behavioural
change.

## Files

- **`CHANGELOG.md`** `[Unreleased]`:
- *Added* — ADR-0014 RFC (#109); README "Formal verification" section
(#108).
- *Fixed* — SafeAPIKey `logSafeBounded` proof rebuild for Idris2 0.8.0
(#116); `tests/aspect_tests.sh` grep-count bash bug (#118); honest
framing of the ABI axiom count + `(s t : T)` → `(s, t : T)` parser-comma
fix to `SafetyLemmas.idr` (#108).
- **`.machine_readable/6a2/STATE.a2ml`**:
  - `last-updated` bumped `2026-04-25` → `2026-05-20`.
- `believe-me-count` corrected `4` → `5`, with citation back to
`PROOF-NEEDS.md` 2026-05-18 audit + #108.
- `[session-history]` entry appended summarising items 11 + 12 + the
SafeAPIKey baseline-rot follow-up + the CI baseline-rot sweep +
operational notes (parallel-session branch drift, workflow OAuth scope
dance).

## Companion PRs from this thread

| PR | Status | What |
|---|---|---|
| #108 | MERGED 2026-05-20T08:13Z | item 11 honest framing (docstring +
README + parser-comma) |
| #109 | MERGED 2026-05-20T08:12Z | item 12 ADR-0014 RFC
(cross-cartridge composition safety) |
| #116 | MERGED 2026-05-20T08:46Z | SafeAPIKey `logSafeBounded` rebuild
for Idris2 0.8.0 |
| #118 | MERGED 2026-05-20T09:02Z | `tests/aspect_tests.sh` grep-count
bash bug |
| #123 | OPEN | `.github/workflows/e2e.yml` Zig + Deno pin refresh |
| **#126 (this)** | OPEN | session-close docs |

## Out of scope (intentionally)

- `governance / Language / package anti-pattern policy` baseline rot
stays untouched per the parallel-session-branch-drift guardrail (parent
campaign standards#66 owns it).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant