Repository navigation
Commit fb2476d
3.3 rc.1 backport fixes (#1662)
* feat: implement export filter functionality for resource exports (#1621)
* feat: implement export filter functionality for resource exports
* Remove comment
* feat: implement export filter functionality for resource exports
* Remove comment
* Fix Copilot remarks
* Wrong commit
* Remove the wildcard support for resources
* Fix Copilot remarks
* Attempt to increase code coverage and fix test
* Add additional test for coverage
* Add test and fix dism_dsc
* fix: correct code coverage calculation for uninstrumented files
Files without LCOV data (e.g., platform-specific code behind #[cfg(windows)]
when only Linux coverage is collected) were incorrectly counting ALL added
lines as uncovered, including non-executable lines like comments and blanks.
This caused coverage to drop significantly when Windows-only files were
modified in a PR.
Fix: skip files without LCOV data since coverage cannot be determined for
uninstrumented code. Also handle the '\ No newline at end of file' diff
marker which could cause off-by-one line number errors after deleted lines.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refactor work on services
* Remove unused key
* Revert change
* Restore native resource filtering and add engine filtering fallback
* Update resource definitions
* Fix Copilot remark
* remove directive
* Change comment wording and update tests
* Add crate
* Revert change and fix test
* Update resource manifest
---------
Co-authored-by: Steve Lee <slee@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* (GH-1563) Enhance the PSScript resources (#1657)
* (GH-1563) Canonicalize `_inDesiredState` for PSScript schema
Prior to this change, the PSScript resource manifests embedded a schema
that minimally defined the `_inDesiredState` canonical property instead
of referencing the canonical schema for that property.
This change updates the embedded schemas to reference the canonical
schema and adds the embedded schema by ID to the `$defs` keyword.
* (GH-1563) Canonicalize script properties for PSScript schemas
Prior to this change, the embedded schemas in the manifests for the
transitional PowerShell script resources defined the script properties
with a minimal schema allowing the value to be any string or null. They
didn't include any other keywords.
This change:
1. Defines a shared subschema for the script properties, which they now
reference instead of redefining the constraints for each property.
1. Removed `null` from the allowed types, since defining a script
property as `null` isn't valid but _not_ specifying the property at
all _is_ valid.
1. Added the `writeOnly` keyword to the script properties, since
they're only used for input and not output.
1. Added the `contentMediaType` keyword to the script properties to
clearly indicate---but not validate---that the value is expected to
be a PowerShell script.
1. Added the `minLength` keyword to the script properties to ensure that
an empty string isn't used as a script value.
1. Adds the `title` and `description` keywords to the script properties
to provide more context for each property in the schema.
* (GH-1563) Canonicalize `input` for PSScript resource schemas
Prior to this change, the `input` property for the PSScript resource
schemas defined the valid types with two problems:
1. It allowed `null` as a valid type, which caused failures when the
resource invoked the scripts.
1. It didn't allow non-integer numbers, erroneously preventing users
from defining input values like `3.14`, even though `[3.14]` was
accepted.
This change:
1. Removes `null` from the valid types for `input`.
1. Adds `number` to the valid types for `input`, allowing non-integer
numbers to be used as input values.
1. Adds the `title` and `description` keywords to the `input` property,
providing better documentation for users.
* (GH-1563) Add constraints to PSScript resource schema
Prior to this change, the embedded schemas for the PSScript resources
didn't require any properties to be defined. For input, a user should
always define at least one script property. For output, the resource
should always return one of three value shapes:
1. For `test` operations, the resource should always define the
`inDesiredState` property.
1. For implemented `get` and `set` operations, the resource should
define the `output` property when the script emits any output to the
success stream.
1. When `get` and `set` operations aren't implemented or don't emit any
output, the resource should return an empty object.
This change adds constraints to the embedded schemas with the `oneOf`
keyword and nested `oneOf`/`anyOf` keywords to enforce these rules.
* (GH-1563) Add docs keywords for PSScript resources
Prior to this change, the embedded schema for the PSScript resources
didn't define the `title` or `description` keywords.
This change:
1. Adds `title` and `description` keywords to the embedded schema for
the PSScript resources to provide some documentation for them.
1. Defines the `$schema` keyword explicitly.
* (GH-1563) Canonicalize output for PSScript resources
Prior to this change, the PSScript resources:
1. Always returned an array of output objects, even if there was only
one object.
1. Didn't ensure that enums in script output were serialized as
strings, causing enums to emit as integers, which is likely not what
the user intended and makes review more difficult.
This change:
1. Ensures that if a script returns a single object, it's serialized as
that object instead of nested in an array.
1. Adds the `-EnumAsString` parameter to the `ConvertTo-Json` call for
emitting script output when invoked through PowerShell to ensure
that enums are serialized as strings. This enhancement doesn't
affect Windows PowerShell, which doesn't support the `-EnumAsString`
parameter.
1. Updates the tests to reflect the new behavior of returning a single
object instead of an array.
1. Fixes the tests to use correct casing for the script properties,
now that the schema validation checks for those properties.
* (GH-1563) Fix tests using invalid casing for PSScript resource
Prior to this change, some tests were using invalid casing for the
PSScript resource type, which didn't previously cause errors during
the JSON Schema validation because the schema didn't forbid additional
properties. The tests passed because PowerShell isn't case-sensitive,
so was able to retrieve the properties even with incorrect casing.
With the changes to the JSON schema _requiring_ one or more script
properties, these tests began to fail because the invalidly-cased
property names didn't satisfy the JSON Schema.
This change corrects the casing in the test definitions to ensure both
that the tests are correct and pass the schema validation.
* Apply suggestions from review
Co-authored-by: Steve Lee <slee@microsoft.com>
---------
Co-authored-by: Steve Lee <slee@microsoft.com>
* Add JSON schema caching (#1637)
* Add JSON schema caching
* address copilot feedback
* fix copilot feedback to not deserializing the json
* rename function to be singular
* make helpers scoped to crate
* make cache crate only
* fix: add support for preserving quoted group names in sshd_config (#1639)
* fix: add support for preserving quoted group names in sshd_config
* Update with remarks Tess
---------
Co-authored-by: Gijs Reijn <26114636+Gijsreyn@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>1 parent def8803 commit fb2476d
32 files changed
Lines changed: 1286 additions & 398 deletions
File tree
- dsc/tests
- lib/dsc-lib
- locales
- src
- configure
- dscresources
- resources
- PSScript
- dism_dsc
- sshdconfig
- locales
- src
- tests
- windows_firewall
- src
- windows_service
- src
- tools/dsctest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
185 | 235 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
21 | 37 | | |
22 | | - | |
| 38 | + | |
23 | 39 | | |
24 | | - | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | | - | |
| 43 | + | |
28 | 44 | | |
29 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2448 | 2448 | | |
2449 | 2449 | | |
2450 | 2450 | | |
| 2451 | + | |
| 2452 | + | |
2451 | 2453 | | |
2452 | 2454 | | |
2453 | 2455 | | |
| |||
2469 | 2471 | | |
2470 | 2472 | | |
2471 | 2473 | | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
2475 | | - | |
| 2474 | + | |
2476 | 2475 | | |
2477 | 2476 | | |
2478 | 2477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| |||
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
| 211 | + | |
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
| |||
241 | 248 | | |
242 | 249 | | |
243 | 250 | | |
| 251 | + | |
244 | 252 | | |
245 | 253 | | |
246 | 254 | | |
| |||
0 commit comments