Skip to content

fix(ci): CI hygiene extracted from #126 — .hypothesis untrack, pre-commit wiring, four-workflow remediation (stack 9/9)#137

Merged
cryptoxdog merged 12 commits into
mainfrom
fix/ci-hygiene-from-126
Jul 23, 2026
Merged

fix(ci): CI hygiene extracted from #126 — .hypothesis untrack, pre-commit wiring, four-workflow remediation (stack 9/9)#137
cryptoxdog merged 12 commits into
mainfrom
fix/ci-hygiene-from-126

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

Summary

Stack position 9/9 (base: fix/action-refs, PR #136). Extracts the clean, reviewable pieces of draft #126 per the remediation plan, so #126 can be closed without merging its 108-file wholesale diff.

What is extracted from #126

Piece Commit Content
.hypothesis cache untracking f0240e7 Removes 92 tracked .hypothesis/ cache files (already gitignored); pure deletions
Trailing-whitespace cleanup 0eef740 Doc/skill files flagged by pre-commit
Quality-gate honesty note 2a8a333 Documents why hyphenated job IDs require bracket syntax in ci-quality.yml
CI pipeline docs 0830ee2 docs/CI_PIPELINE.md rewrite for pre-commit-in-CI, blocking mypy, quality-gate fix
Four-workflow remediation 022610e contracts.yml mypy aligned to pyproject.toml config; docs-code-sync.yml link checker rewritten (correct relative-link resolution, aggregated failures, no silent subshell exits); pr-review-enforcement.yml excludes generated/cache files from size accounting and hardens config parsing; terminology-guard.yml enforces on changed files so new debt blocks without punishing PRs for legacy debt
Pre-commit CI wiring af986d0 New precommit job in ci.yml (Phase 2.5), wired into the ci-gate fan-in as a blocking check

What is deliberately NOT preserved

  • SKIP=packet-envelope-prohibited is removed. The pre-commit job skips only gitleaks (index-based hook with no CI equivalent; covered by the security job). The 23 pre-existing PacketEnvelope references will keep this job honestly red until the CI baseline-ratchet system (R1–R6) lands with a per-finding fingerprint ledger. Blanket-skipping would hide new violations, not just known ones. Documented in ci.yml and docs/CI_PIPELINE.md.
  • The vars-expression trigger fixes (d2769d3, d192f35) — already in fix(ci): workflow trigger + quality-gate expression repair (split 6/6 of #125) #135.

Verification

  • All workflow YAMLs parse (yaml.safe_load on every file in .github/workflows/).
  • Only 12 non-.hypothesis files changed; the remaining 92 are pure cache deletions that pr-review-enforcement.yml (in this very PR) now excludes from size accounting.

Supersedes the remaining content of #126, which should be closed.

cursoragent and others added 6 commits July 22, 2026 21:31
.hypothesis/ has been in .gitignore all along, but 92 of its cache
files were already committed to the repo at some point before the
ignore rule was added (git only ignores new paths, it doesn't untrack
existing ones). Every test run that exercises Hypothesis-based property
tests mutates these files, so they showed up as noisy, unrelated diffs
every time `pre-commit run --all-files` (trailing-whitespace,
end-of-file-fixer) touched them locally or in CI. Untracking them so
the ignore rule actually takes effect.

Co-authored-by: Igor Beylin <cryptoxdog@users.noreply.github.com>
(cherry picked from commit 2b93071)
trailing-whitespace / end-of-file-fixer (from .pre-commit-config.yaml)
were failing on 5 pre-existing docs. Whitespace-only changes, no
content edits.

Co-authored-by: Igor Beylin <cryptoxdog@users.noreply.github.com>
(cherry picked from commit 0923b07)
ci-quality.yml's quality-gate job referenced needs.lint-format.result,
needs.secrets-scan.result, and needs.yaml-validate.result using GitHub
Actions dot notation. Dot notation doesn't work for job IDs containing a
hyphen -- `-` is parsed as subtraction -- so those three always
evaluated to an empty string, not the job's actual result. Every `if
[[ "" == "failure" ]]` was therefore always false: quality-gate could
report a passing summary even when lint-format or secrets-scan failed.
semgrep's result wasn't checked at all (missing from the fail
conditions, independent of the hyphen bug).

Fixed by switching to bracket syntax (needs['lint-format'].result, etc.)
for the three hyphenated job IDs, and added the missing semgrep check.

Co-authored-by: Igor Beylin <cryptoxdog@users.noreply.github.com>
(cherry picked from commit 1e45870)
…ate fix

Documents the new Phase 2.5 (precommit job), the mypy scope/blocking
fix, the ci-quality.yml quality-gate hyphen-notation bug fix, the
pytest -x removal, and the current SKIP list for the precommit job with
rationale for each skipped hook. Also notes that ci-gate and
quality-gate need to be configured as required status checks in branch
protection to actually block merges -- a workflow job failing does not,
by itself, prevent merging.

Co-authored-by: Igor Beylin <cryptoxdog@users.noreply.github.com>
(cherry picked from commit 3e0a205)
…de-sync, pr-review-enforcement, terminology-guard

Applied from cognitive-engine-graphs-open-pr-remediation-v2 126/apply.sh on the rebased #125 baseline.
Post-checks passed: git apply --check, git diff --check, YAML validation on all four workflows, changed-path allowlist.

(cherry picked from commit c69d595)
Two changes to .github/workflows/ci.yml:

1. New "precommit" job (Phase 2.5), required by ci-gate. Runs
   `pre-commit run --all-files` via pre-commit/action so every hook in
   .pre-commit-config.yaml is enforced on every PR/push -- regardless of
   whether a contributor (human or agent) ran `pre-commit install`
   locally, or bypassed hooks with `git commit -n`. Skips two hooks with
   SKIP=gitleaks,packet-envelope-prohibited (both explained inline and
   in docs/CI_PIPELINE.md): gitleaks's `--staged` semantics don't apply
   to a plain CI checkout and secret scanning is already handled
   correctly by the `security` job's gitleaks-action; the packet-envelope
   hook has 23 pre-existing violations representing a real, separately
   tracked architecture migration (PacketEnvelope -> TransportPacket),
   not a CI-config problem.

2. Fixed the "Run Mypy Type Checker" step in the lint job. It ran
   `mypy .` (whole repo) piped through `|| echo "... non-blocking"`,
   which silenced every result -- and `mypy .` itself has always failed
   immediately with "Source file found twice under different module
   names" (tools/auditors/base.py vs auditors.base) before checking a
   single file, so this step has effectively always been a no-op. Now
   runs the same scoped, verified-working invocation as `make lint` /
   ci-quality.yml (`mypy engine/ --config-file=pyproject.toml
   --ignore-missing-imports --exclude chassis`), with no silencing, so
   real type errors now fail the job.

ci-gate's fan-in now also requires `precommit` and fails if it fails.

Verified locally: `pre-commit run --all-files
SKIP=gitleaks,packet-envelope-prohibited` exits 0 on the current tree
(after the preceding commits in this PR); `mypy engine/ ...` exits 0.

Co-authored-by: Igor Beylin <cryptoxdog@users.noreply.github.com>
(cherry picked from commit f87b54e)
@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

ℹ️ Ignored 92 generated/cache file(s) from size accounting.

PR Too Large
Reviewable lines changed: 2312
Limit: 1000 lines
Action Required: Break into smaller, atomic PRs

📋 Best Practices for Large Changes

  1. Refactoring + Features: Separate into 2 PRs
  2. Multiple Features: One PR per feature
  3. Database + Code: Separate migration from logic
  4. Generated Code: Exclude it from reviewable-size accounting

🚫 This PR is blocked until reviewable size limits are met.

- Remove legacy tools/check_packet_envelope_prohibited.py (23 stale refs, drifting regex)
- Rewire ci.yml validate job, terminology-guard.yml, and pre-commit to the SDK scanner
- Add tools/packet_envelope_gate.py: thin pre-commit wrapper delegating to l9-ci-sdk
- Add .l9/baselines/packet-envelope.yml: 19 owned PacketEnvelope debt entries (issue #138)
- Add .l9/baselines/test-quarantine.yml: 39 owned failing-test entries (issue #139)
- Add .github/workflows/baseline-ratchet-caller.yml: thin caller pinned to
  l9-ci-core@8e3d74d3 / l9-ci-sdk@d8ec01f1, fail-closed
- CODEOWNERS: real owner (@cryptoxdog); .l9/baselines/** requires owner review
- All debt entries expire 2026-10-21 with machine-evaluable removal conditions
Comment thread .github/workflows/ci.yml

steps:
- name: Checkout Repository
uses: actions/checkout@v6
Comment thread .github/workflows/ci.yml
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
Comment thread .github/workflows/ci.yml

- name: Install Runtime + Dev Dependencies
run: |
python -m pip install --upgrade pip
Comment thread .github/workflows/ci.yml
# Needed for the "language: system" local hooks (pytest-unit,
# deprecated-import checks, etc.) which shell out to the ambient
# `python3` rather than an isolated pre-commit-managed env.
pip install -r requirements.txt
Comment thread .github/workflows/ci.yml
# deprecated-import checks, etc.) which shell out to the ambient
# `python3` rather than an isolated pre-commit-managed env.
pip install -r requirements.txt
pip install -r requirements-dev.txt
Comment thread .github/workflows/ci.yml
pip install -r requirements-dev.txt

- name: Run Pre-commit Hooks
uses: pre-commit/action@v3.0.1
"docs/CI_PIPELINE.md (baseline ratchet).",
file=sys.stderr,
)
except (json.JSONDecodeError, ValueError):
- First ratchet run (29972728543) truthfully surfaced 22 docker-dependent
  tests erroring in CI with AttributeError: 'GraphDriver' object has no
  attribute 'execute_write' (invisible in sandbox where docker is absent).
  Added to .l9/baselines/test-quarantine.yml with CI fingerprints, owner,
  expiry 2026-10-21, removal_condition test-passes (61 entries total;
  issue #139 amended).
- Re-pin l9-ci-core to 12efdc25 (PR Quantum-L9/l9-ci-core#39): fixes
  --exclude-dir semantics so the provisioned SDK under .l9/runtime is
  excluded from the PacketEnvelope scan (removes 6 spurious findings).
… core f5d6570

Round-2 remediation from run 29973174988:
- Adopt l9-ci-sdk b390dc7 (bare-hex normalization): run-random object
  IDs (ContractViolation[gs_<32hex>]) and content hashes no longer
  churn test-failure fingerprints; 29 quarantine fingerprints
  recomputed under the new normalizer.
- Replace 2 env-dependent signatures with the CI-observed truth
  (engine/ dir-listing order; OPENAI_API_KEY absent on runners).
- Drop duplicate wave6 entry introduced by the round-1 CI append
  (duplicate fingerprints are malformed per the comparator).
- Re-pin caller to l9-ci-core f5d6570 (SDK bump) and bump the
  pre-commit gate wrapper SDK revision to match.

Ledger: 60 entries (39 call-failures + 21 GraphDriver.execute_write
setup errors). Both ledgers validate; local compare-scan PASS (19/19).
Round-3 remediation from run 29973857555 (58/61 matched):
- 2 set-iteration-order signature diffs (sandbox rendered
  {'handlers.py', 'boot.py'}; CI renders {'boot.py', 'handlers.py'}):
  adopt CI rendering, fingerprints verified equal to the run-3
  observed values.
- Add the missed 22nd GraphDriver.execute_write entry
  (tests/performance/test_sync_throughput.py incremental-update
  throughput), fingerprint verified against the run-3 observation.

Ledger: 61 entries; validate-ledger passes; ledgered fingerprint set
now exactly equals the CI-observed set (61/61, zero diff both ways).
…malization)

Adopts l9-ci-sdk#20 via l9-ci-core#41/#42: rendered set literals in
failure signatures are canonicalized, so the two chassis-contract
quarantine fingerprints are now stable regardless of hash-seed-
dependent set iteration order (ratchet runs 29973857555 vs
29974211074 rendered opposite element orders). No ledger changes
needed: existing fingerprints already match the canonical (sorted)
rendering. Local verification: validate-ledger PASS (61 quarantine,
19 packet-envelope), compare-scan PASS 19/19 known, 0 new.
…sis dep

- tools/packet_envelope_gate.py: pass --exclude-dir .l9 (scanner matches
  single path parts; '.l9/runtime' never matched), preventing the provisioned
  SDK source from polluting the PacketEnvelope scan in the pre-commit hook.
  Mirrors l9-ci-core#39.
- requirements-dev.txt: add hypothesis (tests/property/* hard-import it;
  the precommit job installs only requirements.txt + requirements-dev.txt,
  causing 2 collection errors in the pytest-unit hook).

The remaining pytest-unit hook failure (test_chassis_app noop_lifecycle)
is pre-existing ledgered debt (.l9/baselines/test-quarantine.yml, #139).
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@cryptoxdog
cryptoxdog merged commit 2345fad into main Jul 23, 2026
31 of 45 checks passed
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.

3 participants