thoth-station / prescriptions

βš•οΈπŸ’Š Prescriptions to heal your applications and application dependencies πŸ’Šβš•οΈ
https://thoth-station.ninja/docs/developers/adviser/prescription.html
GNU Affero General Public License v3.0
17 stars 10 forks source link

Failed to validate prescriptions for organization `1132719438` #22413

Open fridex opened 2 years ago

fridex commented 2 years ago

Describe the bug

2022-04-25 16:13:32,881 226484 WARNING  thoth.common:340: Logging to a Sentry instance is turned off
2022-04-25 16:13:32,882 226484 INFO     thoth.adviser:253: Version: 0.53.0
2022-04-25 16:13:32,883 226484 INFO     thoth.adviser:978: Validating prescriptions in '../prescriptions/prescriptions'
2022-04-25 16:13:32,883 226484 INFO     thoth.adviser.prescription.v1.prescription:334: Using prescriptions 'thoth' release 'dev+git'
2022-04-25 16:14:07,634 226484 ERROR    thoth.adviser.prescription.v1.prescription:199: Failed to validate schema for prescription: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']
Traceback (most recent call last):
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 197, in from_dict
    PRESCRIPTION_SCHEMA(prescription)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']
2022-04-25 16:14:07,694 226484 ERROR    thoth.adviser.prescription.v1.prescription:302: Failed to load prescription from '../prescriptions/prescriptions/py_/pynvx/gh_release_notes.yaml'
2022-04-25 16:14:07,697 226484 CRITICAL root:105: Traceback (most recent call last):
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 197, in from_dict
    PRESCRIPTION_SCHEMA(prescription)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./thoth-adviser", line 1011, in <module>
    __name__ == "__main__" and cli()
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "./thoth-adviser", line 979, in validate_prescription
    prescription = Prescription.validate(prescriptions)
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 116, in validate
    prescription_instance = cls.load(prescriptions)
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 295, in load
    prescription_instance = cls.from_dict(
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 203, in from_dict
    raise PrescriptionSchemaError(str(exc))
thoth.adviser.exceptions.PrescriptionSchemaError: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']

https://github.com/thoth-station/prescriptions/blob/458f264027e3d3701341b481d598d07d38fd0a93/prescriptions/py_/pynvx/gh_release_notes.yaml#L11-L14

To Reproduce Steps to reproduce the behavior:

  1. Validate prescriptions
  2. See the error

Expected behavior

Prescription validation should succeed.

Additional context

We place organization into the prescription template here:

https://github.com/thoth-station/prescriptions-refresh-job/blob/ea21fa9056b16136ecbb8552ed26dde198fcacc8/thoth/prescriptions_refresh/handlers/gh_release_notes.py#L45

This means that the organization will be placed to the template and become an integer (instead of staying as a string):

       release_notes:
-        organization: 1132719438
+        organization: '1132719438'
codificat commented 2 years ago

I believe this was fully addressed in thoth-station/prescriptions-refresh-job#148, so /close Please reopen if that was not the case

sesheta commented 2 years ago

@codificat: Closing this issue.

In response to [this](https://github.com/thoth-station/prescriptions/issues/22413#issuecomment-1110836841): >I believe this was fully addressed in thoth-station/prescriptions-refresh-job#148, so >/close >Please reopen if that was not the case Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
codificat commented 2 years ago

I did not understand the comments in https://github.com/thoth-station/prescriptions-refresh-job/pull/148 correctly and merged it too soon, going to revert it, so /reopen

sesheta commented 2 years ago

@codificat: Reopened this issue.

In response to [this](https://github.com/thoth-station/prescriptions/issues/22413#issuecomment-1111102611): >I did not understand the comments in https://github.com/thoth-station/prescriptions-refresh-job/pull/148 correctly and merged it too soon, going to revert it, so >/reopen Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
codificat commented 2 years ago

@mayaCostantini I reverted the changes from merging your previous PR too soon - apologies again for that.

/sig stack-guidance

and I'll add (feel free to adjust): /priority important-soon /triage accepted

sesheta commented 1 year ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

codificat commented 1 year ago

/remove-lifecycle stale