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

Add collect_symbols to the default pipelines and store symbols in resources #351

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

keshav-space
Copy link
Member

- Use the `collect_symbols` add-on pipeline to collect the resource symbols.

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Copy link
Member

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

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

@keshav-space The PR looks good, I have a couple of notes:

  • It doesn't look like merge_or_create_resource merges data, but just overwrites the existing values on the Resource with new values. (https://github.com/nexB/purldb/blob/main/minecode/model_utils.py#L428) In the case where we have an existing Resource with symbol data stored in the extra_data field, the contents of the extra_data field will be overwritten if the incoming Resource data has values in there. I think it would make sense to append the new extra_data to the existing one instead of overwriting it, but I wanted to know what you think.

  • We should have a test for merge_or_create_resource to make sure that the extra_data field is updated.

@keshav-space
Copy link
Member Author

  • It doesn't look like merge_or_create_resource merges data, but just overwrites the existing values on the Resource with new values. (https://github.com/nexB/purldb/blob/main/minecode/model_utils.py#L428) In the case where we have an existing Resource with symbol data stored in the extra_data field, the contents of the extra_data field will be overwritten if the incoming Resource data has values in there. I think it would make sense to append the new extra_data to the existing one instead of overwriting it, but I wanted to know what you think.

@JonoYang We could append data, but wouldn't that be more confusing? Suppose we already have source_symbols in the resource. If we reindex this package with a new version of source_inspector I don't think it would make sense to append this to the existing source_symbols.

@JonoYang
Copy link
Member

@JonoYang We could append data, but wouldn't that be more confusing? Suppose we already have source_symbols in the resource. If we reindex this package with a new version of source_inspector I don't think it would make sense to append this to the existing source_symbols.

That's a good point. I think it would be good to rename merge_or_create_resource to update_or_create_resource and remove the merged variable in the function.

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
@keshav-space
Copy link
Member Author

@JonoYang I've renamed the merge_or_create_resource and also added the test.

Copy link
Member

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

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

@keshav-space Looks good, thanks!

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.

PurlDB: Store symbols (from scan results) in the PurlDB
2 participants