Skip to content

Upgrade to Better Auth 1.7 - #216

Merged
wasimxyz merged 10 commits into
stagingfrom
fix/runs-table-overflow-and-dev-login
Sep 1, 2026
Merged

Upgrade to Better Auth 1.7#216
wasimxyz merged 10 commits into
stagingfrom
fix/runs-table-overflow-and-dev-login

Conversation

@wasimxyz

@wasimxyz wasimxyz commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

npm audit fix pulled Better Auth from 1.6.27 to 1.7.2. That is a breaking upgrade, and it broke three things: email sign-in, MCP OAuth, and the type check. This PR finishes the upgrade so all three work again.

Three unrelated runs-list changes were already in flight on this branch and rode along. They are described at the bottom.

What 1.7 broke

Email sign-in. 1.7 looks accounts up by issuer and account ID together. Existing rows had no issuer, so signing in failed with "user not found". Migration 0043_add_account_issuer.sql adds the column, fills it in for existing rows, then makes it required and unique.

MCP OAuth. 1.7 reshaped the OAuth provider tables and ours were never regenerated, so registering a client returned a 500 and no MCP client could connect. Migration 0044_better_auth_17_oauth_tables.sql adds 18 missing columns and three new tables, and drops nothing. The validAudiences setting was removed in 1.7, so the MCP audience is now a seeded row in the new oauth_resource table. scripts/generate-auth-schema.ts knows about the new tables, so the next regeneration keeps them.

The type check. verifyAccessToken was renamed to verifyBearerToken.

Drive-by changes

Wide tables. Wide instrument tables (SpectraMax, Gel Doc) stretched the whole page sideways instead of scrolling inside their own card. The table already had its own horizontal scroll, but the panes around it were allowed to grow to fit their content, so the page grew instead. Adding min-w-0 at each level of that chain (app layout, instrument page, loading skeleton, table-pending wrapper, runs-table shell) lets the main pane shrink beside the sidebar.

Comment counts. Runs with comments gave no hint of that in any list. They now show a small grey speech-bubble icon and a count next to the run ID. The runs list query returns comment_count per run from its own query, which runs alongside the attributions query so the file counts on each row are unaffected. Deleted comments are not counted. A new RunIdCell holds the status icon, run ID, and count, and all eight tables (seven instrument variants plus the dashboard) use it. Runs with no comments look unchanged. The field is also in the REST RunListItem schema and the MCP search_runs output.

Checkbox padding. Removed the shadcn [&:has([role=checkbox])]:pr-0 rule so the checkbox column has 6px on both sides instead of 6px and 0.

Things a reviewer might want to know

  • Both migrations have to run before this deploys. Until 0043 is applied, Better Auth 1.7 cannot find any account row, so email and Google sign-in both fail on that environment. Until 0044 is applied, MCP OAuth registration fails.
  • MCP clients now have to register as native. 1.7 turns away a loopback redirect URI unless the client sends application_type: "native", and there is no server-side setting to relax that. Point a real client at a preview before this reaches production.
  • comment_count is a new field on an existing response. Anything parsing RunListItem or search_runs with a strict schema will see the extra key.
  • DPoP is still not supported. verifyBearerToken rejects DPoP-bound tokens. Supporting them needs replay storage in the database, so it is left out.

Test plan

  • make check passes, including the previously failing type check
  • npm run test:unit (360 pass)
  • make fe-test-integration (391 pass), covering the MCP OAuth flow end to end and the new comment_count assertions
  • Sign in locally with email after applying the migrations
  • Gel Doc and SpectraMax run pages scroll inside their card, with no page-level horizontal scroll
  • Runs with comments show the icon and count; runs without show nothing extra
  • Apply the migrations on staging and confirm Google sign-in still works there
  • Register a real MCP client (Cursor, Claude Code) against a preview to confirm the application_type rule

Made with Cursor

wasimxyz and others added 6 commits September 1, 2026 12:41
Gel Doc and SpectraMax metadata columns were stretching the main pane past the sidebar because flex items would not shrink below the table's min-content width.

Co-authored-by: Cursor <cursoragent@cursor.com>
This pulls Better Auth from 1.6.27 to 1.7.2, which is a breaking account-identity change handled in the next commit.

Co-authored-by: Cursor <cursoragent@cursor.com>
1.7 keys accounts on (issuer, accountId). Seeded credential rows had no issuer, so Alice's password login failed with "Couldn't sign in with that email."

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
data-hub Ready Ready Preview Sep 1, 2026 9:06pm UTC

Request Review

@wasimxyz wasimxyz self-assigned this Sep 1, 2026
@wasimxyz wasimxyz changed the title Fix wide run tables, show run comment counts, and finish the Better Auth 1.7 upgrade Fix wide run tables, show run comment counts, and upgrade to Better Auth 1.7 Sep 1, 2026
The badge was copy-pasted identically across all eight runs tables, so
RunIdCell now derives it from the run's deleted_at and no longer takes
`children` or `labelClassName`.

The dashboard badge picks up the default 12px size instead of 10px, so
both views match. Its `labelClassName="text-sm"` was already inherited
from `Table`, leaving the run ID label unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
wasimxyz and others added 2 commits September 1, 2026 13:17
Lockfile only; the `>=1.1.408` floor in `pyproject.toml` still holds and
CI resolves the version through `uv sync`. Typecheck stays clean.

Co-authored-by: Cursor <cursoragent@cursor.com>
The 1.7 bump landed without regenerating the OAuth provider schema, so
dynamic client registration returned a 500 and the authorization-code
flow was unusable. Adds the missing columns plus the three new tables,
and swaps the removed `validAudiences` option for seeded `resources`.

Also updates the DCR tests for 1.7's native-only loopback redirect rule
and its 201 response.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wasimxyz wasimxyz changed the title Fix wide run tables, show run comment counts, and upgrade to Better Auth 1.7 Upgrade to Better Auth 1.7 Sep 1, 2026
@wasimxyz
wasimxyz merged commit 144ec4c into staging Sep 1, 2026
7 checks passed
@wasimxyz
wasimxyz deleted the fix/runs-table-overflow-and-dev-login branch September 1, 2026 21:13
wasimxyz added a commit that referenced this pull request Sep 1, 2026
* Roll Better Auth back to 1.6 so MCP clients can register.

1.7 rejects Cursor and Claude Code because both omit application_type
and send a non-https callback. Pin the packages to 1.6.27 and add a
migration that lets 1.6 insert account rows again. Leave the UI and
make-check work from #216 in place.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Stop Next from writing a nested web/web folder.

Next 16 treats the git repo as the Turbopack workspace, so make dev
already running in web/ wrote assets to web/web/.next. Pin the app
root and ignore any leftover copy.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Re-apply the Turbopack root pin after withMicrofrontends.

Keeps client assets in web/.next so a leftover cache cannot
restore them into web/web/.next on make dev.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
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