Skip to content

Commit 3010ae4

Browse files
NiallJoeMaherclaude
andcommitted
test(db)+fix(ui): broaden relation guard to all 4 aliases; cover typeless 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>
1 parent c823a39 commit 3010ae4

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎server/db/relations.test.ts‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,28 @@ describe("posts relational config", () => {
1717
({ db } = await import("@/server/db"));
1818
});
1919

20-
it("registers relations on the join tables (no alias collision)", () => {
20+
it("registers relations on all four aliased join tables (no collision)", () => {
2121
const schema = db._.schema;
22-
expect(Object.keys(schema.post_tags.relations)).toContain("post");
23-
expect(Object.keys(schema.post_tags.relations)).toContain("tag");
22+
// All four tables that have a camelCase alias re-export must keep their
23+
// relations registered under the canonical snake_case key.
24+
expect(Object.keys(schema.post_tags.relations)).toEqual(
25+
expect.arrayContaining(["post", "tag"]),
26+
);
2427
expect(Object.keys(schema.post_votes.relations)).toContain("post");
28+
expect(Object.keys(schema.comment_votes.relations)).toContain("comment");
29+
expect(Object.keys(schema.feed_sources.relations)).toContain("user");
2530
});
2631

27-
it("builds the nested relational query used by /feed.xml", () => {
32+
it("builds relational queries that walk the previously-broken relations", () => {
2833
expect(() =>
2934
db.query.posts
3035
.findMany({
3136
columns: { title: true },
3237
with: {
33-
author: { columns: { username: true } },
34-
tags: { with: { tag: true } },
38+
author: { columns: { username: true } }, // used by /feed.xml
39+
tags: { with: { tag: true } }, // post_tags
40+
votes: true, // post_votes
41+
source: true, // feed_sources (one)
3542
},
3643
limit: 1,
3744
})

‎styles/globals.css‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ body {
165165
every form control. Recolour both to the brand accent so input focus matches
166166
the mint focus language used everywhere else (links/buttons already get a mint
167167
:focus-visible ring). Unlayered, so it reliably overrides the plugin's
168-
@layer base styles. The thin ring doubles as the keyboard focus indicator, so
169-
a11y is preserved — only the colour changes. */
168+
@layer base styles. The plugin's thin ring (shown on :focus, pointer and
169+
keyboard) is kept as the focus indicator — only the colour changes. */
170170
[type="text"]:focus,
171171
[type="email"]:focus,
172172
[type="url"]:focus,
@@ -180,6 +180,7 @@ body {
180180
[type="time"]:focus,
181181
[type="week"]:focus,
182182
[multiple]:focus,
183+
input:not([type]):focus,
183184
textarea:focus,
184185
select:focus {
185186
--tw-ring-color: rgb(var(--color-accent));

0 commit comments

Comments
 (0)