Skip to content

fix: /feed.xml relation crash + blue form-input focus ring#1333

Merged
NiallJoeMaher merged 3 commits into
developfrom
fix/feed-xml-relations-and-focus-ring
Jun 14, 2026
Merged

fix: /feed.xml relation crash + blue form-input focus ring#1333
NiallJoeMaher merged 3 commits into
developfrom
fix/feed-xml-relations-and-focus-ring

Conversation

@NiallJoeMaher

Copy link
Copy Markdown
Contributor

Two production fixes.

1. /feed.xml 500 — "There is not enough information to infer relation posts.tags"

Sentry: GET /feed.xml throwing on every request (13 events).

Root cause: the schema barrel re-exports four tables under camelCase aliases (post_votes as postVotes, comment_votes as commentVotes, post_tags as postTags, feed_sources as feedSources). server/db/index.ts passed the whole import * as schema namespace to drizzle, so two keys pointed at the same table object, colliding drizzle's tableNamesMap. Drizzle attached each join table's relations to the alias key and left the canonical key with empty relations — so any many relational walk (with: { tags }, with: { votes }) couldn't find the reverse relation and threw. /feed.xml uses with: { tags: { with: { tag: true } } }, so it 500'd. bookmarks/comments (no alias) worked, which is why it looked selective.

Fix: strip the four aliases from the schema object handed to drizzle so each table is registered once. App code still imports the aliases from the barrel unchanged. Added server/db/relations.test.ts that asserts the join-table relations register and the exact /feed.xml query builds.

Verified by reproducing the build error locally, then confirming it's gone after the fix (post_tags/post_votes relations now populate; the feed query .toSQL() no longer throws).

2. Blue focus ring on form inputs

@tailwindcss/forms paints a hardcoded blue (#2563eb) focus ring + border on every form control, so text inputs lit up blue while links/buttons already used the mint :focus-visible ring. Recoloured the plugin's ring + border to the --color-accent token for all form controls — keeps an accessible, thin, on-brand focus indicator instead of the off-palette blue.

Verified via Playwright: input focus ring went from #2563ebrgb(45 212 191) (accent); links/buttons unchanged; the command-palette input's existing subtle-underline treatment is unaffected.

Checks

ESLint clean · tsc 0 errors · server/db/relations.test.ts + utils/url.test.ts pass (9 tests)

🤖 Generated with Claude Code

NiallJoeMaher and others added 2 commits June 14, 2026 14:19
The schema barrel re-exports four tables under camelCase aliases for app
ergonomics (post_votes as postVotes, etc.). Passing the whole module
namespace to drizzle put two keys per table into its tableNamesMap; the
collision made drizzle attach each join table's relations to the alias
key and leave the canonical key with none. Relational queries that walk a
many-relation on those tables (with: { tags }, with: { votes }) then threw
"There is not enough information to infer relation posts.tags" — which is
exactly what /feed.xml does, so the RSS feed 500'd.

Strip the aliases from the schema object handed to drizzle so each table
is registered once; app code still imports the aliases from the barrel
unchanged. Adds a regression test that builds the /feed.xml query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tailwindcss/forms paints a hardcoded blue (#2563eb) focus ring and border
on every form control, so text inputs lit up blue while links and buttons
already used the mint :focus-visible ring. Override the plugin's ring colour
and border to the accent token for all form controls, keeping an accessible
(now on-brand, thin) focus indicator instead of the off-palette blue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NiallJoeMaher NiallJoeMaher requested a review from a team as a code owner June 14, 2026 13:19
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
codu Ready Ready Preview, Comment Jun 14, 2026 1:25pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0a03afb0-448c-453a-9a06-ab0872bf9c07

📥 Commits

Reviewing files that changed from the base of the PR and between c823a39 and 3010ae4.

📒 Files selected for processing (2)
  • server/db/relations.test.ts
  • styles/globals.css

Walkthrough

The PR fixes a Drizzle ORM relational query failure by stripping four camelCase barrel alias exports (postVotes, commentVotes, postTags, feedSources) from the schema object passed to drizzle(...), preventing duplicate table key collisions. A Vitest regression suite is added to guard the fix. Separately, a CSS :focus override replaces Tailwind Forms' default blue ring with the brand accent color.

Changes

Drizzle Schema Alias Collision Fix

Layer / File(s) Summary
Schema alias stripping in drizzle init
server/db/index.ts
Imports schema as schemaExports, destructures out the four alias keys, and passes the remaining object to drizzle(...) to eliminate duplicate table entries that break relation inference.
Relational config regression tests
server/db/relations.test.ts
New Vitest suite that stubs env vars, dynamically imports @/server/db, asserts expected relation keys on post_tags and post_votes, and verifies the /feed.xml nested query compiles to SQL without throwing.

Accent Focus Ring Override

Layer / File(s) Summary
Accent-colored focus ring for form controls
styles/globals.css
Adds an unlayered :focus block for text inputs, textarea, select, and multi-select that sets --tw-ring-color and border-color to rgb(var(--color-accent)).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A barrel of aliases caused quite a mess,
Drizzle got confused, relations under stress.
I snipped the duplicates, stripped them away,
Now relational queries work perfectly today!
And focus rings glow in accent's bright hue —
The rabbit hops on, with PR reviewed! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both main changes: fixing a relation crash in /feed.xml and correcting blue form-input focus rings, matching the core changeset.
Description check ✅ Passed The description is detailed and well-structured, covering both fixes with root causes and verification steps. However, it deviates from the template by using a custom format instead of the required sections (fixes #issue, pull request details, breaking changes, screenshots, gif).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/feed-xml-relations-and-focus-ring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…less inputs

Code review hardening:
- relations test now asserts comment_votes and feed_sources relations
  register too (not just post_tags/post_votes), and builds a query walking
  votes + source — covering all four stripped aliases, not just two.
- focus-ring override now also targets bare `input:not([type])`, which
  @tailwindcss/forms styles but the typed-selector list missed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NiallJoeMaher NiallJoeMaher merged commit 9635238 into develop Jun 14, 2026
3 of 6 checks passed
@NiallJoeMaher NiallJoeMaher deleted the fix/feed-xml-relations-and-focus-ring branch June 14, 2026 13:24
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