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

chore: ensure consistency of ContextNode keys and add new tests #6254

Merged
merged 5 commits into from
Jul 3, 2024

Conversation

vvagaytsev
Copy link
Collaborator

@vvagaytsev vvagaytsev commented Jul 3, 2024

What this PR does / why we need it:

This PR adds a few more tests for TreeCache to ensure the internal invariants of the cache and to verify the structure consistency. The JSDoc were added to the ContextNode interface to explain its invariants and possible states.

The test-case implemented in 1b4ed18 covers the current behaviour of the TreeCache, that was initially implemented years ago.

There is one fix for ContextNode.key assignment while creation, but that fix is not critical because the wrong value assignment hasn't seem to cause any real issues.

The wrong value just looked very confusing while debugging sessions.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

See individual commits for details.

To make it a bit easier to read and debug.
Use a copy of a context key array when creating a new node.

Otherwise, the parent node will be modified and while child node creation,
and will get the same key.

It doesn't seem to be an actual bug,
but such keys look very confusing in the debugger.
@vvagaytsev vvagaytsev requested review from edvald, thsig and twelvemo July 3, 2024 14:55
@vvagaytsev vvagaytsev added this pull request to the merge queue Jul 3, 2024
Merged via the queue into main with commit 3a69be4 Jul 3, 2024
40 checks passed
@vvagaytsev vvagaytsev deleted the chore/some-tree-cache-tests branch July 3, 2024 16:14
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