Skip to content

Conversation

@kmcgrady
Copy link
Collaborator

@kmcgrady kmcgrady commented Oct 18, 2025

Describe your changes

A little more complicated than the ElementSet Visitor, but this change updates the getIn Method to a GetNodeByDeltaPath visitor.

Testing Plan

  • JS tests are updated
  • E2E tests should pass

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Oct 18, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12812/streamlit-1.51.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12812.streamlit.app (☁️ Deploy here if not accessible)

@kmcgrady kmcgrady added impact:internal PR changes only affect internal code change:refactor PR contains code refactoring without behavior change security-assessment-completed Security assessment has been completed for PR labels Oct 18, 2025
@kmcgrady kmcgrady requested a review from Copilot October 18, 2025 21:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the getIn method functionality from AppNode implementations to a new GetNodeByDeltaPathVisitor class, following the visitor pattern. This change replaces the recursive getIn method that was directly implemented in BlockNode and ElementNode classes.

Key changes:

  • Introduces a new visitor pattern for node traversal by delta path
  • Removes the getIn method from the AppNode interface and implementations
  • Updates all existing usages to use the new visitor pattern

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
GetNodeByDeltaPathVisitor.ts New visitor class that implements delta path traversal logic
GetNodeByDeltaPathVisitor.test.ts Comprehensive test suite for the new visitor
ElementNode.ts Removes the getIn method implementation
BlockNode.ts Removes the getIn method implementation
BlockNode.test.ts Updates tests to use visitor pattern via helper function
AppRoot.ts Adds visitor usage and helper methods for node traversal
AppRoot.test.ts Updates tests to use the new visitor pattern
AppNode.interface.ts Removes getIn method from interface definition

@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 8f785ac to 4ee6955 Compare October 18, 2025 21:36
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch 2 times, most recently from eef2346 to fbd52d2 Compare October 18, 2025 21:41
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 4ee6955 to 7d9edc4 Compare October 18, 2025 21:41
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from fbd52d2 to 1a8a94b Compare October 18, 2025 21:43
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 7d9edc4 to 3448d32 Compare October 18, 2025 21:43
@kmcgrady kmcgrady requested a review from Copilot October 18, 2025 21:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 3448d32 to b320d2a Compare October 18, 2025 21:47
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from 1a8a94b to 38db539 Compare October 18, 2025 21:47
@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2025

📉 Frontend coverage change detected

The frontend unit test (vitest) coverage has decreased by 0.0000%

  • Current PR: 86.0300% (49876 lines, 6964 missed)
  • Latest develop: 86.0300% (49844 lines, 6963 missed)

✅ Coverage change is within normal range.

📊 View detailed coverage comparison

@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from b320d2a to 9f84e8e Compare October 19, 2025 04:21
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch 2 times, most recently from c65a132 to 1f05240 Compare October 19, 2025 16:20
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 9f84e8e to 770c9d0 Compare October 19, 2025 16:20
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from 951bcac to c3d6ea0 Compare October 24, 2025 18:50
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 80b1478 to 97cd5f2 Compare October 24, 2025 18:50
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from c3d6ea0 to ad210aa Compare October 24, 2025 18:53
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 97cd5f2 to 0b3dd40 Compare October 24, 2025 18:53
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from ad210aa to 22c1b20 Compare October 24, 2025 18:55
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 0b3dd40 to 1788c2a Compare October 24, 2025 18:55
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from 22c1b20 to cfa91f3 Compare October 24, 2025 18:59
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 1788c2a to c52b408 Compare October 24, 2025 18:59
@kmcgrady kmcgrady marked this pull request as ready for review October 24, 2025 19:03
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from c52b408 to b9afac2 Compare October 28, 2025 23:26
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch 2 times, most recently from d7b0129 to 7b930f0 Compare October 29, 2025 00:18
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch 2 times, most recently from 3ecb1d2 to 97426f6 Compare October 29, 2025 01:30
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from 7b930f0 to 0bf7c7e Compare October 29, 2025 01:30
/**
* A visitor that retrieves a node at a specific delta path.
*
* This replaces the getIn method functionality from AppNode implementations.
Copy link
Collaborator

Choose a reason for hiding this comment

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

[suggestion] I can see this context being useful at first, but maybe it is better in the PR description/commit messages and then keep the docstring referencing only the current functionality.

)
}

private addBlock(
Copy link
Collaborator

Choose a reason for hiding this comment

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

[suggestion] not for this PR, but should this actually be called replaceNode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea. It's weird because it's aligning to delta protobuf, but this is practically a replacement.

}

visitElementNode(_node: ElementNode): AppNode | undefined {
// ElementNodes are leaf nodes - they have no children to traverse
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// ElementNodes are leaf nodes - they have no children to traverse
// ElementNodes have no children and therefore we do not check them for the element.

}

if (remainingPath.length === 0) {
// Base case: we're at the target location, return the child
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Perhaps
// Base case: we've consumed the entire path (at target location), return the target node

return node.children[currentIndex]
}

// Recursive case: continue down the path
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Perhaps
// Recursive case: create a new visitor and continue traversal

@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 97426f6 to 96013c8 Compare October 30, 2025 03:59
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getelements_to_the_elementssetvisitor branch from 0bf7c7e to dc7d050 Compare October 30, 2025 03:59
Base automatically changed from 10-18-migrate_getelements_to_the_elementssetvisitor to develop October 30, 2025 12:30
@kmcgrady kmcgrady force-pushed the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch from 96013c8 to 4e7ec2f Compare October 30, 2025 12:48
@kmcgrady kmcgrady merged commit d0741e6 into develop Oct 30, 2025
37 checks passed
@kmcgrady kmcgrady deleted the 10-18-migrate_getin_to_getnodebydeltapathvisitor branch October 30, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change impact:internal PR changes only affect internal code security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants