Skip to content

Schema Check: Ignore comments#3359

Open
jeremywiebe wants to merge 3 commits intomainfrom
jer/schema-change-ignore-comments
Open

Schema Check: Ignore comments#3359
jeremywiebe wants to merge 3 commits intomainfrom
jer/schema-change-ignore-comments

Conversation

@jeremywiebe
Copy link
Collaborator

@jeremywiebe jeremywiebe commented Mar 14, 2026

Summary:

In #3357 the Schema Check triggered but the changes were all in code comments. None of these would alter the structure of any Perseus schema types and so it's a false positive and clutters the PR.

This PR changes the tsc command to strip comments so that the resulting comparison files are only code/types. This should eliminate these types of false positives, but retain type/schema safety.

Issue: LEMS-3949

Test plan:

I added a change that should affect the schema and the schema check triggered.

image

I removed above change, added a comment-only change and the schema check cleared.

image

Click the "Edited" button on the Schema Change comment to see earlier runs of the check (as well as its output).

image

Success!

… file for comparison, ignore comments - they don't change the schema structurally
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

Size Change: 0 B

Total Size: 486 kB

ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.8 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.96 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 11.8 kB
packages/perseus-core/dist/es/index.js 24.9 kB
packages/perseus-editor/dist/es/index.js 100 kB
packages/perseus-linter/dist/es/index.js 8.82 kB
packages/perseus-score/dist/es/index.js 9.26 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 187 kB
packages/perseus/dist/es/strings.js 7.47 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (e327cb4) and published it to npm. You
can install it using the tag PR3359.

Example:

pnpm add @khanacademy/perseus@PR3359

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3359

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3359

@github-actions github-actions bot added the schema-change Attached to PRs when we detect Perseus Schema changes in it label Mar 14, 2026
@github-actions github-actions bot removed the schema-change Attached to PRs when we detect Perseus Schema changes in it label Mar 14, 2026
@jeremywiebe jeremywiebe marked this pull request as ready for review March 14, 2026 00:35
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

LGTM - the --removeComments flag addition is straightforward; just remove the test comment from data-schema.ts before merging.

Extended reasoning...

Overview

This PR adds the --removeComments flag to the tsc command in the schema check CI job (.github/workflows/node-ci.yml), so that comment-only changes to data-schema.ts no longer trigger false-positive schema change alerts. The only other change is a leftover test comment in packages/perseus-core/src/data-schema.ts that was used to validate the fix.

Security risks

None. The change is to a CI workflow flag that controls TypeScript compiler output formatting. It does not affect authentication, permissions, data handling, or any runtime code paths.

Level of scrutiny

Low scrutiny is appropriate. This is a single-flag addition to a CI build command - mechanical and easy to verify. The --removeComments flag is a standard tsc option that strips comments from output, which is exactly the desired behavior for comparing schema structure.

Other factors

The inline bug report correctly identifies the test comment as an artifact that should be cleaned up. This is a minor nit that does not affect correctness - the comment is harmless in both the source file and the CI output (since --removeComments now strips it). All CI checks are passing. The PR is well-documented with screenshots showing both positive and negative test cases.

*/
export type PerseusArticle = PerseusRenderer | PerseusRenderer[];

// Comment change - shouldn't trigger schema check
Copy link

Choose a reason for hiding this comment

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

🟡 Nit: The comment // Comment change - shouldn't trigger schema check on line 230 is a test artifact left over from validating the --removeComments feature and should be removed before merging.

Extended reasoning...

What the bug is

Line 230 of packages/perseus-core/src/data-schema.ts contains the comment // Comment change - shouldn't trigger schema check. This is a leftover test artifact from the PR author's test plan, not a meaningful code comment.

How it got there

The PR author added this comment as part of their test plan to verify that comment-only changes no longer trigger the schema change CI check after adding the --removeComments flag to the tsc command. The commit message for e327cb4 explicitly states: "Undo schema change and add comment change that shouldn't trigger check." The PR description also documents this: "I removed above change, added a comment-only change and the schema check cleared."

Step-by-step proof

  1. The diff shows the addition of // Comment change - shouldn't trigger schema check on line 230, right above the Version type definition.
  2. The commit e327cb4 message says "Undo schema change and add comment change that shouldn't trigger check" — confirming it was added purely for testing.
  3. The comment text itself is meta-commentary about the CI process, not documentation about the Version type it precedes.
  4. The PR description explicitly describes adding this comment as a test step.

Impact

No functional impact since it's a comment, but data-schema.ts is the core Perseus schema file with a prominent warning at the top (lines 2-29) about being careful with changes. Leaving test debris in this file adds noise and is inconsistent with the care the file demands.

How to fix

Simply delete line 230 (// Comment change - shouldn't trigger schema check) from packages/perseus-core/src/data-schema.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant