Skip to content

fix(validation): validate constraints#42825

Open
jamietanna wants to merge 7 commits intomainfrom
docs/constraints
Open

fix(validation): validate constraints#42825
jamietanna wants to merge 7 commits intomainfrom
docs/constraints

Conversation

@jamietanna
Copy link
Copy Markdown
Contributor

@jamietanna jamietanna commented Apr 22, 2026

Changes

To provide better coverage for our users of what is a valid option for a
constraints value, we can validate the overall format of the
constraints block, as well as the given names of constraints.

Where we have a Tool defined, we can use the default versioning for that
Tool to validate the constraint's value.

For now, both the validation of the constraints' value, and the
validation of constraints' names will be a warning, but in the future
may be made an error.

Context

Please select one of the below:

  • This closes an existing Issue: Closes #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

@github-actions github-actions Bot requested a review from viceice April 22, 2026 14:35
@jamietanna jamietanna marked this pull request as draft April 22, 2026 14:42
@github-actions github-actions Bot removed the request for review from viceice April 22, 2026 14:42
@jamietanna jamietanna marked this pull request as ready for review April 23, 2026 08:28
@jamietanna jamietanna requested review from a team and RahulGautamSingh April 23, 2026 08:28
@github-actions github-actions Bot requested a review from viceice April 23, 2026 08:28
Comment thread lib/config/validation.ts Outdated
viceice
viceice previously approved these changes Apr 23, 2026
@jamietanna
Copy link
Copy Markdown
Contributor Author

@viceice if I merge this as-is, will this cause issues for other PRs? This looks like an existing coverage issue

@viceice
Copy link
Copy Markdown
Member

viceice commented Apr 23, 2026

@viceice if I merge this as-is, will this cause issues for other PRs? This looks like an existing coverage issue

I don't think so, but can you fix the coverage issues with ignore and to-do comments?

viceice
viceice previously approved these changes Apr 23, 2026
To provide better coverage for our users of what is a valid option for a
`constraints` value, we can validate the overall format of the
`constraints` block, as well as the given names of constraints.

Where we have a Tool defined, we can use the default versioning for that
Tool to validate the constraint's value.

For now, both the validation of the `constraints`' value, and the
validation of `constraints`' names will be a warning, but in the future
may be made an error.
As this was renamed in #7308. It's been long enough since then that we
can remove this check.
@jamietanna jamietanna force-pushed the docs/constraints branch 4 times, most recently from 03a51d1 to d2b20a3 Compare April 23, 2026 13:04
For coverage fix, and also to provide insight when this does happen
viceice
viceice previously approved these changes Apr 23, 2026
@jamietanna
Copy link
Copy Markdown
Contributor Author

@viceice any help with this coverage? I can't seem to craft the right v8 ignores to make it work 🤔

Comment thread lib/config/validation.ts
});
}
} else {
// v8 ignore next -- intentionally unhandled - if we knew what was to be covered here, we'd add validation
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

move before first if and use ignore else

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems to not like it

Copy link
Copy Markdown
Collaborator

@RahulGautamSingh RahulGautamSingh left a comment

Choose a reason for hiding this comment

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

Shouldn't we also validate additionalConstraints values as well?

Comment thread lib/config/validation.ts Outdated
@jamietanna
Copy link
Copy Markdown
Contributor Author

Shouldn't we also validate additionalConstraints values as well?

They're handled under if (!isConstraintName(k)) {

We can't validate them further as they're not as well defined in terms of what the constraint should look like, versioning wise

@jamietanna jamietanna requested a review from viceice April 24, 2026 07:21
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.

3 participants