Skip to content

fix: enforce repository contracts and reduce query module debt - #143

Merged
jmagar merged 9 commits into
mainfrom
codex/address-review-findings
Jul 28, 2026
Merged

fix: enforce repository contracts and reduce query module debt#143
jmagar merged 9 commits into
mainfrom
codex/address-review-findings

Conversation

@jmagar

@jmagar jmagar commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a focused Docs Contract CI job for embedded documentation tests and public-identity checks, and require it in the CI gate
  • repair the README Docker-ingest contract that broke scheduled CI and Docker pre-publish validation
  • migrate active source metadata and installer/package defaults to dinglebear-ai/cortex while preserving the intentional legacy ghcr.io/jmagar/cortex image identity
  • update architecture counts and paths to the live 56-action, 43-migration implementation
  • route launcher and installer changes through release checks and harden workflow-shape coverage
  • extract host canonicalization and host listing from db/queries.rs into db/queries_hosts.rs
  • preserve the caller-selected Cargo/compiler environment in xtask pre-push instead of reloading a login shell

Backlog cleanup

  • closed completed Beads for cortex status and stale schema-version tracking
  • closed GitHub issue Module-size gate drift: 11 files exceed 500-line limit without allowlist entries #134 after verifying the full module-size gate passes
  • created tracked follow-ups for notification quiet hours, environment mutation safety, and poison-tolerant observability locks
  • linked the five outstanding fleet defects to the remediation umbrella bead

Verification

  • documentation contract tests: 4 passed
  • host canonicalization/deduplication tests: 7 passed
  • xtask pre-push router tests: 6 passed
  • cargo clippy --all-targets --all-features --locked -- -D warnings
  • cargo fmt --all -- --check
  • module-size and public-identity gates
  • npm launcher tests, syntax check, README synchronization, and package dry run
  • all 14 version carriers synchronized at 3.11.1
  • Linux installer dry run uses dinglebear-ai/cortex
  • full repository pre-push plan passed before branch publication

PowerShell is not installed on DOOKIE, so install.ps1 could not be executed locally; its source defaults and generated metadata were updated and will be covered by repository CI/platform validation.

Tracks syslog-mcp-iv50b.

Security follow-up

  • updated quinn-proto from 0.11.14 to patched 0.11.15 for GHSA-4w2j-m93h-cj5j
  • set CI and Docker workflows to read-only contents permission by default, with explicit publish-job write scopes preserved
  • added workflow-shape regression coverage for token permissions
  • created syslog-mcp-iv50b.4 for the remaining unfixed Debian runtime-image CVEs

jmagar and others added 9 commits July 27, 2026 17:06
Three review-findings fixes, each with sidecar test coverage:

- agent/ai_transcript: warn once per malformed Gemini content revision
  instead of on every poll cycle, and clear the suppression entry when the
  file parses again. The suppression map is deliberately not persisted.
- command_log: resolve the hostname via the shared scanner::local_hostname()
  OS resolver rather than the HOSTNAME env var with a localhost fallback.
- receiver/listener: drain oversized TCP frames up to a bounded multiple so
  the connection resumes at the next frame, and fix CR detection when the
  delimiter lands on a buffer boundary. Unterminated senders are cut off at
  8x the max message size rather than pinning a TCP slot.

Also carried in this commit (authored concurrently, outside this session's
verification scope):

- lab-auth git dependency moved to dinglebear-ai/labby at the same rev
- removal of the no-mcp marketplace variant machinery (workflows, scripts,
  plugin hooks, and associated docs)
- OTLP and plugin-option doc/comment corrections
- session log for 2026-07-27

Verified for the three fixes above: cargo fmt --check clean, cargo clippy
--all-targets --all-features clean, and targeted module tests pass (51 and
11 passed, 0 failed). The full cargo test --lib suite exceeded a ten-minute
local timeout and was not run to completion; CI covers it.

Co-authored-by: Claude <noreply@anthropic.com>
A four-agent review of the full PR diff surfaced one latent data-loss bug that
three reviewers independently converged on, plus a CI blocker.

Critical:

- deny.toml still allowlisted github.com/jmagar/lab, so the required `deny`
  job would fail on the lab-auth source move. `cargo deny check sources` now
  reports `sources ok`.
- receiver/listener: an at-limit payload terminated by CRLF was accepted or
  dropped purely as a function of where the TCP read boundary landed. The
  accumulate guard compared raw bytes (CR included) against max_size while the
  newline branch compared payload bytes, so the two disagreed by exactly one
  byte at the limit. Reachable in production: an 8 KiB BufReader with the
  default 8192-byte max_message_size. The accumulate limit now reserves one
  byte for a split CRLF terminator, which also makes the pos == 0 carriage
  return check load-bearing — it was previously unreachable and inert.

Observability:

- receiver/listener: the per-frame oversize warn! lost its only rate limiter
  when terminated oversize frames stopped tearing the connection down. Logging
  now backs off exponentially (1st, 10th, 100th) with per-connection totals in
  the closing summary; unterminated frames still always warn.
- scanner: warn once when the hostname cannot be resolved instead of silently
  filing rows under the literal "localhost".
- scripts/ci/changed_paths.py: emit ::warning:: at each fail-open point so a
  silent full-matrix fallback is explainable.

CI contracts:

- ci.yml: the docs-contract gate was skipped for exactly the files
  check-public-identity.sh scans, and the aggregate gate counts skipped as
  success. Broadened to release/skills/docker/workflow.
- check-public-identity.sh: force text mode so the gate behaves identically
  with and without rg on binary files.
- scripts/install.sh: align CORTEX_RMCP_REPO's default with platform.js.
- workflow_shapes: read the workflows directory at test time so a new workflow
  with no permissions block cannot slip through unasserted.

Tests and conventions:

- Four new listener tests: at-limit CRLF split on the CR (fails without the fix
  above), the over-limit counterpart, EOF mid-drain, and both halves of the
  drain bound. Plus exponential-backoff coverage.
- Replace the tautological command_log hostname test with one that sets
  $HOSTNAME to a sentinel and asserts it is ignored.
- Move the dedupe_hosts tests into src/db/queries_hosts_tests.rs per the
  sidecar convention, dropping the #[cfg(test)] re-import that existed only to
  keep them compiling.

Docs: correct the rmcp/xtask dependency claim, a surviving hooks/ row, two
stale plugin skills, the incomplete lefthook tables, and the drain-multiplier
comment (the cutoff is approximate, not an exact 8x).

Deferred to syslog-mcp-ex8z2 (Gemini parse-failure observability) and
syslog-mcp-3zevz (ghcr.io namespace migration is a deployment decision).

Verified: fmt clean, clippy 0 warnings, 62 module tests, 12 CI-contract tests,
4 docs-contract tests, cargo deny sources ok, identity check OK.

Co-authored-by: Claude <noreply@anthropic.com>
The gitleaks job was retired on main, but tests/workflow_shapes.rs still
required `require_success_or_skipped gitleaks` in the ci-gate block and still
asserted the pinned Gitleaks image digest. Both assertions fail against the
current ci.yml, so `ci_uses_changed_path_classifier_and_stable_gate` was
already red on main independently of this branch — the merge just surfaced it.

Replace them with a negative assertion so the retirement itself is the
contract: re-adding gitleaks now requires a deliberate test update rather than
silently satisfying a stale expectation.

Co-authored-by: Claude <noreply@anthropic.com>
The `npm launcher` CI job requires packages/cortex-rmcp/README.md to be
byte-identical to the repo README.md. Earlier commits on this branch and on
main edited the repo README — adding the OTLP token paragraph and the Claude
Code plugin section — without re-running the sync, so the packaged copy was 20
lines behind and `scripts/check-package.js` failed.

Regenerated with packages/cortex-rmcp/scripts/sync-readme.js;
`npm run check --prefix packages/cortex-rmcp` now reports ok.

Co-authored-by: Claude <noreply@anthropic.com>
@jmagar
jmagar merged commit aa7e991 into main Jul 28, 2026
18 checks passed
@jmagar
jmagar deleted the codex/address-review-findings branch July 28, 2026 08:58
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