Repair the CodeQL findings introduced by this integration without
dismissing any alert:
- OpenSpec validators: express the empty-symbol check as an explicit
slice instead of an index-versus-length comparison (#2679).
- OpenSpec tests: create file and outside-target fixtures inside private
mkdtemp directories (#2679).
- Antigravity policy test: give the bridge a private TMPDIR/TEMP/TMP so
its edit accumulator never lands in the shared temp directory (#3221).
- Session recording test: write partial bytes through the staging
descriptor and read the saved file through one opened handle (#3952).
Behavior and assertions are unchanged; each focused suite passes.
Addressing maintainer review (two truthfulness gaps):
1. evaluateSpec gated repository/history availability (no git / not a repo /
shallow clone) and per-target history (never committed) BEFORE any age
rule. Previously the age check bumped STALE first and the weight table
could not let UNVERIFIED override it, so old-date specs in shallow clones
or against uncommitted targets were reported STALE — contradicting the
documented "shallow clones report UNVERIFIED, never STALE" contract.
New fixtures: old-date shallow, no-git, and old-date no-history specs all
remain UNVERIFIED.
2. parseVerifiedDate now accepts an exact YYYY-MM-DD only: full-string match
(no prefix extraction from arbitrary text), UTC round-trip of components
(rejects impossible dates like 2026-02-30 that JS Date silently
normalizes), and rejects future dates. Trailing text, impossible dates,
and future dates are covered as UNVERIFIED.
spec-miner generator intentionally untouched per review: the contract stays
explicitly file-level and optional.
Address review feedback on PR #2679: collectEnforcedAnchors had no fence
awareness, so a spec merely SHOWING the anchor or delta syntax inside a
fenced code block or inline code span was collected and validated as if
the spec declared it — silent over-constraint (a target file could fail
freshness for a spec that never enforced it) or grammar errors on an
otherwise-fine file.
Both validators now strip fenced code blocks (``` / ~~~) and inline code
spans (`...`) before any comment/anchor/marker sweep; fenced blocks are
replaced with an equal number of blank lines so line-oriented parsing is
unaffected. The documented contract gains one line: code is illustrative,
never declarative.
Adds fixtures proving: fenced/tilde-fenced/inline example anchors are
ignored, fenced unknown-key and ADDED markers are ignored, a fenced anchor
does NOT satisfy an Invariant, and freshness only enforces the real anchor.