Skip to content

[ Interactive Graph | Vector Graph ] PR4: Scoring#3442

Draft
SonicScrewdriver wants to merge 1 commit intoLEMS-3971/vector-pr3from
LEMS-3971/vector-pr4
Draft

[ Interactive Graph | Vector Graph ] PR4: Scoring#3442
SonicScrewdriver wants to merge 1 commit intoLEMS-3971/vector-pr3from
LEMS-3971/vector-pr4

Conversation

@SonicScrewdriver
Copy link
Copy Markdown
Contributor

@SonicScrewdriver SonicScrewdriver commented Apr 1, 2026

Summary

This PR was created with the help of AI, albeit with heavy oversight and review.

This is part of a series of PRs implementing the vector graph type for the Interactive Graph widget:

PR1 – type definitions and schema
PR2 – state management
PR3 – rendering & accessibility
▶️ PR4 – scoring (this PR)
PR5 – editor support

Issue: LEMS-3971

  • Added scoring logic for the vector graph type. The graph is now gradeable.

Changes:

  • score-interactive-graph.ts — Adds vector scoring branch. Both tail (coords[0]) and tip (coords[1]) must match exactly via approximateDeepEqual. Unlike ray (which uses collinear for the second point), vector scoring is order-sensitive — swapping tail and tip is incorrect.
  • score-interactive-graph.test.ts — 6 new tests: undefined guess (invalid), missing coords (invalid), correct answer, wrong tail (incorrect), wrong tip (incorrect), swapped tail and tip (incorrect).

Test plan:

  • pnpm tsc — no new type errors
  • pnpm test packages/perseus-score/src/widgets/interactive-graph/ — 44 tests pass, including 6 new vector scoring tests
  • No existing scoring tests regress

@SonicScrewdriver SonicScrewdriver self-assigned this Apr 1, 2026
@SonicScrewdriver SonicScrewdriver changed the title docs(changeset): Added ability to score Vector Interactive Graphs [ Interactive Graph | Vector Graph ] PR4: Scoring Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Size Change: +34 B (+0.01%)

Total Size: 496 kB

Filename Size Change
packages/perseus-score/dist/es/index.js 9.69 kB +34 B (+0.35%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.5 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.21 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.9 kB
packages/perseus-core/dist/es/index.js 25.1 kB
packages/perseus-editor/dist/es/index.js 101 kB
packages/perseus-linter/dist/es/index.js 9.3 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 194 kB
packages/perseus/dist/es/strings.js 8.28 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 Apr 1, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3442

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

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

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

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

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