Skip to content

chore(comments): code comments explain the code, not its history - #200

Merged
mmcky merged 9 commits into
mainfrom
chore/code-comments
Sep 11, 2026
Merged

chore(comments): code comments explain the code, not its history#200
mmcky merged 9 commits into
mainfrom
chore/code-comments

Conversation

@mmcky

@mmcky mmcky commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Code comments across the theme explained the code through the history of the parity project: phase numbers (Phase 6 (#92)), tracker issues used as labels, PLAN.md items, and "matches the Sphinx build" given as the reason for a value. That context already lives in git, the PRs and CHANGELOG.md, and in the code it goes stale once the project closes. This PR rewrites those comments to say what the code does and why, corrects the comments that turned out to be wrong about the code, and adds the rule to CONTRIBUTING.md so new code follows it.

The theme's behaviour does not change. Apart from the renamed test titles, one CI step name and one fixture string listed below, every edit is to comment text.

The rule

A new Code comments section in CONTRIBUTING.md:

  • No project framing. No phase numbers, PLAN.md items, milestones or tracker issues.
  • No issue numbers as labels. Link an issue or PR only when it holds detail a comment cannot give in a line (an upstream bug being worked around, a field a fork adds, the regression a test exists to catch, the measurements a claim rests on), and state the point in the comment too.
  • Reasons, not comparisons. Give the measurement, contrast ratio or constraint rather than "matches the Sphinx build". Code ported from another project keeps one line of provenance.

What changed

47 files: 19 in app/, 13 in tests/, 4 in styles/, 3 workflows, plugins/git-metadata.mjs, scripts/relative-css-asset-urls.mjs, and CONTRIBUTING.md, Makefile, .npmrc, playwright.config.ts, tailwind.config.js and template.yml at the root.

The largest share, about a third of the changed lines, is styles/quantecon.css, where about 40 values were justified by the Sphinx build; those comments now give each value's own reason. Most of the rest is the same kind of rewrite, with reasons that leaned on the Sphinx build or history told in the past tense restated as what the code does (chiefly tests/visual/theme.spec.ts, app/components/Outline.tsx, app/types.ts and tests/visual/fouc.spec.ts), plus short labels such as (Phase 4, #90) or -- #186 coming off otherwise sound comments.

Edits that are not comment text:

Where Before After
tests/visual/theme.spec.ts On this page outline (#182) On this page outline
tests/visual/theme.spec.ts Meta/SEO and notebook output polish (#92) Meta/SEO and notebook output
tests/visual/theme.spec.ts Site options reach the theme (#173) Site options reach the theme
tests/visual/static.spec.ts Static build -- in-page anchors (#186) Static build -- in-page anchors
tests/unit/seo.test.mjs the Sphinx set, on a lecture page … the full set, on a lecture page …
.github/workflows/ci.yml step Run FOUC guard (QuantEcon/quantecon-theme-src#66) Run FOUC guard
no-thebe fixture notebook stderr output text ending (#92) tag dropped

Screenshot baselines are named explicitly in each toHaveScreenshot call rather than derived from test titles, and nothing filters tests by title, so the renames move no baseline. The CI step name is not a status check; job names are unchanged.

Corrected along the way

Two review passes turned up comments that were wrong about the code; they now match it:

  • Contrast. Six light code colours fall short of AA, not two: the table in Five light-mode code token colours fall short of WCAG AA contrast #172 leaves out the diff-addition green (3.5:1). Numbers measure 3.2:1, not 3.4:1; the stderr label is 5.5:1, not 7.0:1; the link colour is 5.08:1. Dark-mode ratios for literals, emphasis, strong text and the footer were measured against stone-900, but that text sits on the #222 content panel, so they are restated for that ground.
  • Sizes. UNITS said the root always stays at 16px, but the toolbar's font-size control steps it to 0.9rem or 1.1rem. The figure and paragraph comments quoted 16px, 8px and 1rem for what is 1em (18px) and 0.5em (9px).
  • Meta tags. app/seo.ts and both route meta functions described the social tags as filling gaps in upstream's set; they also replace upstream's twitter:card, and twitter_logo_url wins over a page thumbnail.
  • First paint. app/root.tsx said the sans-serif tail renders before the webfont lands, where normally the metric-matched fallback face does, and its keep-in-sync list pointed at upstream's Document for the <body> class that this theme renders in app/components/Document.tsx.
  • Test harness. playwright.config.ts and preview.yml said the Playwright harness never runs a static myst build --html; the static-chrome project does.
  • Smaller ones. "Hydration currently fails on every load" in tests/visual/fouc.spec.ts (current builds hydrate cleanly); a site-options note calling twitter:site an open gap (social-meta asserts it); a release.yml paragraph about a make deploy target that no longer exists; a PLAN.md claim about the plugin's long-term home; two quantecon.css pointers to a removed tailwind.config.js note; a template.yml pointer to a README section that does not exist (now docs/launch.md); "a directory above" _assets/ in scripts/relative-css-asset-urls.mjs, where routes/ sits beside it; and the multilingual suite's doc comment, which had drifted above the outline suite.

References kept

A link stays where its thread holds detail the comment cannot carry:

One provenance line stays on code ported from quantecon-book-theme (launch.py, scrollspy.js, the git-metadata and i18n helpers, the _code.scss palette) and on update-snapshots.yml. The three template.yml option descriptions that name the book-theme equivalents are left as they are: they are user-facing, and a lecture repo migrating its _config.yml needs that mapping.

Verification

  • No code changed, checked mechanically. Every changed file was compared with main after stripping comments from both sides: TypeScript's printer for TS, TSX and JS, postcss for CSS, parsed YAML with shell comments dropped from run: blocks, parsed JSON, and full-line # comments dropped from the shell scripts, Makefile and .npmrc. All are identical once the seven renamed strings in the table are reversed. The checker was first shown to fail on a planted code change for each of those comparisons.
  • Comments checked for accuracy, adversarially. Reviewers covering every changed file compared each rewritten comment with the code, a second pass searched the whole codebase for history framing the first pass missed, and every finding went to a three-lens panel (accuracy, the rule, value to a maintainer) that needed two of three votes. 41 findings were confirmed and 6 rejected; each confirmed one was re-checked (contrast ratios recomputed, file, class and control names confirmed) before it was applied.
  • No tooling directives touched. No @ts-*, eslint, /*!, rtl: or similar comment was added or removed.
  • Unit tests. tests/unit/seo.test.mjs and tests/unit/launch-urls.test.mjs pass locally.
  • CI covers the build, type-check, visual regression and FOUC suites.

Changelog. No entry: like #175, which corrected the FOUC comments, this changes nothing a consumer of the theme can see.

🤖 Generated with Claude Code

mmcky and others added 2 commits September 11, 2026 08:51
Comments across app/, styles/, tests/, the workflows and config named
project phases, tracker issues and PLAN.md items, and justified values
by pointing at the Sphinx build. Rewrite them to state the reason
itself: the measurement, the contrast ratio, the constraint. A link
stays only where its thread holds detail a comment cannot give in a
line (a fork feature the code reads, a guarded regression, measured
timings), and ported code keeps one provenance line.

Add a "Code comments" section to CONTRIBUTING.md with the rule.

Comment-only: every changed code file is identical once comments are
stripped (TypeScript printer for TS/JS, postcss for CSS, parsed YAML
and JSON). The one data change drops an issue tag from the stderr
output text in the no-thebe fixture notebook.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Drop the issue numbers from four describe titles, the Sphinx framing
from an seo unit-test title, and the tracker link from the FOUC guard's
CI step name. Screenshot baselines are named explicitly in each
toHaveScreenshot call, so no snapshot moves. Also restate the
tailwind.config.js grid-track comment and a FOUC-suite note in the
present tense.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 10, 2026 22:57
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-11 04:10 UTC

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

🎭 Visual regression results

passed  41 passed
skipped  12 skipped

Details

stats  53 tests across 2 suites
duration  1 minute, 29 seconds
commit  ff9f68e

Skipped tests

mobile-chrome › theme.spec.ts › QuantEcon theme — visual regression › without JavaScript › drawer-opens-without-javascript
mobile-chrome › theme.spec.ts › QuantEcon theme — visual regression › drawer-closes-when-search-opens
mobile-chrome › theme.spec.ts › QuantEcon theme — visual regression › launch-colab
mobile-chrome › theme.spec.ts › QuantEcon theme — visual regression › live-compute-toggle
mobile-chrome › theme.spec.ts › QuantEcon theme — visual regression › live-compute-toggle-absent-without-thebe
mobile-chrome › theme.spec.ts › On this page outline › outline-pinned-and-nested
mobile-chrome › theme.spec.ts › On this page outline › outline-tracks-scroll
mobile-chrome › theme.spec.ts › On this page outline › outline-unnumbered
mobile-chrome › theme.spec.ts › On this page outline › outline-within-viewport
mobile-chrome › theme.spec.ts › Meta/SEO and notebook output › social-meta
mobile-chrome › theme.spec.ts › Meta/SEO and notebook output › stderr-collapsed
mobile-chrome › theme.spec.ts › Site options reach the theme › site-options

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It spans 41 files of dense, domain-specific comment rationale (contrast ratios, hydration timings, layout math) that warrant human domain verification, and the repo's required ## [Unreleased] CHANGELOG entry (CONTRIBUTING.md:187-189) is absent though it falls outside the PR's changed files.

Pull request overview

This PR is a documentation/comment cleanup that rewrites code comments across the theme so they explain what the code does and why, rather than narrating the parity project's history (phase numbers like Phase 6 (#92), PLAN.md items, tracker issues used as labels, and "matches the Sphinx build" as a justification). It also codifies the rule in a new Code comments section of CONTRIBUTING.md. The theme's runtime behavior is unchanged: apart from seven documented, baseline-neutral string edits (test titles, one CI step name, one fixture stderr string), every change is comment text. Along the way it corrects a handful of now-stale claims (e.g. five light-mode code colours fail AA, not two; numbers measure 3.2:1) and moves a misplaced doc comment back above the Multilingual editions suite.

Changes:

  • Rewrite ~41 files' comments to drop project framing (phase numbers, PLAN.md, issue-number labels) and replace "matches the Sphinx build" with the actual reason (measurement, contrast ratio, layout constraint), keeping one provenance line for ported code.
  • Add a Code comments section to CONTRIBUTING.md establishing the rule for new code.
  • Fix stale factual claims and reposition the multilingual doc comment; retain issue links (#126, #130, #172, #117) only where they carry detail a line cannot.
File summaries
File Description
CONTRIBUTING.md Adds the "Code comments" convention (no project framing, no issue labels, reasons not comparisons).
styles/quantecon.css Bulk of the change: ~40 Sphinx-comparison justifications replaced with each value's own reason; corrects AA-failure count and number contrast to 3.2:1.
tests/visual/theme.spec.ts De-labels test titles, corrects the site-options/twitter:site note, moves the multilingual doc comment above its suite.
tests/visual/static.spec.ts, static-server.mjs, serve-static.sh De-labels #186/#138/#150 and generalizes "lecture sites" to "static hosts".
tests/visual/fouc.spec.ts Reframes hydration wording as conditional; keeps #126 for timings.
tests/visual/fixture*/*.yml.in, notebook.ipynb, unit/seo.test.mjs, unit/i18n.test.mjs Drop issue labels from comments; one fixture stderr string and one test title renamed.
app/root.tsx, revalidate.ts, seo.ts, routes/$.tsx, _index.tsx Rewrite meta/hydration/revalidate comments; drop #92/#186 labels, keep #126.
app/i18n.ts, links.ts, renderers.tsx, types.ts, components/* Replace book-theme/Sphinx framing with reasons and one-line provenance.
tailwind.config.js, template.yml, playwright.config.ts, styles/rtl.css, styles/app.css De-frame layout/units/config comments.
scripts/relative-css-asset-urls.mjs, plugins/git-metadata.mjs Drop #138/#150/PLAN.md references.
.github/workflows/{ci,preview,release}.yml De-label a CI step name and drop stale PLAN.md/make deploy paragraphs.
Review details
  • Files reviewed: 40/41 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@quantecon-services quantecon-services left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the full diff and independently checked the claims: stripped comments from both branches (esbuild for TS/TSX/JS/CSS, parsed YAML and JSON) and recomputed every contrast ratio the comments cite.

Verified

  • Behaviour is unchanged. After stripping comments, 30 of 40 code files are byte-identical to main; the other 10 differ only in the seven renamed strings listed in the description. Screenshot baselines are named explicitly, so the suite renames move nothing.
  • The #172 correction is right: five light palette values fall short of AA (2.75 / 2.94 / 3.24 / 3.65 / 4.21), and numbers are 3.24:1, not 3.4:1. Every other figure in the rewritten comments checks out (#af5f5f 4.54:1 and 3.85:1 on stone-900, #d78787 6.42:1, #44403c 10.3:1, #6cb6ff 7.4:1 on #222, the 0.95625rem derivation, the 122px outline offset, the 1.75rem sub-entry padding).
  • No PLAN.md, phase or Sphinx references remain in code apart from the three template.yml descriptions kept on purpose.

Suggested improvements

  1. Inherited wrong figure in styles/quantecon.css (stderr fold). The comment says the #856404 label is 7.0:1 on white. It is 5.5:1 (still AA). The old comment had the same error, but since this PR is about comments carrying the true measurement, worth fixing here.

  2. Reword the code-palette sentence. "It ships unconditionally, with no toggle, since no site turns it off" refers to a Sphinx option this theme never had. Suggest: "It ships unconditionally; there is no toggle."

  3. Three removals dropped a design decision rather than history. The rule as written does not distinguish the two, so these may be worth a single retained clause each, or an explicit "deliberate design decisions" exception in the CONTRIBUTING section:

    • styles/quantecon.css links block: the note that hover-only underline and #004979 visited links were consciously left out.
    • tests/visual/theme.spec.ts launch-colab: BinderHub deliberately not offered and JupyterHub removed. The test now asserts "the only launch target" with no reason why.
    • app/seo.ts: og:type "website" now has no stated reason. A lecture page could plausibly be "article", so a future reader may change it.
  4. Optional, same rule applied to docs. README.md still describes the OpenGraph set and stderr fold in terms of the Sphinx sites, and tests/visual/README.md carries three issue-number labels. Out of scope here, but a natural follow-up alongside the figure/lists px comments already listed.

Items 1 and 2 are one-line edits in the same file; the rest are judgement calls. Approve either way.


Generated by Claude Code

mmcky and others added 2 commits September 11, 2026 09:53
An adversarial review of the rewritten comments (reviewers over every
changed file, a whole-codebase sweep for missed framing, and a
three-lens panel per finding) confirmed factual errors and leftover
history framing. Each was re-checked before applying:

- contrast: the stderr label is 5.5:1 and the link 5.08:1, six light
  code colours miss AA, and dark-mode ratios are restated for the #222
  content panel the text actually sits on
- sizes: the UNITS root under the toolbar font-size control, and figure
  and paragraph spacing quoted in px for what is em
- comments contradicting the code: the seo and route meta tags, the
  first-paint font, the dark-bg keep-in-sync pointer, the static-build
  claims in playwright.config.ts and preview.yml, the relative-css
  directory note, and the template.yml README pointer
- history framing the first pass missed: Makefile, .npmrc, serve.sh,
  mpl-widget.css, Document.tsx, the launch-urls tests,
  PageHeaderHistory.tsx and a release.yml step comment
- CONTRIBUTING: git log -L rather than git blame, and measurements as
  a reason to keep a link

Still comment-only: every changed file is identical to main once
comments are stripped from both sides.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restore the design decision the rewrite dropped from the launch-colab
test comment: Binder and JupyterHub are deliberately not offered. And
reword the code-palette note so it no longer explains the missing
toggle by an option this theme never had.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mmcky

mmcky commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Where each point stands as of 200c4d1:

  1. stderr label contrast. Fixed in 86df855, which gives the #856404 label as 5.5:1. That commit came out of a separate accuracy pass over every rewritten comment, which also corrected the count in the code-highlighting note (six light colours miss AA once the diff-addition green is counted, a colour the table in Five light-mode code token colours fall short of WCAG AA contrast #172 leaves out) and restated the dark-mode ratios for the #222 content panel the text actually sits on.
  2. Code-palette sentence. Applied in 200c4d1, using your wording: "It ships unconditionally; there is no toggle."
  3. Removed design decisions. The launch-colab comment again says why Colab is the only launch target (Binder and JupyterHub are not offered, by design), in 200c4d1. The og:type reason, the :visited note and a CONTRIBUTING clause for deliberate omissions are left as they are.
  4. Docs. Agreed that it is out of scope, so README.md and tests/visual/README.md are left for a follow-up. The figure and lists px comments that the description had listed as follow-ups were corrected in 86df855.

Copy link
Copy Markdown
Collaborator

Review — reviewed at 200c4d1

Verdict: approve in principle. The core change is right and unusually well verified. What follows is the evidence I re-derived independently, then the issues still open.

Verification

I reproduced the comment-only claim rather than taking it on trust, with my own stripper (self-tested against planted edits in each language) over all changed files — a JS/TS tokenizer handling strings, template literals, regex literals and JSX; CSS comment stripping; structural YAML and JSON comparison. At 200c4d1 the diff is still comment-only apart from exactly the seven changes the description lists. Also confirmed:

  • snapshotPathTemplate (playwright.config.ts:63) never interpolates a test title, and all four toHaveScreenshot calls pass explicit filenames — the four describe renames move no baseline.
  • The ci.yml edit is a step name; the job is FOUC guard (WebKit), untouched — no required status check can break.
  • The fixture notebook string is asserted only via the substring "a deliberate warning on stderr" (theme.spec.ts:491), which survives.
  • No make deploy target exists (no Makefile target, no npm script), so release.yml's dropped paragraph lost nothing true.
  • git blame on code lines still reaches the original PR (font-size: 0.95625rem0842d0d); only the rewritten comment lines re-attribute. The recovery argument holds.

The 86df855 corrections check out — including the ones I had not caught

I recomputed every contrast figure touched in 86df855. All exact:

Claim Computed
#0072bc on white 5.08:1 5.08
#af5f5f on #222 3.50:1 3.50
#d78787 on #222 5.84:1 5.84
#5fafaf / #d7af5f on #222 6.2 / 7.7 6.24 / 7.72
#856404 on white 5.5:1 5.49
#0072bc @70% over #222 ≈2.2:1 2.17
blue-300 @70% over #222 ≈5.0:1 5.04

The re-grounding from stone-900 to the #222 content panel is the right call and one I had missed: .article sits inside Page.tsx's dark:bg-qepage-dark, not on the body. "Six light values fall short of AA" is now correct (#70a0d0 2.75, #60a0b0 2.94, #40a070 3.24, #00a000 3.48, #bb60d5 3.65, #0e84b5 4.21). The figure px comments (18px/9px) and the UNITS/toolbar-control reconciliation are right too.

The one substantive disagreement: bullet 3 over-fires

Sphinx mentions in source fall from 95 across 15 files to 1; book-theme from 23 to 9. "Matches the Sphinx build" reads as project framing, but for this theme it is the specificationREADME.md still describes the theme in those terms. styles/quantecon.css is ~700 lines of values obtained by measuring the deployed lecture builds, and now carries no statement that it was derived from anything, though bullet 3 itself grants ported code a provenance line.

Where the comparison was the only justification for a magic number, the replacement restates the declaration instead of giving a reason:

styles/quantecon.css Now reads Gap
font-size: 0.9rem (footer) "chrome at a fixed size" Doesn't say why 0.9. Was .8rem of an 18px root.
opacity: 0.7 "fades the rule, badge and text together" Restates what opacity does.
margin-bottom: 1.25em "18px, in place of its 20px mb-5" Doesn't say why 18.
back-to-top 15.3px / 600 "a small blue pill" Reads as arbitrary; it is a measurement.

Also deleted without replacement: "Known differences from the Sphinx build, deliberately out of scope here: it underlines only on hover, and colours :visited links #004979." — a recorded known divergence, not history, and now nowhere in the repo. Same for "Self-hosting Source Code Pro is a separate change."

Suggestion: amend the bullet so a cross-system constraint counts as a reason — /* 14.4px: the lecture builds' .8rem of an 18px root */ satisfies both goals — and restore a handful of provenance anchors.

Still open

  1. styles/quantecon.css:616-618 self-contradicts. "a fixed size, not the content base", then ".85 of the 18px content size". A maintainer moving .article to 19px is told by the second sentence to do what the first forbids. The value is pinned to the ported button, not to .article.
  2. static.spec.ts:84 contradicts Outline.tsx:25 on the same decision — "the provider Link, which resolves … and turns 'Top' into a full reload" vs "the provider would resolve … 'Top' would leave the document". Outline.tsx is right.
  3. Seven bare labels survive in fixture Markdown in directories this PR edited: features.md:12 (#173), intro.md:2 / lists.md:3 (#143), outline.md:7 + features.md:100 (#182), lists.md:53 (#121), lists.md:9 QuantEcon/mystmd#50. The first three are inert frontmatter; features.md:100, lists.md:9 and lists.md:53 are rendered body prose feeding features.png / lists.png, so those would move baselines — a real reason to defer, worth stating.
  4. The rule's bullets 1 and 2 overlap — bullet 1 bans tracker issues outright, bullet 2 then permits them conditionally — and the section never states its scope. It is applied to YAML and shell comments here while README.md, docs/, tests/visual/README.md and PLAN.md keep the banned framing.
  5. Nothing enforces it. .eslintrc.js exists but there is no lint script or CI step.
  6. ~10 comment lines were edited in place without re-wrapping (theme.spec.ts:20, :451, fixture/myst.yml.in).

Worth keeping

serve-static.sh going from (#138, #150, #186) to "asset URLs that only resolve under myst start, loader fetches a static host cannot answer" is the PR at its best — the number replaced by the thing it stood for. Likewise the outline sub-list padding decomposed into this file's own values, the playwright.config.ts baseline-vs-candidate recipe generalised out of a one-off 2.0.0 upgrade note, and the misplaced "Multilingual editions" doc comment moved back over its own suite.


Generated by Claude Code

Follow-up to the code-comments rewrite, from an accuracy review of #200.

The rewrite read "matches the Sphinx build" as project framing and removed
it everywhere: Sphinx mentions in source fell from 95 across 15 files to 1.
For this theme that phrase is the specification rather than history -- the
theme reproduces the deployed lecture sites -- so where it was the only
justification for a value, the replacement restated the declaration instead
of giving a reason.

CONTRIBUTING.md: state the section's scope (code comments, including YAML,
shell and fixture comments; prose docs keep their history), fold the
overlapping first two bullets into one ban plus one exception, and say that
a constraint from another system is a reason, with a worked example and a
note to record deliberate divergences.

styles/quantecon.css: restore the derivation for the four values whose only
reason was removed -- the footer's 0.9rem and 0.7 opacity, the 5px rule's
18px gap, and the back-to-top 15.3px, whose comment had come to contradict
itself by deriving a deliberately unpinned size from `.article`. Restore the
two deleted notes: the known divergences on link underlines and `:visited`,
and that self-hosting Source Code Pro is separate work. Add a header note so
a reader knows what the measurements are measurements of. List all six
AA-failing code colours rather than counting them, and record that the
palette is inherited from quantecon-book-theme, so changing it is a decision
for both themes (see #172).

static.spec.ts: the provider `Link` would resolve against the un-slashed SSR
pathname; the code does not use it, so the present tense contradicted the
same explanation in Outline.tsx.

Fixture frontmatter comments: drop the issue labels the rule bans, matching
the myst.yml.in files beside them. The labels in features.md, lists.md and
the lists.md fancy-list line are rendered page text feeding features.png and
lists.png, so they are left for a run of update-snapshots.yml.

Reflow the comment lines that were edited in place and left short.

Comment-only, verified mechanically against 200c4d1 with a comment stripper
for TS/TSX/JS and CSS: no code token changes. tests/unit is unchanged at
17 passing; the 2 failures are missing node_modules in this environment and
are identical before and after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAy8brFG9x8fXet3AV9dJE
The theme already diverges from the lecture builds in four places and every
one is an accessibility fix -- the outline's undimmed resting entries, its
non-colour-only active state, the dark footer link, and the flat rem-rooted
content size. That rule was only discoverable by reading four scattered
comments, so state it: match the lecture builds, except where matching them
fails WCAG, and say so with the measurement where you diverge. Changing an
inherited value for any other reason stays a two-theme decision (#172 for the
code palette, #201 for the footer).

Note that a contrast ratio must be computed on the composited colour, since
an `opacity` on the element is what the reader actually sees. That is the
step the footer missed: the dark footer link was corrected for it and the
light one never was.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAy8brFG9x8fXet3AV9dJE

Copy link
Copy Markdown
Collaborator

How the review was addressed — now at 115cbeb

Everything from my review above is either fixed here, fixed by 86df855 / 200c4d1, filed as an issue, or listed below as deliberately deferred. Two commits added.

0227f15 — keep the reason when the reason is another system

This is the substantive disagreement from the review, and one piece of evidence settled it. #187 cites this file and line as the record of a deferred decision:

One finding is a decision the team already took and deferred rather than a defect that slipped through. styles/quantecon.css:342-343 records it: "Known differences from the Sphinx build, deliberately out of scope here: it underlines only on hover, and colours :visited links #004979."

That comment was deleted by this PR. An open project tracker quotes it verbatim, by file and line, as the reason an item is on its plan — so removing it would have broken a live citation and left DrDrij's underline finding looking like a defect that slipped through rather than a decision already taken. It is restored, along with the deferred note that self-hosting Source Code Pro is separate work.

Also in this commit:

  • The four values whose only justification was removed get their derivation back — the footer's 0.9rem and 0.7 opacity, the 5px rule's 18px gap, and the back-to-top 15.3px, whose comment had come to contradict itself by deriving a deliberately unpinned size from .article.
  • A header note on styles/quantecon.css saying what its measurements are measurements of.
  • The six AA-failing code colours are listed rather than counted, and the comment records that the palette is inherited from quantecon-book-theme, so changing it is a two-theme decision (Five light-mode code token colours fall short of WCAG AA contrast #172) — another clause this PR had dropped.
  • static.spec.ts:84 now says the provider Link would resolve against the un-slashed SSR pathname, matching Outline.tsx; the present tense described a bug the code does not have.
  • Four fixture frontmatter comments lose the issue labels the rule bans, matching the myst.yml.in files beside them.
  • Five comment lines edited in place and left short are re-wrapped.

115cbeb — record the match-except-for-WCAG rule

Answering "are the inherited values ours to change?": mostly not, but the theme already diverges in four places and every one is an accessibility fix — the outline's undimmed resting entries (10.3:1 where the Sphinx panel composites to 4.47:1), its active state carrying weight and a rule so it is not colour-only, the dark footer link, and the flat rem-rooted content size. That rule was only discoverable by reading four scattered comments. CONTRIBUTING now states it, with the divergences as the model, and adds the step that was missed: composite any opacity before computing a ratio.

Issues opened

Deliberately not done

  • Three rendered-prose labelsfeatures.md:100 (#182), lists.md:9 QuantEcon/mystmd#50, lists.md:53 (#121). These are page body text feeding features.png and lists.png, so editing them turns the visual job red until /update-snapshots runs. Worth folding into whichever PR next refreshes those baselines rather than spending a refresh on comment text.
  • The CI guard is on a separate branch, claude/busy-dijkstra-oy40fc (be034da), not here. It greps the build job for Phase N / PLAN.md / parity milestone / open question N so the new rule does not decay — bare #NNN deliberately unmatched, since issue links are allowed and the pattern would hit every hex colour. I kept it out of this PR because adding a CI step would cost the comment-and-docs-only property that the mechanical verification rests on. Say the word and I will fold it in.

Verification

Re-ran the check at 115cbeb: with a comment stripper over every changed .ts/.tsx/.js/.mjs/.css file and structural comparison of the YAML, JSON and shell, the PR is still comment-only apart from exactly the seven strings the description lists. tests/unit is 17 passing, unchanged before and after; the 2 failures are missing node_modules in my environment and fail identically on the untouched head. I could not run the visual suite locally.

One correction to my review above: I listed outline.md:7 as a rendered label that would move a baseline. It does not — the no-thebe fixture has no snapshots and its outline tests assert on heading text only, so that one is fixed here.


Generated by Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It spans 47 files with many nuanced, individually hard-to-verify technical assertions (measured pixel values, contrast ratios, upstream behaviour) where my sampled checks all passed but exhaustive verification of every rewritten comment warrants a human maintainer's sign-off.

Review details
  • Files reviewed: 50/51 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

…website"

CONTRIBUTING.md requires every change to land an `## [Unreleased]` entry;
this PR had none. Added under `### Changed`, with the scope, the
comment-only property and the seven string edits it rests on.

app/seo.ts: `og:type "website"` was left without a reason when the Sphinx
reference came off, and "article" is the choice a future reader would reach
for on a page with a byline. Records why it is not: the lectures carry none
of the `article:*` metadata that choice commits to, and the deployed sites
declare "website" throughout (which is what the comment on `main` said).

Both raised in review on this PR -- the CHANGELOG entry by the Copilot
reviewer, the og:type reason by quantecon-services.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAy8brFG9x8fXet3AV9dJE
Reverts the CHANGELOG half of b8b8101, keeping the app/seo.ts og:type
comment it also carried.

I added the entry on a Copilot review flag citing CONTRIBUTING's
"add your change to `## [Unreleased]`" rule, without checking whether this
PR had already taken a position. It had: the description says no entry,
because like #175 -- which corrected the FOUC comments and touched no
CHANGELOG -- this changes nothing a consumer of the theme can see. Verified
that 1aae2c8 (#175) indeed has no CHANGELOG entry, so the cited precedent
holds. The author's call stands.

It was also the sole cause of the merge conflict against main: #199 released
v2.7.0, moving the `## [Unreleased]` entries this added to into `## [2.7.0]`.
With the entry gone the PR no longer touches CHANGELOG.md at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAy8brFG9x8fXet3AV9dJE
Brings in the v2.7.0 release (#199). No conflicts once the CHANGELOG entry
reverted above is gone -- this branch no longer touches that file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants