Commit Graph

2 Commits

Author SHA1 Message Date
boshu 6d20d0ed20 fix(test): macOS bats portability — gawk hard-coding + non-POSIX \s regex (age-qzvm)
Two more BSD/macOS test failures found by the full-suite diagnostic (sibling to
age-lz4b's sed fix): generate-cli-reference-portability test hard-coded gawk
(absent on macOS) for a pattern-semantics check -> system awk (the generator's own,
portable + adds macOS coverage); check-removed-symbol-refs test passed GNU '\s' to
the POSIX-ERE --regex mode (matches on Linux git-grep, not macOS, flipping exit
1->0) -> POSIX '[[:space:]]+'. Both pass on macOS+Linux.

Bead: age-qzvm
2026-06-23 08:52:12 -04:00
Bo 041ca731d6 fix(scripts): generate-cli-reference.sh mawk portability (soc-o73v) (#323)
## What

One-line awk fix + 3 regression tests. Closes `soc-o73v`.

## Why

`scripts/generate-cli-reference.sh` line 60 used POSIX interval
expression `[[:space:]]{2,}`. Older mawk (Ubuntu LTS default,
pre-1.3.4-20240123) **silently rejects** intervals and produces an
empty/14-line `COMMANDS.md` instead of the full 4455-line command
reference.

CI runs on gawk → green. Local dev on Ubuntu mawk → empty file. No
signal until you actually inspected the output.

## Fix

```diff
- /^[[:space:]]{2,}[a-z0-9][a-z0-9-]*([[:space:]]+|$)/ {
+ /^[[:space:]][[:space:]]+[a-z0-9][a-z0-9-]*([[:space:]]+|$)/ {
```

Output is **byte-identical** under both awks. Validated by re-running
the script: `git diff cli/docs/COMMANDS.md` is empty.

## Test coverage

`tests/scripts/generate-cli-reference-portability.bats` (3 tests):

1. **'script does not use POSIX interval expressions ({N,} / {N,M})'** —
regex-greps the script for re-introduction
2. **'command-extraction regex matches indented commands under both
awks'** — runs gawk + mawk against the same fixture and verifies
identical output
3. **'regex does not match single-space indents or unindented lines'** —
guards the intent (≥2-space indent is the signal)

## Discovered

Harvested from `.agents/rpi/next-work.jsonl` set
`discovery-2026-05-12-ddd-hexagonal`, item #4 (low severity). Surfaced
during /evolve cycle 197 on 2026-05-18.

## Validation

- ✅ `bats tests/scripts/generate-cli-reference-portability.bats` — 3/3
PASS
- ✅ `scripts/pre-push-gate.sh --fast` — passed (1 pre-existing warn
unrelated)
- ✅ Byte-identical `COMMANDS.md` output before/after

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

Co-authored-by: Codex <codex@example.invalid>
2026-05-18 21:07:08 +00:00