Skip to content

Commit ff93784

Browse files
committed
fix(gui): keep the inset rationale in one place
The stylesheet rule, the test file header, and three per-assertion comments each restated the same two facts — that `.card` has no padding and that the warning box needs margin rather than padding. CodeRabbit's slop detector flagged the repetition, and it was right: the explanation belongs on the CSS rule, where the values it justifies live. The test header now points at that rule and keeps only what is specific to the test — why the assertions read source text rather than measuring, and the browser measurements the contract is derived from. The comments that survive per assertion are the ones the CSS does not carry: why the rule regex is anchored, how a shorthand is read, and why an inline style would silently disable the fix.
1 parent 5da7f7b commit ff93784

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

‎gui/src/styles.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,8 @@ dialog.modal-overlay::backdrop {
17641764
* threshold field do not, so those two rendered flush against the card border.
17651765
*
17661766
* The warning takes margin, not padding: it is a bordered box, so its own padding insets
1767-
* the text and leaves the border itself on the card edge.
1767+
* the text and leaves the border itself on the card edge. The field takes padding — the
1768+
* `.input` inside is full-width, so the field owns the inset for the whole group.
17681769
*/
17691770
.anthropic-pool-card { margin-top: 12px; }
17701771
.anthropic-pool-card__notice {
@@ -1777,7 +1778,6 @@ dialog.modal-overlay::backdrop {
17771778
.anthropic-pool-card__field {
17781779
display: block;
17791780
margin-top: 12px;
1780-
/* The `.input` inside is full-width, so the field owns the inset for the whole group. */
17811781
padding: 0 16px;
17821782
}
17831783
.api-active-keys-skeleton {

‎gui/tests/anthropic-pool-card-layout.test.ts‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import { expect, test } from "bun:test";
22

33
/**
4-
* Claude account-pool card inset contract.
4+
* Claude account-pool card inset contract. The rule comment on
5+
* `.anthropic-pool-card__notice` in `src/styles.css` explains why each value is what it is.
56
*
67
* Source-text assertions, not rendered measurements: happy-dom performs no layout, so a
78
* getBoundingClientRect() here returns zeros and would prove nothing. Rendered proof was
8-
* captured in a real browser during the fix — the title sat 17px from the card's left
9-
* edge while the warning box and the threshold input sat at 1px. This file's job is to
10-
* keep the CSS shape that produced that gap from coming back silently.
11-
*
12-
* The bug: `.card` carries no padding of its own, so each child supplies the 16px inset.
13-
* `.card-row`, `.card-sub` and `.setting-row` all do, which is why the title row, the help
14-
* line and the rotation rows were indented. The experimental warning box and the threshold
15-
* field are none of those three, so they ran flush against the card border.
9+
* captured in a real browser during the fix — the title sat 17px from the card's left edge
10+
* while the warning box and the threshold input sat at 1px.
1611
*/
1712

1813
const cssUrl = new URL("../src/styles.css", import.meta.url);
@@ -66,26 +61,18 @@ async function rowInset(): Promise<number> {
6661
test("the warning box is inset by the same amount as the card's padded rows", async () => {
6762
const css = withoutComments(await Bun.file(cssUrl).text());
6863
const notice = ruleBody(css, ".anthropic-pool-card__notice");
69-
70-
// Margin, not padding: the box draws a border, so padding alone insets the text and
71-
// leaves the border itself sitting on the card edge — the original bug, one layer in.
7264
expect(horizontal(notice, "margin")).toBe(await rowInset());
7365
});
7466

7567
test("the threshold field is inset by the same amount as the card's padded rows", async () => {
7668
const css = withoutComments(await Bun.file(cssUrl).text());
7769
const field = ruleBody(css, ".anthropic-pool-card__field");
78-
79-
// The `.input` inside is full-width, so the field carries the inset for the whole group;
80-
// without it the input's own border reaches the card edge.
8170
expect(horizontal(field, "padding")).toBe(await rowInset());
8271
});
8372

8473
test("the help line inside the threshold field is not indented twice", async () => {
8574
const css = withoutComments(await Bun.file(cssUrl).text());
8675

87-
// `.card-sub` brings its own 16px, which lands on top of the field's inset and pushes the
88-
// help text out of line with the label directly above it.
8976
const group = css.match(
9077
/(^|\n)([^{}]*\.anthropic-pool-card__field \.card-sub\s*)\{([^}]*)\}/,
9178
);

0 commit comments

Comments
 (0)