Skip to content

fix(hub): attribute imported Build authors and preserve webhook delivery IDs - #323

Merged
weastler merged 8 commits into
build/hub/newfrom
weastler-hub-author-webhook-fixes
Nov 20, 2026
Merged

weastler merged 8 commits into
build/hub/newfrom
weastler-hub-author-webhook-fixes

Conversation

@weastler

@weastler weastler commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Builds imported from GitHub Actions workflow runs had no author, so the Hub gallery showed "Unknown author" even when GitHub knew who made the commit. Webhook delivery recovery also failed because GitHub delivery IDs can exceed JavaScript's safe integer range. The App's credentials worked; the recovery failure came from parsing and validating those IDs.

What changes

Hub resolves the linked GitHub author of the exact imported commit and stores that identity on the Build. The gallery and prototype detail use it when the prototype has no stored owner; search uses the same visible author. Unlinked authors remain unknown. Lookup failures do not block available artifacts, and recovery retries the attribution.

Commit attribution does not assign ownership. Existing owners are retained. For a non-admin to manage public share links, the stored owner must match the signed-in user, a successful Build must match their GitHub identity, and they must still have repository access. Ownerless imports require repository-admin permission. The existing schema does not independently establish the provenance of historical owner assignments.

npm run github:repair-author previews the proposed Build author and whether it would update or preserve existing metadata. It affects one repository and Build, writes only with --apply, and never changes the prototype owner. The guide also documents compiled and Azure maintenance entry points.

Webhook delivery IDs are parsed losslessly, stored as 64-bit integers, and sent as exact decimal strings when redelivered. The read-only npm run github:check-webhooks diagnostic checks App and repository access, required webhook settings and subscriptions, and scoped delivery evidence. It compares Build completion to the current provider attempt; a signed receipt or completed Build alone does not prove that webhook recovery processed the run.

flowchart LR
  run[Workflow run] --> sha[Imported commit SHA]
  sha --> lookup[GitHub commit author]
  lookup -->|linked account| build[Build author]
  lookup -->|no linked account| unknown[Unknown author + warning]
  lookup -->|lookup failure| retry[Artifacts import; run retried]
  build --> view[Gallery and detail fallback when no stored owner]
Loading

These changes do not repair production data. Existing Builds need a separately approved repair after deployment, and live webhook recovery has not been verified against the deployed Hub.

The screenshots show a local Hub route (/repositories/<id>) at 1280×900 with synthetic data. An unlinked author remains "Unknown author"; an imported author appears as "By @octocat".

Repository gallery, light theme, 1280×900: unknown and imported author cards

Repository gallery, dark theme, 1280×900: unknown and imported author cards

No Storybook story's presentation changes: Storybook fixtures keep their existing author matching, so there is no Storybook screenshot section.

weastler and others added 4 commits November 19, 2026 16:38
Resolve the Build author from the account linked to the imported commit,
add an idempotent dry-run-first author repair command, keep GitHub webhook
delivery IDs lossless through recovery and redelivery, and add a
non-mutating webhook communication diagnostic.

Local, unreviewed work preserved separately from the deployment branch.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Combine configured workflow-path selection from #319 with commit-author
resolution. Deselected workflows settle before author lookup; author
failures keep per-run completion unrecorded so recovery retries them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@weastler
weastler requested review from a team and nshki as code owners November 20, 2026 06:16
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 06:16

Copilot AI 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.

🟡 Changes recommended

Unresolved security issues allow commit attribution to grant sharing authority without authenticated ownership evidence and webhook diagnostics to pass despite missing required access-removal subscriptions.

13 open issues
What changed in this PR

Improves Hub’s GitHub Actions import and recovery flow by attributing Builds to their exact commit author and preserving large webhook delivery IDs.

Changes:

  • Adds commit-author lookup, retry handling, and author display fallbacks while preserving explicit owners.
  • Preserves 64-bit delivery IDs and distinguishes HTTP, transport, and response failures.
  • Adds scoped author repair, read-only webhook diagnostics, documentation, and regression coverage.

Existing production Builds still require an approved repair; deployed webhook recovery remains unverified.

File Description
hub/​server/​workers/​github-recovery.test.ts Adds the commit-author client mock.
hub/​server/​scripts/​repair-github-build-author/​index.ts Adds the scoped repair command.
hub/​server/​scripts/​check-github-webhooks/​index.ts Adds the webhook diagnostic command.
hub/​server/​repositories/​prototype-index/​find-repository-index/​index.ts Adds gallery author fallback from Builds.
hub/​server/​repositories/​prototype-index/​find-repository-index/​index.db.test.ts Covers author fallback and explicit owners.
hub/​server/​repositories/​prototype-index/​find-prototype-detail/​index.ts Adds detail-header author fallback.
hub/​server/​repositories/​github-webhook-redeliveries/​types.ts Supports exact decimal delivery IDs.
hub/​server/​repositories/​github-webhook-redeliveries/​claim-due-github-webhook-redeliveries/​index.ts Avoids rounding large claimed IDs.
hub/​server/​repositories/​github-webhook-deliveries/​find-github-webhook-evidence/​index.ts Reads delivery, recovery, and Build evidence.
hub/​server/​repositories/​github-webhook-deliveries/​find-github-webhook-evidence/​index.db.test.ts Covers scoped, read-only evidence lookup.
hub/​server/​repositories/​github-builds/​record-github-build-run-completion/​index.ts Clarifies the completion comment.
hub/​server/​repositories/​github-builds/​record-github-build-author/​index.ts Stores attribution and links unset mapped owners.
hub/​server/​repositories/​github-builds/​list-github-builds-awaiting-import/​index.ts Clarifies the pending-author-work comment.
hub/​server/​repositories/​github-builds/​find-github-build-author-target/​index.ts Finds a repository-scoped repair target.
hub/​server/​integrations/​github/​errors.ts Adds commit-lookup HTTP errors.
hub/​server/​integrations/​github/​create-github-webhook-deliveries-client/​types.ts Extends delivery IDs and repository scope.
hub/​server/​integrations/​github/​create-github-webhook-deliveries-client/​index.ts Preserves IDs and adds diagnostic reads.
hub/​server/​integrations/​github/​create-github-webhook-deliveries-client/​index.test.ts Covers precision, validation, and safe responses.
hub/​server/​integrations/​github/​create-github-webhook-deliveries-client/​errors.ts Classifies webhook request failures.
hub/​server/​integrations/​github/​create-github-actions-client/​index.ts Looks up linked authors by exact commit SHA.
hub/​server/​integrations/​github/​create-github-actions-client/​index.test.ts Covers author lookup and provider failures.
hub/​server/​domains/​github-webhooks/​types.ts Accepts exact IDs for redelivery.
hub/​server/​domains/​github-webhooks/​recover-github-webhook-deliveries/​index.db.test.ts Covers large-ID recovery through storage.
hub/​server/​domains/​github-webhooks/​check-github-webhook-communication/​index.ts Coordinates read-only communication checks.
hub/​server/​domains/​github-webhooks/​check-github-webhook-communication/​index.test.ts Covers diagnostic results and evidence limits.
hub/​server/​domains/​github-builds/​repair-github-build-author/​index.ts Coordinates author inspection and repair.
hub/​server/​domains/​github-builds/​repair-github-build-author/​index.db.test.ts Covers repair safety and repeat application.
hub/​server/​domains/​github-builds/​prepare-github-workflow-run-build/​index.ts Resolves or reuses saved attribution.
hub/​server/​domains/​github-builds/​import-github-workflow-run/​types.ts Adds the author-lookup dependency.
hub/​server/​domains/​github-builds/​import-github-workflow-run/​index.ts Continues artifact import during lookup failures.
hub/​server/​domains/​github-builds/​import-github-workflow-run/​index.db.test.ts Covers attribution, preservation, and retries.
hub/​package.json Exposes both maintenance commands.
hub/​docs/​github-actions-builds.md Documents authors, repair, and webhook checks.
hub/​client/​application/​hub/​view-models/​repository-show-data/​index.ts Avoids login-only user matching in real data.
hub/​client/​application/​hub/​view-models/​repository-show-data/​index.test.ts Covers snapshot and explicit-owner display.

Review effort: Max (adaptive)

Comment thread hub/package.json Resolved
weastler and others added 4 commits November 20, 2026 09:16
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lookups

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@weastler
weastler merged commit 289ce6f into build/hub/new Nov 20, 2026
51 checks passed
@weastler
weastler deleted the weastler-hub-author-webhook-fixes branch November 20, 2026 20:17
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.

3 participants