-
Notifications
You must be signed in to change notification settings - Fork 58
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 submission process #701
Fix submission process #701
Conversation
…factor-submission-workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
* Try to use consistent naming rather than calling everything "sections" * Make the _label_to_id function clearer by just having it transform string to string * Other minor simplifications
ecosystem/utils/submission_parser.py
Outdated
website=website, | ||
) | ||
md_sections = issue_formatted.split("### ")[1:] | ||
args = dict(_parse_section(s) for s in md_sections) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultdict
isn't needed here as all args have default values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has gotten a bit involved - might be worth splitting it out into two PRs if possible.
ecosystem/utils/submission_parser.py
Outdated
|
||
def _label_to_id(label: str) -> str: | ||
"""Given a fields "label", find its `id` from the issue template""" | ||
if not hasattr(_label_to_id, "map"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo this is confusing storing the value on the function object itself. Instead, I recommend using a global constant:
LABELs_TO_IDS = _load_labels()
def _load_labels() -> dict[...]:
...
Rather than having _label_to_id
as a helper function, you can inline the call in parse_section
to be LABELs_TO_IDS[label]
.
--
Edit: another alternative is to define the variable inside parse_submission_issue
and then pass it into parse_section
. That's probably clearer to avoid global state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I went with the latter. And I see your point about it getting involved but I'm not sure how to cleanly split into two PRs.
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Great comment in parse_submission_issue
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Thanks! |
Summary
The submission process was broken as some entries in the issue template were being ignored by the parser. This PR fixes that and makes the submission process more robust so similar issues don't occur in the future.
Details
Currently, to add a new field to the issue template, you need to edit four different files to make sure the field makes it through to the database. This PR avoids that by explicitly mapping field IDs in the issue template to attributes of the repository model and writing the entry immediately. After this change, you only need to edit the issue template and the repository model.
I've also added a test check the fields in the issue template match fields in the repository model.