Skip to content

Allow sub-config matches to accept multiple patterns - #4508

Open
cakeni wants to merge 2 commits into
meta:mainfrom
cakeni:feat/sub-config-multiple-matches
Open

cakeni wants to merge 2 commits into
meta:mainfrom
cakeni:feat/sub-config-multiple-matches

Conversation

@cakeni

@cakeni cakeni commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Allow [[sub-config]]'s matches key to accept either a single glob string or a non-empty list of glob strings. A listed sub-config applies when any entry matches, while existing single-string configurations retain their current behavior and precedence.

The change also updates migration code and configuration documentation, and adds coverage for single values, multiple values, and rejection of an empty list.

Fixes #4462

Test Plan

  • python test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema (formatting passed; local lint compilation is blocked by the installed MinGW headers while building mimalloc)
  • GitHub Actions on the fork branch is in progress with no failures reported at PR creation time

@meta-cla meta-cla Bot added the cla signed label Aug 11, 2026
@cakeni
cakeni marked this pull request as ready for review August 11, 2026 13:30
@meta-codesync

meta-codesync Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D115572089. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity for more than 2 weeks.

If you are still working on this this pull request, please add a comment or push new commits to keep it active. Otherwise, please unassign yourself and allow someone else to take over.

Thank you for your contributions!

@github-actions github-actions Bot added the stale label Aug 27, 2026
@cakeni

cakeni commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Still working on this; keeping it active for review.

@github-actions github-actions Bot removed the stale label Aug 28, 2026

@stroxler stroxler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @cakeni - sorry for the slow turnaround on this.

Unfortunately, this PR is tied to a stale diff internally, which makes it hard for me to review and merge it. Would you mind closing this PR and opening a fresh one? Then you can assign it to me - I should be able to turn around review much faster.

While you're at it, could you make a couple of minor adjustments? An initial AI review flagged two potential issues:

  1. The JSON schema rejects the new list syntax.
    [schemas/pyrefly.json:376–378](https://github.com/meta/pyrefly/blob/9beaefd178062f7e7341a761c6c26b7264caae43/schemas/pyrefly.json#L376-L378) still requires "type": "string". I confirmed the documented matches = ["src/first.py", "tests/second.py"] example fails validation for both pyrefly.toml and pyproject.toml.
    Fix: accept a string or an array of strings with minItems: 1, and add positive-list and empty-list schema tests.

  2. Invalid-glob diagnostics regress, including for existing scalar configs.
    [config.rs:135–142](https://github.com/meta/pyrefly/blob/9beaefd178062f7e7341a761c6c26b7264caae43/crates/pyrefly_config/src/config.rs#L135-L142) uses an untagged enum that discards the underlying Glob error. For matches = "src/[a", the useful message identifying the malformed pattern becomes data did not match any variant of untagged enum OneOrMany. A bad list entry produces the same generic error.
    Fix: use a string-or-sequence serde visitor that propagates glob errors directly, with regression tests for malformed scalar and list entries.

@stroxler stroxler assigned stroxler and unassigned samwgoldman Nov 2, 2026
@stroxler

stroxler commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Once again just to make sure it doesn't get lost: to help me turn this around, could you not only address those concerns, but close this PR and open a fresh one, assigned to me?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PyTorch: Allow matches in [[sub-config]] to accept a list of paths/globs

3 participants