Skip to content

doctor: list the contrast problems an editor theme keeps as designed - #13272

Closed
josephfarina wants to merge 7 commits into
josephfarina/theme-a/04-accepted-variantfrom
josephfarina/theme-a/04b-doctor-kept-contrast
Closed

josephfarina wants to merge 7 commits into
josephfarina/theme-a/04-accepted-variantfrom
josephfarina/theme-a/04b-doctor-kept-contrast

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

astryx doctor lists each contrast problem an editor theme keeps as designed, with its part, variant, mode, ratio and reason, before the theme is added to the app.

Problem and solution fit

An editor theme can keep a contrast problem as designed with a reason. doctor now lists each one (theme-accepted-contrast), read by the editor itself, whether or not the theme has been added (an app copy carries no settings). One whose colors changed since covers nothing and is named apart. The disk is read in doctor's adapter, which loads the editor only when a folder at or above the working one holds a themes folder.

Evidence

  • Before: no acceptance was ever listed by doctor.
  • After: each acceptance is listed as <theme>: <part> (<variant>) on <ground> in <mode> at <ratio>:1 (<reason>); one whose colors changed since is listed apart, still as info: a problem again at the ratio drawn now, or no longer needed where its place now passes. A kept pair stays kept while other variants of its ground fail beside it.
  • Regression test: theme-contrast-accepted-as-designed.test.mjs (doctor lists a variant acceptance from a theme made with new).

Scope

Components: theme editor (doctor)

  • A new doctor check; no new command or option.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

The touched tests, the stack's theme-editor tests, the CLI strict typecheck and eslint, on this layer's tree.

Gate

preflight: pass 091bd9c
replay: worse 0 at 091bd9c

@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 22, 2026 6:18pm 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 22, 2026, 6:26 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 owner decision about this check, and four fixes are needed whatever that decision is.

  • Approval waits on an engineering owner deciding whether the stable doctor may report the experimental theme editor's contrast acceptances, because no current record covers the theme-accepted-contrast check and the theme-editor exception in spec:AST-017 FR27 does not list doctor.
  • editorKeptContrastAt lists every stored acceptance (packages/cli/api/theme-edit/_adapter.mjs:1016), so after an accepted color changes, doctor still says the problem is kept as designed while the editor's show lists it as an open problem again.
  • editorKeptContrast reads the disk in doctor's entry (packages/cli/api/doctor/doctor.mjs:3698-3703), which architecture:cli-surface INV21 keeps in the subject's adapter, so it belongs in api/doctor/_adapter.mjs.
  • The gate looks for themes beside the nearest package.json (doctor.mjs:3699) while the reader resolves the app with the editor's projectRoot, so from a subfolder whose package.json only sets "type": "module" doctor lists nothing although the editor finds the theme.
  • The description's After example says 3.9:1 where the same fixture prints 2.09:1, and its Scope list ticks "One defect is restored" for a change that adds a new check.

An engineering owner records the decision by naming or adding the record that governs this check, or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. Adding a doctor assertion to the "lapses when the variant fill changes" test would cover the first fix.

Claims and files checked
  • Review mode: full; reason: no-earlier-review
  • Claim: doctor lists each contrast problem an editor theme keeps, with part, variant, mode, ratio and reason: false in part, it also lists acceptances the editor no longer applies (_adapter.mjs:1016).
  • Claim: read through the editor's own settings reader: verified (_adapter.mjs:1016).
  • Claim: works before the theme is added to the app: verified (editedThemes reads only themes/).
  • Claim: the editor is loaded only for an app with a themes folder: verified (doctor.mjs:3699-3701), with the root caveat above.
  • Claim: doctor listed no acceptance before: verified (no such check at the base).
  • Claim: the After example prints 3.9:1: false, the same fixture prints 2.09:1.
  • Claim: the regression test shows doctor listing a variant acceptance: partly, the test calls the two helpers rather than doctor.
  • Claim: one defect is restored: false, this adds a new check.
  • Claim: no new public API is hidden under a bug-fix label: verified.
  • Claim: no internal context in public text: verified.
  • Claim: touched tests and eslint pass: verified on the head.
  • File .changeset/doctor-kept-contrast.md: overstates what is listed (see the acceptance finding).
  • File packages/cli/api/doctor/doctor.mjs: adapter and root findings.
  • File packages/cli/api/doctor/theme-checks.mjs: clear.
  • File packages/cli/api/theme-edit/_adapter.mjs: lapsed-acceptance finding.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: no assertion for doctor itself or for a lapsed pair.

Automated review (maintainer link)

Comment thread packages/cli/api/doctor/doctor.mjs Resolved
Comment thread packages/cli/api/doctor/doctor.mjs Resolved
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04-accepted-variant branch from 0735f64 to 8147d18 Compare November 21, 2026 11:45
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04b-doctor-kept-contrast branch from 5d139fe to 5cff489 Compare November 21, 2026 11:45

@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 owner decision about this check, and two fixes are needed whatever that decision is. The four fixes from the earlier review are in.

  • Approval waits on an engineering owner deciding whether the stable doctor may report the experimental theme editor's contrast acceptances, and how a lapsed one reads, because no current record covers the theme-accepted-contrast check and the theme-editor exception in spec:AST-017 FR27 does not list doctor.
  • After a person changes an accepted color so the place passes, doctor still warns that the kept problem "is a problem again" while the editor's show lists no problem there, and a lapsed line prints the accepted ratio instead of the one drawn now (packages/cli/api/theme-edit/_adapter.mjs:1038, packages/cli/api/doctor/theme-checks.mjs:2468).
  • The new warn carries no fix, although the published DoctorCheck type says one is always present on warn and fail (packages/cli/api/doctor/doctor.type.mjs:23, packages/cli/api/doctor/theme-checks.mjs:2471-2476).

An engineering owner records the decision by naming or adding the record that governs this check, or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. A case in the "lapses when the variant fill changes" test where the new color passes would cover the first fix.

Claims and files checked

Review mode: full; reason: rebase

  • Claim: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added: verified (theme-checks.mjs:2458-2459, and a doctor run on the test fixture).
  • Claim: a record whose colors changed is named apart, as a problem again, with a warning: verified for a pair that still fails; also applied to a place that passes again (second bullet above).
  • Claim: the records are read by the editor itself, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1015-1055).
  • Claim: the disk is read in doctor's adapter, which loads the editor only when a folder at or above the working one holds a themes folder: verified (doctor/_adapter.mjs:1948-1956).
  • Claim: doctor listed no acceptance before: verified (no such check at the base).
  • Claim: the regression test shows doctor listing a variant acceptance: partly, the test calls the check builder and the editor reader rather than a doctor run; a doctor run lists it.
  • Claim: a new doctor check with no new command or option, no tagalong and no public API: verified.
  • Claim: no internal context in public text: verified.
  • Claim: the touched tests, contrast tests, strict typecheck and eslint pass: verified for the touched, doctor and contrast suites, eslint and the strict typecheck; the full theme-editor suite was not rerun.
  • File .changeset/doctor-kept-contrast.md: clear.
  • File packages/cli/api/doctor/_adapter.mjs: clear.
  • File packages/cli/api/doctor/doctor.mjs: clear.
  • File packages/cli/api/doctor/theme-checks.mjs: lapsed wording, ratio and missing fix.
  • File packages/cli/api/theme-edit/_adapter.mjs: a passing place marked as a problem; the second withAccepted pass is a no-op.
  • File packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: no case for a place that passes again, and no doctor run.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Covers the theme-editor reading this pull request records (the owner's ruling on the contrast readings): the doctor row names lapsed acceptances apart, as a warning, and its stable text names no experimental surface.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5cff489

@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: the engineering owner's ruling at this head settles that astryx doctor may list the contrast problems an editor theme keeps as designed, and two fixes remain.

  • After a person changes an accepted color so the pair passes, doctor still warns that the kept problem "is a problem again" and prints the accepted ratio rather than the one drawn now (packages/cli/api/theme-edit/_adapter.mjs:1038, packages/cli/api/doctor/theme-checks.mjs:2468).
  • The new warn carries no fix, though DoctorCheck documents fix as always present on warn (packages/cli/api/doctor/doctor.type.mjs:23); since the ruling keeps the experimental editor out of doctor's text, give it a fix that names no experimental surface, or keep the check info.

#13326 says it makes both fixes; once it lands in this branch, the new head gets its own review.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added to the app: verified (theme-checks.mjs:2458-2466; editedThemes reads the editor's themes folder, no theme add needed).
  • Changeset: one whose colors changed is named apart, as a problem again, with a warning: true for a pair that still fails; false where the new colors pass (theme-edit/_adapter.mjs:1038, theme-checks.mjs:2468), the first finding above.
  • Description: read by the editor itself, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1015-1055).
  • Description: one whose colors changed covers nothing and is named apart: verified for a failing pair; also applied to a place that passes, the first finding above.
  • Description: the disk is read in doctor's adapter, which loads the editor only when a themes folder sits at or above the working folder: verified (doctor/_adapter.mjs:1948-1956; doctor.mjs:3632 only calls it).
  • Description, before: doctor never listed an acceptance: verified (no such check at the base).
  • Description, after: the line format, and a changed-color record listed apart with a warning as a problem again: format verified; false for a place that passes (the first finding above).
  • Description, regression test: doctor lists a variant acceptance from a theme made with new: partly: the test calls the two helpers, not doctor's run (theme-contrast-accepted-as-designed.test.mjs:241-249).
  • Description, scope: a new doctor check, no new command or option: verified.
  • Description, scope: separable tagalongs removed; no public API, default or interaction model hidden; no internal context in public text: verified (no tagalong; no export changes; no internal context found in the added lines, title, body, branch or commit message).
  • Description, testing: touched tests, the theme-editor tests, the strict typecheck and eslint: partly checked: touched and nearby suites pass, eslint clean, strict typecheck passes once the neutral theme is built; the full theme-editor suite was not run.
  • Description, gate: local preflight and replay results: not reproducible here; at this head the review-pass and review-signal workflows pass and no full CI run exists (the commit skips CI).
  • Description, gate: review findings are fixed by the paired pull request: #13326 states both fixes and targets this branch; this head still has both defects.
  • Owner comment: the row names lapsed acceptances apart, as a warning, and its stable text names no experimental surface: verified for the label and message (theme-checks.mjs:2456-2475); the warning still has no fix.
  • .changeset/doctor-kept-contrast.md: its changed-color sentence is covered by the first finding above; otherwise clear.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: the first finding above (wording, ratio, status) and the second finding above (no fix on warn).
  • packages/cli/api/theme-edit/_adapter.mjs: the first finding above (in-effect mark for a passing place); non-blocking: redundant second withAccepted pass.
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking: calls the helpers only; no passing-place case.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04b-doctor-kept-contrast branch from 5cff489 to eb3534f Compare November 21, 2026 22:18
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04-accepted-variant branch from 8147d18 to c77b318 Compare November 21, 2026 22:18
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec eb3534f

@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 ruling settles that astryx doctor may list the contrast problems an editor theme keeps as designed, and two fixes remain.

  • After a person changes an accepted color so the pair passes, doctor still warns that the kept problem "is a problem again" and prints the accepted ratio rather than the one drawn now (packages/cli/api/theme-edit/_adapter.mjs:1040, packages/cli/api/doctor/theme-checks.mjs:2468).
  • The new warn carries no fix, though DoctorCheck documents fix as always present on warn (packages/cli/api/doctor/doctor.type.mjs:23); since the ruling keeps the experimental editor out of doctor's text, give it a fix that names no experimental surface, or keep the check info.

#13326, still open on top of this branch, is titled for the first fix; once the fixes land here, the new head gets its own review.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added to the app: verified (theme-checks.mjs:2458-2466).
  • Changeset: one whose colors changed is named apart, as a problem again, with a warning: true for a pair that still fails; false where the new colors pass (theme-edit/_adapter.mjs:1040, theme-checks.mjs:2468), the first finding above.
  • Description: read by the editor itself, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1017-1057).
  • Description: one whose colors changed covers nothing and is named apart: verified for a failing pair; also applied to a place that passes, the first finding above.
  • Description: the disk is read in doctor's adapter, which loads the editor only when a themes folder sits at or above the working folder: verified (doctor/_adapter.mjs:1948-1956; doctor.mjs:3632 only calls it).
  • Description, before: doctor never listed an acceptance: verified (no such check at the base).
  • Description, after: the line format, and a changed-color record listed apart with a warning as a problem again: format verified; false for a place that passes, the first finding above.
  • Description, regression test: doctor lists a variant acceptance from a theme made with new: partly: the test calls the two helpers, not doctor's run (theme-contrast-accepted-as-designed.test.mjs:241-249).
  • Description, scope: a new doctor check, no new command or option: verified.
  • Description, scope: no tagalongs; no public API, default or interaction model hidden; no internal context in public text: verified.
  • Description, testing: the touched tests, the theme-editor tests, the strict typecheck and eslint: verified for the touched test, the theme editor's contrast suites, doctor's suites, the strict typecheck and eslint; the rest of the theme-editor suite was not run.
  • Description, gate: local preflight and replay results at this head: not reproducible here; no CI test run exists for this code.
  • Description, gate: rebased onto main with the pull request's own diff unchanged: verified (the patch is identical).
  • Owner comment: lapsed acceptances are named apart, as a warning, and the stable text names no experimental surface: verified for the label and message (theme-checks.mjs:2456-2477); the warning still has no fix.
  • .changeset/doctor-kept-contrast.md: its changed-color sentence is covered by the first finding above; otherwise clear.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: the first finding above (wording, ratio, status) and the second (no fix on warn).
  • packages/cli/api/theme-edit/_adapter.mjs: the first finding above (in-effect mark for a passing place); non-blocking: a redundant second withAccepted pass.
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking: calls the helpers only; no passing-place case.

Automated review (maintainer link)

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

Not ready yet: approval waits on an engineering owner decision about how doctor shows a kept contrast problem that no longer applies, and three fixes are needed whatever that decision is.

  • Approval needs an engineering owner to decide whether the earlier ruling on this pull request, which names lapsed acceptances apart "as a warning", covers this head's info-only row (packages/cli/api/doctor/theme-checks.mjs:2479); an engineering owner records it here, for example with /approve-spec <full head SHA>, and the author may do so as an engineering owner.
  • After a person keeps a heading on a #333333 card and then gives five more card variants the same fill, doctor says the kept problem "no longer holds, because a color changed" at "1.66:1, kept at 1.66:1" though the kept pair is drawn unchanged (packages/cli/api/doctor/theme-checks.mjs:2486-2489, via packages/cli/api/theme-edit/_settings.mjs:13546-13556), so name a cause only after checking the record's colors, or keep that pair out of the across-variants grouping.
  • .changeset/doctor-kept-contrast-grouped.md announces that the row "no longer" misreads grouped failures, but the row first ships in this pull request, so the note describes a fix no release needs and should be deleted.
  • The description's Evidence line says a changed-color record is listed "with a warning", but every row is now info and a place that passes reads "no longer needed", so update it once the decision above is made.

Both findings from the last review are fixed.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Release note: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added: verified (theme-checks.mjs:2460-2464; test lines 240-249).
  • Release note: a record whose colors changed is named apart as a problem again at the ratio drawn now: verified (theme-checks.mjs:2465-2467; test lines 264-269); in the grouped-variant case doctor also names a record whose colors did not change, finding above.
  • Release note: or as no longer needed where its place now passes: verified (theme-checks.mjs:2468-2470; test lines 273-285).
  • Release note: the row is information: verified (theme-checks.mjs:2479).
  • Second release note: the row no longer calls a kept problem no longer needed while a grouped failure still covers it: true for a record kept without a variant (_settings.mjs:13546-13550), but the row is new in this pull request, finding above.
  • Description: doctor lists the kept problems before the theme is added: verified.
  • Description: read by the editor itself, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1018-1044).
  • Description: a record whose colors changed covers nothing and is named apart: verified; also applied to an unchanged pair in the grouped case, finding above.
  • Description: the disk is read in doctor's adapter, which loads the editor only when a themes folder sits at or above the working folder: verified (doctor/_adapter.mjs:1948-1956, doctor.mjs:3632).
  • Description, before: doctor never listed an acceptance: verified.
  • Description, after: the line format: verified; listed apart "with a warning": false, finding above.
  • Description, regression test: doctor lists a variant acceptance from a theme made with new: partly; the test calls the two helpers, not doctor's run.
  • Description, scope: a new doctor check, no new command or option, no hidden public API, no internal context: verified.
  • Description, testing: the touched tests, the theme-editor tests, the strict typecheck and eslint: verified for the touched tests, doctor's and the editor's contrast suites and eslint; the strict typecheck reports errors only in two templates that need an unbuilt theme.
  • Description, gate: the preflight and replay results describe an earlier revision; not reproduced for this one.
  • Earlier ruling: lapsed acceptances are named apart and the stable text names no experimental surface: verified (theme-checks.mjs:2477-2495); "as a warning": the row is info, decision pending.
  • .changeset/doctor-kept-contrast-grouped.md: finding above (delete).
  • .changeset/doctor-kept-contrast.md: clear.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: the cause finding above; the info status waits on the decision.
  • packages/cli/api/theme-edit/_adapter.mjs: non-blocking: a second withAccepted pass that changes nothing.
  • packages/cli/api/theme-edit/_settings.mjs: the grouped branch feeds the cause finding; non-blocking: grouped variants and ratio are read from the problem's sentence.
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking: the new cases keep a card heading with a variant, a shape the editor does not record, and the doctor cases call the helpers only.

Automated review (maintainer link)

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: this reads the variants from the problem's sentence, which names at most four (… and N more, built at line 12813), and the ratio is the group's lowest; a group whose text has no part of its own also gets an empty part from the key. Carrying the names, the part and each variant's ratio as fields on the grouped problem would remove the parsing.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a420a91

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec b3f8879

@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: one fix is needed. The engineering owner's approvals settle the info-only theme-accepted-contrast row, and the three findings from the last review are fixed.

  • The new keptRecords and keptAsDesigned constants sit between oneNotePerCause and its JSDoc in packages/cli/api/theme-edit/_settings.mjs, so the CLI strict typecheck that CI runs fails with TS7006: Parameter 'list' implicitly has an 'any' type at line 12779; move the two constants above the comment block at line 12747.

Non-blocking: keptAsDesigned repeats withAccepted's record match without its ratio check, so one shared predicate would keep the two in step.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0)
  • Release note: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added: verified (doctor/theme-checks.mjs:2462-2464, test lines 197-252).
  • Release note: one whose colors changed is named apart, as a problem again at the ratio drawn now, or as no longer needed where its place passes: verified (theme-checks.mjs:2465-2470, test lines 296-336).
  • Release note: the row is information: verified (theme-checks.mjs:2479).
  • Description: the editor itself reads the records, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1018-1044).
  • Description: doctor's adapter reads the disk and loads the editor only when a folder at or above the working one holds a themes folder: verified (doctor/_adapter.mjs:1948-1956).
  • Description: before this change, doctor listed no acceptance: verified (no such check on the base).
  • Description: a kept pair stays kept while other variants of its ground fail beside it: verified (theme-edit/_settings.mjs:12795, test lines 254-294).
  • Description: the regression test lists a variant acceptance from a theme made with new: verified (test lines 197-252).
  • Description: a new doctor check with no new command, option or hidden public API: verified.
  • Description: tested with the CLI strict typecheck: false (TS7006 at _settings.mjs:12779).
  • .changeset/doctor-kept-contrast.md: clear.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: clear.
  • packages/cli/api/theme-edit/_adapter.mjs: non-blocking (second withAccepted pass).
  • packages/cli/api/theme-edit/_settings.mjs: blocking (TS7006 at 12779); non-blocking (duplicated record match, sentence parsing).
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: clear.

Automated review (maintainer link)

(a.when ?? '') === at.when &&
a.mode === at.mode &&
a.color === pair.color &&
a.groundColor === pair.groundColor,

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: this repeats withAccepted's record match (lines 13696-13705) but leaves out its ratio check (at.ratio + 0.005 >= a.ratio), so a see-through kept pair drawn lower stays out of the grouping without being accepted. One shared predicate for "the record at this place and pair" would keep the two in step.

@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04b-doctor-kept-contrast branch from b3f8879 to e0c3a28 Compare November 22, 2026 15:50
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e0c3a28

@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 engineering owner's approvals settle the information-only theme-accepted-contrast row, and the typecheck failure from the last review is fixed.

Non-blocking: keptAsDesigned repeats withAccepted's record match without its ratio check, and no test drives doctor() itself, so the themes gate and the row's place in the report are covered only by direct calls to the reader.

Claims and files checked

Review mode: full; reason: history

  • Release note: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added: verified (doctor/theme-checks.mjs:2460-2464; a doctor() run on a theme made with new and never added)
  • Release note: a record whose colors changed is named apart, as a problem again at the ratio drawn now, or as no longer needed where its place passes: verified (theme-checks.mjs:2465-2470; doctor() runs after a failing and a passing fill change)
  • Release note: the row is information: verified (theme-checks.mjs:2479)
  • Description: the editor itself reads the records, whether or not the theme has been added, because an app copy carries no settings: verified (theme-edit/_adapter.mjs:1018-1044; the app copy writes only the doc, module, stylesheet and fonts files)
  • Description: doctor's adapter reads the disk and loads the editor only when a folder at or above the working one holds a themes folder: verified (doctor/_adapter.mjs:1948-1956)
  • Description: before this change doctor listed no acceptance: verified (no such check in the base's doctor)
  • Description: the listed format, and changed records listed apart while the row stays information: verified (doctor() runs in every state)
  • Description: a kept pair stays kept while other variants of its ground fail beside it: verified (three other card variants failing in another fill leave the record kept; _settings.mjs:12795)
  • Description: the regression test lists a variant acceptance from a theme made with new: verified (test lines 240-250)
  • Description: a new doctor check, with no new command, option, public API or hidden default: verified
  • Description: no tagalongs, and no internal context in public text: verified
  • Description: tested with the touched tests, the editor's tests, the CLI strict typecheck and eslint: verified at this head (touched test, editor acceptance and grouping suites, doctor suites, strict typecheck, eslint)
  • Description: this revision differs from the last reviewed one only by moving one helper above a doc comment: verified (only the oneNotePerCause doc comment moved)
  • .changeset/doctor-kept-contrast.md: clear
  • packages/cli/api/doctor/_adapter.mjs: clear
  • packages/cli/api/doctor/doctor.mjs: clear
  • packages/cli/api/doctor/theme-checks.mjs: clear
  • packages/cli/api/theme-edit/_adapter.mjs: non-blocking (second withAccepted pass, editor context opened per theme)
  • packages/cli/api/theme-edit/_settings.mjs: non-blocking (record match repeated without the ratio check; variants read from the problem's sentence)
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking (no test drives doctor() itself)

Automated review (maintainer link)

if (!kept.length) continue;
const ctx = await context(root);
const res = await resolvedTokens(ctx, slug);
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 returns withAccepted(data, said, res) (_settings.mjs:13318), so this second pass changes nothing; keptNow(a, await contrastProblems(ctx, data, res)) reads the same. context(root) two lines up can also move above the loop, so a project with several editor themes opens it once.

undo: 'astryx experimental theme editor set bv contrast-accepted none --on badge --when variant:info --ground badge --mode light',
}),
]);
// doctor lists it too, read from the editor settings, with its variant.

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: these assertions call the reader and acceptedContrastCheck directly, so the themes gate in doctor/_adapter.mjs and the push at doctor.mjs:3632 are untested. One (await doctor({cwd})).data.checks.find(c => c.id === 'theme-accepted-contrast') assertion here would cover both; it returns the same row today.

An editor theme can keep a contrast problem as designed, with a reason. doctor now lists each one, with its part, variant, mode, ratio and reason, read by the editor itself, whether or not the theme has been added to the app. One whose colors changed since covers nothing and is named apart, with a warning, as the editor's show lists it as open again. The disk is read in doctor's adapter, which loads the editor only when a folder at or above the working one holds a themes folder.

[skip ci]
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]
… 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]
…e same fill

A pair the theme keeps as designed is left out of the across-variants grouping, so the record still covers it while other variants fail beside it, and doctor never calls it lapsed while its colors are unchanged. The grouped changeset goes: that row first ships here.

[skip ci]
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04b-doctor-kept-contrast branch from e0c3a28 to c5f922e Compare November 22, 2026 16:29
@josephfarina
josephfarina force-pushed the josephfarina/theme-a/04-accepted-variant branch from c77b318 to 4bcfd12 Compare November 22, 2026 16:29
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c5f922e

@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: one fix is needed. The engineering owner's approvals still settle the information-only theme-accepted-contrast row, and the rebased revision passes the strict typecheck, lint and the doctor and editor tests.

  • Miss: when the editor cannot render the components (react-dom not found, or another render failure once its census cache is rebuilt), editorKeptContrastAt (packages/cli/api/theme-edit/_adapter.mjs:1028-1035) still sorts every record with keptNow, so astryx doctor says each kept contrast problem "is no longer needed: its colors changed and it now passes" though nothing was measured; skip keptNow when ctx.unchecked is set (list the records as kept or not checked) and add a test that clears the census cache and react-dom.

Non-blocking: keptAsDesigned repeats withAccepted's record match without its ratio check, and no test drives doctor() itself.

Claims and files checked

Review mode: full; reason: rebase

  • Release note: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason, before the theme is added: verified (doctor/theme-checks.mjs:2460-2464; a doctor() run on a theme made with new and never added)
  • Release note: a record whose colors changed is named apart as a problem again at the ratio drawn now: verified (theme-checks.mjs:2465-2467; doctor() after a failing fill change)
  • Release note: or as no longer needed where its place now passes: verified where the theme is measured; false when the editor cannot render the components (theme-edit/_adapter.mjs:1028-1035)
  • Release note: the row is information: verified (theme-checks.mjs:2479)
  • Description: the editor itself reads the records, whether or not the theme has been added, because an app copy carries no settings: verified (theme-edit/_adapter.mjs:1018-1044)
  • Description: doctor's adapter reads the disk and loads the editor only when a folder at or above the working one holds a themes folder: verified (doctor/_adapter.mjs:1948-1956)
  • Description: before this change doctor listed no acceptance: verified (no such check in the base's doctor)
  • Description: the listed format, and changed records listed apart while the row stays information: verified (doctor() runs in each state), apart from the unrendered case above
  • Description: a kept pair stays kept while other variants of its ground fail beside it: verified (the five-variant test passes; _settings.mjs:13194)
  • Description: the regression test lists a variant acceptance from a theme made with new: verified (test lines 241-249)
  • Description: a new doctor check, with no new command, option, public API, visual representation or default: verified
  • Description: no tagalongs, and no internal context in public text: verified
  • Description: tested with the touched tests, the editor's tests, the CLI strict typecheck and eslint: verified at this revision (424 tests, strict typecheck and eslint clean)
  • Description: the gate lines record a run at the revision before the rebase: not evidence for this revision
  • .changeset/doctor-kept-contrast.md: its "no longer needed" sentence is false only in the unrendered state, closed by the fix below
  • packages/cli/api/doctor/_adapter.mjs: clear
  • packages/cli/api/doctor/doctor.mjs: clear
  • packages/cli/api/doctor/theme-checks.mjs: clear
  • packages/cli/api/theme-edit/_adapter.mjs: blocking (unrendered census); non-blocking (second withAccepted pass, editor context opened per theme)
  • packages/cli/api/theme-edit/_settings.mjs: non-blocking (record match repeated without the ratio check; variants read from the problem's sentence)
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking (no test drives doctor() or an unrendered census)

Automated review (maintainer link)

…s kept

Where the editor cannot draw the components (react-dom missing, a render that fails), nothing is measured, so each kept record is listed as kept, never as "no longer needed".

[skip ci]
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 091bd9c

@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. With react-dom missing and the editor's census cache cleared, astryx doctor now lists each kept contrast problem as kept instead of "no longer needed", and the engineering owner's approvals still settle the information-only theme-accepted-contrast row.

Non-blocking:

  • theme-contrast-kept-unchecked.test.mjs passes without the fix, because its mocked context() keeps the real, measured census; making the mocked partData throw a render failure, or removing the census cache and react-dom, would make it guard the fix.
  • In that unrendered state a record whose colors changed also reads "kept as designed" at its recorded ratio; a word that it was not measured would help.
  • Earlier notes stand: keptAsDesigned repeats withAccepted's record match without its ratio check, and no test drives doctor() itself.
Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none
  • Release note: doctor lists each kept contrast problem with its part, variant, mode, ratio and reason before the theme is added: verified (doctor/theme-checks.mjs:2460-2464; theme-contrast-accepted-as-designed.test.mjs:240-249)
  • Release note: a record whose colors changed is named apart as a problem again at the ratio drawn now: verified where the theme is measured (doctor() after a failing fill change: 2.3:1, kept at 2.09:1)
  • Release note: or as no longer needed where its place now passes: verified where the theme is measured (test lines 321-327); no longer said when the components cannot render (theme-edit/_adapter.mjs:1032-1036)
  • Release note: the row is information: verified (theme-checks.mjs:2479)
  • Description: the editor itself reads the records, whether or not the theme has been added: verified (theme-edit/_adapter.mjs:1019-1052)
  • Description: doctor's adapter reads the disk and loads the editor only when a folder at or above the working one holds a themes folder: verified (doctor/_adapter.mjs:1948-1956)
  • Description: before this change doctor listed no acceptance: verified (no such check at the base)
  • Description: the listed format, and changed records listed apart while the row stays information: verified (doctor() runs in each state)
  • Description: a kept pair stays kept while other variants of its ground fail beside it: verified (the five-variant test passes; _settings.mjs:13194)
  • Description: the regression test lists a variant acceptance from a theme made with new: verified (test lines 240-249)
  • Description: a new doctor check, with no new command, option, public API, visual representation or default: verified
  • Description: no tagalongs, and no internal context in public text: verified
  • Description: tested with the touched tests, the editor's tests, the CLI strict typecheck and eslint: verified at this revision (20 tests, typecheck and eslint clean)
  • Description: the gate lines say pending: not evidence for this revision
  • .changeset/doctor-kept-contrast.md: clear
  • packages/cli/api/doctor/_adapter.mjs: clear
  • packages/cli/api/doctor/doctor.mjs: clear
  • packages/cli/api/doctor/theme-checks.mjs: clear
  • packages/cli/api/theme-edit/_adapter.mjs: non-blocking (unrendered state not named in the row; second withAccepted pass; editor context opened per theme)
  • packages/cli/api/theme-edit/_settings.mjs: non-blocking (record match repeated without the ratio check; variants read from the problem's sentence)
  • packages/cli/api/theme-edit/theme-contrast-accepted-as-designed.test.mjs: non-blocking (no test drives doctor())
  • packages/cli/api/theme-edit/theme-contrast-kept-unchecked.test.mjs: non-blocking (passes without the fix)

Automated review (maintainer link)

return {
...real,
context: async (/** @type {string} */ root) => ({
...(await real.context(root)),

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: this keeps the real context's measured census and only adds unchecked, so editorKeptContrastAt from the previous revision measures it too and finds the record in effect: run against that revision's adapter, this test passes. To guard the fix, make the mocked partData (_parts.mjs) throw an AstryxError with ERR_RENDER_MISSING_DEPENDENCY, so the real context() returns its empty census, or remove the census cache and the react-dom link as a person meets it.

// record is listed as kept, never as lapsed.)
if (ctx.unchecked) {
for (const a of kept)
out.push({slug, ...a, inEffect: true, ratioNow: null});

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: here a record whose colors changed also reads "kept as designed" at its recorded ratio (two badge records, one with its fill changed to #46b8da, both read at 2.09:1 with react-dom unlinked), and the row does not say nothing was measured. A clause such as "not checked: the components could not be rendered" would tell the person why the listing may be out of date.

josephfarina added a commit that referenced this pull request Nov 22, 2026
josephfarina added a commit that referenced this pull request Nov 22, 2026
@github-actions
github-actions Bot deleted the josephfarina/theme-a/04b-doctor-kept-contrast branch November 23, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — 091bd9ce Deployed Nov 22, 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