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

Fix repeat deletion Issue #1415

Closed
wants to merge 2 commits into from
Closed

Fix repeat deletion Issue #1415

wants to merge 2 commits into from

Conversation

shubham1g5
Copy link
Contributor

@shubham1g5 shubham1g5 commented Jul 2, 2024

Technical Summary

https://dimagi.atlassian.net/browse/USH-4708 (Deleting a repeat was causing errors in resolving references )

After deleting a repeat, a node's reference can change due to change in repeat index of the node. Therefore we need a way to not use the existing cache while resolving references. The way cache is setup today I was not able to find a way to expire it for all nodes without looping through all possible references therefore I choose to pass a flag to not use the cache.

Safety Assurance

Safety story

  • Impact should be limited to evaluating Xpath after delete repeats action which already seems to be a little broken at the moment.
  • Due to us not using reference cache post delete, there can be a small performance downside after deleting a repeat node for large forms. Although would not expect to be substantial.

Automated test coverage

dimagi/formplayer#1597

QA Plan

None

Special deploy instructions

  • This PR can be deployed after merge with no further considerations.

Rollback instructions

  • This PR can be reverted after deploy with no further considerations.

Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change.

Duplicate PR

Automatically duplicate this PR as defined in contributing.md.

@shubham1g5
Copy link
Contributor Author

Closing PR for now as I think I don't have complete picture yet in the problem or solution here. Will reopen once I have more context on the concerned issue.

@shubham1g5 shubham1g5 closed this Jul 2, 2024
@shubham1g5 shubham1g5 reopened this Jul 2, 2024
@shubham1g5
Copy link
Contributor Author

Closing PR for now as I think I don't have complete picture yet in the problem or solution here. Will reopen once I have more context on the concerned issue.

reopening after verifying some assumptions and tests.

@ctsims
Copy link
Member

ctsims commented Jul 2, 2024

Hey @shubham1g5

How much work is it to simulate the regression you created in Formplayer directly in this repo? I've found that it's really, really helpful to be able to simulate the direct code path during testing (especially with future regression), but if it's a ton of work not a strong need.

More pressing, I think this is a pretty big change to the interface and the degree of complexity of the lookups, which worries me. I'd be very heavily inclined to follow the alternate path of clearing the reference caches directly by creating a clearVolatiles() (or something similar with a scope that's one level up) method on AbstractTreeElement and propagating that via a walk on the tree for the root which I think constrains the scope more effectively.

@shubham1g5
Copy link
Contributor Author

Thanks for the feedback, I raised an alternate PR here which should address both these points of feedback #1417 .

@shubham1g5 shubham1g5 closed this Jul 3, 2024
@shubham1g5 shubham1g5 deleted the fixRepeatDeletion branch July 3, 2024 06:48
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.

2 participants