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 shape equality in ADT validator #1514

Merged
merged 4 commits into from May 10, 2024

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented May 9, 2024

It was causing false negatives (doesMemberTargetAdtShape being false when it should be true) for some shapes, when a lot of shapes were added in an unrelated namespace.

Some ShapeId constructors use a cache internally, which explains why it'd sometimes still match instance equality, but it's not a mechanism that should be relied upon, and it will never be one.

I've also checked for any other usages of == in our Java sources and they are all about primitives/enums, so it's fine.

Not adding tests due to the unpredictable nature of the issue.

PR Checklist (not all items are relevant to all PRs)

  • ❌ Added unit-tests (for runtime code)
  • ❌ Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • ❌ Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • ❌ Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • ❌ Updated dynamic module to match generated-code behaviour
  • ❌ Added documentation
  • Updated changelog

@kubukoz
Copy link
Member Author

kubukoz commented May 9, 2024

update:

image

the ShapeId factory/cache has a size bound, so I'm pretty sure the users who bumped into this were simply adding enough new shapes to go over this limit before the @adt-marked shapes had their ShapeIds created - causing the latter to never get cached, and thus never have referential equality match.

@kubukoz kubukoz marked this pull request as ready for review May 9, 2024 22:31
@kubukoz kubukoz merged commit 7cc1aa9 into series/0.18 May 10, 2024
11 checks passed
@kubukoz kubukoz deleted the fix-validator-shapeid-equality branch May 10, 2024 12:52
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.

None yet

2 participants