Skip to content

ci(preview): timing telemetry and preview ownership metadata (stage 1) - #1142

Draft
kyle-compute wants to merge 4 commits into
stagingfrom
ci/preview-telemetry
Draft

ci(preview): timing telemetry and preview ownership metadata (stage 1)#1142
kyle-compute wants to merge 4 commits into
stagingfrom
ci/preview-telemetry

Conversation

@kyle-compute

@kyle-compute kyle-compute commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Why this PR exists

  • Preview-pipeline performance claims were based on manual log reading.
  • Without one durable timing contract, we could not compare queueing, database preparation, Modal, Vercel, and gate time across revisions.
  • Later cancellation work also needed a canonical identity for "this exact preview generation."

What this PR changes

  • Defines one preview generation value: PR number plus the first 12 characters of the head SHA.
  • Computes it once during planning and passes it to every preview job.
  • Records per-job and per-step durations in a schema-v1 preview-timing.json artifact.
  • Records allowlisted external identifiers and Vercel configure/build-wait/alias sub-phase timings.
  • Marks skipped phases as skipped instead of recording a misleading zero-second success.
  • Adds a readable timing table to the job summary.
  • Retains timing artifacts for 14 days.
  • Redacts URL credentials, query strings, fragments, and all non-allowlisted identifiers.
  • Makes telemetry soft-fail so measurement cannot break a valid preview deployment.

What this PR does not change

  • It does not reorder, cancel, speed up, or otherwise change deployment work.
  • It does not change the Require working preview check.
  • It does not change preview verification or publication logic.
  • It does not expose preview secrets to fork PRs.
  • It does not by itself prove a performance improvement; it creates the instrument used to prove later changes.

Evidence and validation

  • 51 preview-metrics and workflow-wiring tests passed.
  • The broader preview-script slice had one failure that reproduces on clean origin/staging.
  • Tests cover generation stability, redaction, missing fields, skipped phases, Vercel timings, artifact assembly, and a stubbed Actions API.
  • Workflow tests prove every job records identity and the gate's telemetry steps run after deployment publication.

Risk

  • The gate makes one additional Actions Jobs API request.
  • Permission or rate-limit failures can make telemetry incomplete, but cannot fail the preview.
  • Identifier leakage is limited by a fixed allowlist and redaction tests.
  • Runtime overhead is expected to be a few seconds but has not yet been proven by the canary set.

Merge gate

Before undrafting:

  • Run docs-only, frontend-only, backend-only, migration, and promotion canaries.
  • Confirm the timing artifact is present and schema-valid.
  • Confirm phase totals agree with GitHub timestamps within five seconds.
  • Confirm skipped work is marked skipped.
  • Confirm median preview duration changes by less than 10 seconds.
  • Confirm the required check name and fork secret boundaries are unchanged.

Stack order

Rollback

Revert this PR or remove the two soft telemetry steps. It changes no deployment or provider state, so there is nothing else to restore.

Add the schema-v1 observability contract for the preview pipeline:

- canonical preview generation (pr<N>-<sha12>) defined once in
  record_preview_metrics.py and exported as the detect-changes
  preview_generation output
- a Record preview identity step in every job: PR, head SHA, generation,
  event action, and the component plan in each job summary
- a final-gate Record preview metrics step that queries the Actions Jobs
  API and emits a machine-readable timing artifact (queue delay, container
  init, checkout/sync, database, Modal deploy, Vercel configure/build/
  alias sub-phases via a new timings job output) plus a Markdown timing
  table; uploaded with 14-day retention
- external identifiers (Supabase branch id/ref, Modal app/URL, Vercel
  deployment id/URL, GitHub deployment id) recorded through a fixed
  allowlist with URL userinfo/query redaction
- metrics publication is always() + continue-on-error so telemetry can
  never fail or gate the required check

No deployment behavior changes: same components, same order, same check
name.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oddish-app Ready Ready Preview Aug 11, 2026 1:01am

Comment thread .github/workflows/pr-preview.yml

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium. Left a non-blocking comment: Cursor Bugbot found an unresolved medium-severity issue (telemetry steps can fail the required preview gate), and the Bugbot check did not pass. Assigned reviewers for human follow-up; Cursor Security Agent was not present on this PR.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Oddish preview

Commit: b681d2a36fae8d6b2f9719e22773a2b76f9d1915

Surface Link Target
Frontend https://pr-1142.oddish.app Vercel preview for b681d2a
Backend oddish-pr-1142 oddish-pr-1142
Database project iuhqsjvgdzxsownqglom project iuhqsjvgdzxsownqglom

Vercel deployment URL: https://oddish-o6mmxe1gl.oddish.app

Plan:

  • Frontend deploy: true
  • Backend deploy: true
  • Migrations: true

This comment is updated by the PR Preview workflow.

Cursor Bugbot correctly flagged that a Record preview identity failure
could flip its job and make the gate reject a working preview, and that
the gate's new checkout was a hard dependency the gate never had. Every
telemetry step is now continue-on-error; the gate checkout is advisory
too (verify/publish do not use the working tree), so the whole telemetry
chain degrades to missing metrics instead of a failed gate.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b4e1f4e. Configure here.

DEPLOY_BACKEND: ${{ needs.detect-changes.outputs.deploy_backend }}
RUN_MIGRATIONS: ${{ needs.detect-changes.outputs.run_migrations }}
DEPLOY_FRONTEND: ${{ needs.detect-changes.outputs.deploy_frontend }}
run: python "$GITHUB_WORKSPACE/.github/scripts/preview/record_preview_metrics.py" identity

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gate checkout delays verification

Medium Severity

The gate's new Checkout repository and Record preview identity steps run before create/verify/publish, even though comments note verify/publish do not use the working tree. That puts a full checkout on the required-check critical path every run, adding avoidable latency against the stated few-second telemetry budget.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b4e1f4e. Configure here.

DEPLOY_BACKEND: ${{ needs.detect-changes.outputs.deploy_backend }}
RUN_MIGRATIONS: ${{ needs.detect-changes.outputs.run_migrations }}
DEPLOY_FRONTEND: ${{ needs.detect-changes.outputs.deploy_frontend }}
run: python "$GITHUB_WORKSPACE/.github/scripts/preview/record_preview_metrics.py" identity

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Identity skipped after step failure

Low Severity

Record preview identity uses continue-on-error: true but not if: always(), and in component jobs it is the final step. When an earlier deploy/prepare/vercel step fails, GitHub skips identity entirely, so failed jobs never get the ownership block that telemetry was added to provide.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b4e1f4e. Configure here.

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