Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
Fix/aws parity b (#1684)
Nahuel Nucera7bb86a56c38e
diff --git a/README.md b/README.mdindex 4a775177..afb7fd47 100644--- a/README.md+++ b/README.md@@ -599,7 +599,7 @@ MiniStack expands AWS SAM transforms (`Transform: AWS::Serverless-2016-10-31`) i| **Transfer Family** | CreateServer, DescribeServer, DeleteServer, ListServers, StartServer, StopServer, CreateUser, DescribeUser, DeleteUser, ListUsers, ImportSshPublicKey, DeleteSshPublicKey | 12 operations; **real SFTP listener** on `:2222` (override with `SFTP_PORT`) backed by S3 — `ls`, `put`, `get`, `mkdir`, `rename` work end-to-end against the local S3 emulator; `SFTP_PORT_PER_SERVER=1` allocates one port per `CreateServer` from `SFTP_BASE_PORT` (default 2300); SSH key auth scans every user across every server and account; `LOGICAL` and `PATH` home-directory mappings; host key persists across restarts when `PERSIST_STATE=1` || **IoT Jobs** | Control plane (`iot`): CreateJob, DescribeJob, ListJobs, GetJobDocument, CancelJob, DeleteJob, ListJobExecutionsForThing, DescribeJobExecution, CancelJobExecution; data plane (`iot-jobs-data`): GetPendingJobExecutions, StartNextPendingJobExecution, DescribeJobExecution (incl. the `$next` sentinel), UpdateJobExecution | 9 control-plane + 4 device data-plane operations sharing one store. Executions walk `QUEUED → IN_PROGRESS → {SUCCEEDED, FAILED, REJECTED, CANCELED}`; the remaining AWS terminal statuses (`TIMED_OUT`, `REMOVED`) are modeled and counted in `jobProcessDetails` but nothing sets them — there are no execution timeouts, and deleting a thing DELETES its executions (freeing a job that was only waiting on that thing) rather than marking them `REMOVED`. `versionNumber` gives optimistic concurrency: every transition bumps it and a stale `expectedVersion` is rejected with a 409 whose message carries the current version — coded `VersionConflictException` on the control plane and `InvalidStateTransitionException` on the device plane, each as its own service model declares. `executionNumber` is write-once (always 1: an execution is never re-queued). Devices may only report `IN_PROGRESS` / `SUCCEEDED` / `FAILED` / `REJECTED` via `UpdateJobExecution`; targets are thing or thing-group ARNs — `SNAPSHOT` jobs resolve group membership once at creation, `CONTINUOUS` jobs also pick up things added to a target group later, and a target must name a thing or thing group in the caller's own account and region (anything else is `ResourceNotFoundException`, since it would resolve to no devices at all); a non-continuous job auto-`COMPLETED`s (with `jobProcessDetails` counts) once every execution is terminal. **`documentSource` is not fetched**: a job created with an S3 `documentSource` serves a `{"documentSource": "<url>"}` placeholder as its document rather than the object's content, so the lifecycle still runs — pass `document` when the content matters. **Timestamps are epoch seconds on every plane, as AWS documents**: control-plane responses use `timestamp` shapes (boto3 parses them to datetimes) while `iot-jobs-data` responses carry whole-second integer `long`s. **Jobs over MQTT**: the reserved `$aws/things/<thing>/jobs/#` request topics (`get`, `start-next`, `<jobId>/get` incl. `$next`, `<jobId>/update`) answer on their `accepted`/`rejected` topics from the same store as the HTTP plane (`jobDocument` as a JSON object over MQTT, a string over HTTP, as on AWS; rejections carry the string `ErrorCode` values and the execution's state on version and state-transition conflicts); `notify` fires when the pending set changes and `notify-next` when the queue front changes; `stepTimeoutInMinutes` and `executionNumber` are accepted but ignored. Job state persists with the IoT store when `PERSIST_STATE=1` || **IoT Core** | CreateThing, DescribeThing, ListThings, UpdateThing, DeleteThing, CreateThingType, CreateThingGroup, AddThingToThingGroup, ListThingsInThingGroup, ListThingGroupsForThing, CreateKeysAndCertificate, RegisterCertificate, RegisterCertificateWithoutCA, UpdateCertificate, DeleteCertificate, GetRegistrationCode, DeleteRegistrationCode, RegisterCACertificate, DescribeCACertificate, UpdateCACertificate, ListCACertificates, DeleteCACertificate, CreateProvisioningTemplate, DescribeProvisioningTemplate, ListProvisioningTemplates, UpdateProvisioningTemplate, DeleteProvisioningTemplate, AttachThingPrincipal, DetachThingPrincipal, ListThingPrincipals, ListPrincipalThings, CreatePolicy, CreatePolicyVersion, AttachPolicy, DetachPolicy, ListAttachedPolicies, ListTargetsForPolicy, AttachPrincipalPolicy, DetachPrincipalPolicy, ListPrincipalPolicies, ListPolicyPrincipals, CreateTopicRule, GetTopicRule, ReplaceTopicRule, DeleteTopicRule, ListTopicRules, UpdateIndexingConfiguration, GetIndexingConfiguration, DescribeIndex, ListIndices, SearchIndex, DescribeEndpoint, Publish (HTTP), MQTT-over-WebSocket pub/sub | 52 operations + **MQTT 3.1.1 and 5.0 over WebSocket** (negotiated per connection) on the gateway port — clients use the address returned by `DescribeEndpoint`; local CA signs `CreateKeysAndCertificate` certificates (CA persists across restarts when `PERSIST_STATE=1`); multi-tenancy via transparent topic prefixing (same pattern as Transfer Family's shared SFTP listener); no plain TCP 1883 (real AWS IoT requires TLS or SigV4 on every connection), but a **native mTLS MQTT listener on 8883** serves device SDK binaries by default — the client certificate is optional (no certificate means the default account, like an unsigned WebSocket upgrade) and, when presented, must be registered `ACTIVE` in exactly one account, which then serves the session; unknown, inactive or doubly-registered certificates get a "not authorized" CONNACK (see `IOT_MTLS_PORT` in the environment table); local CA cert available at `GET /_ministack/iot/ca.pem` for SDK trust configuration; IoT policies are stored but **not enforced** on the data plane; **fleet indexing** works the way it does on AWS — `UpdateIndexingConfiguration` turns the `AWS_Things` index on (Terraform `aws_iot_indexing_configuration`), and searching while `thingIndexingMode` is `OFF` answers `ResourceNotFoundException`; `SearchIndex` then queries the live registry + classic shadows with `AND`-separated `thingName` / `thingTypeName` / `thingGroupNames` / `attributes.*` / `shadow.reported.*` / `shadow.desired.*` terms (`*` / `?` wildcards, `maxResults` / `nextToken` paging) — there is no projection to build, so hits are always current; the deprecated principal-policy family (`AttachPrincipalPolicy` / `DetachPrincipalPolicy` / `ListPrincipalPolicies` / `ListPolicyPrincipals`) maps 1:1 onto the modern policy-target store; **topic rules fire on matching publishes** (incl. Basic Ingest `$aws/rules/<name>`) with SQL SELECT projection (`topic()`, `timestamp()`, `encode()`, `newuuid()`, `replace()`, `clientid()`, `isUndefined()`), **WHERE-clause evaluation** (comparisons, `IN`, `LIKE`, `BETWEEN`, `IS NULL`, `regexp_matches`, bare boolean attributes, composed with `AND` / `OR` and parenthesised grouping; missing attributes fail closed as on AWS; unparseable SQL → `SqlParseException`), and `lambda` / `republish` / `dynamoDBv2` / `sns` / `sqs` actions dispatched in-process with the rule's `errorAction` on failure; **device shadows over MQTT** — the `$aws/things/<thing>/shadow[/name/<name>]/{get,update,delete}` reserved topics drive the shadow store and reply on `accepted` / `rejected` (with `delta` and `documents` on update); a **CA-certificate registry** (`RegisterCACertificate` and friends) with the just-in-time-registration `registered` event on `$aws/events/certificates/registered/{caCertificateId}`; a **provisioning-template registry** (`CreateProvisioningTemplate` and friends) — storage + CRUD only, so `provisioningRoleArn` is presence-checked but not resolved and the fleet-provisioning MQTT workflow (`$aws/provisioning-templates/...`) is not implemented; and `SearchIndex` answers `connectivity.connected` / `connectivity.timestamp` / `connectivity.disconnectReason` when `thingConnectivityIndexingMode` is `STATUS`, deriving `connected` from the live session registry |-| **IoT Wireless** | GetPositionEstimate | Single operation (`POST /position-estimate`, SigV4 scope `iotwireless`, endpoint prefix `api.iotwireless`). **The response is the raw GeoJSON blob** — the output shape's `payload` trait — so boto3 hands back a `StreamingBody` under `GeoJsonPayload`, not a JSON envelope. Resolves from `Ip` only: `WiFiAccessPoints` / `CellTowers` / `Gnss` are accepted and ignored, `Timestamp` and `AdvancedConfiguration` only reach `properties`, and the estimate is synthetic + deterministic — the canonical IP (an IPv4-mapped IPv6 address counts as its IPv4 form) hashes onto lon [-180, 180) / lat [-60, 60), 4 decimals — so the same address always answers the same estimate and consumer tests can assert on it. `properties` carry the two accuracy values of one live call (`horizontalAccuracy` 1000000, `horizontalConfidenceLevel` 0.67, measured on a call that sent no `AdvancedConfiguration`, so that is the default level — `AdvancedConfiguration.WiFiCellular.ConfidencePercent` is the caller's say over it and drives the reported level over 100, within the 50 to 99 the model allows) plus `timestamp`, which is always there: AWS documents the request's `Timestamp` as the resolve time and the receive time as its substitute when the caller sends none, so send a `Timestamp` and the whole blob is byte-identical. The real payload's `country` and city/state/postal properties are omitted for that determinism. An input with no resolver hint and an `IpAddress` that `ipaddress.ip_address()` refuses answer `ValidationException` with the live service's verbatim wording; a `Timestamp` that is not a Unix timestamp, and a `ConfidencePercent` outside the model's range, are `ValidationException` too; a valid address that is **not globally routable or is multicast** (private, loopback, TEST-NET, multicast groups, ...) answers `ResourceNotFoundException` `Cannot find position for the IP address <ip>`, mirroring the real service's refusal when its geo database has no entry. A well-formed request whose only measurements are WLAN/cell/GNSS is `ResourceNotFoundException` too, naming the IP-only scope — AWS documents that class for a measurement it cannot solve, and 400 for measurement data formatted incorrectly. Stateless — nothing persists |+| **IoT Wireless** | GetPositionEstimate | Single operation (`POST /position-estimate`, SigV4 scope `iotwireless`, endpoint prefix `api.iotwireless`). **The response is the raw GeoJSON blob** — the output shape's `payload` trait — so boto3 hands back a `StreamingBody` under `GeoJsonPayload`, not a JSON envelope. Resolves from `Ip` only: `WiFiAccessPoints` / `CellTowers` / `Gnss` are accepted and ignored, `Timestamp` and `AdvancedConfiguration` only reach `properties`, and the estimate is synthetic + deterministic — the canonical IP (an IPv4-mapped IPv6 address counts as its IPv4 form) hashes onto lon [-180, 180) / lat [-60, 60), 4 decimals — so the same address always answers the same estimate and consumer tests can assert on it. `properties` carry `horizontalAccuracy` 1000000 (the value of one live call) and `horizontalConfidenceLevel` 0.68 (the default the AWS IoT Core Device Location guide documents — `AdvancedConfiguration.WiFiCellular.ConfidencePercent` overrides it, divided by 100, within the 50 to 99 the model allows) plus `timestamp`, which is always there: AWS documents the request's `Timestamp` as the resolve time and the receive time as its substitute when the caller sends none, so send a `Timestamp` and the whole blob is byte-identical. The real payload's `country` and city/state/postal properties are omitted for that determinism. An input with no resolver hint and an `IpAddress` that `ipaddress.ip_address()` refuses answer `ValidationException` (those two wordings are recorded from the live service; every other message in this service is MiniStack's own, since none is documented); a `Timestamp` that is not a Unix timestamp, and a `ConfidencePercent` outside the model's range, are `ValidationException` too; a valid address that is **not globally routable or is multicast** (private, loopback, TEST-NET, multicast groups, ...) answers `ResourceNotFoundException` `Cannot find position for the IP address <ip>`, mirroring the real service's refusal when its geo database has no entry. A well-formed request whose only measurements are WLAN/cell/GNSS is `ResourceNotFoundException` too — the developer guide documents 404 for exactly that ("no location information was found or solved ... The MAC address or cellular tower information is not sufficient ... The GNSS payload is not sufficient"), and 400 for measurement data formatted incorrectly. Stateless — nothing persists || **EventBridge Scheduler** | CreateSchedule, GetSchedule, UpdateSchedule, DeleteSchedule, ListSchedules, CreateScheduleGroup, GetScheduleGroup, DeleteScheduleGroup, ListScheduleGroups, TagResource, UntagResource, ListTagsForResource | 12 actions; schedules **fire their targets** — a background sweep invokes each enabled schedule's target (Lambda, SQS, SNS, Step Functions) when due, honoring `State`, `StartDate`/`EndDate`, and `ActionAfterCompletion: DELETE`; schedule groups with cascading deletes; `rate()`, `cron()`, `at()` expressions; group/prefix/state filters on list; default group auto-created; CFN `AWS::Scheduler::Schedule` and `AWS::Scheduler::ScheduleGroup` supported || **EKS** | CreateCluster, DescribeCluster, ListClusters, DeleteCluster, CreateNodegroup, DescribeNodegroup, ListNodegroups, DeleteNodegroup, CreateAddon, DescribeAddon, ListAddons, UpdateAddon, DeleteAddon, AssociateEncryptionConfig, CreateAccessEntry, DescribeAccessEntry, ListAccessEntries, UpdateAccessEntry, DeleteAccessEntry, AssociateAccessPolicy, DisassociateAccessPolicy, ListAssociatedAccessPolicies, AssociateIdentityProviderConfig, DescribeIdentityProviderConfig, DisassociateIdentityProviderConfig, ListIdentityProviderConfigs, TagResource, UntagResource, ListTagsForResource | `CreateCluster` spawns a real **k3s** container (75 MB) with a full Kubernetes API server; `kubectl`, Helm, and any K8s tooling work out of the box; cascading delete removes nodegroups and k3s container; addon CRUD (e.g. `vpc-cni`, `coredns`, `kube-proxy`, `aws-ebs-csi-driver`) at `/clusters/{name}/addons` flips status to `ACTIVE` on create / update; `AssociateEncryptionConfig` at `/clusters/{name}/encryption-config/associate` records KMS encryption config (rejects re-association, AWS-shape `update` envelope); **Access Entries** (modern post-1.29 IAM bindings — replaces aws-auth ConfigMap) at `/clusters/{name}/access-entries[/{principalArn}[/access-policies[/{policyArn}]]]` for Crossplane / Terraform `aws_eks_access_entry` + `aws_eks_access_policy_association`; OIDC discovery + JWKS served at the cluster's `identity.oidc.issuer` URL so Terraform's `aws_iam_openid_connect_provider` (IRSA) works against ministack; **OIDC Identity Provider Config** (`AssociateIdentityProviderConfig` / `DescribeIdentityProviderConfig` / `DisassociateIdentityProviderConfig` / `ListIdentityProviderConfigs`) at `/clusters/{name}/identity-provider-configs[/{verb}]` — one OIDC IdP per cluster, issuer + clientId + claims forwarded to the k3s API server via `--kube-apiserver-arg=oidc-*` flags, tags reachable via `ListTagsForResource`; CFN `AWS::EKS::Cluster` and `AWS::EKS::Nodegroup` supported || **OpenSearch Service** | CreateDomain, DescribeDomain, DescribeDomains, DeleteDomain, ListDomainNames, UpdateDomainConfig, DescribeDomainConfig, DescribeDomainChangeProgress, ListVersions, GetCompatibleVersions, AddTags, ListTags, RemoveTags | Management plane on `/2021-01-01/*` (`boto3.client("opensearch")`, SigV4 scope `es`). Default data plane is a stub endpoint (`<domain>.ministack.local:9200`) — set `OPENSEARCH_DATAPLANE=1` to spawn one real `opensearchproject/opensearch` container per `CreateDomain` (same pattern as ElastiCache/RDS); `DescribeDomain.Endpoint` then points at that container and `_cluster/health`/`/_search` work end-to-end. Add `OPENSEARCH_DASHBOARDS=1` (with dataplane on) to also spawn a per-domain `opensearch-dashboards` sidecar; `DescribeDomain.DashboardEndpoint` is populated. ARNs follow `arn:aws:es:<region>:<account>:domain/<name>`; Terraform `aws_opensearch_domain` resource compatible. |diff --git a/ministack/core/responses.py b/ministack/core/responses.pyindex d806effb..7ee62071 100644--- a/ministack/core/responses.py+++ b/ministack/core/responses.py@@ -462,7 +462,15 @@ def error_response_xml(code: str, message: str, status: int, namespace: str = "hreturn status, {"Content-Type": "application/xml"}, body-def error_response_json(code: str, message: str, status: int = 400, extra: dict | None = None) -> tuple:+# Error-body content types. The json protocol (awsJson1.0/1.1) answers+# `application/x-amz-json-1.0`; a rest-json service answers `application/json`.+JSON_1_0_CONTENT_TYPE = "application/x-amz-json-1.0"+REST_JSON_CONTENT_TYPE = "application/json"+++def error_response_json(code: str, message: str, status: int = 400, extra: dict | None = None,+ *, message_key: str = "message",+ content_type: str = JSON_1_0_CONTENT_TYPE) -> tuple:"""AWS-style JSON error response.Real AWS emits the error type in BOTH the body (`__type`) and the@@ -472,16 +480,28 @@ def error_response_json(code: str, message: str, status: int = 400, extra: dict`extra` carries the modeled members some exceptions add to the body (forexample `resourceId` / `resourceArn` on `ResourceAlreadyExistsException`),so callers never have to rebuild the envelope themselves.++ `message_key` is the wire name of the message member, which is NOT the same+ across services: it is whatever the exception shape declares, after any+ `locationName`. Most json-protocol services model `message`, which is why+ that is the default, but for example iotwireless models `Message`. boto3+ finds either; Java/Go SDK v2 unmarshal by the modeled name, so the wrong+ casing loses the message there. Pull the shape before overriding this.++ `content_type` likewise: `application/x-amz-json-1.0` suits the json+ protocol, while a rest-json service answers `application/json`. Both SDK+ and boto3 pick their parser from the service model rather than this header,+ so it is about matching the wire, not about parsing."""data = {"__type": code,- "message": message,+ message_key: message,}if extra:data.update(extra)body = json.dumps(data, ensure_ascii=False).encode("utf-8")return status, {- "Content-Type": "application/x-amz-json-1.0",+ "Content-Type": content_type,"x-amzn-errortype": code,}, bodydiff --git a/ministack/services/ec2.py b/ministack/services/ec2.pyindex efc2a1c4..478d987b 100644--- a/ministack/services/ec2.py+++ b/ministack/services/ec2.py@@ -163,6 +163,27 @@ def _az_id_for_zone_name(zone_name):return f"{_az_id_prefix(region)}-az{n}"+def _zone_name_for_az_id(az_id):+ """AZ id -> the zone name it belongs to in this region, or None.++ The inverse of ``_az_id_for_zone_name`` over the zones this region+ fabricates. CreateSubnet takes ``AvailabilityZoneId`` on its own, and on+ AWS the two members are one mapping, not two independent inputs: the+ CreateSubnet reference's own examples always answer a consistent pair+ (``us-east-2a``/``use2-az1``, ``us-west-2-lax-1a``/``usw2-lax1-az1``).+ Resolving the name from the id is what keeps the stored subnet a record+ AWS could actually produce.+ """+ if not az_id:+ return None+ region = get_region()+ for letter in "abc":+ name = f"{region}{letter}"+ if _az_id_for_zone_name(name) == az_id:+ return name+ return None++# ── Persistence ────────────────────────────────────────────def get_state():@@ -2951,8 +2972,16 @@ def _matches_subnet_filters(subnet, filters):def _create_subnet(p):vpc_id = _p(p, "VpcId") or _DEFAULT_VPC_IDcidr = _p(p, "CidrBlock") or "10.0.1.0/24"- az = _p(p, "AvailabilityZone") or f"{get_region()}a"- az_id = _p(p, "AvailabilityZoneId") or _az_id_for_zone_name(az)+ # AvailabilityZone and AvailabilityZoneId are one mapping on AWS, never two+ # independent inputs: every CreateSubnet response pairs a zone name with+ # that zone's own id. Honouring a supplied id alongside a conflicting name+ # stored a pair (us-east-1a / use1-az2) that no real account can return, so+ # the id resolves the name when it is the only one given, and the name wins+ # the derivation whenever it is present.+ requested_az = _p(p, "AvailabilityZone")+ requested_az_id = _p(p, "AvailabilityZoneId")+ az = requested_az or _zone_name_for_az_id(requested_az_id) or f"{get_region()}a"+ az_id = _az_id_for_zone_name(az)subnet_id = _new_subnet_id()_subnets[subnet_id] = {"SubnetId": subnet_id,diff --git a/ministack/services/iotwireless.py b/ministack/services/iotwireless.pyindex 9d1bed54..70d71766 100644--- a/ministack/services/iotwireless.py+++ b/ministack/services/iotwireless.py@@ -20,10 +20,9 @@ form of ``Ip.IpAddress`` is hashed (SHA-256) onto lon [-180, 180) / lat[-60, 60), 4 decimals, so the same address always answers the same estimateand a consumer test can assert on it.-The blob's ``properties`` carry the two accuracy fields with the values of-the single live call recorded for this work (eu-west-1, 2026-08-26):-``horizontalAccuracy`` 1000000 and ``horizontalConfidenceLevel`` 0.67. That-call asked for nothing, so 0.67 is the default level;+The blob's ``properties`` carry ``horizontalAccuracy`` 1000000, from the+single live call recorded for this work (eu-west-1, 2026-08-26), and+``horizontalConfidenceLevel`` 0.68, the default the developer guide documents;``AdvancedConfiguration.WiFiCellular.ConfidencePercent`` is the caller's ownsay over it and drives the reported level, over 100, within the 50 to 99 themodel allows. The@@ -37,7 +36,10 @@ GeoJSON. The live payload's ``country`` is left out for determinism, as arethe ``city`` / ``state`` / ``postalCode`` properties the developer guidelists for IP lookups (documented divergence).-Refusals mirror the live service verbatim (measured eu-west-1 2026-08-26).+Two refusals are recorded from the live service (eu-west-1 2026-08-26) and+are marked as such at their call sites. EVERY OTHER message in this module+is unverified: no message string is documented for this operation, so the+wording is this emulator's own and must not be read as AWS's.An input with no resolver hint answers ``ValidationException`` ``"1validation error detected: Request must have at least 1 valid positionmeasurement."``, and an ``IpAddress`` that ``ipaddress.ip_address()``@@ -72,7 +74,7 @@ import jsonimport loggingfrom datetime import datetime, timezone-from ministack.core.responses import error_response_json+from ministack.core.responses import REST_JSON_CONTENT_TYPE, error_response_jsonlogger = logging.getLogger("iotwireless")@@ -104,9 +106,7 @@ async def handle_request() -> tuple:if method == "POST" and path == "/position-estimate":return _get_position_estimate(body)- return error_response_json(- "ValidationException", f"No route for {method} {path}", 400- )+ return _validation(f"No route for {method} {path}")# ---------------------------------------------------------------------------@@ -120,13 +120,18 @@ async def handle_request(# the value, so an empty `Ip` reaches the address validator below._HINT_MEMBERS = ("WiFiAccessPoints", "CellTowers", "Ip", "Gnss")-# The values of the one live call recorded for this work (eu-west-1,-# 2026-08-26). Fixed, because the estimate is synthetic: there is no solver-# behind it whose accuracy could vary per address. That call sent no-# `AdvancedConfiguration`, so 0.67 is what the service reports when the-# caller asks for nothing; a caller that does ask drives the level itself.+# Fixed, because the estimate is synthetic: there is no solver behind it whose+# accuracy could vary per address. The accuracy is the value of the one live+# call recorded for this work (eu-west-1, 2026-08-26)._HORIZONTAL_ACCURACY = 1000000-_HORIZONTAL_CONFIDENCE_LEVEL = 0.67+# AWS IoT Core Device Location documents the default confidence level twice, as+# 0.68: "The default value is 0.68, which indicates a 68% probability that the+# actual device location is within the uncertainty radius of the estimated+# location", and of the CLI example's ConfidencePercent=68, "which is also the+# default value when this parameter is not specified"+# (iot/latest/developerguide/device-location-resolve-solvers.html). This was+# was 0.67, from a single unrecorded call; the documented default is the source.+_HORIZONTAL_CONFIDENCE_LEVEL = 0.68# `AdvancedConfiguration.WiFiCellular.ConfidencePercent`, as the model# constrains it: an integer, 50 to 99 inclusive.@@ -138,8 +143,26 @@ _CONFIDENCE_PERCENT_MAX = 99_INVALID = object()+def _error(code: str, message: str, status: int) -> tuple:+ """An iotwireless error body.++ The exception shapes of iotwireless/2020-11-22 declare the message member+ as ``Message`` with no ``locationName``, so ``Message`` is what goes on the+ wire — not the ``message`` most json-protocol services model. The protocol+ is ``rest-json``, so the body is ``application/json``.++ ``ResourceNotFoundException`` and ``ConflictException`` also model+ ``ResourceId`` / ``ResourceType``. Both are optional and nothing here knows+ what the live service puts in them for this operation, so they are omitted+ rather than filled with a guess.+ """+ return error_response_json(code, message, status,+ message_key="Message",+ content_type=REST_JSON_CONTENT_TYPE)++def _validation(message: str) -> tuple:- return error_response_json("ValidationException", message, 400)+ return _error("ValidationException", message, 400)def _get_position_estimate(body: bytes) -> tuple:@@ -174,18 +197,15 @@ def _get_position_estimate(body: bytes) -> tuple:f"{_CONFIDENCE_PERCENT_MAX}")if "Ip" not in payload:- # A WLAN/cell/GNSS-only request is well formed, MiniStack simply has- # no solver behind it. AWS reserves 400 for malformed input and- # documents 404 for exactly this outcome: "no location information- # was found or solved ... due to cases such as insufficient data in- # the measurement data input", so the scope limit refuses like the- # address the resolver cannot place, not like bad JSON.- return error_response_json(- "ResourceNotFoundException",- "MiniStack resolves position from Ip only: provide Ip.IpAddress "- "(WiFiAccessPoints/CellTowers/Gnss are accepted but not resolved)",- 404,- )+ # A WLAN/cell/GNSS-only request is well formed; there is no solver+ # behind it here, so it takes the same unresolvable-measurement 404 as+ # an address the IP resolver cannot place. The wording is NOT the live+ # service's: no message string is documented for this operation+ # (botocore carries only "Resource does not exist." on the shape), and+ # the developer-guide sentence this branch was written against could+ # not be retrieved to verify. Nothing here may name the emulator.+ return _error("ResourceNotFoundException",+ "Cannot find position for the supplied measurements", 404)ip_member = payload["Ip"]raw = ip_member.get("IpAddress") if isinstance(ip_member, dict) else Nonetry:@@ -201,11 +221,8 @@ def _get_position_estimate(body: bytes) -> tuple:# (measured with TEST-NET 203.0.113.7); MiniStack approximates that# refusal class deterministically with the global-routability test# (multicast groups are global in `ipaddress` but have no place).- return error_response_json(- "ResourceNotFoundException",- f"Cannot find position for the IP address {canonical}",- 404,- )+ return _error("ResourceNotFoundException",+ f"Cannot find position for the IP address {canonical}", 404)lon, lat = _coordinates_for(canonical)properties = {@@ -279,11 +296,11 @@ def _confidence_level(payload: dict):reports, over 100. The model constrains it to an integer from 50 to 99inclusive and a value outside that is refused rather than clamped.- Omitted, the level stays the 0.67 of the one live call, which sent no- ``AdvancedConfiguration`` at all. AWS documents the member's own default- as 68, and a caller who sends ``ConfidencePercent: 68`` gets 0.68 here;- what 0.67 records is what the service answered a request that asked for- nothing, which is the thing an emulator has to reproduce.+ Omitted, the level is the documented default of 0.68 — the developer+ guide gives that both as the confidence level's own default and as the+ value ``ConfidencePercent`` takes when the caller sends none — so a+ request that asks for nothing and one that sends ``ConfidencePercent: 68``+ answer the same level, as on AWS."""advanced = payload.get("AdvancedConfiguration")if advanced is None:diff --git a/ministack/services/location.py b/ministack/services/location.pyindex fa64c9e9..f8b0c1c7 100644--- a/ministack/services/location.py+++ b/ministack/services/location.py@@ -81,6 +81,7 @@ import urllib.parsefrom ministack.core.persistence import load_statefrom ministack.core.responses import (+ REST_JSON_CONTENT_TYPE,AccountRegionScopedDict,error_response_json,get_account_id,@@ -162,22 +163,56 @@ def _tracker_arn(name):return f"arn:aws:geo:{get_region()}:{get_account_id()}:tracker/{name}"-def _error(status, code, message):- return error_response_json(code, message, status)+def _error(status, code, message, extra=None):+ """An Amazon Location error body.++ location/2020-11-19 is ``rest-json``. Its exception shapes declare+ ``Message`` but carry ``locationName: "message"``, so the wire name is the+ lowercase ``message`` the helper already emits — the capitalised member+ name never reaches the wire. ``ValidationException`` additionally models+ ``reason`` and ``fieldList`` (locationNames of ``Reason`` and+ ``FieldList``); ``extra`` carries those where the caller knows them.+ """+ return error_response_json(code, message, status, extra,+ content_type=REST_JSON_CONTENT_TYPE)+++# ValidationExceptionReason, verbatim from the model's enum. `reason` is a+# modeled member of ValidationException and the live service populates it, so+# every refusal below names the one that fits rather than leaving it out.+_REASON_FIELD = "FieldValidationFailed"+_REASON_MISSING = "Missing"+_REASON_CANNOT_PARSE = "CannotParse"+_REASON_UNKNOWN_OPERATION = "UnknownOperation"+_REASON_OTHER = "Other"-def _validation(message):- return _error(400, "ValidationException", message)+def _validation_reason(message, reason, field=None):+ """A ValidationException carrying its modeled `reason`, and `fieldList`+ when the refusal is about one named member.++ ValidationExceptionField models Name/Message with locationNames `name` and+ `message`, so the entries go on the wire lowercase.+ """+ extra = {"reason": reason}+ if field is not None:+ extra["fieldList"] = [{"name": field, "message": message}]+ return _error(400, "ValidationException", message, extra)def _constraint(value, field, constraint):"""The request-surface ValidationException shape: one violated memberconstraint. The exact wordings are unmeasured on Amazon Location; the- shape is the one the AWS SDKs render for every service."""- return _validation(+ shape is the one the AWS SDKs render for every service.++ Carries `reason: FieldValidationFailed` and the one-entry `fieldList` the+ model declares for exactly this case.+ """+ message = (f"1 validation error detected: Value '{value}' at '{field}' failed to "f"satisfy constraint: {constraint}")+ return _validation_reason(message, _REASON_FIELD, field)def _not_found(name):@@ -222,7 +257,8 @@ def _max_results(body):if value is None:return 100, Noneif not _is_number(value) or int(value) != value:- return None, _validation("MaxResults must be an integer")+ return None, _validation_reason("MaxResults must be an integer",+ _REASON_FIELD, "maxResults")value = int(value)if value > 100:return None, _constraint(@@ -246,7 +282,8 @@ def _time_bound(body, member, default):return default, Noneparsed = _parse_timestamp(value)if parsed is None:- return None, _validation(f"{member} must be a timestamp")+ return None, _validation_reason(f"{member} must be a timestamp",+ _REASON_FIELD, member)return parsed, None@@ -487,9 +524,10 @@ def _validate_settings(body):# (CreateTracker reference.) An enum-set message naming one member# would be misleading, so the refusal says what happened to the rest.# Wording unmeasured.- return _validation(+ return _validation_reason(f"PricingPlan '{plan}' is no longer accepted. The only allowed "- f"value is RequestBasedUsage."+ f"value is RequestBasedUsage.",+ _REASON_FIELD, "pricingPlan",)return None@@ -531,7 +569,8 @@ def _position_view(pos):def _create_tracker(body):name = body.get("TrackerName", "")if not name:- return _validation("TrackerName is required.")+ return _validation_reason("TrackerName is required.",+ _REASON_MISSING, "trackerName")err = _validate_tracker_name(name)if err is not None:return err@@ -605,7 +644,7 @@ def _list_trackers(body):if token:cursor = _decode_token(token, (str,))if cursor is None:- return _validation(_INVALID_TOKEN)+ return _validation_reason(_INVALID_TOKEN, _REASON_FIELD, "nextToken")# Sorted by name: a total order the token can resume from.records = sorted(_trackers.values(), key=lambda r: r["TrackerName"])if cursor is not None:@@ -867,7 +906,7 @@ def _get_position_history(name, device_id, body):if token:cursor = _decode_token(token, (float, float, int))if cursor is None:- return _validation(_INVALID_TOKEN)+ return _validation_reason(_INVALID_TOKEN, _REASON_FIELD, "nextToken")# Documented defaults when the members are omitted: the 24 hours up to now.start, err = _time_bound(body, "StartTimeInclusive", _now() - 24 * 3600)if err is not None:@@ -915,7 +954,8 @@ async def handle_request(method, path, headers, body_bytes, query_params):try:body = json.loads(body_bytes) if body_bytes else {}except json.JSONDecodeError:- return _validation("Could not deserialize the request body as JSON.")+ return _validation_reason("Could not deserialize the request body as JSON.",+ _REASON_CANNOT_PARSE)# POST /tracking/v0/trackers -- CreateTrackerif path == "/tracking/v0/trackers" and method == "POST":@@ -971,4 +1011,5 @@ async def handle_request(method, path, headers, body_bytes, query_params):if method == "DELETE":return _delete_tracker(name)- return _validation(f"No route for {method} {path}")+ return _validation_reason(f"No route for {method} {path}",+ _REASON_UNKNOWN_OPERATION)diff --git a/ministack/services/signer.py b/ministack/services/signer.pyindex 0213f801..97718778 100644--- a/ministack/services/signer.py+++ b/ministack/services/signer.py@@ -91,6 +91,7 @@ from datetime import datetime, timedelta, timezoneimport ministack.services.s3 as s3_svcfrom ministack.core.persistence import load_statefrom ministack.core.responses import (+ REST_JSON_CONTENT_TYPE,AccountRegionScopedDict,error_response_json,get_account_id,@@ -157,7 +158,11 @@ _IMAGE_FORMATS = ("JSON", "JSONEmbedded", "JSONDetached")_ENCRYPTION_ALGORITHMS = ("RSA", "ECDSA")_HASH_ALGORITHMS = ("SHA1", "SHA256")_MAX_TAGS = 200-_TAG_KEY_RE = re.compile(r"[a-zA-Z+\-=._:/]+")+# botocore signer/2017-08-25 TagKey.pattern is `^(?!aws:)[a-zA-Z+-=._:/]+$`.+# `+-=` there is a RANGE (U+002B..U+003D), so it also admits `,` `-` `.`+# `/` the digits `0-9` `:` `;` `<` `=`. Escaping the hyphen narrows the+# class and refused a tag key AWS accepts (`env1`, `2024`).+_TAG_KEY_RE = re.compile(r"[a-zA-Z+-=._:/]+")_ACCOUNT_ID_RE = re.compile(r"[0-9]{12}")# PutSigningProfile reference: "If unspecified, the default is 135 months."_DEFAULT_VALIDITY = {"type": "MONTHS", "value": 135}@@ -170,7 +175,19 @@ def _now():def _error(status, code, message):- return error_response_json(code, message, status)+ """A signer error body.++ signer/2017-08-25 is ``rest-json``, so the body is ``application/json``+ rather than the json-protocol content type. Its exception shapes model the+ message member as lowercase ``message`` (locationName ``message``), which+ is already the helper's default, so the casing is left alone here.++ Those shapes also carry an optional ``code`` member. It is not populated:+ nothing here knows the string the live service puts in it, and a guess+ would read as if it had been measured.+ """+ return error_response_json(code, message, status,+ content_type=REST_JSON_CONTENT_TYPE)def _profile_arn(name):diff --git a/ministack/services/translate.py b/ministack/services/translate.pyindex e895448b..2aa79685 100644--- a/ministack/services/translate.py+++ b/ministack/services/translate.py@@ -229,7 +229,7 @@ def _fail_orphaned_jobs():if job.get("JobStatus") not in _TERMINAL_STATUSES:job["JobStatus"] = "FAILED"job["Message"] = "Internal Failure. The job did not survive a MiniStack restart."- job["EndTime"] = time.time()+ job["EndTime"] = int(time.time())try:@@ -290,8 +290,18 @@ def _output_folder_prefix(job_id, output_prefix):def _sort_key(job):"""Submission time with the job id breaking ties, so the ordering is total- and stable across calls. Callers reverse it to get newest first."""- return (job.get("SubmittedTime") or 0.0, job.get("JobId") or "")+ and stable across calls. Callers reverse it to get newest first.++ Ordered on the internal high-resolution `_SubmittedAt`, not the wire+ `SubmittedTime`: the wire member is whole epoch seconds (the shape is a+ `timestamp` and the json protocol carries it as an integer), so two jobs+ submitted inside the same second tie there and the job id — a uuid — would+ decide their order. `_SubmittedAt` keeps the sub-second value the list+ order needs, and never reaches the wire (leading underscore, see+ `_JOB_MEMBERS`).+ """+ return (job.get("_SubmittedAt") or float(job.get("SubmittedTime") or 0.0),+ job.get("JobId") or "")def _encode_token(job):@@ -520,7 +530,7 @@ def _finalize_stop(job_id, run_id):if job is None or job.get("JobStatus") != "STOP_REQUESTED":returnjob["JobStatus"] = "STOPPED"- job["EndTime"] = time.time()+ job["EndTime"] = int(time.time())logger.info("Translate: job %s stopped", job_id)_emit_state_change(job_id, "STOPPED")@@ -538,7 +548,7 @@ async def _run_job(job_id, run_id, account_id, region):if job is not None and job.get("JobStatus") not in _TERMINAL_STATUSES:job["JobStatus"] = "FAILED"job["Message"] = "Internal Failure. Please try your request again."- job["EndTime"] = time.time()+ job["EndTime"] = int(time.time())_emit_state_change(job_id, "FAILED")@@ -570,7 +580,7 @@ def _fail(job_id, run_id, job, message):returnjob["JobStatus"] = "FAILED"job["Message"] = message- job["EndTime"] = time.time()+ job["EndTime"] = int(time.time())logger.info("Translate: job %s failed: %s", job_id, message)_emit_state_change(job_id, "FAILED")@@ -720,7 +730,7 @@ def _translate_job(job_id, run_id, job):)else:job["Message"] = "Your job has completed successfully."- job["EndTime"] = time.time()+ job["EndTime"] = int(time.time())logger.info("Translate: job %s %s, %d of %d document(s) translated into %s under s3://%s/%s",job_id,@@ -849,7 +859,11 @@ def _start_text_translation_job(data):job_output_prefix = _output_folder_prefix(job_id, output_prefix)run_id = new_uuid()+ # Stamped once: the wire member is the whole-second truncation of this, and+ # the sub-second value stays behind under `_SubmittedAt` for the list order.+ _submitted_at = time.time()job = {+ "_SubmittedAt": _submitted_at,"JobId": job_id,"JobName": data.get("JobName"),"JobStatus": "SUBMITTED",@@ -857,7 +871,10 @@ def _start_text_translation_job(data):"SourceLanguageCode": data["SourceLanguageCode"],"TargetLanguageCodes": list(data["TargetLanguageCodes"]),"Message": None,- "SubmittedTime": time.time(),+ # translate is the json protocol (jsonVersion 1.1) and SubmittedTime /+ # EndTime are `timestamp` shapes: whole epoch seconds. time.time()+ # returns a float, which Java/Go SDK v2 reject on a timestamp member.+ "SubmittedTime": int(_submitted_at),"EndTime": None,"InputDataConfig": copy.deepcopy(data["InputDataConfig"]),# Reported as the rewritten location from the moment the job exists,diff --git a/scripts/_collect_plan_plugin.py b/scripts/_collect_plan_plugin.pyindex 3fecd8fc..9261525b 100644--- a/scripts/_collect_plan_plugin.py+++ b/scripts/_collect_plan_plugin.py@@ -5,20 +5,23 @@ single ``--collect-only`` pass yields both the ``serial`` and ``parallel``counts. Collecting twice (once per ``-m`` filter) doubled the cost of theshard-planning job for data one pass already has.-Writes ``{"tests/test_x.py": {"parallel": 12, "serial": 3}, ...}`` to the path-in $MINISTACK_COLLECT_OUT.+Writes ``{"tests/test_x.py": {"parallel": 12, "serial": 3}, ...}`` to+``<rootpath>/.pytest_collect_plan.json``. The path is derived from the pytest+session rather than handed in through the environment: the plugin and its one+caller already agree on the repo root, so an env var would only be a second+way to say the same thing."""import json-import os+#: Where the plan lands, relative to the pytest rootpath. Kept here so the+#: caller imports the name instead of duplicating the literal.+COLLECT_PLAN_FILENAME = ".pytest_collect_plan.json"-def pytest_collection_finish(session):- out = os.environ.get("MINISTACK_COLLECT_OUT")- if not out:- return+def pytest_collection_finish(session):rootpath = session.config.rootpath+ out = rootpath / COLLECT_PLAN_FILENAMEcounts: dict[str, dict[str, int]] = {}for item in session.items:try:diff --git a/scripts/select_test_shard.py b/scripts/select_test_shard.pyindex 337de382..4d8ccdb7 100644--- a/scripts/select_test_shard.py+++ b/scripts/select_test_shard.py@@ -18,8 +18,10 @@ def collect_by_file(mode: str | None = None) -> dict[str, dict[str, int]] | dictOne pass rather than one per ``-m`` filter: collection dominates theshard-planning job, and both counts come out of the same collected set."""- out_path = REPO_ROOT / ".pytest_collect_plan.json"- env = {**os.environ, "MINISTACK_COLLECT_OUT": str(out_path)}+ from _collect_plan_plugin import COLLECT_PLAN_FILENAME++ out_path = REPO_ROOT / COLLECT_PLAN_FILENAME+ env = dict(os.environ)env["PYTHONPATH"] = os.pathsep.join(p for p in (str(Path(__file__).resolve().parent), env.get("PYTHONPATH", "")) if p)diff --git a/tests/test_ec2.py b/tests/test_ec2.pyindex 8c454924..04529919 100644--- a/tests/test_ec2.py+++ b/tests/test_ec2.py@@ -2691,7 +2691,11 @@ def test_ec2_default_subnets_carry_availability_zone_id(ec2):def test_ec2_create_subnet_availability_zone_id(ec2):- """AvailabilityZoneId must never be null: it's derived from the AZ, or honored when given."""+ """AvailabilityZoneId must never be null, and must always name the zone+ AvailabilityZone names: on AWS the two are one mapping, and every+ CreateSubnet example in the reference answers a consistent pair+ (us-east-2a/use2-az1, us-west-2-lax-1a/usw2-lax1-az1). An id supplied on+ its own resolves the zone name; a conflicting pair cannot be stored."""vpc_id = ec2.create_vpc(CidrBlock="10.78.0.0/16")["Vpc"]["VpcId"]derived = ec2.create_subnet(VpcId=vpc_id, CidrBlock="10.78.1.0/24",@@ -2701,14 +2705,24 @@ def test_ec2_create_subnet_availability_zone_id(ec2):desc = ec2.describe_subnets(SubnetIds=[derived["SubnetId"]])["Subnets"][0]assert desc["AvailabilityZoneId"] == "use1-az3"- # AZ says use1-az1, but an explicit AvailabilityZoneId must win.- explicit = ec2.create_subnet(VpcId=vpc_id, CidrBlock="10.78.2.0/24",- AvailabilityZone="us-east-1a",- AvailabilityZoneId="use1-az2")["Subnet"]- assert explicit["AvailabilityZoneId"] == "use1-az2"+ # AvailabilityZoneId alone resolves the zone name it belongs to, so both+ # members agree the way a real response does.+ by_id = ec2.create_subnet(VpcId=vpc_id, CidrBlock="10.78.2.0/24",+ AvailabilityZoneId="use1-az2")["Subnet"]+ assert by_id["AvailabilityZoneId"] == "use1-az2"+ assert by_id["AvailabilityZone"] == "us-east-1b"++ # A conflicting pair never lands: the zone name drives the id, so the+ # record stays one AWS could actually return.+ conflicting = ec2.create_subnet(VpcId=vpc_id, CidrBlock="10.78.3.0/24",+ AvailabilityZone="us-east-1a",+ AvailabilityZoneId="use1-az2")["Subnet"]+ assert conflicting["AvailabilityZone"] == "us-east-1a"+ assert conflicting["AvailabilityZoneId"] == "use1-az1"ec2.delete_subnet(SubnetId=derived["SubnetId"])- ec2.delete_subnet(SubnetId=explicit["SubnetId"])+ ec2.delete_subnet(SubnetId=by_id["SubnetId"])+ ec2.delete_subnet(SubnetId=conflicting["SubnetId"])ec2.delete_vpc(VpcId=vpc_id)@@ -4428,8 +4442,8 @@ def test_ec2_cross_account_ami_sharing():assert _consumer_sees() == []# The consumer never gains modify rights: the image is not in their scope.- from botocore.exceptions import ClientErrorimport pytest as _pytest+ from botocore.exceptions import ClientErrorwith _pytest.raises(ClientError) as exc:consumer.modify_image_attribute(ImageId=ami, LaunchPermission={"Add": [{"Group": "all"}]})diff --git a/tests/test_iotwireless.py b/tests/test_iotwireless.pyindex 9888e6c2..b6fdc447 100644--- a/tests/test_iotwireless.py+++ b/tests/test_iotwireless.py@@ -79,11 +79,14 @@ def test_iotwireless_position_estimate_is_geojson_point_blob(iotwireless):def test_iotwireless_accuracy_properties_carry_the_measured_values(iotwireless):- """The two accuracy properties carry the values of the one live call- (eu-west-1, 2026-08-26), which sent no `AdvancedConfiguration`."""+ """`horizontalAccuracy` is the value of the one live call (eu-west-1,+ 2026-08-26). `horizontalConfidenceLevel` is the documented default: the+ developer guide gives 0.68 both as the confidence level's default ("The+ default value is 0.68, which indicates a 68% probability...") and as what+ `ConfidencePercent` takes when the caller sends none."""properties = json.loads(_estimate_bytes(iotwireless, "1.2.3.4"))["properties"]assert properties["horizontalAccuracy"] == 1000000- assert properties["horizontalConfidenceLevel"] == 0.67+ assert properties["horizontalConfidenceLevel"] == 0.68@pytest.mark.parametrize("percent,level", [(50, 0.5), (68, 0.68), (99, 0.99)])@@ -251,12 +254,14 @@ def test_iotwireless_timestamp_only_input_is_validation_exception(iotwireless):def test_iotwireless_non_ip_hints_alone_are_resource_not_found(iotwireless):- """Documented divergence: MiniStack resolves from Ip only, so an input- carrying nothing but WLAN measurements is refused with a message naming- the IP-only scope (the real service would run the third-party solver).- The input is well formed, and AWS documents 404 for a measurement it- cannot solve and 400 for measurement data formatted incorrectly, so the- scope limit refuses like the address the resolver cannot place."""+ """Documented divergence: only the Ip resolver exists here, so an input+ carrying nothing but WLAN measurements cannot be solved (the real service+ would run the third-party solver). The input is well formed, so it takes+ the unresolvable-measurement 404 rather than a 400.++ Only the status and the error code are asserted. No message string is+ documented for this operation, so pinning one here would pin this+ emulator's own wording and read as if it were AWS's."""with pytest.raises(ClientError) as excinfo:iotwireless.get_position_estimate(WiFiAccessPoints=[{"MacAddress": "A0:EC:F9:1E:32:C1", "Rss": -75}]@@ -264,7 +269,6 @@ def test_iotwireless_non_ip_hints_alone_are_resource_not_found(iotwireless):response = excinfo.value.responseassert response["ResponseMetadata"]["HTTPStatusCode"] == 404assert response["Error"]["Code"] == "ResourceNotFoundException"- assert "Ip only" in response["Error"]["Message"]# ---------------------------------------------------------------------------@@ -328,7 +332,10 @@ def test_iotwireless_raw_timestamp_that_is_not_a_timestamp_is_refused(value):assert status == 400document = json.loads(raw)assert document["__type"] == "ValidationException"- assert document["message"] == (+ # Capital `Message`: the iotwireless/2020-11-22 exception shapes declare+ # that member with no `locationName`, so that is the wire name. boto3+ # finds it either way, which is why only these raw-body tests see it.+ assert document["Message"] == ("Timestamp must be a Unix timestamp, in seconds since the epoch")@@ -357,7 +364,7 @@ def test_iotwireless_raw_advanced_configuration_must_be_the_shape(advanced):assert status == 400document = json.loads(raw)assert document["__type"] == "ValidationException"- assert "ConfidencePercent" in document["message"]+ assert "ConfidencePercent" in document["Message"]@pytest.mark.parametrize("ip_member", [{}, {"IpAddress": ""}])@@ -372,7 +379,7 @@ def test_iotwireless_raw_ip_without_an_address_is_not_valid(ip_member):assert status == 400document = json.loads(raw)assert document["__type"] == "ValidationException"- assert document["message"] == (+ assert document["Message"] == ("1 validation error detected: IP Address is not valid.")