Skip to content

fix: resolve code-quality findings that point at real defects - #9157

Merged
patmmccann merged 2 commits into
adcontextprotocol:mainfrom
patmmccann:agent/code-quality-fixes
Nov 21, 2026
Merged

patmmccann merged 2 commits into
adcontextprotocol:mainfrom
patmmccann:agent/code-quality-fixes

Conversation

@patmmccann

Copy link
Copy Markdown
Collaborator

🤖 This PR was written by an AI agent (Claude Code) on behalf of @patmmccann.

Problem

Several GitHub Code Quality findings in adcp point at real defects rather than style:

  • server/public/agents.html escaped agent.contact.website for HTML but did not check the scheme, so a javascript: URL became a clickable link.
  • The outreach red-team scenarios spam_within_week and new_member_immediate_dm compared hard-coded constants, so they always passed whatever shouldContact() did.
  • static/schemas/validation-example.cjs read v1/core/product.json, which no longer exists, and crashed on start.
  • server/public/committees.html restored a hard-coded copy of the button's markup after a failed request, because originalHtml was scoped inside the try.

Fix

  • agents.html: the existing, unused safeHttpsUrl() helper now gates the website link to https: URLs.
  • outreach-scenarios.ts: the two scenarios run the production shouldContact() rules against a synthetic relationship. tests/addie/outreach-scenarios.test.ts covers them.
  • validation-example.cjs is deleted.
  • committees.html keeps the button's original markup and restores it on failure.
  • Smaller cleanups the same findings flagged:
    • the PropertyCrawler crawl block is reindented, because its indentation suggested it sat outside the surrounding try;
    • two admin-domain-health map callbacks get explicit semicolons;
    • conditions that were always true or always false are removed: a dead ternary in the certification reminder, the outreach simulator's shouldContact flag, and repeated stripe, authMiddleware, response and forecast guards.

Not changed

The four missing-await findings in server/src/db/client.ts (around lines 537 and 673) are deliberate. That code compares promise objects by identity, so adding await would break it. They should be dismissed as false positives.

The unused-code removal and the new oxlint rules are in a separate PR, so this one stays reviewable.

Testing

The pre-push storyboard matrix was skipped locally (it takes hours on this machine), so this PR relies on CI for it.

No changeset: no protocol release surface changes.

🤖 Generated with Claude Code

- agents.html linked agent.contact.website with HTML escaping only, so a
  javascript: URL became a clickable link; the existing (unused)
  safeHttpsUrl() helper now gates it to https: URLs.
- Outreach red-team scenarios spam_within_week and
  new_member_immediate_dm compared hard-coded constants, so they always
  passed. They now run the production shouldContact() rules against a
  synthetic relationship, with a regression test.
- Delete static/schemas/validation-example.cjs: it read a schema path
  (v1/core/product.json) that no longer exists and crashed on start.
- committees.html restores the button's original markup on failure
  instead of a hard-coded copy (originalHtml was scoped inside the try).
- Reindent the PropertyCrawler crawl block whose indentation suggested it
  sat outside the surrounding try.
- Add explicit semicolons in two admin-domain-health map callbacks.
- Drop conditions that were always true or always false: a dead ternary in
  the certification reminder, the outreach simulator's shouldContact flag,
  repeated stripe/authMiddleware/response/forecast guards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit ab5c2cd.

Approve preview

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T12:33:49.744886Z 38e7bef PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

bolt-app.ts and addie-chat.ts changed, so their source hashes did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean code-quality PR with no blocking or medium findings.

Checked against the decision table top-down:

  • No critical/high findings (row 1 n/a).
  • gated_paths: false (row 2 n/a).
  • high_risk is true, but all reasons are (modified) — no (deleted) (row 3 n/a). The reviewer verified each "dead guard" removal against base source (stripe && stripe under the if (!stripe) early return; addie-chat.ts unconditional response.text deref; bolt-app.ts ternary inside if (!certContextText); product-factory.ts forecast assigned in all branches; outreach-simulator.ts continue before removed check). The removed registry-api.ts authMiddleware throws fail closed, not an auth bypass.
  • No medium findings at all (rows 4, 5, 8 n/a).
  • No prior decision (row 6 n/a).
  • No no-auto-approve team match (row 7 n/a).
  • No static/schemas/source/** change, so no changeset needed and no schema↔docs/oneOf/immutable-artifact concerns; deleted validation-example.cjs has no other references.

With zero findings and no escalation trigger, this falls through to row 9 = approve.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean subsequent pass with no findings.

This run's delta over the prior clean (approve) pass is a single generated artifact — server/src/addie/generated/tool-surface-inventory.generated.json — with two SHA entries updated (bolt-app.ts, addie-chat.ts) to track source files that already changed and passed review in the prior clean pass. No reviewable logic; the file is a regenerated inventory excluded from the largest-file rule.

Checks:

  • No critical/high findings → row 1 does not fire.
  • gated_paths: false → row 2 does not fire.
  • high_risk is true, but all reasons are (modified) with no accompanying medium-or-higher finding, and none are (deleted) → rows 3, 5 do not fire.
  • No medium findings in any sensitive category → row 4 does not fire.
  • Prior decision was approve (not escalate), and this run surfaces no new findings → row 6 does not fire.
  • No no-auto-approve team match → row 7 does not fire.
  • Zero medium findings → row 8 does not fire.

Falls through to row 9 → approve. The high_risk flag is heuristic; a modified-file match with no reviewer concern is presumed safe.

@patmmccann
patmmccann enabled auto-merge (squash) November 21, 2026 12:42
@patmmccann
patmmccann merged commit 5538ffe into adcontextprotocol:main Nov 21, 2026
53 checks passed
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 21, 2026
…extprotocol#9159)

No conflicts. server/src/http.ts changed on both sides in separate hunks:
this branch's first-use DOMPurify loader and training-agent prewarm, and
main's two Stripe product lookups. git's merge keeps both.

Resolution ledger:
- mechanical: none
- semantic: none; the auto-merged file was read, and main adds no SDK
  barrel imports or eager loads of the first-use modules

Check: typecheck passes, and the full server unit suite passes
(867 files, 14,707 tests, 31 skipped; main adds no server tests).
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