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

File I/O Abstraction Part 8: Simplify module registry related components #16329

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

shenglol
Copy link
Contributor

@shenglol shenglol commented Feb 5, 2025

One of the main blockers in replacing Uri and IFileResolver with IFileHandle is the complexity of the module registry related code. This PR simplifies it by having ArtifactReference hold a reference to BicepSourceFile, eliminating the need for Uri, IConfigurationManager, and IFeatureProviderFactory operations when parsing module and extension references.

Although this PR includes many file changes, most are unavoidable test updates. The primary modifications are in Bicep.Core/Registry.

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Test this change out locally with the following install scripts (Action run 13149651171)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 13149651171
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 13149651171"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 13149651171
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 13149651171"

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Dotnet Test Results

    78 files   -     39      78 suites   - 39   33m 47s ⏱️ - 17m 20s
11 729 tests  -     13  11 729 ✅  -     13  0 💤 ±0  0 ❌ ±0 
27 216 runs   - 13 603  27 216 ✅  - 13 603  0 💤 ±0  0 ❌ ±0 

Results for commit 0e67524. ± Comparison against base commit 5f03b3b.

This pull request removes 1785 and adds 618 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ
�0\u0010\u0007�}�<Az��,�\u001d}��\u0005?h*�������R[���\u000c	G.9�2ٹ~[�CQ7R[����a�i=�? & \udac8\udc06�\u0001D?{'#��uuhe��~Pj�kOe��Q֐
s��)�Zބ���\u0019��k�y�/��yyn*?\u0014�S\u0005k?4\u001a�>�o}ѧ�#�@�0�b�)��
b�L�y�;��(���\u0004\u0012�@�\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��K
�0\u0010\u0006�=E�\u0001b��U�{7�\u001b\u000f\u0010�\u0011+���BA���Bܴ��C0�2\u0019�$�\u001f�ޛv\u000b&��\u0012�5]\u001346�H�{�;�+��\u001bET	\u0019"���;�q���]+s���B�M�\u0017�0\u0015iŴ�\u0003�1S�d+��\u000e��\u0018W�9'y�AK.�Vv��P����\u0006|�7�\u0013}�?�8r���"\u0012�3D�\u0010����L�y�\u001f88��V�6���8B\u001dl��\-<����<ϛ�\u000bb�d�\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��O\u000b�0\u0014\u0000��\u0014�\u000f0���\u0006\u001e�\u000e\u0019aA�5F\u000e2�B
��|�\u0010]�.jA�\u001d�\u001e�m��������Ԕ\u0015bJa\u001f��aK0�y�"L\u0002"_0��\u000b
\u0000l\u0006��ý�uiK��\u001fD\u0015�u����@I�l\u001f\u0010�"����ة/FBx��9ʊ�4�R]�6=�K��3�\u001e����E��\u001fS\u0006�\u000e��\u0007\2\u0002������d&�|�\u001f^�\u001c\u0016�xy\﷉7�v\u0003��&�q\u001cg|O��j	\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003�Ա
�0\u0010\u0006��>E�\u0001b��Tpw\u0011\|�؞X���\u0015
⻛\u000e���R�`�1��]\u0008\u0017�غv�.Ūf\u0012,,\u0018\u0019\u001b��R��\u001d�\u000c\u0011�\u0013n@KBh;�$=�u�*?�7z���R�d9����\u0008�c� R:6��ג���i��*+Rl٩�\u0014]<\u001f�O}�`���>����s���\u0003��\u0004\u001dE�k\u0000��_��?��\u001b��
lKL\u001aL7�ﱚ/���k�O=[\u0010\u0004A�9\u000f>��\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003��K
�0\u0010\u0006�=EO��$�$.�w�\u0015�\u0016|�T��\u0005��\u000b�E���
�[f\u0018f���t��]�yUsI�R��\u0006�Vj�}��\u000c�\u000b00D����}�\u0011mݸ*��Ĭ\u001f$l�s�gh�5hak�2����P;L�0��攵�����K]����jX��Ѩ��}kƧ�\u0003\u0008��\u0010�$-D�?J\u0013�H&�<����\u001bDQ\u0014Ekx\u0002U�.�\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���
�@\u0010\u0000�=�\u0014�\u0003���k�!�\u0011\u0016\u0004]cɅ\u000c�P\u0003��o=D\u0017��Z�~ǝ��e���N7+�SSV�r�\u0003\u0008��,�X�{\u000b3	�|A\u0000I.(\u0000^3x'\u001d�U�K��\u0014�~\u0010Q����DXR%�B��LI;/2��S_\u000c��M��(+R��Ku-���/���tz��7^�O��\u0008\u0003�\u0006p�)\u0017�\u0000$8o���������qrXl��q��&�ܳ\u0017��=9��8�{\u0002j�?�\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_banned_function_replacement ("createArray(1, 2, 3)","array","[
  1
  2
  3
]")
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_banned_function_replacement ("createObject('key', 'value')","object","{
  key: 'value'
}")
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_strings_with_newlines ("
","\n")
Bicep.Core.IntegrationTests.DecompilationTests ‑ Decompiler_handles_strings_with_newlines ("
","\r\n")
…

♻️ This comment has been updated with latest results.

Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@shenglol shenglol merged commit a90dc1f into main Feb 5, 2025
47 checks passed
@shenglol shenglol deleted the shenglol/file-io-abstraction-part-8 branch February 5, 2025 03:30
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