Skip to content

Add workaround for graded during serialization#3597

Merged
handeyeco merged 3 commits intomainfrom
fix-graded
May 7, 2026
Merged

Add workaround for graded during serialization#3597
handeyeco merged 3 commits intomainfrom
fix-graded

Conversation

@handeyeco
Copy link
Copy Markdown
Contributor

@handeyeco handeyeco commented May 7, 2026

Summary:

The problem: in #3466 we added a switch for graded. Everything was just dandy except that we broke publishes. That's because we started passing graded down to widgets (which we needed so IG could change its behavior based on the graded flag) but then every widgets started getting graded. Because of the janky way we serialize, that started adding graded in the WidgetOptions of some widgets (ticket and Slack convo). Rather than discard unneeded fields, the publish pipeline just explodes when it sees a field it doesn't expect (which is totally cool and awesome) and it wasn't expecting graded.

The best solution is to make data serialization opt-in vs opt-out (see LEMS-4108). However that's probably a medium risk change and we have a playtest today, so this change just skips around the denylist for graded.

Why this should be more safe than the last PR: in #3466 there were some red flags...namely that I had to add graded to a bunch of tests. That was reverted as part of the bugfix (#3589) and the fact that I didn't need to add those changes back in this PR to pass checks indicated that this doesn't have the same problem as the last attempt.

@handeyeco handeyeco self-assigned this May 7, 2026
Copy link
Copy Markdown

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Size Change: +8 B (0%)

Total Size: 504 kB

📦 View Changed
Filename Size Change
packages/perseus-editor/dist/es/index.js 104 kB +8 B (+0.01%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.32 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 12 kB
packages/perseus-core/dist/es/index.js 25.6 kB
packages/perseus-linter/dist/es/index.js 9.41 kB
packages/perseus-score/dist/es/index.js 9.78 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 198 kB
packages/perseus/dist/es/strings.js 8.5 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
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3597

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

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

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

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

@handeyeco handeyeco changed the title docs(changeset): Deprecate excludeDenylistKeys and add workaround for graded Add workaround for graded during serialization May 7, 2026
Copy link
Copy Markdown
Contributor

@ivyolamit ivyolamit left a comment

Choose a reason for hiding this comment

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

This change looks logical, since it's specific removal of graded, it will less likely have other side effects.

// from the higher-up WidgetOptions (bad)
// See: LEMS-4108 and https://khanacademy.slack.com/archives/C01AZ9H8TTQ/p1778089642003609
// eslint-disable-next-line no-restricted-syntax
(filteredProps as any).graded = props.graded;
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.

can we add a test coverage for this.

@handeyeco handeyeco merged commit a51b535 into main May 7, 2026
11 checks passed
@handeyeco handeyeco deleted the fix-graded branch May 7, 2026 17:32
handeyeco pushed a commit that referenced this pull request May 7, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @khanacademy/perseus@77.5.0

### Minor Changes

- [#3597](#3597)
[`a51b5358a0`](a51b535)
Thanks [@handeyeco](https://github.com/handeyeco)! - Deprecate
excludeDenylistKeys and add workaround for `graded`

### Patch Changes

- [#3593](#3593)
[`7dd1ff6114`](7dd1ff6)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Fix
blue line on vector when graph becomes interactive after correct answer


- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`


- [#3584](#3584)
[`e5e24fb670`](e5e24fb)
Thanks [@catandthemachines](https://github.com/catandthemachines)! -
Improving screen reader experience for pause/play button on image gifs.

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/kas@2.2.3
    -   @khanacademy/math-input@26.4.20
    -   @khanacademy/perseus-core@26.0.3
    -   @khanacademy/perseus-linter@5.0.3
    -   @khanacademy/perseus-score@8.8.2
    -   @khanacademy/pure-markdown@2.2.8
    -   @khanacademy/simple-markdown@2.2.3
    -   @khanacademy/keypad-context@3.2.48
    -   @khanacademy/kmath@2.4.6

## @khanacademy/kas@2.2.3

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

## @khanacademy/keypad-context@3.2.48

### Patch Changes

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/perseus-core@26.0.3

## @khanacademy/kmath@2.4.6

### Patch Changes

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/perseus-core@26.0.3

## @khanacademy/math-input@26.4.20

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/perseus-core@26.0.3
    -   @khanacademy/keypad-context@3.2.48

## @khanacademy/perseus-core@26.0.3

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`


- [#3570](#3570)
[`51dd982ad9`](51dd982)
Thanks [@benchristel](https://github.com/benchristel)! - The Perseus
parsers now guard against NaN and Infinity values in number fields.
These values get converted to null by `JSON.stringify`, and previously
caused the parsers to be non-idempotent.

- Updated dependencies
\[[`651efcc50b`](651efcc)]:
    -   @khanacademy/kas@2.2.3
    -   @khanacademy/pure-markdown@2.2.8

## @khanacademy/perseus-editor@31.2.2

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`


- [#3583](#3583)
[`e6e297c793`](e6e297c)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (CX) | Handle
null width/height in image editor


- [#3597](#3597)
[`a51b5358a0`](a51b535)
Thanks [@handeyeco](https://github.com/handeyeco)! - Deprecate
excludeDenylistKeys and add workaround for `graded`

- Updated dependencies
\[[`7dd1ff6114`](7dd1ff6),
[`651efcc50b`](651efcc),
[`e5e24fb670`](e5e24fb),
[`a51b5358a0`](a51b535),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/perseus@77.5.0
    -   @khanacademy/kas@2.2.3
    -   @khanacademy/math-input@26.4.20
    -   @khanacademy/perseus-core@26.0.3
    -   @khanacademy/perseus-linter@5.0.3
    -   @khanacademy/perseus-score@8.8.2
    -   @khanacademy/keypad-context@3.2.48
    -   @khanacademy/kmath@2.4.6

## @khanacademy/perseus-linter@5.0.3

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/kas@2.2.3
    -   @khanacademy/perseus-core@26.0.3
    -   @khanacademy/pure-markdown@2.2.8
    -   @khanacademy/kmath@2.4.6

## @khanacademy/perseus-score@8.8.2

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

- Updated dependencies
\[[`651efcc50b`](651efcc),
[`51dd982ad9`](51dd982)]:
    -   @khanacademy/kas@2.2.3
    -   @khanacademy/perseus-core@26.0.3
    -   @khanacademy/kmath@2.4.6

## @khanacademy/pure-markdown@2.2.8

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

- Updated dependencies
\[[`651efcc50b`](651efcc)]:
    -   @khanacademy/simple-markdown@2.2.3

## @khanacademy/simple-markdown@2.2.3

### Patch Changes

- [#3546](#3546)
[`651efcc50b`](651efcc)
Thanks [@nishasy](https://github.com/nishasy)! - Add new lint rule to
avoid using `as` and suppress lint errors for existing instances of `as`

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants