Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve strict dirs before suffixes for potential metadata files #1480

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Jan 8, 2025

What does this PR do?

Modifies the code when resolving potential metadata files to not reuse the suffixType when that type doesn't match with the provided file path. Added a test to ensure this doesn't regress.

See the GitHub issue for a repro. Certain metadata types have non-unique file suffixes like "rule" or "site". These would not resolve correctly in certain code paths, such as when retrieving RestrictionRule metadata.

What issues does this PR fix or reference?

#3168
@W-17555689@

@shetzel shetzel requested a review from a team as a code owner January 8, 2025 23:46
@WillieRuemmele
Copy link
Member

QA Notes


from repro repo 🚀
before

 ➜  sf project retrieve start --metadata restrictionrule      
 ›   Warning: @salesforce/plugin-agent is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.

 ────────────── Retrieving Metadata ──────────────

 Retrieving v61.0 metadata from test-9fekem0ocrbk@example.com using the v62.0 SOAP API

 ✔ Preparing retrieve request 8ms
 ✔ Sending request to org 1.00s
 ✔ Waiting for the org to respond 309ms
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 1.33s

 ›   Warning: Nothing retrieved

after ✅

pd project retrieve start --metadata restrictionrule                                                             

 ────────────── Retrieving Metadata ──────────────

 Retrieving v61.0 metadata from test-9fekem0ocrbk@example.com using the v62.0 SOAP API

 ✔ Preparing retrieve request 6ms
 ✔ Sending request to org 835ms
 ✔ Waiting for the org to respond 3.10s
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 4.05s


Retrieved Source
┌─────────┬──────┬─────────────────┬───────────────────────────────────────────────────────────┐
│ State   │ Name │ Type            │ Path                                                      │
├─────────┼──────┼─────────────────┼───────────────────────────────────────────────────────────┤
│ Changed │ Foo  │ RestrictionRule │ force-app/main/default/restrictionRules/Foo.rule-meta.xml │
└─────────┴──────┴─────────────────┴───────────────────────────────────────────────────────────┘

@WillieRuemmele WillieRuemmele merged commit 50cb744 into main Jan 9, 2025
52 checks passed
@WillieRuemmele WillieRuemmele deleted the sh/resolve-strict-dir-before-suffix branch January 9, 2025 18:24
peternhale pushed a commit that referenced this pull request Jan 9, 2025
…#1480)

* fix: resolve strict dirs before suffixes for potential metadata files

* fix: do not reuse suffixType if no match
peternhale added a commit that referenced this pull request Jan 24, 2025
* chore: wip

* chore: license year

* chore(release): 12.11.0 [skip ci]

* chore: only check md file (#1475)

* fix: add workflow flow actions to decomposed workflow preset and allow isAddressable (#1467)

* fix: add workflow flow actions and allow isAddressable

* fix: add workflow flow actions

* chore(release): 12.11.1 [skip ci]

* W-17279149 Register MD APIs to metadata registry (#1472)

* chore: register md apis to metadata registry

* Update metadataRegistry.json

chore:empty commit

* chore(release): 12.11.2 [skip ci]

* chore: auto-update metadata coverage in METADATA_SUPPORT.md [no ci]

* fix: update snapshot (#1478)

* chore(release): 12.11.3 [skip ci]

* feat(mdTypes): register tua viz and ws metadata types (#1479)

* chore(release): 12.12.0 [skip ci]

* chore: auto-update metadata coverage in METADATA_SUPPORT.md [no ci]

* fix: resolve strict dirs before suffixes for potential metadata files (#1480)

* fix: resolve strict dirs before suffixes for potential metadata files

* fix: do not reuse suffixType if no match

* chore(release): 12.12.1 [skip ci]

* chore: wip

* chore: wip

* chore: wip

* chore: encoded in MD, chars in SD (#1485)

* chore: wip

* chore: wip

* chore: update md xml to include xml header

* chore: temp (#1490)

* chore: wip

* Wr/decompose esr (#1492)

* chore: reset snapshots to main

* fix: deploy ESR yaml and -meta

* test: fix registry test

* chore: bump core

* chore: always decompose to yaml

The schema property contents in an esr can be either yaml of json.
For simplicity, given the property alwasy represents an Open API spec, the decomposed format of schema will be yaml.
Recomposition will use an existing xml property, schemaUploadFileExtension, to determine the format when build the MD type.

* chore: add missing expected artifacts

---------

Co-authored-by: peternhale <peter.hale@salesforce.com>

* chore: fix test

* chore: address review suggestions

---------

Co-authored-by: Willhoit <iowillhoit@users.noreply.github.com>
Co-authored-by: svc-cli-bot <Svc_cli_bot@salesforce.com>
Co-authored-by: Matt Carvin <90224411+mcarvin8@users.noreply.github.com>
Co-authored-by: Idan Roas <44600753+IdanRoas@users.noreply.github.com>
Co-authored-by: Willie Ruemmele <willieruemmele@gmail.com>
Co-authored-by: PKV <43024336+PraveenViswanathan@users.noreply.github.com>
Co-authored-by: Steve Hetzel <shetzel@salesforce.com>
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