Skip to content

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>
@keshav-space keshav-space requested a review from JonoYang March 21, 2024 08:08
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.

@keshav-space keshav-space requested a review from JonoYang March 22, 2024 19:07
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

3 participants