Port filename PR identity - #3941
Conversation
There was a problem hiding this comment.
Requesting changes: filename-based --prs matching currently accepts timestamp-slug numeric prefixes, which causes mismatches against the intended behavior and documentation for PR filtering.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
| ChangelogFilterCriteria criteria, | ||
| HashSet<string> matchedPrs) | ||
| { | ||
| var fileNumbers = ChangelogPrIdentity.ParseLeadingPrNumbers(fileName); |
There was a problem hiding this comment.
ParseLeadingPrNumbers(fileName) here will treat any leading numeric segment as a PR identity before YAML prs: is considered. That makes --prs match files like 1735-foo.yaml by filename alone when prs: is empty.
This conflicts with the intended behavior documented in this PR (1735-foo.yaml should require YAML prs: or --files) and can include incorrect entries when filtering by PR.
Please constrain filename-based matching to explicit PR-style names (e.g. 12345.yaml, 12345-...) and add a negative test proving 1735-foo.yaml without prs: does not match --prs .../pull/1735.
There was a problem hiding this comment.
Here's the response following AI analysis:
The prefix match is real for a local directory --prs scan, but it is the same rule git-range already uses on main (ParseLeadingPrNumbers, including 1755000000-my-title.yaml). CDN --prs is unaffected: it GETs {n}.yaml and passes IncludeAll, so it never runs this filter and never sees 1735-foo.yaml.
The PR text that said timestamp-slug files need prs: or --files was wrong for that shared helper. I’ve fixed the docs to match git-range (leading numeric segments or YAML prs:). I won’t add a 12345-… allowlist or a negative 1735-foo.yaml test — that would make local --prs stricter than git-range, which this PR is not doing.
Local --prs is the only path that changes. The useful case is {n}.yaml after an author strips prs:. Scrubbed CDN copies already work via the probe key. --files remains the way to select leftover slug names precisely.
| { | ||
| /// <summary> | ||
| /// Parses PR numbers from the leading dash-separated numeric segments of an entry file name, | ||
| /// covering the PR-number naming schemes (<c>123.yaml</c>, <c>123-456.yaml</c>, |
There was a problem hiding this comment.
<c>123-456.yaml</c> that doesn't exist anymore. If a changelog has multiple PR's we create 123.yaml and 456.yaml
The later only contains:
link: 123
That way each PR can check against a known S3 location
There was a problem hiding this comment.
My AI analysis says the behaviour you're describing doesn't exist in main yet so I'll put this PR in draft state until the main branch stabilizes.
There was a problem hiding this comment.
I've rebased again now that more fixes have landed. Here's the latest response after AI analysis:
Agreed — 123-456.yaml is not how we author or store extra PRs anymore. changelog add writes one {n}.yaml per PR; after upload the scrubber adds {extra}.yaml markers with link: {canonical} so each PR has a known S3 key (#3928/#3930).
I’ve dropped that example from the helper docs and described markers instead. I’m not tightening ParseLeadingPrNumbers in this PR: git-range on main still treats leading dash-separated digits as identity (including leftover hyphenated names), and this change only shares that helper with local --prs. Changing the parser would be a git-range behavior change and is out of scope here.
ec718a5 to
90fec96
Compare
Why
#3911 tried to fix stale CDN pool listings by bringing back
changelog/{org}/{repo}/{branch}/registry.json. That approach was rejected (review): discovery should be PR-keyed GETs, not an unbounded per-branch index. That architecture is already onmain(#3922–#3930).One keep-item from that review did not land: local
--prsmatching must use the same identity as git-ref. Local--prsstill joined only on YAMLprs:. After an author stripsprs:from a PR-numbered file (12345.yaml), local--prsmissed it even though the file name carries the PR. CDN--prswas already fine (it probes{n}.yamlwithIncludeAll).What
Share filename PR identity with local
--prs(and any matcher path that usesChangelogEntryMatcher):prs:prs:-stripped{n}.yamlstill matches local--prs--filesfor precise path selection{n}.yamlwithlink: {canonical}), not combined123-456.yamlfilenamesGit-range already had this logic; it now uses the shared helper instead of a private copy.
CDN
--prsis unchanged: it still probes{n}.yamldirectly. This PR does not restore poolregistry.jsonreconcile.Generative AI disclosure
Did you use a generative AI (GenAI) tool to assist in creating this contribution?
Tool(s) and model(s) used: Cursor Grok 4.5