Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a feature flag for Mafs point graphs with fixed numPoints #1381

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

benchristel
Copy link
Member

Summary:

The point graph has two separate user experiences:

  • fixed number of points, where you can drag points around, but not add
    or delete them
  • unlimited points, where you can add and delete points

We have built the first of these experiences in Mafs, but not the
second. We want to release Mafs graphs with fixed-numPoints before
implementing unlimited points.

This commit adds logic to make that possible with feature flags. It also
moves the existing (similar) logic for polygon graphs so all decisions
about which graph to render are made in one, testable place.

Issue: LEMS-2126

Test plan:

Deploy a webapp ZND. Visit
/internal-courses/test-everything/test-everything-1/te-interactive-graph/a/survey-of-graph-types
and verify that only the graphs that should use Mafs are doing so.

The point graph has two separate user experiences:

- fixed number of points, where you can drag points around, but not add
  or delete them
- unlimited points, where you can add and delete points

We have built the first of these experiences in Mafs, but not the
second. We want to release Mafs graphs with fixed-numPoints before
implementing unlimited points.

This commit adds logic to make that possible with feature flags. It also
moves the existing (similar) logic for polygon graphs so all decisions
about which graph to render are made in one, testable place.

Issue: LEMS-2126

Test plan:

Deploy a webapp ZND. Visit
`/internal-courses/test-everything/test-everything-1/te-interactive-graph/a/survey-of-graph-types`
and verify that only the graphs that should use Mafs are doing so.
@benchristel benchristel self-assigned this Jun 27, 2024
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jun 27, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/tricky-rice-nail.md, packages/perseus/src/widgets/interactive-graph.test.tsx, packages/perseus/src/widgets/interactive-graph.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team June 27, 2024 23:24
Copy link
Contributor

github-actions bot commented Jun 27, 2024

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1381

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1381

Copy link
Contributor

github-actions bot commented Jun 27, 2024

Size Change: +180 B (+0.02%)

Total Size: 849 kB

Filename Size Change
packages/perseus/dist/es/index.js 410 kB +180 B (+0.04%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.2 kB
packages/kmath/dist/es/index.js 4.26 kB
packages/math-input/dist/es/index.js 80.1 kB
packages/math-input/dist/es/strings.js 1.73 kB
packages/perseus-core/dist/es/index.js 906 B
packages/perseus-editor/dist/es/index.js 272 kB
packages/perseus-error/dist/es/index.js 866 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/perseus/dist/es/strings.js 3.21 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.

Project coverage is 71.12%. Comparing base (93eeda1) to head (7eb38c7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1381      +/-   ##
==========================================
+ Coverage   69.64%   71.12%   +1.48%     
==========================================
  Files         493      497       +4     
  Lines      104303   104406     +103     
  Branches     7502    11301    +3799     
==========================================
+ Hits        72638    74256    +1618     
+ Misses      31480    30150    -1330     
+ Partials      185        0     -185     

Impacted file tree graph

Files Coverage Δ
packages/perseus/src/widgets/interactive-graph.tsx 61.25% <86.84%> (+10.61%) ⬆️

... and 139 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93eeda1...7eb38c7. Read the comment docs.

Copy link
Contributor

@nishasy nishasy left a comment

Choose a reason for hiding this comment

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

LGTM

@benchristel benchristel merged commit 26dceb8 into main Jul 1, 2024
11 checks passed
@benchristel benchristel deleted the benc/points-feature-flag branch July 1, 2024 17:34
Copy link
Contributor

@mark-fitzgerald mark-fitzgerald left a comment

Choose a reason for hiding this comment

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

Very nice!

benchristel pushed a commit that referenced this pull request Jul 1, 2024
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/[email protected]

### Minor Changes

-   [#1376](#1376) [`3ee100add`](3ee100a) Thanks [@benchristel](https://github.com/benchristel)! - Implement the protractor for Mafs interactive graphs


-   [#1381](#1381) [`26dceb8d7`](26dceb8) Thanks [@benchristel](https://github.com/benchristel)! - Make the `mafs.point` flag control whether point graphs with fixed numbers of points should use Mafs. Previously, turning on the `mafs.point` flag would enable Mafs for point graphs with unlimited points as well.

### Patch Changes

-   [#1358](#1358) [`93eeda1e2`](93eeda1) Thanks [@benchristel](https://github.com/benchristel)! - Add TODO comment


-   [#1379](#1379) [`685fa9048`](685fa90) Thanks [@nishasy](https://github.com/nishasy)! - [Interactive Graph Editor] Moving around/renaming components so they make more sense for the upcoming hint mode work


-   [#1370](#1370) [`48e879ace`](48e879a) Thanks [@benchristel](https://github.com/benchristel)! - Internal: copy Mafs' implementation of useMovable into our own useDraggable hook.

## @khanacademy/[email protected]

### Patch Changes

-   [#1375](#1375) [`a8b3aa9c0`](a8b3aa9) Thanks [@nishasy](https://github.com/nishasy)! - [Interactive Graph Editor] Fix the broken storybook preview for segments, points, and polygons


-   [#1379](#1379) [`685fa9048`](685fa90) Thanks [@nishasy](https://github.com/nishasy)! - [Interactive Graph Editor] Moving around/renaming components so they make more sense for the upcoming hint mode work

-   Updated dependencies \[[`3ee100add`](3ee100a), [`93eeda1e2`](93eeda1), [`685fa9048`](685fa90), [`48e879ace`](48e879a), [`26dceb8d7`](26dceb8)]:
    -   @khanacademy/[email protected]

Author: khan-actions-bot

Reviewers: benchristel

Required Reviewers:

Approved By: benchristel

Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ⏭️  Publish npm snapshot, ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1377
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