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

Use $schema keys for menuinst JSON validation #5569

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Dec 14, 2024

Description

Recent changes in menuinst fixed this design issue. We can now safely rely on $schema to self-validate the JSON document. As a result, menuinst is no longer necessary as a dependency either.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Dec 14, 2024
@jaimergp jaimergp mentioned this pull request Dec 14, 2024
3 tasks
@jaimergp jaimergp marked this pull request as ready for review December 20, 2024 11:54
@jaimergp jaimergp requested a review from a team as a code owner December 20, 2024 11:54
@jaimergp
Copy link
Contributor Author

@conda/builds-tools, this is ready for review! 🙏 See conda/menuinst#283 for broader context.



@cache
def _build_validator(url):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall we restrict which domains can be provided so they can only come from a series of pre-approved locations? e.g. github.com/conda/menuinst, schemas.conda.org, etc. Otherwise users might be able to simply link the equivalent of "allow-everything" schema and bypass these validations. Not that they result in errors, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

With conda/infrastructure#1082 now closed, I think we should restrict it to that domain.

Copy link

codspeed-hq bot commented Dec 20, 2024

CodSpeed Performance Report

Merging #5569 will not alter performance

Comparing jaimergp:menuinst-230 (80caf05) with main (9da6306)

Summary

✅ 5 untouched benchmarks

@jaimergp
Copy link
Contributor Author

jaimergp commented Jan 7, 2025

Gentle ping, @conda/builds-tools.

@jaimergp
Copy link
Contributor Author

jaimergp commented Feb 4, 2025

Blocked by conda/infrastructure#1082

Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

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

Can't merge as-is



@cache
def _build_validator(url):
Copy link
Member

Choose a reason for hiding this comment

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

With conda/infrastructure#1082 now closed, I think we should restrict it to that domain.

Comment on lines +1700 to +1702
r = requests.get(url)
if not r.ok:
log.error("Could not fetch '%s', status code %s", r.status_code)
Copy link
Member

Choose a reason for hiding this comment

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

This would have to handle requests exceptions better.

Comment on lines +1734 to +1735
"https://github.com/conda/menuinst/raw/refs/tags/2.2.0/"
"menuinst/data/menuinst.schema.json"
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't hardcode a GitHub URL that way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Status: 🏗️ In Progress
Development

Successfully merging this pull request may close these issues.

3 participants