Skip to content

feat(ci): Fail when a table copies GitHub state - #4128

Merged
BYK merged 4 commits into
mainfrom
byk/provider-state-check
Nov 23, 2026
Merged

BYK merged 4 commits into
mainfrom
byk/provider-state-check

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

GitHub is the source of truth for GitHub state, but Junior keeps copies of it in its tables. Those copies drift and need reconcile code. This adds the rule to design/github.md and a check that stops new copies.

provider-state:check reads the latest Drizzle snapshot of each package and fails on:

  • any column of a junior-github table that is not in scripts/github-state-baseline.json
  • in any package, a provider state column (state, title, draft, merged_at, closed_at, assignees, labels, additions, deletions, changed_files, mergeable, *_count) on a table with a provider_id column, unless the baseline lists it

The baseline is grouped by table. A table maps to one reason for the whole table, or to a reason for each column. Each reason says why the value may stay: it is a Junior-owned fact, it is too expensive to derive, or it is a mirror that a follow-up cleanup removes. The file matches scripts/*-baseline.json, so baseline-growth:check keeps it shrink-only. Every entry sits under one tables key, so a new table counts as growth too. Each cleanup PR removes its entries.

The check runs in pnpm lint through scripts/check.mjs. It shares the latest-snapshot read with money-units:check through scripts/lib/drizzle-snapshots.mjs.

via @BYK.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 23, 2026 9:49pm UTC

Request Review

@sentry-junior
sentry-junior Bot requested a review from BYK November 23, 2026 21:17
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 23, 2026
Comment thread scripts/github-state-exceptions.mjs Resolved
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

513 screenshot changes — 0 changed · 513 added · 0 removed

Review screenshots in Frameshift

@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 1 potential issue.

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 36a8786. Configure here.

Comment thread scripts/check-provider-state.mjs Resolved
@BYK
BYK merged commit 3e41369 into main Nov 23, 2026
57 checks passed
@BYK
BYK deleted the byk/provider-state-check branch November 23, 2026 22:07
BYK added a commit that referenced this pull request Nov 23, 2026
Stacked on #4128, which adds
`scripts/github-state-exceptions.mjs`. This PR removes entries from that
file.

Every pull request webhook parses the issue references in a Junior pull
request body and writes them to `junior_github_pull_request_issues`.
Nothing reads that table. When Junior needs a pull request's linked
issues, the body on GitHub is the source.

This drops the table, its write path in the webhook handler, the body
parser that only fed it, and its entries in the exceptions file.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Aa74cba793e2579695b0fbabff9e41a78 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
BYK added a commit that referenced this pull request Nov 23, 2026
…e footer (#4132)

Stacked on #4128, which adds
`scripts/github-state-baseline.json`. This PR removes this table's entry
from that file.

`junior_github_issues` copies the state of Junior's issues from
webhooks. Nothing reads `state`, `state_reason`, `opened_at`, or
`closed_at`. The only reader is the close annotation, which fans out to
the row's `conversation_ids`. Those ids are also in the issue body
footer that Junior writes, and every `issues` webhook carries that body.

This drops the table. When a Junior-authored issue closes, the webhook
reads the Conversations from its footer and marks the issue closed in
each one that already holds a card for it.

Guard: a person can edit the footer, so the footer only picks the
candidates. The write needs the Conversation's own annotation for the
issue key in `junior_conversation_annotations`, which Junior adds when
it opens the issue. An edited footer cannot add a card to another
Conversation. The issue author must still be the bot.

#4100 reads this table for its reaction poll, so it
needs another source before it can merge.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Aa74cba793e2579695b0fbabff9e41a78 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aa74cba793e2579695b0fbabff9e41a78/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
Co-authored-by: BYK <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 094d27ef Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant