You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is unclear to me why there needs to be two concepts for this, I feel that it is possible they could be merged and essentially warnings are a sub-set of constraints that apply to all needs (as opposed to usually constraint "sets" are specified by the need).
It is also of note that for both of these concepts, more complex checks involving all needs have been requested: #1217, #1238, which neither currently support directly.
It is of note that, if warnings were merged with constraints (or called at the same time), AND we improve the detection of need modifications, these may not need to be re-computed for every re-build (as is the case now)
One note-to-self here is that possibly the needs should be "sealed" before checking for constraints here:
,
then constraints/warnings would be processed, allowing for access to the immutable NeedsView, and then the constraints_ fields would be updated as a "special exception" to sealing the needs
The text was updated successfully, but these errors were encountered:
chrisjsewell
changed the title
Difference between constraints and warnings?
Difference between constraints and warnings? (and complex checks)
Oct 8, 2024
I completely agree with @chrisjsewell on this write-up. needs-constraint-failed-options make it possible to end up with the same behavior as needs_warnings.
Additionally needs_constraints integrate with the individual needs, so the result can be used for rendering and later consumption in the needs dictionary.
I also agree on sealing the needs before evaluating the constraints.
I'm not 100% sure if we cover here all use cases.
A Constraint allows to set custom user text, if it fails. So the user get feedback in the docs, and maybe help what to change. Warnings as of now do not support such a custom feedback,or am I wrong?
Warnings as of now do not support such a custom feedback,or am I wrong?
but then doesn't that support my assertion that warnings are just a sub-set of constraints 😅 (i.e. we can deprecate warnings without any loss of functionality)
needs_constraints
andneeds_warnings
(and to a lesser extent need_statuses and need_tags) are very similar in their function:It is unclear to me why there needs to be two concepts for this, I feel that it is possible they could be merged and essentially
warnings
are a sub-set of constraints that apply to all needs (as opposed to usually constraint "sets" are specified by the need).At a minimum, this functionality should be expanded on in: https://sphinx-needs.readthedocs.io/en/latest/tutorial.html#enforcing-valid-need-items
It is also of note that for both of these concepts, more complex checks involving all needs have been requested: #1217, #1238, which neither currently support directly.
It is of note that, if warnings were merged with constraints (or called at the same time), AND we improve the detection of need modifications, these may not need to be re-computed for every re-build (as is the case now)
One note-to-self here is that possibly the needs should be "sealed" before checking for constraints here:
sphinx-needs/sphinx_needs/directives/need.py
Line 301 in 4120c18
then constraints/warnings would be processed, allowing for access to the immutable
NeedsView
, and then theconstraints_
fields would be updated as a "special exception" to sealing the needsThe text was updated successfully, but these errors were encountered: