Skip to content

unified: Preserve argument label ordering in MaD - #23139

Open
asgerf wants to merge 1 commit into
mainfrom
unified/mad-signatures
Open

asgerf wants to merge 1 commit into
mainfrom
unified/mad-signatures

Conversation

@asgerf

@asgerf asgerf commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The argument label order had been sorted due to an incorrect belief that they could appear at an arbitrary order at the call site. This PR restores the MaD models to use the original declaration order.

The argument label order was normalized due to an incorrect belief that they could appear at an arbitrary order at the call site.
@asgerf asgerf added the no-change-note-required This PR does not need a change note label Nov 16, 2026
@asgerf
asgerf marked this pull request as ready for review November 16, 2026 11:57
@asgerf
asgerf requested a review from a team as a code owner November 16, 2026 11:57
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 11:57

Copilot AI 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.

🟡 Changes recommended

Active findings remain because the change lacks multi-parameter coverage for mixed-label ordering and DCA results validating production alert impact beyond the focused fixture.

2 open issues
What changed in this PR

Restores declaration-order handling for Swift argument labels in unified MaD so model selectors match valid call sites and callable declarations.

Changes:

  • Preserves argument and parameter label order using AST parent indexes.
  • Updates legacy Swift and format-string model selectors to declaration order.
  • Adjusts the MaD regression test and expected sink locations.
File Description
unified/​ql/​test/​library-tests/​mad/​test.swift Reorders constructor arguments in the MaD regression test to match declaration order.
unified/​ql/​test/​library-tests/​mad/​test.expected Updates expected sink locations for the reordered test calls.
unified/​ql/​lib/​ext/​legacy-swift.model.json Updates legacy Swift model selectors to use declaration-order labels.
unified/​ql/​lib/​ext/​format-string.model.yml Updates format-string model selectors to use declaration-order labels.
unified/​ql/​lib/​codeql/​unified/​internal/​mad/​LegacyMaD.qll Preserves argument-label order when constructing MaD signatures for calls and callable declarations.

Review effort: Lite (dynamic)

)
|
name + ":" order by group, name
name + ":" order by arg.getParentIndex()
)
|
name + ":" order by group, name
name + ":" order by param.getParentIndex()

@geoffw0 geoffw0 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.

LGTM.

The existing query tests give me a lot of confidence in the adjustments to models.

There's a significant risk of merge / semantic merge issues with my work on various new queries. I think we should merge this as soon as possible, I will fix up my open PRs, and check recently merged ones as well.

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

Labels

no-change-note-required This PR does not need a change note Unified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants