Repository navigation
app/: GitHub's webhook (sc-8900) - #74
Closed
ndbroadbent wants to merge 28 commits into
Closed
ndbroadbent wants to merge 28 commits into
ndbroadbent wants to merge 28 commits into
Conversation
VisualCIdocspring/visualci · build #297 · 331 unchanged · no changes This PR vs base: nothing since #261, across 2 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
force-pushed
the
laravel-orgs
branch
from
December 2, 2026 15:28
5c1bc0c to
900e8f4
Compare
ndbroadbent
force-pushed
the
laravel-webhooks
branch
from
December 2, 2026 15:28
89ad3b5 to
7081273
Compare
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
force-pushed
the
laravel-webhooks
branch
from
December 2, 2026 16:01
7081273 to
d0b9b1d
Compare
ndbroadbent
force-pushed
the
laravel-orgs
branch
from
December 2, 2026 16:01
900e8f4 to
a9f9238
Compare
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
…orted as is, the emails outbox (once per dedupe key and recipient; billing email or admins with their choices), DeliverEmails through Postmark (queued on each email, scheduled every five minutes; five attempts, then failed), a member's notice on MembershipChanged; emails table and users' email choices
…UALCI_EMAILS_HEARTBEAT_URL/TOKEN; fails when the oldest unsent email has waited over 30 minutes or delivery errored), and failed_unresolved_count for /status (emails_failed_unresolved, as today)
…claim lapses after 30 minutes, far longer than a 10-second send), so a slow run's batch is never sent twice; a crashed run's fifth attempt ends failed, never a sixth; a failed send waits five minutes for the next run; the membership notice's dedupe key is the change's time, fixed at dispatch, so a retried listener doesn't send it again
… and dependencies merged
… within five minutes, constant-time), Team on checkout and active, Free on deletion, only the organization's own subscription and only newer events, packs and automatic reloads credited once per reference, billing problems shown and reloads paused; the plans; STRIPE_SECRET_KEY/STRIPE_WEBHOOK_SECRET
… for Team and for credit packs, Stripe's portal, automatic reloads, payment methods (list, add, default, remove) and invoices, admins only (a member 403, anyone else 404); the Stripe client and catalog (products, prices by lookup key, the portal configuration, the customer) on Laravel's HTTP client
…y, and a webhook event whose livemode doesn't match the key is refused; a subscription event's freshness check and its change happen in one transaction with the organization's row locked; a paid invoice no longer clears the two-subscriptions notice; payment method IDs are letters, digits and underscores only
… and dependencies merged
…e (shown once, vcu_/vci_ plus 40 letters and digits, stored as SHA-256 with the first ten characters shown) and delete; project tokens by the project's admins (a member 403); a security notice when one is made
…en's id; a notice that can't be queued is logged, never losing a token that's already made
…gin (admins; 50 a day per organization, 3 a day per address, staff exempt), waiting for the invitee to accept or decline whether or not they have an account (recorded for their account when one exists); accepting never lowers a role; admins withdraw invitations, change roles and remove members, except where the forge decides the membership, and the organization keeps an admin; a removed member is told unless they left themselves
…aren't in (their tools are the admin MCP's, with its audit log); changing or removing a member locks the admin memberships first, so two admins demoting each other can't leave none; accepting re-reads the invitation FOR UPDATE (a withdrawn one or a second click is a 404) and tells the person they joined
… and dependencies merged
…their organizations and roles, pending invitations, email choices, the heard-about question), email choices, an organization's billing email (admins), 'How did you hear about VisualCI?'; the team's email about each new sign-up through the outbox (reply-to the person), once answered or ten minutes after sign-up, every minute with a heartbeat (VISUALCI_SIGNUPS_HEARTBEAT) that fails when one waits over 40 minutes
…Auth application with its ID and secret), as today's; staff who aren't in an organization can't change its billing email; the sign-ups heartbeat fails when the database can't answer
… page request goes to /login since #57)
…vice/code and /device/token for the CLI (device code stored hashed, ten minutes, one token once, claimed in one statement), GET/POST /api/ui/device/{code} for the person to approve or deny (codes read as typed); a security notice when the CLI signs in
…isualCI command-line sign-in' label, where and when it was asked for and 'only approve this if you just ran visualci login', with the name the CLI sent as a detail; at most ten codes per address in ten minutes (429); expired codes deleted daily (VISUALCI_DEVICE_PRUNE_HEARTBEAT); a poll within the interval gets slow_down; the code is claimed and its token made in one transaction; the client's address comes through TRUSTED_PROXIES
… and dependencies merged
… and dependencies merged
…ign-ups with how they heard about VisualCI, every email rendered with sample data, failed emails retried or dismissed; a 404 for anyone who isn't staff
…lugs checked (reserved words, lowercase letters, digits and dashes) and unique (409), names 1 to 100 characters, five a day except for staff (a new account's own organization doesn't count)
…ns::invite_to, orgs::create_org, tokens::make_project_token and remove_project_token, which the web routes now call too; callers check the person's role
…b-Signature-256, constant time); merges, closed and reopened pull requests (a fork's branch by its label), deleted branches and visibility changes dispatched to the domain once per linked project (by GitHub's repository ID, else URL) as forge::events; installations attach to and detach from linked projects (only from the installation being removed) and recheck their organizations' GitHub members; membership and team changes queue RecheckAccess, which asks the App for each person's permission on every linked repository and applies it as a sign-in does; the GitHub App client (JWT, installation tokens, collaborator permission)
…s collaborators once (affiliation=all; one installation token per installation for the run; the path looked up by GitHub's ID) and derives everyone's permission from that, keyed by repository ID; nothing changes unless every repository was read, and it stops when the rate limit is low; an installation is attached only after GitHub confirms it exists (a stale or redelivered 'created'); renamed and transferred repositories move their links by ID; a delivery naming a repository's ID backfills links that only had its URL; 'edited' takes the repository's own private flag; deliveries up to GitHub's 25 MB
… and dependencies merged
ndbroadbent
force-pushed
the
laravel-webhooks
branch
from
December 2, 2026 16:06
d0b9b1d to
38a4500
Compare
ndbroadbent
force-pushed
the
laravel-orgs
branch
from
December 2, 2026 16:06
a9f9238 to
67a3b0f
Compare
ndbroadbent
added a commit
that referenced
this pull request
Dec 2, 2026
… (a pull request closed without merging, or the branch deleted) closes its builds waiting for review with today's warning; reopen_branch brings back the newest; both idempotent and fire BuildChanged; for the forge listeners once #74 lands
ndbroadbent
force-pushed
the
laravel-staff
branch
from
December 2, 2026 23:41
fb2ec24 to
4e4cbe5
Compare
Member
Author
|
Included in #87. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of sc-8900 (the forge side of the Laravel Rust port). Stacked on #70.
Ports
POST /webhooks/github(the API host, outside the session and CSRF groups).Signatures:
X-Hub-Signature-256is checked in constant time; an unsigned or wrongly signed delivery gets 401. WithoutGITHUB_WEBHOOK_SECRETthe route answers 404.Reading deliveries: ported as today's
read_event. A fork's branch goes by its head label (octocat:main). Merges, closes, reopens, branch deletions (deleteandpushwithdeleted), installation and repository changes, member, membership, organization and team events are all read.Domain events: once per linked project, through
forge::events. features agreed this seam and handle the events with idempotent listeners:PullRequestMerged { project_id, head, base, merge_commit }BranchClosed { project_id, branch, why: "pull_request" | "branch_deleted" }BranchReopenedRepositoryVisibilityChanged { project_id, private }Linked projects match by GitHub's repository ID, or by URL when the link has no ID yet. The response says
{dispatched: n}.Installations: attached to or detached from linked projects. A removal only applies to projects on the installation being removed. Each affected organization's GitHub-derived members are rechecked.
Access: member, membership and organization events recheck the people they name; team events recheck everyone in the installation's organizations.
RecheckAccess(a queued job) asks the App for each person's permission on every linked repository, collaborators only as today, and applies it throughauth::memberships::apply, the same path a sign-in takes. A person GitHub can't answer for is logged, and the others still update.GitHub App client (
forge::github_app): the JWT (GITHUB_APP_ID,GITHUB_APP_PRIVATE_KEY_BASE64), installation tokens, and collaborator permission by permanent user ID.Not in this PR:
Tests:
app/tests/webhooks.rscovers signature refusal, merges reaching both projects (by ID and by URL), a fork's branch, a deleted branch, installation detach and attach (including another installation's removal leaving the project alone), and a collaborator change queueing a recheck. The JWT and permission calls aren't run in tests, to avoid committing a private key, even a test one;applyhas its own tests. The whole app suite passes on docspring-dev, and clippy is clean.