Skip to content

feat: Architecture Review action V1#1

Open
brovatten wants to merge 14 commits into
mainfrom
feat/architecture-review-v1
Open

feat: Architecture Review action V1#1
brovatten wants to merge 14 commits into
mainfrom
feat/architecture-review-v1

Conversation

@brovatten
Copy link
Copy Markdown
Member

Summary

Rewrites this action from a server-mediated docs generator into a self-contained PR-diff visualizer. On every PR, it posts a sticky comment with a screenshot of the architecture diagram, with components colored green/yellow/red (added/modified/removed).

Architecture:

  • All work runs in the user's runner (no CodeBoarding-hosted server).
  • Reads the base commit's .codeboarding/analysis.json from git history, runs incremental analysis on PR head (cheap — LLM only for components whose code changed), diffs the two.
  • Renders PNG via Playwright + the existing CodeBoarding-vscode webview UI (bundled by cloning + building at action time).
  • Pushes PNG to an orphan branch codeboarding-images, posts sticky PR comment via marocchino/sticky-pull-request-comment.

What's in the PR

  • action.yml — composite action with steps for checkout, deps, analysis, diff, render, upload, comment.
  • scripts/compute_diff.py — vendored port of CodeBoarding-wrapper's diff_component_trees (pure stdlib, no pydantic). README documents this as a TODO to move into core.
  • scripts/render_diagram.mjs — Playwright script; matches the webview's e2e postMessage wire format.
  • README.md — usage, limitations, TODOs.
  • .github/workflows/example-usage.yml — replaced old cron-based docs flow with a PR self-test using uses: ./.

Test plan

  • CI triggers .github/workflows/example-usage.yml on this PR.
  • Since this repo has no .codeboarding/analysis.json, expect the "no baseline yet" path: action runs, computes nothing, posts the cold-start comment. That's the V1 success criterion for the self-test.
  • Comment appears on the PR. Sticky behavior: subsequent pushes update the same comment.
  • Workflow completes without erroring on the Playwright / render branch (which is skipped for no-baseline runs).
  • Action YAML parses (validated locally).

Limitations called out in the README

  • Baseline must be committed; cold-start posts a message instead of an image.
  • Fork PRs get text-only summary (no image push).
  • No focus/crop mode on huge diagrams.
  • Image branch grows unbounded (cleanup is on roadmap).

Out of scope for V1 / blocked on upstream

These need changes outside CodeBoarding-action (see README "TODOs" section):

  • Move diff_component_trees from wrapper to core.
  • Slim analyze-this-checkout entry point in core (avoid the re-clone).
  • Webview-ui as a release asset (avoid clone + build).
  • CodeBoarding-hosted /render endpoint (would remove orphan-branch + fork-PR limitations).

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

Architecture review · no baseline yet

This is the first run for this repo (no .codeboarding/analysis.json at the PR base commit 189e8f3), so there is nothing to diff against. Once a baseline is established on the target branch, future PRs will show what changed.

codeboarding-action · run 26418022986

brovatten added 6 commits May 25, 2026 13:15
Replace the server-mediated docs-generation flow with a self-contained
PR-diff-comment flow that runs analysis in the user's GH runner and
posts a sticky comment with a screenshot of the architecture diagram —
components colored green/yellow/red for added/modified/removed.

- New action.yml composite: checks out engine + webview-ui, runs
  incremental analysis seeded from PR base SHA, diffs against the
  freshly-generated head analysis, renders PNG via Playwright +
  bundled webview UI, pushes to orphan branch, posts sticky comment.
- scripts/compute_diff.py: vendored port of the wrapper's
  tree_diff/loader logic (pure stdlib, no pydantic).
- scripts/render_diagram.mjs: Playwright + static server + postMessage
  injection (matches the webview's e2e wire format).
- README: usage, limitations, TODOs for upstream refactors that would
  let us drop the vendored bits.
- example-usage.yml: replaced old daily-cron flow with a PR self-test
  that exercises the local action via uses: ./
The vscode repo isn't accessible from arbitrary GH Actions runners.
Bundle the prebuilt dist (~2MB) directly. README updated to drop
the vscode_ref input; rebuilding the bundle is a manual step until
the webview-ui ships as a public release asset (tracked in TODOs).
@brovatten brovatten force-pushed the feat/architecture-review-v1 branch from 1f0228c to cba8719 Compare May 25, 2026 20:15
brovatten added 8 commits May 25, 2026 13:19
generate_analysis() re-clones the repo from URL — the fresh clone only
has 'main' as a local head, so checkout_repo fails on PR feature
branches. Switch to run_incremental which takes the already-checked-out
target-repo path directly. Bonus: kills the redundant clone.

Also: seed static_analysis.pkl from base SHA if present (avoids
IncrementalCacheMissingError on the first incremental run), and fail
loud-and-early when OPENROUTER_API_KEY is empty.
Pasting a key into GitHub's secret UI often picks up a trailing newline.
That breaks OpenRouter's Bearer auth (header value gets the newline).
Strip whitespace defensively so the secret-as-pasted UX just works.
OpenRouter keys are 73 chars (sk-or-v1- + 64 hex). User's key was 75 chars
after whitespace strip, suggesting wrap-around quotes or a leftover env-line
prefix. Strip both forms and surface a prefix-OK signal in the log so we
can see at a glance whether the value looks like an OpenRouter key.
Tiny repos / legacy pkls produce no cluster baseline and incremental
can't proceed. Catch the exception and re-run the full pipeline so
we still get an analysis.json to diff against the base.
Old position evaluated steps.base.outputs.found before the seed step
ran, so the condition was always false and Playwright was never
installed. Render then failed with ERR_MODULE_NOT_FOUND.
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