Skip to content

doctor: a failure reported across several variants keeps a kept place failing - #13365

Closed
josephfarina wants to merge 2 commits into
josephfarina/theme-a/fx-13272from
josephfarina/theme-a/fx-13326
Closed

josephfarina wants to merge 2 commits into
josephfarina/theme-a/fx-13272from
josephfarina/theme-a/fx-13326

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the review finding on #13326: a failure the editor reports across several variants at once carries no place doctor can read, so a kept record there was still called "no longer needed" while its place drew at 1.17:1 (on butter: keep the blue card's heading, then give the green and purple cards the same fill). The record's standing is now read by one helper, keptNow, which reads such a failure by its own key (text part, ground and mode) and counts it at each variant it names.

Testing

theme-contrast-accepted-as-designed.test.mjs (a failure across variants, in the shape the editor reports, keeps the place failing; a failure on another ground does not; nothing failing reads as no longer needed).

Gate

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

@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:32pm UTC

Request Review

@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 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:52 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cdea8c8

@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: the behaviour this pull request reports is unchanged at this head, so the fix and its release note need another pass. An engineering owner has already recorded the spec decision for this head, so nothing waits on a maintainer.

  • Running the scenario in the description (on butter, keep the blue card's heading, then give the green and purple cards the same #1e293b fill), astryx doctor prints 1 kept contrast problem is no longer needed: its colors changed and it now passes on this head exactly as it does on the base, while the editor lists text ("This week") in heading on 3 card variants (blue, green, purple) is 1.17:1 in light.
  • The new rule cannot match that problem, because it requires the text to begin text in <part> (packages/cli/api/theme-edit/_settings.mjs:12742) while the grouped wording begins text ("<sample>") in <part> on N <ground> variants (_settings.mjs:12052) and its key is variants|…, which contrastPlace does not read; matching on that key, which carries the part, ground and mode, is the smaller fix.
  • .changeset/doctor-kept-contrast-grouped.md:5 tells consumers the row no longer calls such a record no longer needed, which the run above disproves, so the note should land with the fix rather than before it.
  • The loose arm compares only part and mode (_settings.mjs:12768), so a kept record whose own place passes is reported as a problem again from a failure on another ground: over the same fixture, a record for toast on the card ground in dark comes back at 4.16:1, taken from the base theme's text in toast ("Changes saved") is 4.16:1 in dark … the base theme draws it so.
  • The new test case builds its grouped problem as key: 'text-variants|heading|card' with text text in heading (variants blue, green, purple) … (theme-contrast-accepted-as-designed.test.mjs:495-498), a shape no code path emits, so it passes while the real path stays uncovered; building the case from contrastProblems, as theme-variant-problems-one-cause.test.mjs does, would have caught this.
Claims and files checked

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

  • Claim (release note): doctor's kept-contrast row no longer calls a record no longer needed while its part fails in a grouped variant problem — false; the end-to-end run on this head prints the old sentence.
  • Claim (description): a failure reported across several variants at once carries no place doctor can read — verified; the grouped key is variants|… and contrastPlace reads only text|… and track|… keys.
  • Claim (description): the record's standing is now read by one helper that also counts a failure naming the same part and mode in its text — verified as written, but that text rule does not match the grouped wording.
  • Claim (testing): the new test covers a grouped failure keeping the place failing — false in substance; its fixture is a problem shape the editor never emits, and the file's 17 tests pass either way.
  • File .changeset/doctor-kept-contrast-grouped.md: finding, the claim above.
  • File packages/cli/api/theme-edit/_settings.mjs: findings, the text rule misses the grouped wording and matches on part and mode alone.
  • File packages/cli/api/theme-edit/_adapter.mjs: clear; the call site matches the helper's contract, the dropped contrastPlace import has no other use, and the function's own documentation stays accurate.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: finding, the fixture shape above.
  • Also run: the touched test file (17 passed), ESLint over the three changed source files (clean), and the CLI strict typecheck (the same two pre-existing template errors on this head and the base).

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cc6f0bc

@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.

Approved pending CI: CI has not run on this head yet.

The grouped case now reads as a problem again at 1.17:1 rather than "no longer needed", and the earlier findings on this pull request are fixed. Two optional follow-ups: the test's kept record carries when: 'variant:blue', which the editor never writes for a card variant, so the !a.when path a real record takes has no test; and doctor now says "because a color changed … at 1.17:1, kept at 1.17:1" although the kept pair is unchanged.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Release note: doctor's kept-contrast row no longer calls a kept problem no longer needed while its part still fails in a problem reported across several variants at once. Verified: the described scenario prints "no longer needed" on the base and "a problem again … at 1.17:1" on this head.
  • Description: a failure reported across several variants carries no place doctor can read. Verified: its key starts variants|, and the place reader handles only text| and track| keys.
  • Description: on butter, keeping the blue card's heading and then giving the green and purple cards the same fill made doctor call the record no longer needed while it drew at 1.17:1. Verified on the base.
  • Description: one helper now reads such a failure by its own key (text part, ground and mode) and counts it at each variant it names. Verified in keptNow and acrossVariants; the adapter calls the helper once.
  • Testing: a grouped failure in the editor's shape keeps the place failing, a failure on another ground does not, and nothing failing reads as no longer needed. Verified: 18 tests pass, and the grouped fixture matches the editor's output.
  • Commit message: the loose text match is gone, so a failure on another ground never stands for a kept place. Verified.
  • .changeset/doctor-kept-contrast-grouped.md: clear.
  • packages/cli/api/theme-edit/_settings.mjs: clear, with a non-blocking note on the four-name limit of grouped variants.
  • packages/cli/api/theme-edit/_adapter.mjs: clear; one call and no leftover import.
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: clear, with a non-blocking note on the kept record's when.

Automated review (maintainer link)

const kept = /** @type {any} */ ({
part: 'heading',
ground: 'card',
when: 'variant:blue',

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: the editor writes no when for a card variant's heading (its accept line is --on heading --ground card --mode light), so a real record reaches the grouped failure through !a.when (_settings.mjs:12753), which no case covers. Dropping when here, or adding a case without it, tests the path doctor takes.

part: k[3],
ground: k[4],
mode: k[6],
variants: named.split(/,\s*/).map(v => v.replace(/ and \d+ more$/, '')),

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: the grouped text names at most four variants and then says and N more (:12052), so a record whose when is a fifth or later variant still reads as no longer needed. Records on a ground's variants carry no when and are unaffected, and no shipped part was found with five same-colored variants of its own. Carrying the variant names in the key would close it.

@josephfarina
josephfarina marked this pull request as ready for review November 21, 2026 15:37
… 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]
The fix matched a wording no code emits: a failure across three or more of a ground's variants reads 'text ("…") in <part> on N <ground> variants', with a variants key that names the text part, the ground and the mode. That key is now read, and the failure counts at each variant it names. The loose text match is gone, so a failure on another ground never stands for a kept place. The test builds the failure in the shape the editor reports.

[skip ci]
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/fx-13326 branch from cc6f0bc to a420a91 Compare November 21, 2026 22:18
@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 a420a91

@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.

Approved pending CI: CI has not finished on this head yet.

After the rebase the grouped case still reads correctly: with the blue card's heading kept and the green and purple cards given the same fill, astryx doctor now reports the kept problem as a problem again at 1.17:1 instead of "no longer needed".

  • Optional: the new unit test's kept record carries when: 'variant:blue', which the editor never writes for a card variant's heading, so the !a.when path doctor actually takes is not covered.
Claims and files checked

Review mode: full; reason: rebase

  • Changeset: the doctor row no longer calls a kept problem "no longer needed" while its place still fails in a failure grouped across variants — verified with the editor on butter (3 and 9 card variants) and at _settings.mjs:13546-13550.
  • Description: a grouped failure carried no place doctor could read, so the kept record was called no longer needed at 1.17:1 — verified on the base branch.
  • Description: one helper, keptNow, reads the grouped failure by its key and counts it at each variant it names — verified at _settings.mjs:13531-13582.
  • Description: the tests cover a grouped failure in the editor's shape, a failure on another ground, and nothing failing — verified; the fixture matches the key and text the editor writes, and the test file passes.
  • Description: the preflight and replay lines are stated for an earlier commit — not evidence for this head.
  • .changeset/doctor-kept-contrast-grouped.md — non-blocking: it is a separate entry for a fix to a doctor row that has not shipped yet.
  • packages/cli/api/theme-edit/_adapter.mjs — clear.
  • packages/cli/api/theme-edit/_settings.mjs — clear.
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs — non-blocking: the untested !a.when path above.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Folded into the change it fixes, in place.

@github-actions
github-actions Bot deleted the josephfarina/theme-a/fx-13326 branch November 23, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — a420a912 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