Skip to content

feat: support AiAuthoringBundle metadata with dynamic handler resolution#1234

Merged
scolladon merged 9 commits intomainfrom
feat/support-AiAuthoringBundle-metadata
Mar 4, 2026
Merged

feat: support AiAuthoringBundle metadata with dynamic handler resolution#1234
scolladon merged 9 commits intomainfrom
feat/support-AiAuthoringBundle-metadata

Conversation

@scolladon
Copy link
Owner

@scolladon scolladon commented Mar 2, 2026

Explain your changes


Support AiAuthoringBundle metadata and introduce dynamic handler resolution from SDR registry attributes.

Instead of hardcoding every metadata type → handler mapping, TypeHandlerFactory now auto-resolves handlers using a multi-tier chain:

  1. Explicit overrides (handlerMap) — for types needing specialized behavior (reduced from 50 to 21 entries)
  2. inFolder: trueInFolderHandler
  3. adapter from SDR strategies (bundle/mixedContentInResource, digitalExperienceInBundle)
  4. Child heuristics (xmlTag+key + non-adapter parent → Decomposed, no xmlTag + folderPerType parent → CustomObjectChild)
  5. InFile parent detection (parent with xmlTag+key children → InFile)
  6. FallbackStandardHandler

New SDR metadata types (like AiAuthoringBundle) are now handled automatically without code changes in most cases.

Changes:

  • Add adapter and decomposition fields to Metadata schema, persisted from SDR strategies
  • Rewrite TypeHandlerFactory.resolveHandler() with multi-tier dynamic resolution
  • Update DESIGN.md with new dispatch flow diagram and resolution tiers table

Does this close any currently open issues?


closes #1232

  • Jest tests added to cover the fix.
  • NUT tests added to cover the fix.
  • E2E tests added to cover the fix.

Any particular element that can be tested locally


Any metadata type with strategies.adapter set to bundle, mixedContent, or digitalExperience in the SDR registry will now auto-resolve to the correct handler without needing an explicit entry in handlerMap.

Any other comments


The override map still handles types that need specialized behavior deviating from what SDR signals would suggest (e.g., FlowFlowHandler for deletion warnings, CustomFieldCustomFieldHandler for MasterDetail detection).

@scolladon scolladon requested a review from mehdicherf as a code owner March 2, 2026 17:10
@scolladon
Copy link
Owner Author

Hi @gavignon !

Could you test on your laptop and help us validate this PR please ?
You can follow those steps to easily do it locally

@scolladon scolladon changed the title fea: support AiAuthoringBundle metadata feat: support AiAuthoringBundle metadata Mar 2, 2026
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c6c20ab) to head (be07bd8).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1234   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           58        58           
  Lines         1544      1574   +30     
  Branches       194       204   +10     
=========================================
+ Hits          1544      1574   +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add `adapter` and `decomposition` optional fields to the Metadata Zod
schema and persist them from SDR registry `strategies.adapter` and
`strategies.decomposition` in `SDRMetadataAdapter.convertType()`.

These fields carry SDR strategy information through the metadata pipeline,
enabling downstream consumers (TypeHandlerFactory) to dynamically resolve
handlers based on registry attributes instead of hardcoded mappings.
Replace the hardcoded 50-entry handlerMap with a multi-tier resolution
chain that auto-resolves handlers from SDR metadata attributes:

1. Explicit overrides (handlerMap) — for types needing specialized behavior
2. inFolder — maps to InFolderHandler
3. adapter (bundle/mixedContent → InResource, digitalExperience → InBundle)
4. Child heuristics (xmlTag+key → Decomposed, folderPerType → CustomObjectChild)
5. InFile parent detection (parent with xmlTag+key children)
6. Fallback → StandardHandler

This reduces the override map from 50 to 21 entries. New SDR metadata
types are auto-resolved without code changes in most cases.
Update Stage 4 dispatch flow diagram to show multi-tier resolution chain.
Add handler resolution tiers table. Document adapter and decomposition
metadata fields. Update handler "Used by" lists to note auto-resolved
types. Update extensibility guidance for new metadata types.
@scolladon scolladon changed the title feat: support AiAuthoringBundle metadata feat: support AiAuthoringBundle metadata with dynamic handler resolution Mar 3, 2026
Add tests for deletion change type (line 84 ternary) and child type
falling through both child heuristics to Standard (line 126 false branch).
Mark xmlName guard in buildIndex as istanbul ignore since all real metadata
entries always provide xmlName.
Remove defensive guard and istanbul ignore comment for xmlName in
buildIndex. Since all metadata entries always have xmlName set (both SDR
and internal registry provide it), use a non-null assertion instead.
Also remove leftover investigation script (verify_resolution.js).
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Published under dev-1234 npm channel.

$ sf plugins install sfdx-git-delta@dev-1234

@gavignon
Copy link
Contributor

gavignon commented Mar 4, 2026

Hello, I just tested it and it works! The new metadata type is in the package.xml and the diff files are generated as well. Thanks

@scolladon scolladon merged commit a57f8fb into main Mar 4, 2026
21 of 24 checks passed
@scolladon scolladon deleted the feat/support-AiAuthoringBundle-metadata branch March 4, 2026 08:59
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Shipped in release v6.33.0.
Version v6.33.0 will be assigned to the latest npm channel soon
Install it using either v6.33.0 or the latest-rc npm channel

$ sf plugins install sfdx-git-delta@latest-rc
# Or
$ sf plugins install sfdx-git-delta@v6.33.0

💡 Enjoying sfdx-git-delta?
Your contribution helps us provide fast support 🚀 and high quality features 🔥
Become a sponsor 💙
Happy incremental deployment!

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.

Metadata Type AiAuthoringBundle not supported

2 participants