Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ tools/specs/
# into a workspace-relative path so every OS/edition shares one cache location).
.psmodules/

# Not yet decided whether this should be tracked -- excluded for now
tools/

# OS
Thumbs.db
Desktop.ini
Expand Down
69 changes: 53 additions & 16 deletions Data/PfbCapabilityMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -2146,16 +2146,16 @@
"quiesce": "2.28",
"skip_quiesce": "2.28"
},
"contextScope": {
"scope": "array",
"provenance": "default"
},
"readOnlyBodyProperties": [
"created",
"id",
"promotion_status",
"time_remaining"
],
"contextScope": {
"scope": "array",
"provenance": "default"
},
"parameterComponentOverrides": {
"ignore_usage": "Ignore_usage"
}
Expand Down Expand Up @@ -7060,14 +7060,14 @@
"names": "2.14"
},
"bodyProperties": {
"policy_type": "2.14",
"name": "2.14",
"id": "2.14",
"signing_authority": "2.14",
"static_authorized_principals": "2.14",
"enabled": "2.14",
"is_local": "2.14",
"location": "2.14",
"policy_type": "2.14",
"signing_authority": "2.14",
"static_authorized_principals": "2.14",
"realms": "2.19",
"context": "2.24"
},
Expand Down Expand Up @@ -7731,6 +7731,11 @@
"names": "2.16"
},
"bodyProperties": {
"name": "2.16",
"id": "2.16",
"enabled": "2.16",
"is_local": "2.16",
"location": "2.16",
"policy_type": "2.16",
"lockout_duration": "2.16",
"max_login_attempts": "2.16",
Expand All @@ -7741,11 +7746,6 @@
"min_characters_per_group": "2.16",
"enforce_username_check": "2.16",
"enforce_dictionary_check": "2.16",
"name": "2.17",
"id": "2.17",
"location": "2.17",
"is_local": "2.17",
"enabled": "2.17",
"max_password_age": "2.18",
"realms": "2.19"
},
Expand Down Expand Up @@ -9392,7 +9392,30 @@
"X-Request-ID": "2.18",
"add_to_groups": "2.23"
},
"bodyProperties": {},
"bodyProperties": {
"id": "2.18",
"name": "2.18",
"capacity": "2.18",
"data_addresses": "2.18",
"details": "2.18",
"management_address": "2.18",
"raw_capacity": "2.18",
"serial_number": "2.18",
"status": "2.18",
"unique": "2.18",
"chassis_serial_number": "2.23",
"node_key": "2.27"
},
"readOnlyBodyProperties": [
"capacity",
"chassis_serial_number",
"data_addresses",
"details",
"id",
"raw_capacity",
"status",
"unique"
],
"contextScope": {
"scope": "array",
"provenance": "default"
Expand Down Expand Up @@ -10164,7 +10187,10 @@
"parameters": {
"X-Request-ID": "2.19"
},
"bodyProperties": {},
"bodyProperties": {
"resource": "2.19",
"scope": "2.19"
},
"contextScope": {
"scope": "array",
"provenance": "default"
Expand Down Expand Up @@ -11862,7 +11888,13 @@
"resource_ids": "2.23",
"resource_names": "2.23"
},
"bodyProperties": {},
"bodyProperties": {
"copyable": "2.23",
"key": "2.23",
"namespace": "2.23",
"resource": "2.23",
"value": "2.23"
},
"contextScope": {
"scope": "array",
"provenance": "default"
Expand Down Expand Up @@ -13539,7 +13571,12 @@
"fleet_names": "2.27",
"validate_target_certificates": "2.27"
},
"bodyProperties": {},
"bodyProperties": {
"authentication_credentials": "2.27",
"ca_certificate": "2.27",
"ca_certificate_group": "2.27",
"management_address": "2.27"
},
"contextScope": {
"scope": "array",
"provenance": "default"
Expand Down
35 changes: 24 additions & 11 deletions Private/Assert-PfbApiCapability.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,30 @@ function Assert-PfbApiCapability {
}
}

# Dictionary bodies only, and deliberately so. An array body's per-element fields are NOT
# checked, because the capability map records nothing to check them against:
# tools/Build-PfbCapabilityMap.ps1 fills bodyProperties from Get-PfbSchemaPropertyNames,
# whose schema walk resolves $ref and allOf but never descends through an array schema's
# "items". Every array-bodied endpoint in the spec -- PUT /workloads/tags/batch,
# POST /nodes/batch, POST /resource-accesses/batch -- therefore carries
# "bodyProperties": {} in Data/PfbCapabilityMap.json, so a union-of-element-fields check
# would compare every field against an empty map and could never fire. Skipping is an
# honest no-op; the alternative is a gate that only looks like one. Teaching the map to
# record per-element fields is its own change, and this loop picks it up for free if a
# future map representation ever lands.
# Dictionary bodies only. An array body's per-element fields are NOT checked -- but note
# the reason has changed, and the note this comment used to carry was wrong about what
# would happen next.
#
# It previously read that array-bodied endpoints carry "bodyProperties": {} in
# Data/PfbCapabilityMap.json, because Get-PfbSchemaPropertyNames' walk resolves $ref and
# allOf but never descends an array schema's "items" -- so a check would compare every
# field against an empty map and could never fire. That was true, and it concluded that
# "this loop picks it up for free if a future map representation ever lands."
#
# That map representation has now landed (issue #82): Get-PfbSpecCapabilities hops "items"
# at its call site, and PUT /workloads/tags/batch, POST /nodes/batch,
# POST /resource-accesses/batch and POST /fleets/members/batch now carry real per-element
# fields. But it is NOT picked up for free, because of the type guard on the line below:
# an array body arrives as [hashtable[]] (see Set-PfbWorkloadTag, which passes its -Tags
# straight through), and [hashtable[]] is not an IDictionary, so this loop is skipped
# before the map is ever consulted.
#
# Enabling it therefore means relaxing this guard to iterate the elements and union their
# keys -- a deliberate behaviour change that can start refusing calls that succeed today,
# not a no-op. It is left as its own change rather than smuggled in with the map fix.
# Today the blast radius is nil: Set-PfbWorkloadTag is the only cmdlet reaching an
# array-bodied endpoint, and all five of its fields are 2.23 -- but that stops being true
# as soon as #44 adds cmdlets for the other three.
#
# Endpoint minVersion and query-parameter checks above still run for array-bodied calls,
# which is gating those endpoints previously had none of.
Expand Down
Loading