Skip to content

feat: automate yiacad PR review lane#18

Merged
electron-rare merged 6 commits into
mainfrom
feat/yiacad-pr-review-automation
Mar 29, 2026
Merged

feat: automate yiacad PR review lane#18
electron-rare merged 6 commits into
mainfrom
feat/yiacad-pr-review-automation

Conversation

@electron-rare
Copy link
Copy Markdown
Owner

Summary

  • wire the YiACAD service-first backend, web review read model, and evidence-pack contracts
  • add GitHub checks and evidence-pack visibility in /review and /diagram project shells
  • add sticky PR summary publishing and blocking PR gate logic in yiacad_product CI

Verification

  • python unittest contracts for backend, review, evidence-pack, PR summary, and PR comment flows
  • npm run build in web/

Copilot AI review requested due to automatic review settings March 29, 2026 02:19
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, push a new commit or reopen this pull request to trigger a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR wires the YiACAD “PR review lane” across the web worker, GraphQL read model, CI evidence-pack outputs, and GitHub-facing PR summary publishing so the /review and project shells can surface checks/evidence and optionally publish a sticky PR summary.

Changes:

  • Route web EDA worker pipelines through tools/cad/yiacad_backend_client.py and persist richer CI run metadata (engine/summary/degraded reasons/timestamps).
  • Extend web GraphQL/types/UI to surface GitHub checks, evidence packs, PR assessment fields, and add a publishPullRequestSummary mutation.
  • Add CI utilities to generate evidence packs + sticky PR summary comments, and introduce a new “YiACAD Product” workflow plus evidence-pack publishing in kicad-exports.

Reviewed changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web/workers/eda-worker.mjs Route EDA pipelines through backend client; persist CI run metadata + artifact summaries
web/lib/types.ts Expand snapshot types for checks/evidence packs/PR fields and CI run metadata
web/lib/graphql/schema.ts Add new GraphQL fields and publishPullRequestSummary mutation
web/lib/graphql/client.ts Update snapshot query + add PR summary publish mutation
web/lib/eda-queue.ts Redis connection behavior changed to require REDIS_URL
web/lib/ci-enqueue.ts Persist richer CI run metadata and ensure .ci dir exists
web/components/project-shell.tsx UI: show PR/check/evidence summaries + richer CI run cards
web/components/pr-review-shell.tsx UI: checks/evidence panels + publish-summary action
tools/test_python.sh Add YiACAD contract tests to stable suite
tools/hw/* Add KiCad Seeed MCP launcher/bridge/smoke and wire into fusion/proof tooling
tools/cockpit/* Improve JSON-mode logging and add MCP smoke artifact to backend proof
tools/ci/* Add evidence-pack + PR summary generator + sticky PR comment publisher
tools/cad/* Harden engine baseline detection + add backend client surfaces and new backend actions
specs/* + specs/contracts/* Update specs/contracts to reflect YiACAD app boundary + engine status/degraded reasons
.github/workflows/yiacad_product.yml New workflow: contracts, web build, evidence pack, PR review + sticky comment
.github/workflows/kicad-exports.yml Publish YiACAD evidence pack artifact for KiCad exports lane

Comment thread web/lib/eda-queue.ts
Comment on lines 22 to 28
function redisConnection() {
const url = new URL(process.env.REDIS_URL ?? "redis://127.0.0.1:6379");
const rawUrl = process.env.REDIS_URL;
if (!rawUrl) {
throw new Error("REDIS_URL is not configured.");
}
const url = new URL(rawUrl);
const db = url.pathname && url.pathname !== "/" ? Number(url.pathname.slice(1)) : 0;
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

redisConnection() now throws when REDIS_URL is unset, while web/workers/eda-worker.mjs still defaults to redis://127.0.0.1:6379. This inconsistency makes local usage fragile (enqueue will fail unless REDIS_URL is exported, but the worker will happily connect to localhost). Align the behavior by either restoring the localhost default here or requiring REDIS_URL in both places (with a clearer local-dev setup path).

Copilot uses AI. Check for mistakes.
actions: read
checks: read
contents: read
pull-requests: write
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

This workflow runs on pull_request while granting pull-requests: write, and it checks out + executes code from the PR branch (Python + shell + npm build). That combination is a security risk because a malicious PR can run arbitrary code with a write-capable token (e.g., alter PR state/comments or attempt token exfiltration). Consider splitting the PR-comment publishing into a pull_request_target job that checks out the base ref (or otherwise avoids executing PR code), and keep PR builds/tests on pull_request with read-only permissions.

Suggested change
pull-requests: write
pull-requests: read

Copilot uses AI. Check for mistakes.
Comment on lines +60 to +68
comments_raw = github_request(
"GET",
f"/repos/{repository}/issues/{pull_request_number}/comments?per_page=100",
token,
)
comments = comments_raw if isinstance(comments_raw, list) else []
existing = find_existing_comment(
[comment for comment in comments if isinstance(comment, dict)], marker
)
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

publish_comment() only fetches the first 100 PR comments (per_page=100) and doesn't paginate. On PRs with >100 comments, the existing sticky marker comment could be missed and the script would create a duplicate summary comment instead of updating the original. Consider paging through results (following Link headers) until the marker is found, or querying in reverse chronological order and scanning until you hit the marker.

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +27
headers = {
"Authorization": f"Bearer {token}",
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
}
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

github_request() does not send a User-Agent header. GitHub's API guidance expects a user agent, and some environments/proxies can reject requests without it. Add an explicit User-Agent (e.g., YiACAD-PR-Review/1.0) to make the integration more robust.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30ec250a5c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 43 to 45
if proc.returncode != 0:
raise RuntimeError(proc.stderr.strip() or proc.stdout.strip() or "YiACAD bridge failed")
raise RuntimeError(proc.stderr.strip() or proc.stdout.strip() or "YiACAD backend client failed")
return json.loads(proc.stdout.strip() or "{}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse backend JSON before rejecting non-zero exits

_run_json_command raises on any non-zero return code, but YiACAD commands can legitimately return non-zero while still emitting a structured --json-output contract (for example blocked runs or direct-fallback paths). Because run_intent depends on this helper and on_run expects a payload, the KiCad plugin cannot surface blocked/error details and instead fails the action flow when those cases occur.

Useful? React with 👍 / 👎.

Comment on lines +153 to +155
response = http_json(service_url(args.host, args.port, "/projects/current"))
print(json.dumps(response, indent=2, ensure_ascii=False))
return 0 if response.get("status") != "blocked" else 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle 404 from projects-current endpoint gracefully

This path calls http_json directly, but /projects/current can return HTTP 404 when no context snapshot exists. urllib.request.urlopen raises HTTPError on 404, so the command crashes instead of returning a controlled blocked result/exit code for fresh environments with no prior YiACAD run.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 29, 2026

YiACAD PR Summary

Assessment

  • 4 GitHub check(s) failed on the current PR head.

GitHub Checks

  • in_progress yiacad-pr-review
  • success yiacad-evidence-pack
  • in_progress Firmware — ESP32-S3 build
  • success Firmware — Unity tests (native)
  • failure yiacad-backend-contracts
  • failure python-stable
  • failure Playwright E2E
  • success firmware-lint
  • in_progress Hardware — KiCad ERC + exports
  • success yiacad-web-build
  • in_progress kicad-checks
  • success secret_scan

Evidence Packs

  • in_progress KiCad Exports: feat: automate yiacad PR review lane (run)
  • failure Evidence Pack Validation: feat: automate yiacad PR review lane (run)
  • in_progress YiACAD Product: feat: automate yiacad PR review lane (run)

Changed Files

  • .github/agents/arch_mesh.md
  • .github/agents/architect_agent.md
  • .github/agents/doc_agent.md
  • .github/agents/docs_research.md
  • .github/agents/embedded_cad.md
  • .github/agents/firmware.md
  • .github/agents/firmware_agent.md
  • .github/agents/hw_schematic_agent.md
  • .github/agents/kill_life_bridge.md
  • .github/agents/pm_agent.md
  • .github/agents/pm_mesh.md
  • .github/agents/qa_agent.md

Next Steps

  • Fix the failing GitHub checks before merge.

Generated by YiACAD review lane from GitHub checks and tracked workflow evidence.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9d5bd346b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/lib/project-store.ts
Comment on lines +607 to +608
if (evidencePacks.length === 0) {
rationale.push("No tracked evidence pack was found for the current PR head.");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require successful evidence packs for CAD merge approval

This branch treats any attached evidence pack as sufficient, even when the pack status is failure, cancelled, or otherwise non-passing. In a CAD-affecting PR with green checks but a failed evidence workflow, the function still returns a favorable recommendation, which can mislead reviewers into merging without a successful CAD proof run. The recommendation should be based on passing evidence statuses, not just non-empty evidence.

Useful? React with 👍 / 👎.

Comment thread web/lib/project-store.ts
Comment on lines +907 to +911
`/repos/${GITHUB_REPO}/actions/runs?${new URLSearchParams({
head_sha: headSha,
event: "pull_request",
per_page: String(GITHUB_REVIEW_RUN_LIMIT)
}).toString()}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Paginate workflow runs before assessing evidence coverage

The review loader only requests the first page of workflow runs with a small cap (per_page=8) and does not paginate. For PR heads with more runs than that, tracked workflows can be absent from this slice even when they succeeded, which leaves evidencePacks incomplete and can incorrectly downgrade/blocks recommendations downstream. Fetch all relevant pages (or a robust filtered set) before deciding evidence availability.

Useful? React with 👍 / 👎.

- Created INFRA_VPS_RUNBOOK_2026.md detailing operational procedures for monitoring VPS services.
- Added infra_vps_healthcheck.sh script for automated health checks on DNS, TLS, TCP, and HTTP for VPS services.
- Introduced infra_vps_security_audit.sh for non-intrusive security checks on external VPS services.
- Established JSON schema for infra VPS inventory in infra_vps.schema.json.
- Developed integration for runtime status reporting in the Next.js API route.
- Implemented Playwright tests for smoke testing the application and ensuring core functionalities.
- Updated Makefile for development dependencies and testing commands.
- Created various test files for unit and end-to-end testing across different components.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea6d2b039f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

-not -path "*/.kicad_blocks/*" \
-not -path "*/kicad_blocks/*" \
-not -path "*.kicad_blocks/*" \
-not -path "*.kicad_block/*" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore kicad_blocks exclusion pattern

In the Discover schematics and PCBs step of .github/workflows/kicad-exports.yml, the new ignore glob uses *.kicad_block/* (singular) instead of */kicad_blocks/*, so schematics inside kicad_blocks/ are no longer excluded. On repos that vendor reusable block libraries there, ERC will run on those library sources and can produce false failures/noise that block the export lane.

Useful? React with 👍 / 👎.

) -> dict[str, object]:
comments_raw = github_request(
"GET",
f"/repos/{repository}/issues/{pull_request_number}/comments?per_page=100",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Paginate issue comments before locating sticky marker

The sticky-comment updater only fetches ?per_page=100 once before searching for <!-- yiacad-pr-summary -->. For PRs with more than 100 comments, the existing summary comment may be on a later page, so this path posts a new comment instead of updating the original one, breaking idempotent “single sticky summary” behavior.

Useful? React with 👍 / 👎.

@electron-rare electron-rare merged commit 5efb380 into main Mar 29, 2026
21 of 25 checks passed
@electron-rare electron-rare deleted the feat/yiacad-pr-review-automation branch March 29, 2026 15:14
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

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.

2 participants