Repository navigation
test: expand snapshot coverage to guard upcoming library refactor - #1880
Draft
WillieRuemmele wants to merge 6 commits into
Draft
WillieRuemmele wants to merge 6 commits into
WillieRuemmele wants to merge 6 commits into
Conversation
Adds sample projects for adapter/transformer/registry-attribute classes that had no snapshot coverage: bundle (lwc/aura, newer bundles), matchingContentFile (incl. wave), mixedContent (documents, experiences), computeApp, default+children and legacySuffix.
Adds zipSnap/sourceToZipManifest to the snapshot helpers. Converts each sample project to an in-memory mdapi zip and snapshots the sorted entry names/sizes/hashes (not bytes, which vary by timestamp/library). Reads the zip with an independent minimal reader and asserts: - zipFileCount reported by convert() equals real entry count (incl. directory entries) - posix paths only, no duplicate entries - zip is not bloated / is meaningfully compressed on larger content Guards against regressions when swapping the zip library.
xmlAdversarial: objects, fields and labels covering entities, CDATA, comments, empty elements, whitespace, unicode, numeric-looking text, BOM and CRLF. Locks in current round-trip behavior ahead of any XML parser or builder swap. lifecycleContract: records the Lifecycle events (name, order, payload keys) SDR emits during source-format deploy and retrieve, plus the deploy telemetry customDimensions, so refactors cannot silently change what consumers see.
Adds a no-op merge test to every standard snapshot project: merge the original mdapi over the committed expected source and require no XML file to change. Any byte change here is something source-tracking would flag as a local edit. Also awaits five dirsAreIdentical calls that could never fail, and excludes binary and lossy-snapshot files from the comparison.
dirsAreIdentical was called without await in forceignore, customLabels-multiple, preset-sharingRules, preset-PermSet and staticResource, so a missing or extra file could never fail those tests (eslint no-floating-promises suppressed them). forceignore and customLabels-multiple also pointed at snapshot directories that do not exist; fixed the paths. Removed two stale baseline files that fresh conversion no longer produces (undecomposed PermissionSet and SharingRules parents, left over from before the presets decomposed them) and the matching known-change exception. Drops the five eslint suppressions.
|
This PR lacks any commits of the 'fix' or 'feat' type, and therefore will not trigger a release. To silence all further warnings, react to this warning comment (or any other) with the 👀 emoji. NOTE: If your repo uses squash commits, make sure to add the appropriate conventional commit prefix (e.g., 'fix:', 'feat:', 'chore:', etc) in the squash commit message. |
Windows checkouts convert fixtures to CRLF, which changes zip entry sizes and hashes and makes the no-op merge test report changed files. Force LF so baselines are identical on every platform.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds test coverage only (no changes under
src/) so that a large upcoming refactor of SDR's internals (new XML, zip, HTTP and logging libraries; class-to-function API changes) can be checked against today's behavior instead of against rewritten unit tests.childrenandlegacySuffixtypes.zipFileCountequals the real entry count including directory entries, posix paths, no duplicates, and that content is compressed and not bloated. Zip bytes are intentionally not snapshotted (timestamps, library).metadata_api_deploy_resulttelemetry keys.dirsAreIdenticalcalls were never awaited (suppressed byno-floating-promises) so they could not fail; two also pointed at snapshot directories that don't exist. Awaited them, fixed the paths, removed two stale baseline files (undecomposed PermissionSet/SharingRules parents that fresh conversion no longer produces), and dropped the five eslint suppressions.What issues does this PR fix or reference?
None. Preparation for the libraries-monorepo / Effect migration.
Functionality Before
Snapshot tests covered the convert path for a subset of strategies. Nothing asserted zip contents, byte-stability of unchanged retrieves, or the Lifecycle/telemetry contract, and five directory checks silently never ran.
Functionality After
Same product behavior (no
src/changes). The test suite now fails if any of the above change.Metadata Registry: Successful Deploy and Retrieve (required if applicable)
N/A: no registry changes.
Notes for reviewers
main, so they pin existing behavior, including some quirks (e.g. XML comments are hoisted next to their parent, whitespace in values is trimmed,<tag/>becomes<tag></tag>). Fixtures are hand-written, not retrieved from an org.