Skip to content

doctor: a lapsed kept contrast problem reads as drawn now - #13326

Merged
josephfarina merged 2 commits into
josephfarina/theme-a/04b-doctor-kept-contrastfrom
josephfarina/theme-a/fx-13272
Nov 22, 2026
Merged

josephfarina merged 2 commits into
josephfarina/theme-a/04b-doctor-kept-contrastfrom
josephfarina/theme-a/fx-13272

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the review findings on #13272: doctor said a kept contrast problem whose colors changed is a problem again even where the new colors pass, printed the kept ratio rather than the one drawn now, and its warning carried no fix. A lapsed acceptance is now listed as a problem again at the ratio drawn now, or as no longer needed where its place passes, and the row stays information.

Testing

theme-contrast-accepted-as-designed.test.mjs (lapsed at the ratio drawn now; a fill that now passes reads as no longer needed).

Gate

preflight: pass 409ac97 (rebased onto main 4f7035e, own diff unchanged by patch-id from d2b3d6c)
replay: worse 0 at 409ac97 (rebased onto main 4f7035e, own diff unchanged by patch-id from d2b3d6c)

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 10:36pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 21, 2026, 10:46 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 21, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ready yet: approval waits on an engineering owner deciding how stable doctor reports the theme editor's kept contrast records, and two fixes are needed whatever that decision is.

  • Approval waits on an engineering owner deciding whether doctor's theme-accepted-contrast row may read a lapsed record this way (always info, a problem again at the ratio drawn now, or no longer needed), because no current record covers the row: spec:AST-050 FR11 lists doctor's theme checks without it, and the theme-editor exception in spec:AST-017 FR27 does not list doctor.
  • When the editor reports a kept place's failure as one problem across three or more variants, editorKeptContrastAt finds no problem at the place, so doctor says the record is "no longer needed: its colors changed and it now passes" while the place still draws at 1.17:1 (packages/cli/api/theme-edit/_adapter.mjs:1034-1049; on butter, keep the blue card's heading, then give the green and purple cards the same #1e293b fill).
  • .changeset/doctor-kept-contrast.md:5 still says a lapsed record is named "as a problem again, with a warning", which contradicts the new changeset and the row, now always info (packages/cli/api/doctor/theme-checks.mjs:2479), so fold this change into that note and drop the second one.

An engineering owner records the decision by naming or adding the record that governs this row, or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. A test case for the grouped-variant case would cover the second fix.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: before this change, doctor said a changed record is a problem again even where the new colors pass: verified (light badge info fill #0b4f5c on the base).
  • Claim: before this change, doctor printed the kept ratio rather than the one drawn now: verified (the base prints 2.09:1 where the editor draws 2.3:1).
  • Claim: before this change, the warning carried no fix: verified.
  • Claim: a lapsed record is now a problem again at the ratio drawn now: verified (theme-checks.mjs:2465-2467; it prints 2.3:1, kept at 2.09:1).
  • Claim: a lapsed record reads as no longer needed where its place passes: verified for a measured place that passes; it is also said where the place still fails (second bullet above).
  • Claim: the row stays information: verified (theme-checks.mjs:2479).
  • Claim: the test covers the drawn ratio and a fill that now passes: verified; the new ratio assertion fails on the base and the file passes here.
  • Changeset .changeset/doctor-kept-contrast-lapsed.md: true except in the grouped-variant case, and it contradicts the earlier note for the same row.
  • File .changeset/doctor-kept-contrast-lapsed.md: contradicts .changeset/doctor-kept-contrast.md:5.
  • File packages/cli/api/doctor/theme-checks.mjs: the "no longer needed" line is reached for a place that still fails.
  • File packages/cli/api/theme-edit/_adapter.mjs: grouped problems read as no problem; the outer withAccepted call changes nothing.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: no grouped-variant case; the ratio assertion accepts any number.

Automated review (maintainer link)

at.mode === a.mode,
),
inEffect: here.some(x => x.accepted),
ratioNow: open.length

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ratioNow is null whenever no problem with a readable place sits here, and acceptedContrastCheck then says the place passes. The editor's grouped problems carry no place (contrastPlace reads only text| and track| keys; variants| at _settings.mjs:12015, base| at :12027). On butter, keep the blue card's heading at 1.17:1, then give the green and purple cards the same #1e293b fill: show lists "text ("This week") in heading on 3 card variants (blue, green, purple) is 1.17:1 in light", and doctor says the record is no longer needed and the place passes. Count a record as no longer needed only when its place is measured and passes, for example by keeping each member's place on a grouped problem and matching against those.

const ctx = await context(root);
const res = await resolvedTokens(ctx, slug);
const covered = withAccepted(
const now = withAccepted(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: contrastProblems already ends with withAccepted(data, said, res) (_settings.mjs:12495), and a second pass returns its notes unchanged, so this outer call can go.

acceptedContrastCheck(await editorKeptContrastAt(cwd))?.message,
).toMatch(
/no longer holds?, because a color changed[^]*bv: badge \(variant info\)/,
/no longer holds?, because a color changed[^]*bv: badge \(variant info\) on badge in light at [\d.]+:1, kept at/,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: [\d.]+:1, kept at accepts any number. Matching at 2.3:1, kept at 2.09:1 proves the line prints the ratio drawn now, which is the change under test.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ready yet: approval waits on an engineering owner deciding how stable doctor reports the theme editor's kept contrast records, and one fix is needed whatever that decision is.

  • Approval waits on an engineering owner deciding whether doctor's theme-accepted-contrast row may read a lapsed record this way (always info, a problem again at the ratio drawn now, or no longer needed), because no current record covers the row (spec:AST-050 FR11 lists doctor's theme checks without it, and the theme-editor exception in spec:AST-017 FR27 does not list doctor), and the ruling recorded on #13272 calls a lapsed record a warning.
  • When the editor reports a kept place's failure as one problem across three or more variants, doctor still says the record is "no longer needed: its colors changed and it now passes" while the place draws at 1.17:1, because the new near fallback in packages/cli/api/theme-edit/_adapter.mjs:1042-1053 keeps at != null and a grouped problem has no place (on butter, keep the blue card's heading, then give the green and purple cards the same #1e293b fill).

An engineering owner records the decision by naming or adding the record that governs this row, or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. The second release note is gone and the first now matches the row.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: before this change, doctor called a changed record a problem again even where the new colors pass: verified (light badge info fill #0b4f5c on the base).
  • Claim: before this change, doctor printed the kept ratio rather than the one drawn now: verified (2.09:1 printed where the editor draws 2.3:1).
  • Claim: before this change, the warning carried no fix: verified (the base row has no fix).
  • Claim: a lapsed record is now a problem again at the ratio drawn now: verified (theme-checks.mjs:2465-2467; it prints 2.3:1, kept at 2.09:1).
  • Claim: a lapsed record reads as no longer needed where its place passes: verified for a measured place that passes; it is also said where a grouped failure still fails (second bullet above).
  • Claim: the row stays information: verified (theme-checks.mjs:2479).
  • Claim: the test covers the drawn ratio and a fill that now passes: verified; the file passes, 15 of 15.
  • Release note .changeset/doctor-kept-contrast.md: true except in the grouped-variant case.
  • File .changeset/doctor-kept-contrast.md: clear; it matches the row and the second note is gone.
  • File packages/cli/api/doctor/theme-checks.mjs: the "no longer needed" line is reached for a place that still fails.
  • File packages/cli/api/theme-edit/_adapter.mjs: the near fallback never holds a grouped problem; the outer withAccepted call changes nothing.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: no grouped-variant case; the ratio assertion accepts any number.

Automated review (maintainer link)

Comment on lines +1042 to +1053
// (A failure the editor reports across several variants at once
// names no one variant: one at the same part, ground and mode
// still says the place is not passing.)
const near = now.filter(
({at}) =>
at != null &&
at.part === a.part &&
at.ground === a.ground &&
at.when === '' &&
at.mode === a.mode,
);
const open = (here.length ? here : near).filter(x => !x.accepted);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

near keeps at != null, so it never holds the problem it is meant for: a failure the editor groups across three or more variants is keyed variants|… (_settings.mjs:12015), and contrastPlace returns null for every key but text| and track| (_settings.mjs:12702-12723). In the butter case the record has no variant, so near is the same list as here. At this head, keeping the blue card's heading at 1.17:1 and then giving the green and purple cards the same #1e293b fill still makes doctor say "no longer needed: its colors changed and it now passes: g: heading on card in light" while show lists the heading at 1.17:1 on 3 card variants. Report "no longer needed" only for a place that is measured and passes, for example by giving the grouped problem its members' places and matching against those, and add that case to the test.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d2b3d6c

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: an engineering owner's approval at this head settles how doctor reads the theme editor's kept contrast records, and one fix remains.

  • When the editor reports a kept place's failure as one problem across three or more variants, doctor says the record is "no longer needed: its colors changed and it now passes" while the place draws at 1.17:1, because the near fallback in packages/cli/api/theme-edit/_adapter.mjs:1045-1053 keeps only problems with a place and a grouped problem has none (on butter, keep the blue card's heading, then give the green and purple cards the same #1e293b fill).

The grouped-variant fix proposed in #13365 targets this branch and resolves this once it is on this pull request's head. Two non-blocking notes stay open on the existing inline threads: the ratio assertion at line 268 of the test accepts any number, and the outer withAccepted call changes nothing.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim: before this change, doctor called a changed record a problem again even where the new colors pass: verified (light badge info fill #0b4f5c on the base).
  • Claim: before this change, doctor printed the kept ratio rather than the one drawn now: verified (2.09:1 printed where the editor draws 2.3:1).
  • Claim: before this change, the warning carried no fix: verified (the base row has no fix).
  • Claim: a lapsed record is now listed as a problem again at the ratio drawn now: verified (theme-checks.mjs:2465-2467; it prints 2.3:1, kept at 2.09:1).
  • Claim: a lapsed record reads as no longer needed where its place passes: verified for a measured place that passes; it is also said where a grouped failure still fails (the bullet above).
  • Claim: the row stays information: verified (theme-checks.mjs:2479).
  • Claim: the test covers the drawn ratio and a fill that now passes: verified (test lines 268 and 279-285); the file passes, 15 of 15.
  • Claim: the author's preflight and replay passed at this head: not verified; they are local runs, and no CI workflow ran at this head.
  • Claim: the review findings are fixed in the paired #13365: that pull request proposes the fix, but it is not part of this head.
  • Release note .changeset/doctor-kept-contrast.md: true except in the grouped-variant case.
  • Owner decision: an engineering owner approved this head as written.
  • File .changeset/doctor-kept-contrast.md: clear.
  • File packages/cli/api/doctor/theme-checks.mjs: the "no longer needed" line is reached for a place that still fails.
  • File packages/cli/api/theme-edit/_adapter.mjs: the near fallback never holds a grouped problem; the outer withAccepted call changes nothing.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: no grouped-variant case; the ratio assertion accepts any number.

Automated review (maintainer link)

doctor warned that a kept contrast problem whose colors changed is a problem again even where the new colors pass, printed the kept ratio rather than the one drawn now, and its warning carried no fix. A lapsed acceptance is now a problem again at the ratio drawn now, or no longer needed where its place passes, and the row stays information.

[skip ci]
…ssing

When the editor reports a kept place's failure as one problem across several variants, it names no one variant, so doctor found no problem at the record's place and said it was no longer needed. A problem at the same part, ground and mode that names no variant now counts. The doctor release note says how a lapsed record reads, and the second note is gone.

[skip ci]
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04b-doctor-kept-contrast branch from 5cff489 to eb3534f Compare November 21, 2026 22:18
josephfarina added a commit that referenced this pull request Nov 21, 2026
… failing

A failure the editor reports across several variants at once carries no place doctor could read, so a kept record there was still called no longer needed while its place drew at 1.17:1. The record's standing is now read by one helper, which also counts a failure that names the same part and mode in its text.

Fixes the review finding on #13326.

[skip ci]
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/fx-13272 branch from d2b3d6c to 409ac97 Compare November 21, 2026 22:18
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 409ac97

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: an engineering owner's approval at this head settles how astryx doctor reads the theme editor's kept contrast records, and one fix remains.

  • A kept place that still fails is reported as passing when the editor groups its failure across variants: editorKeptContrastAt (packages/cli/api/theme-edit/_adapter.mjs, lines 1047–1062) leaves the drawn ratio empty for the editor's single problem across three or more variants, so on butter, keeping the blue card's heading at 1.17:1 and then giving the green and purple cards the same fill makes doctor say the record "is no longer needed: its colors changed and it now passes" while the editor still lists the heading at 1.17:1; count such a place as open and add that case to the test.

The fix proposed in #13365 targets this branch, so this finding can be rechecked once that change is part of this pull request. As a smaller note, the drawn-ratio assertion at line 268 of the test accepts any number.

Claims and files checked

Review mode: full; reason: rebase

  • Claim: doctor lists each kept record with its part, variant, ground, mode, ratio and reason — verified (theme-checks.mjs 2460–2464; test 241–249).
  • Claim: a lapsed record that still fails is listed as a problem again at the ratio drawn now — verified (theme-checks.mjs 2465–2467; test 265–269).
  • Claim: a lapsed record is listed as no longer needed where its place now passes — verified for a single-variant place (test 271–285); false for a place the editor reports across three or more variants (finding above).
  • Claim: the row is information — verified (theme-checks.mjs 2479).
  • Claim (description): the parent's review findings are fixed — verified for the passing place, the drawn ratio and the warning; the grouped-variant case stays open.
  • Claim (description): the tests cover the drawn ratio and a fill that now passes — verified; the test file passes at this head.
  • Claim (description): the gate results — not checkable at this head; they name an earlier commit.
  • File .changeset/doctor-kept-contrast.md — its "no longer needed where its place now passes" is false for grouped places until the code is fixed.
  • File packages/cli/api/doctor/theme-checks.mjs — clear on its own; it reads an empty drawn ratio as passing.
  • File packages/cli/api/theme-edit/_adapter.mjs — finding above.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs — no grouped-variant case; the drawn-ratio pattern accepts any number.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 409ac97 into josephfarina/theme-a/04b-doctor-kept-contrast Nov 22, 2026
9 checks passed
@github-actions
github-actions Bot deleted the josephfarina/theme-a/fx-13272 branch November 23, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 409ac973 Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant