Skip to content

[codex] Review CMAP candidate fixes#1

Merged
GYF0311 merged 6 commits into
mainfrom
codex/cmap-review-poc-fixes
May 14, 2026
Merged

[codex] Review CMAP candidate fixes#1
GYF0311 merged 6 commits into
mainfrom
codex/cmap-review-poc-fixes

Conversation

@GYF0311

@GYF0311 GYF0311 commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bring over five isolated POC fixes from CMAP_review: unused dependency cleanup, safer inbox evidence paths, friendlier safe-path errors, stronger HTML redaction, and structured candidate visibility in the HTML review dashboard.
  • Add focused regression coverage for inbox path escapes, structured candidate rendering, and view redaction.
  • Sync .context module docs so the project map reflects the new review-layer checks.

Why

CMAP_review/REPORT.md identified these as small, high-ROI review candidates. The PR is a reviewable code suggestion only; it does not merge or change main.

Validation

  • pnpm test tests/integration/m24-inbox-path-escape.test.ts tests/integration/m25-view-structured-candidates.test.ts tests/unit/redact.test.ts
  • pnpm typecheck
  • git diff --check
  • pnpm test

Notes

  • CMAP_review/ and unrelated untracked research/ files are intentionally not included.

Claude Review and others added 6 commits May 14, 2026 08:38
Source code has no import of fast-glob; the project uses a custom
globToRegExp() in src/core/module-index.ts instead. Removing the
dependency keeps package.json honest and trims node_modules. Bundle
size unchanged (tsup already tree-shook it out).

Tests: 134/134 pass
Smoke: pass
Build: pass
The original 'Path escapes project root: <path>' didn't tell users
what to do instead. New message suggests _cmap-view/ or absolute path
inside the project root, and the symlink variant now shows the resolved
target.

Preserves the 'Path escapes project root' prefix so existing
m3.test.ts toContain() assertion still passes.

Tests: 134/134 pass
Typecheck: pass
The inbox promote --apply path was the only place in the codebase
that checked evidence with bare path.join(cwd, item) instead of
resolveInsideRoot. Combined with the cmap update --agent --write-inbox
flow that ingests external AI-authored MapPatches, this allowed
candidate evidence to reference '../outside' or '/etc/passwd' and
be accepted as canonical evidence, violating the v0.2 trust boundary.

Aligns inbox.ts with relate.ts / map-patch.ts / pack.ts /
freshness.ts which already use resolveInsideRoot.

Adds tests/integration/m24-inbox-path-escape.test.ts covering:
- relative escape ('../outside-file.txt') -> rejected
- absolute escape ('/etc/passwd') -> rejected
- inside path -> does not trigger path-escape

Tests: 137/137 pass (134 existing + 3 new)
Typecheck: pass
Smoke: pass

Credit: GPT round 1 review (codex:codex-rescue) and external gptpro
review (P0.5-1) both flagged this; Claude three-view review missed
it independently.
Before: api_key/token/secret/password fields + Bearer header
After:  + authorization / x-api-key headers
        + cloud SDK idioms (client_secret/access_key/access_token/
                            refresh_token/private_key)
        + PEM private key blocks (RSA/OPENSSH/EC/DSA/ENCRYPTED)

Adds tests/unit/redact.test.ts with 7 cases including a negative
case ('tokenization', 'tokens.ts' must not be redacted) to prevent
over-aggressive redaction regressions.

Tests: 141/141 pass (134 existing + 7 new)
Typecheck: pass
Smoke: pass

Credit: external gptpro review (P0.5-5)
The view dashboard's collectInboxCandidates() only read legacy
.context/inbox/*.md and .context/inbox/relations/*.json. Anything
written to .context/inbox/candidates/*.json by candidate-store
(the v0.2 main line) was invisible in the human review layer,
defeating the dashboard's purpose.

Adds collectStructuredCandidates() helper using parseCmapCandidate
for schema validation, with MAX_CANDIDATES quota shared across
legacy and structured sources, and an 'omitted' warning when over
budget.

Adds tests/integration/m25-view-structured-candidates.test.ts:
- module.alias.add candidate appears in HTML
- evidence.merge candidate shows dry-run command reviewers can copy

Tests: 136/136 pass (134 existing + 2 new)
Typecheck: pass
Smoke: pass

Credit: GPT round 1 (codex:codex-rescue) independently surfaced
this gap during adversarial review of Claude's diagnosis.
@GYF0311 GYF0311 marked this pull request as ready for review May 14, 2026 00:58
@GYF0311 GYF0311 merged commit 707f8ae into main May 14, 2026
2 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.

1 participant