-
Notifications
You must be signed in to change notification settings - Fork 364
[Interactive Graph] Add logarithm graph state management and reducer #3422
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
Open
ivyolamit
wants to merge
5
commits into
LEMS-3953/pr2-logarithm-kmath
Choose a base branch
from
LEMS-3953/pr3-logarithm-state-management
base: LEMS-3953/pr2-logarithm-kmath
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
21cf8a3
[LEMS-3953/pr3-logarithm-state-management] docs(changeset): Add logar…
ivyolamit 0b06409
[LEMS-3953/pr3-logarithm-state-management] [Interactive Graph] Add lo…
ivyolamit c40ec7a
[LEMS-3953/pr3-logarithm-state-management] fix claude code review com…
ivyolamit ce9f761
[LEMS-3953/pr3-logarithm-state-management] fix range issue
ivyolamit 54a615a
[LEMS-3953/pr3-logarithm-state-management] address claude review comm…
ivyolamit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@khanacademy/perseus": minor | ||
| --- | ||
|
|
||
| Add logarithm graph state management and reducer for supporting Logarithm graph in Interactive Graph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 The
getLogarithmCoordsfunction ininitialize-graph-state.tsis missing theexportkeyword, unlike its counterpartgetExponentialCoords(line 490) which is exported. The design doc (logarithm.md:307) explicitly lists exportinggetLogarithmCoordsas a PR 3 deliverable, and PR 6 (editor support) will need to import it exactly the way the editor currently importsgetExponentialCoords.Extended reasoning...
What the bug is
getLogarithmCoordsis declared asfunction getLogarithmCoords(noexportkeyword) at line 521 ofinitialize-graph-state.ts. Its counterpartgetExponentialCoordsis declaredexport function getExponentialCoordsat line 490 of the same file. The PR description explicitly states it follows the exponential pattern throughout, and the design doc atpackages/perseus/src/widgets/interactive-graphs/__docs__/notes/logarithm.mdline 307 listspackages/perseus/src/index.ts — Export getLogarithmCoordsas a PR 3 task.The code path that will fail
getExponentialCoordsis re-exported frompackages/perseus/src/index.ts(line 113) and consumed bypackages/perseus-editor/src/widgets/interactive-graph-editor/start-coords/util.ts(line 6) to compute default start coordinates in the editor UI. PR 6 (editor support for logarithm) will add logarithm handling to that sameutil.ts, importinggetLogarithmCoordsthe same way. Without theexportkeyword here and a corresponding re-export inindex.ts, that import will fail to compile.Why existing code doesn't prevent it
The function is only called internally within
initializeGraphStatein the same file, so the missing export produces no error today. TypeScript module boundaries are only enforced at import sites, and no import site exists yet for this function.Addressing the refutation
The refutation argues this is not a bug because the function works for its current purpose and the export can be added in PR 6. This is a reasonable position for a strict "does this PR break anything" review, but the PR description explicitly claims to follow the exponential pattern and the design doc explicitly lists the export as a PR 3 deliverable. Omitting it means this PR does not fully deliver on its stated scope, and the gap will need to be caught before PR 6 merges — exactly the kind of thing a PR review should flag.
Impact
No runtime or compilation failure in this PR or any currently merged code. The impact is forward-compatibility: PR 6 will fail to compile when it attempts to import
getLogarithmCoordsfrom@khanacademy/perseus.How to fix it
function getLogarithmCoordstoexport function getLogarithmCoordsat line 521 ofinitialize-graph-state.ts.getLogarithmCoordsto the re-exports inpackages/perseus/src/index.tsalongsidegetExponentialCoords(line 113).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too fussed if it's exported during this PR or the later PR, myself.