Skip to content

OOT HUD: Add API endpoint, PR page integration, and replicator mapping (Part 3/3)#8112

Merged
huydhn merged 2 commits into
pytorch:mainfrom
subinz1:oot-hud-3-integration
May 30, 2026
Merged

OOT HUD: Add API endpoint, PR page integration, and replicator mapping (Part 3/3)#8112
huydhn merged 2 commits into
pytorch:mainfrom
subinz1:oot-hud-3-integration

Conversation

@subinz1

@subinz1 subinz1 commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

This is Part 3 of 3 of the OOT HUD pipeline, split from #8069 per reviewer request.

Depends on: #8110 (Part 1) and #8111 (Part 2)

This PR adds the final integration layer for the OOT HUD:

  • API endpoint (torchci/pages/api/oot/results.ts) — receives relay callbacks with:
    • Timing-safe token authentication (crypto.timingSafeEqual)
    • Payload size validation (2MB cap)
    • DynamoDB writes via UpdateItem (so completed callbacks don't clobber in_progress fields)
  • PR page integration — renders OotPrSection on pytorch/pytorch PRs inside an ErrorBoundary
  • ClickHouse replicator mapping — adds torchci-oot-workflow-job DynamoDB table to the replicator Lambda
  • API handler tests (torchci/test/ootResults.test.ts) covering:
    • Method rejection (non-POST)
    • Auth: missing token, wrong token, different-length token, missing env var
    • Successful DynamoDB write
    • Required field validation (job_name)
    • DynamoDB write failure handling
    • String body JSON parsing

PR Stack

  1. OOT HUD: Add ClickHouse queries, utility library, and unit tests (Part 1/3) #8110 — OOT HUD: Add ClickHouse queries, utility library, and unit tests (Part 1/3)
  2. OOT HUD: Add frontend components — summary, dashboard, PR section (Part 2/3) #8111 — OOT HUD: Add frontend components — summary, dashboard, PR section (Part 2/3)
  3. This PR — OOT HUD: Add API endpoint, PR page integration, and replicator mapping (Part 3/3)

Test Plan

  • ootResults.test.ts covers the API handler end-to-end (mocked DynamoDB)
  • PR page integration can be verified via Vercel preview on any pytorch/pytorch PR
  • Replicator mapping will be active once the DynamoDB table and ClickHouse table (Add ClickHouse schema for OOT workflow job table #8105) are deployed

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

@subinz1 is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@subinz1

subinz1 commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @atalman @malfet @zxiiro,

This is Part 3 of 3 of the OOT HUD pipeline, split from #8069 per the suggestion from @malfet and @atalman.

This PR contains the API endpoint, PR page integration, replicator mapping, and API handler tests — the final integration layer that ties everything together.

PR Stack

  1. OOT HUD: Add ClickHouse queries, utility library, and unit tests (Part 1/3) #8110 — ClickHouse queries + ootUtils.ts + ootUtils.test.ts
  2. OOT HUD: Add frontend components — summary, dashboard, PR section (Part 2/3) #8111 — OOT frontend components
  3. This PR — API endpoint + PR page integration + replicator mapping

Depends on: #8110 (Part 1) and #8111 (Part 2). All review feedback from #8069 has been incorporated.

CC @groenenboomj @jewelkm89

atalman pushed a commit that referenced this pull request May 22, 2026
…t 1/3) (#8110)

## Summary

This is **Part 1 of 3** of the OOT HUD pipeline, split from #8069 per
reviewer request.

This PR adds the foundational data layer for the Out-of-Tree (OOT) HUD:

- **ClickHouse queries** for three views: OOT summary dashboard,
per-backend dashboard, and PR-level results
- **Shared utility library** (`torchci/lib/oot/ootUtils.ts`) with:
- Relay payload types (`RelayTrusted`, `RelayWorkflow`,
`RelayCallbackPayload`, etc.)
  - DynamoDB record extraction and validation (`extractDynamoRecord`)
  - UpdateItem write logic (`writeToDynamo`)
  - Payload size validation (`validatePayloadSize`)
  - UI helpers (`conclusionColor`, `conclusionLabel`)
  - `ApiError` class for structured HTTP error responses
- **Unit tests** (`torchci/test/ootUtils.test.ts`) covering:
  - Field mapping and DynamoDB key construction
  - Required field validation (job_name, check_run_id)
  - Test result computation (total from passed+failed+skipped)
  - Timing metric handling
  - Payload size validation
  - UI helper functions

### PR Stack
1. **This PR** — OOT HUD: Add ClickHouse queries, utility library, and
unit tests (Part 1/3)
2. #8111 — OOT HUD: Add frontend components — summary, dashboard, PR
section (Part 2/3)
3. #8112 — OOT HUD: Add API endpoint, PR page integration, and
replicator mapping (Part 3/3)

## Test Plan
- `ootUtils.test.ts` covers all utility functions
- ClickHouse queries can be tested once the `oot_workflow_job` table is
created (see #8105)
@subinz1 subinz1 force-pushed the oot-hud-3-integration branch 2 times, most recently from 8842fd1 to d25f5e9 Compare May 24, 2026 06:17
zxiiro pushed a commit that referenced this pull request May 26, 2026
…rt 2/3) (#8111)

## Summary

This is **Part 2 of 3** of the OOT HUD pipeline, split from #8069 per
reviewer request.

**Depends on:** #8110 (Part 1 — queries + utils + tests)

This PR adds the frontend pages and components for the OOT HUD:

- **OOT Summary page** (`torchci/pages/oot/index.tsx`) — aggregated view
of all registered OOT backends with latest status, PR count, and success
rates
- **Per-backend dashboard** (`torchci/pages/oot/[org]/[repo].tsx`) —
detailed job history per downstream repo with filtering
- **OotPrSection component** (`torchci/components/oot/OotPrSection.tsx`)
— shows OOT CI results inline on pytorch/pytorch PR pages

All components consume the ClickHouse queries and utility library added
in Part 1.

### PR Stack
1. #8110 — OOT HUD: Add ClickHouse queries, utility library, and unit
tests (Part 1/3)
2. **This PR** — OOT HUD: Add frontend components — summary, dashboard,
PR section (Part 2/3)
3. #8112 — OOT HUD: Add API endpoint, PR page integration, and
replicator mapping (Part 3/3)

## Test Plan
- Frontend pages can be verified via Vercel preview once dummy data is
populated in the `oot_workflow_job` ClickHouse table (see #8105)
- Components import from `ootUtils.ts` (Part 1) — no runtime
dependencies on the API endpoint (Part 3)
@subinz1

subinz1 commented May 26, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot rebase -b main

Add the final integration layer for the OOT HUD:

- API endpoint (pages/api/oot/results.ts) that receives relay
  callbacks with timing-safe token auth, payload validation, and
  DynamoDB writes via UpdateItem
- PR page integration: render OotPrSection on pytorch/pytorch PRs
  inside an ErrorBoundary
- ClickHouse replicator mapping for the torchci-oot-workflow-job
  DynamoDB table
- API handler tests (ootResults.test.ts) covering auth, validation,
  DynamoDB write success/failure, and string body parsing

This is Part 3 of the OOT HUD pipeline split from pytorch#8069.
@subinz1 subinz1 force-pushed the oot-hud-3-integration branch from d25f5e9 to c927602 Compare May 26, 2026 12:51
@malfet

malfet commented May 26, 2026

Copy link
Copy Markdown
Contributor

Is there any non-synthetic data in DB one can use to actually see how it will render? (Because the hook exists, isn't it?)

@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
torchci Ready Ready Preview May 30, 2026 9:32am

Request Review

)}
</ErrorBoundary>
<ErrorBoundary>
{prNumber && repoOwner === "pytorch" && repoName === "pytorch" && (

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.

Why are we building it exclusive to pytorch/pytorch? It should apply to any repo, shouldn't it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, but for now we are focusing on pytorch/pytorch repo as confirmed by Alban in the "Sync on Cross-Repository CI Relay for PyTorch Out-of-Tree Backends" call on Tuesday,

@subinz1

subinz1 commented May 27, 2026

Copy link
Copy Markdown
Collaborator Author

Is there any non-synthetic data in DB one can use to actually see how it will render? (Because the hook exists, isn't it?)

Hello @malfet,

The ClickHouse table has seed data from @atalman — you can see it at: https://hud.pytorch.org/api/clickhouse/oot_summary?parameters={"days":"14"}

It returns 3 backends (intel/intel-extension-for-pytorch, pytorch-labs/ascend-pytorch, pytorch-labs/cambricon-pytorch) with ~150 total jobs. Real production data will flow once downstream repos onboard to L2.

@huydhn

huydhn commented May 30, 2026

Copy link
Copy Markdown
Contributor

A rebase fixes the build now, I'm going to merge this

@huydhn huydhn merged commit c53a8dc into pytorch:main May 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants