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

JS: Add library for naming endpoints #15380

Merged
merged 16 commits into from
Feb 14, 2024
Merged

Conversation

asgerf
Copy link
Contributor

@asgerf asgerf commented Jan 19, 2024

Adds a library, EndpointNaming.qll for generating human-readable names for endpoints, based on their access paths.

Since a given endpoint can very often be reached via multiple access paths (some of which are very ugly) a great deal of work goes into ranking these access paths and try to pick the least bad best one.

There are several intended use-cases for this. The model editor and VEA both need to generate human-readable names for endpoints. Also, for library summarisation we need to be able to name intermediate types and good readability for those names not a strict requirement though certainly a nice-to-have.

There are some unit tests in the PR, and some more real-world test output stored in a separate repo (internal link).

The work isn't entirely done yet, though I think it would be helpful to get it reviewed and merged in the current state, and then iterate from there.

Commit-by-commit review recommended as there are some general-purpose initial commits.

@asgerf asgerf added the no-change-note-required This PR does not need a change note label Jan 19, 2024
@github-actions github-actions bot added the JS label Jan 19, 2024
@asgerf asgerf force-pushed the js/endpoint-naming branch 2 times, most recently from 8842c18 to 930d79d Compare January 30, 2024 13:50
@asgerf asgerf force-pushed the js/endpoint-naming branch 3 times, most recently from 17263c5 to 08e61b6 Compare January 30, 2024 15:21
@asgerf asgerf force-pushed the js/endpoint-naming branch from 08e61b6 to 36e069b Compare January 30, 2024 15:32
@asgerf asgerf force-pushed the js/endpoint-naming branch from 36e069b to 1737ba1 Compare January 30, 2024 15:36
@asgerf asgerf marked this pull request as ready for review January 30, 2024 16:14
@asgerf asgerf requested a review from a team as a code owner January 30, 2024 16:14
Copy link
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

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

Since a given endpoint can very often be reached via multiple access paths (some of which are very ugly) a great deal of work goes into ranking these access paths and try to pick the least bad best one.

Looks like you did a lot of iterations of making it slightly better.
Nice work 👍

I got some comments, but they're all minor.

Previously it was theoretically possible to create a cycle of preferred predecessors, since badness had higher precedence than depth. We now require the preferred predecessor to have lower depth.

With this criteria we can remove the arbitray cap on badness.
@asgerf
Copy link
Contributor Author

asgerf commented Feb 13, 2024

Thanks for the review @erik-krogh, I've answered all comments, PTAL.

Copy link
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

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

Nice work 👍

@asgerf asgerf merged commit 2172c48 into github:main Feb 14, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants