Skip to content

Conversation

@handeyeco
Copy link
Contributor

@handeyeco handeyeco commented Dec 4, 2025

Summary:

We had scorePerseusItem which validates/scores with an answerful PerseusItem and we had emptyWidgetsFunctional which checks for "emptiness" with an answerless PerseusItem, but we didn't have a helper that did full client-side validation which we'll need before we can remove scorePerseusItem (and answerful PerseusItems) from the client.

Issue: LEMS-3731

@handeyeco handeyeco self-assigned this Dec 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3089

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

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

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

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Size Change: +102 B (+0.02%)

Total Size: 499 kB

Filename Size Change
packages/perseus-score/dist/es/index.js 9.3 kB +102 B (+1.11%)
ℹ️ 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.98 kB
packages/math-input/dist/es/index.js 99.2 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 13.1 kB
packages/perseus-core/dist/es/index.js 22.6 kB
packages/perseus-editor/dist/es/index.js 98.2 kB
packages/perseus-linter/dist/es/index.js 8.64 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 202 kB
packages/perseus/dist/es/strings.js 7.73 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.72 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

🛠️ Item Splitting: No Changes ✅

import {scorePerseusItem, scoreWidgetsFunctional} from "./score";
import {getExpressionWidget, getTestDropdownWidget} from "./util/test-helpers";

describe("flattenScores", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved

* `PerseusWidgetsMap` or ` into any function that accepts a
* `ValidationDataMap` without any mutation of data.
*/
export type ValidationDataMap = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just didn't see the point of having this type and it was keeping me from reusing helpers between scoring and validation logic. Ideally in the future we could just have a AnswerfulPerseusItem and AnswerlessPerseusItem or something.

* If a widget says that it is empty once it is graded.
* Trying to encapsulate references to the score format.
*/
export function scoreIsEmpty(score: PerseusScore): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved a bunch of these helpers into their own files.

@handeyeco handeyeco changed the title add validateUserInput Add validateUserInput for client-side validation Dec 4, 2025
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