Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/ci.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Code quality

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.19.0
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check formatting and linting
run: pnpm exec biome ci .
- name: Generate Cloudflare types
run: pnpm cf-typegen
- name: Check types
run: pnpm check:types
- name: Test
run: pnpm test
- name: Build
run: pnpm build
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Built by combining [withastro/astro-review](https://github.com/withastro/astro-r
GitHub webhooks ─→ Hono ingress (signature verification)
└→ router.ts (pure rule table: event → capability dispatch)
├→ ReviewCoordinator DO (one per PR) ─→ ReviewWorkflow ─→ PullRequestReviewer agent
└→ TriageCoordinator DO (one per issue) ─→ TriageWorkflow ─→ FixVerifier / RetriageJudge agents
├→ TriageCoordinator DO (one per issue) ─→ TriageWorkflow ─→ FixVerifier / RetriageJudge agents
└→ ReleaseSecurityCoordinator DO (one per PR) ─→ ReleaseSecurityWorkflow ─→ ReleaseSecurityReviewer agent
```

- **Router** (`src/router.ts`): deterministic and pure. `pull_request.labeled`
Expand Down Expand Up @@ -89,6 +90,23 @@ labels (visible, maintainer-overridable):
Missing labels are created automatically with sensible colors, so installing
on a fresh repository requires no setup.

### Release security (`src/release-security/`)

Factory privately reviews same-repository `withastro/astro` release PRs from
`changeset-release/<base>` when they are opened, reopened, or synchronized. A
smoke-only path uses `release-security-test/<base>` with the exact title
`[test] release security reviewer`; it checks model health without performing a
release review. Maintainers can rerun either managed check from GitHub.

Each PR has one durable coordinator. The active review is terminated when a
new head arrives, only the newest pending head runs next, and stalled work is
terminalized as `INCOMPLETE`. The model receives a credential-free, read-only
checkout and one isolated CodeMode analysis tool. Private report and
best-effort transcript copies are stored in the `PRIVATE_REPORTS` R2 bucket;
Flue's private durable agent state also retains the structured model output.
GitHub receives only a check result and a sanitized comment containing the
verdict and reviewed SHA. `BLOCK` and `INCOMPLETE` both fail the check.

## Repository configuration

Target repositories may add `.github/factory.yml` (all sections optional; no
Expand Down Expand Up @@ -288,8 +306,8 @@ Three deliberate design choices:
- **Permissions**: Contents (read/write — also required by GitHub's
`resolveReviewThread` mutation), Issues (read/write), Pull requests
(read/write), Checks (read/write), Actions (read/write — dispatching preview
release workflows).
- **Events**: Pull request, Issues, Issue comment.
release workflows), Repository security advisories (read).
- **Events**: Pull request, Check run, Issues, Issue comment.
- **Webhook URL**: `https://<worker>/channels/github/webhook`.
- **Secrets** (`wrangler secret put` / `.dev.vars`): `GITHUB_APP_ID`,
`GITHUB_APP_PRIVATE_KEY` (PKCS#8 — convert with
Expand All @@ -303,11 +321,25 @@ short-lived contents-read token passed as a one-shot git header — never
persisted to git config — after which the origin remote is removed, so the
agent still runs credential-free.

Before deploying release security, create the private bucket declared in
`wrangler.jsonc`:

```sh
pnpm exec wrangler r2 bucket create astro-release-securitybot-reports
```

For cutover, deploy Factory while the previous reviewer remains available,
open the smoke PR described above, and confirm the `Astro release security smoke
test` check completes. Then disable the previous reviewer's webhook or workflow
before opening or synchronizing a release PR, so only Factory publishes the
managed check and comment.

## Development

```sh
pnpm install
pnpm dev # local dev (vite + workerd); triage sandboxes need Docker running
pnpm exec biome ci . # formatting and linting
pnpm test # vitest
pnpm check:types # tsc
pnpm deploy # vite build && wrangler deploy
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@biomejs/biome": "2.5.9",
"@cloudflare/codemode": "^0.5.1",
"@cloudflare/sandbox": "^0.12.3",
"@flue/github": "^2.0.3",
"@flue/runtime": "^2.0.3",
Expand Down
55 changes: 48 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading