mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
dfe2117fed11d2b95fb2a7fc6cbada9d8d4cca49
88
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5aad012e78 |
feat(emr-serverless): tag, untag and list tags for applications (#4667)
EMR Serverless had no tagging API: no TagHandler was registered for the emr-serverless ARN service, so TagResource, UntagResource and ListTagsForResource could not be routed, and a tagged aws_emrserverless_application could not be planned. Register an emr-serverless handler with the shared /tags dispatcher, answering 200 as the model does, over the tags already stored on the application. Validate keys and values, the user guide's 50 tag limit and its reserved aws: prefix, refuse job run ARNs as not found, and synchronize the application mutators so a tag write cannot lose a concurrent update. Closes #4662 |
||
|
|
4a51c0e814 |
feat(dlm): manage lifecycle policies (#4335)
* feat(dlm): manage lifecycle policies * fix(dlm): use shared partition regex |
||
|
|
d214144c86 |
chore(compat): bump the pinned AWS SDKs for the compatibility suites (#4237)
The SES tenant-level deliverability launch on 2026-09-17 added a TENANT_NAME metric dimension to BatchGetMetricData and a TenantName filter to the message insights export. Both reached the Java SDK in 2.55.0 and botocore in a release after the pinned one, so the suites could not express either against the versions pinned here. Java moves 2.52.0 to 2.55.3 and Python 1.43.69 to 1.43.100, the current releases of each. |
||
|
|
4b3923712a |
feat(redshiftserverless): add namespace lifecycle and tagging (#3631)
* feat(redshiftserverless): add namespace lifecycle Amazon Redshift Serverless was absent entirely: every call returned UnknownOperationException, so Terraform's aws_redshiftserverless_namespace could not be planned or applied against Floci. Add a JSON 1.1 service under the RedshiftServerless. target prefix with CreateNamespace, GetNamespace, ListNamespaces, UpdateNamespace, and DeleteNamespace. Namespaces are account and Region scoped and stored through StorageFactory. AWS defaults are applied on create (dbName dev, kmsKeyId AWS_OWNED_KMS_KEY, empty logExports, status AVAILABLE), adminUserPassword is accepted and never returned, DeleteNamespace returns the removed namespace with status DELETING, and UpdateNamespace applies only the supplied fields. Workgroups, snapshots, and the tagging operations remain unemulated. * feat(redshiftserverless): add namespace tagging operations Terraform's aws_redshiftserverless_namespace calls ListTagsForResource on every read once tags are involved, so the namespace lifecycle alone left the resource broken as soon as a config set tags. Add ListTagsForResource, TagResource, and UntagResource. Lookup is by resourceArn rather than namespace name, scoped to the caller's Region, since that is how AWS keys these operations; the namespace is currently the only taggable Redshift Serverless resource, so any other ARN is reported absent. TagResource merges into the existing tags, UntagResource removes by key, and tags passed to CreateNamespace are readable back and survive UpdateNamespace. * fix(redshiftserverless): emit creationDate as ISO-8601 per the API model The awsJson1.1 default is epoch seconds and 133 call sites use it, but this model overrides it: TimestampFormatTrait ISO_8601 on creationDate (and on all eleven other timestamp members in the package, audited). Strict clients broke on the number: Terraform's Go SDK failed to decode and orphaned the created namespace outside state; the Java SDK failed to unmarshall. Only botocore's lenient parsing let CLI checks pass. Emitted via the repo's millisecond-ISO idiom; format pinned by regex in the integration test and by a new handler-level unit test class covering the wire layer that had none (timestamp shape, nextToken emission, maxResults type guard). Checklist note added to AGENTS.md + CONTRIBUTING.md so the next service checks the trait before reaching for the epoch idiom. * docs(redshiftserverless): the ISO-8601 rule is per member, not model-wide Review follow-up: the earlier claim that every timestamp member in this model carries TimestampFormatTrait(ISO_8601) is wrong — 15 of the model's 30 INSTANT members carry no trait and fall back to the awsJson1.1 epoch default. The shipped code is unaffected (creationDate, the only timestamp emitted, is genuinely ISO_8601), but the claim was load-bearing guidance: whoever adds snapshots or scheduled actions next would have applied ISO-8601 to trait-free members and reintroduced the bug in the opposite direction. Narrowed in all four places it appeared. * fix(redshiftserverless): validate collection types, copy-on-update; drop em dashes A present iamRoles, logExports, tags or tagKeys member that was not a JSON array parsed to null and was then indistinguishable from an omitted member, so a malformed UpdateNamespace silently kept the stored value and returned 200 instead of reporting the request as invalid. Only a missing or null member now means "omitted"; a present member of the wrong type, or a collection holding a non-string element, is a ValidationException naming the member. updateNamespace mutated the stored Namespace in place while GetNamespace and ListNamespaces read without taking the same monitor, so a concurrent reader could observe a torn object with some fields updated and some not. Build the new state on a copy and store that instead, which also makes the write-back explicit. The same in-place mutation was present in tagResource, untagResource and deleteNamespace, so all four now copy. Merge semantics are unchanged. Replace the em dashes in the timestamp guidance with commas and periods, per the repository ban. * fix(redshiftserverless): reject Redshift reserved words as namespace names CreateNamespace rejects a namespace name that is an Amazon Redshift SQL reserved word, so names like select or user passed the length and [a-z0-9-] checks here and were persisted. Add the documented reserved word list to the shared namespace-name validator, which create, get, update and delete all reach, so the rejection is consistent. |
||
|
|
532bae5525 |
feat(dms): add replication subnet group lifecycle and tagging (#3630)
* feat(dms): add replication subnet group lifecycle AWS DMS was entirely absent, so every terraform-aws-data-storage example using aws_dms_replication_subnet_group failed at plan with UnknownOperationException. Adds a minimal dms service on AWS JSON 1.1 (X-Amz-Target prefix AmazonDMSv20160101.) implementing CreateReplicationSubnetGroup, DescribeReplicationSubnetGroups and DeleteReplicationSubnetGroup. Subnets are resolved against the emulated EC2 service, so the VpcId and Availability Zones a group reports are the ones its subnets actually have, and AWS's own rules are enforced: the identifier is stored lowercase, "default" is reserved, subnets must share a VPC, and a group must cover at least two Availability Zones. Tagging actions and replication instances, endpoints and tasks are out of scope and still report UnknownOperationException. * feat(dms): add resource tagging for replication subnet groups Terraform's aws_dms_replication_subnet_group reads tags back through ListTagsForResource, so without the tagging trio the resource could be created but never read cleanly. Adds ListTagsForResource, AddTagsToResource and RemoveTagsFromResource, and stores the Tags member of CreateReplicationSubnetGroup with the group. DMS does not return a subnet group ARN from describe, so the provider builds arn:aws:dms:<region>:<account>:subgrp:<id> client side; Floci parses that form back to the stored group and rejects anything else, including another account's ARN, with ResourceNotFoundFault. * fix(dms): address review findings Emit IsReadOnly on ReplicationSubnetGroup, the one member of the model's seven the response was missing. It is always false: a read-only group is one DMS manages for a zero-ETL integration, which Floci does not emulate. Fault a cross-Region ARN the way a cross-account one already faulted. Storage is keyed by the caller's Region, so honouring an eu-west-1 ARN from a us-east-1 caller silently reached the caller's own group of that name rather than the one named. Reject a subnet with no Availability Zone as InvalidSubnet. Set.copyOf rejects nulls, so such a subnet raised a NullPointerException and surfaced as a 500 instead of a client error. Adds the user-realistic minimum-AZ case: two subnets sharing one AZ, which the previous tests did not cover because they passed one subnet. * fix(dms): reject wrongly-typed tag, filter and arn-list members A present member of the wrong JSON type was coerced rather than rejected. asText() on an object yields the empty string, so a tag whose Value was an object stored an empty value and reported success; a Filters or ResourceArnList member that was not a list was ignored outright, which turned a filtered describe into an unfiltered one. Every string member now answers SerializationException when it is present with another JSON type, matching what AWS returns when a json-1.1 member will not deserialize, and matching how Kinesis, Cognito and KMS already report the same class of error here. An absent member stays a parameter error: missing and mistyped are different faults. * fix(dms): paginate DescribeReplicationSubnetGroups and validate the description DescribeReplicationSubnetGroups returned every matching group in one response and ignored both MaxRecords and Marker, so an SDK or Terraform paginator diverged from a live account as soon as more than one page of groups existed. Page through the shared opaque-cursor helper, keyed on the group identifier, so a Marker stays resumable across groups created or deleted between requests. MaxRecords defaults to 100 and is rejected outside the documented 20 to 100 range rather than clamped, with the InvalidParameterValueException a live account answers. Marker is emitted only while a further page remains: an SDK paginator treats any Marker as "ask again", so one on the final page loops forever. ReplicationSubnetGroupDescription now also enforces the model's printable-character constraint, so a value carrying a control character such as 0x01 is rejected instead of persisted. * docs(dms): describe the Marker as the opaque cursor it is * fix(test): DmsTest must compile at the sdk-test-java module's Java 17 target List.getFirst() is a Java 21 SequencedCollection method. The main project compiles at 21, but compatibility-tests/sdk-test-java pins source/target 17, and DmsTest was the only file in that module using getFirst() -- so the native arm64 sdk-test-java image failed to build and every test in it was skipped. This was not caught earlier because the previous head of this PR had no CI rollup at all; the merge that made the branch mergeable is what first ran the job. Replaced with get(0), which is what the rest of the module uses. * style(test): import Objects and Collectors instead of naming them inline AGENTS.md asks for imports rather than inline fully-qualified names. DmsServiceTest had two: java.util.Objects::nonNull and java.util.stream.Collectors.toMap. Neither was imported; both now are. |
||
|
|
eb787672b8 |
feat(timestream-influxdb): add Timestream for InfluxDB backed by InfluxDB 2.x containers (#3683)
* feat(timestream-influxdb): add Timestream for InfluxDB backed by InfluxDB 2.x containers Implements all 24 AmazonTimestreamInfluxDB operations; DB instances and read replica clusters run real influxdb:2.7 containers. * Fix #2566 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> * fix(timestream-influxdb): reject unsupported RestoreFromDbBackup parameters Point-in-time restore needs a continuous backup, and REPLACE_EXISTING accepts no configuration overrides, so both are rejected instead of silently restoring on-demand data or dropping the overrides. * Fix #2566 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> * style(timestream-influxdb): import the classes used instead of naming them inline Replaces the inline fully-qualified LinkedHashMap, Comparator, Predicate and TimestreamInfluxDbService references with imports. * Fix #2566 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> --------- Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com> |
||
|
|
66bcdaf675 |
feat(codeartifact): add CodeArtifact control-plane support (#3713)
Floci had zero CodeArtifact support: no service package, no docs, nothing. Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository, or either permissions-policy resource failed outright. This adds the full CodeArtifact control plane: domain and repository CRUD, resource policies with optimistic-locking revisions, tags, and the fixed set of real AWS-hosted external (upstream) connections (public:npmjs, public:pypi, public:maven-central, etc.). Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic) are intentionally out of scope here: this closes the terraform apply gap, not real package serving. ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag operation that addresses the resource with a query parameter on the bare path rather than a path segment, unlike every other V1TagsController/SharedTagsController handler. That method lives on V1TagsController itself rather than the shared AbstractTagsController base: SharedTagsController (mounted at /tags) already declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST on the shared base collides with it and Quarkus refuses to start. CodeArtifact's handler is @V1Tags-qualified and only ever registered against V1TagsController, so the method belongs there. core/common stays service-free: CodeArtifactTagHandler registers itself as a bean the same way MskTagHandler does, and TagHandler gained a default for the lowercase key/value entry names CodeArtifact uses instead of AWS's usual capitalized Key/Value. Known, documented limitations (see docs/services/codeartifact.md): no cycle detection across upstream chains, no referential-integrity check when deleting a repository other repositories reference as an upstream, and no authorization check on cross-account domainOwner addressing (consistent with Floci's opt-in IAM enforcement elsewhere). Verified against the real botocore codeartifact service-2.json (protocol, exact querystring vs. body placement per operation, exact ARN format, epoch-seconds timestamps, real error shapes) and the live AWS API docs for behavioral rules not in the wire model (DeleteDomain blocked while repositories exist, the real fixed external-connection name/format list, PutDomainPermissionsPolicy's all-body field placement vs. the sibling repository operation's querystring placement). Live-verified three ways: - Unit tests including a concurrent-create race test proving the synchronized guard actually holds under contention, plus full-stack QuarkusTest/RestAssured integration tests. - A real terraform init/apply/plan/destroy cycle against a running Floci instance, independently confirming destroy actually tore the domain down via a follow-up describe-domain call. - A live AWS SDK v2 Java test exercising the real CodeartifactClient against a live instance. |
||
|
|
1f554003be | test(sagemaker): add sdk-test-java coverage for SageMaker (#3717) | ||
|
|
a985773611 |
feat(bcm-pricing-calculator): emulate workload estimates (#3441)
* feat(bcm-pricing-calculator): emulate workload estimates * fix(bcm-pricing-calculator): serialize timestamps as epoch seconds * fix(bcm-pricing-calculator): align idempotency and errors |
||
|
|
a0fd815366 |
feat(oam): emulate observability access manager (#3440)
* feat(oam): emulate observability access manager * fix(oam): honor explicit deny statements |
||
|
|
128d3ef181 |
feat(datasync): add the DataSync management plane (#3377)
* feat(datasync): add the DataSync management plane Emulates the AWS DataSync management API over JSON (X-Amz-Target FmrsService.<Action>, signing name datasync): agents, the eleven CreateLocation/DescribeLocation/UpdateLocation trios plus the shared ListLocations and DeleteLocation, tasks, and resource tagging. Each DescribeLocation* projects the create request that produced the location, so the configuration that went in is the configuration that comes back, and LocationUri is derived from that request per the scheme AWS documents for the type. DescribeAgent reports ONLINE and DescribeTask reports AVAILABLE from the first read, which is what the Terraform provider's aws_datasync_task waits on. Credential members (Password, SecretKey, SasConfiguration, the Kerberos files and the nested Protocol.SMB.Password) are dropped before the configuration is stored, as AWS never reads them back either. Errors use InvalidRequestException, the only client error the DataSync model declares. The task-execution data plane (StartTaskExecution, DescribeTaskExecution, ListTaskExecutions, CancelTaskExecution, UpdateTaskExecution) transfers real bytes between real storage systems and keeps raising UnknownOperationException rather than a stub success. * fix(datasync): default VerifyMode from the task mode The DataSync model documents two VerifyMode defaults, not one: POINT_IN_TIME_CONSISTENT for a BASIC task and ONLY_FILES_TRANSFERRED for an ENHANCED one, which also cannot use POINT_IN_TIME_CONSISTENT at all. CreateTask applied the BASIC default to every task, so an ENHANCED task created without an explicit VerifyMode read back wrong. The default now follows TaskMode, and a VerifyMode the mode does not support is rejected with InvalidRequestException, the only client error this API declares. UpdateTaskRequest carries no TaskMode, so a task keeps the mode it was created with and UpdateTask applies the same rule against the stored mode. An unrecognized TaskMode is rejected rather than silently treated as BASIC. * test(datasync): add the SDK compatibility test Drives an agent, an S3 and an NFS location, both task modes and the tag round trip through the AWS SDK v2 DataSync client, which is the one piece of real-SDK verification the RestAssured tests do not cover. It asserts the VerifyMode default for a BASIC and an ENHANCED task, and that an ENHANCED task rejects POINT_IN_TIME_CONSISTENT on create and on update. --------- Co-authored-by: lex00 <artigues.dev@gmail.com> |
||
|
|
cae8f9a013 |
feat(bedrock): add guardrail lifecycle and versions (#3380)
* feat(bedrock): add guardrail lifecycle and versions
Amazon Bedrock control plane over REST JSON: CreateGuardrail through
DeleteGuardrail, CreateGuardrailVersion, ListGuardrails with pagination, and
resource tagging on /tagResource, /untagResource and /listTagsForResource.
Guardrails report READY on the first read, so the Terraform provider's status
poll for aws_bedrock_guardrail completes without a transition.
The control plane and bedrock-runtime both sign as "bedrock". The runtime
descriptor keeps that credential scope, and the new descriptor routes through
its resource class, which ServiceEnabledFilter checks first.
Policy blocks are stored under the read-shape member names, so a *Config
submitted on create or update reads back unsuffixed. ListGuardrails honours
maxResults and nextToken, and DeleteGuardrail rejects a guardrailVersion that
is not a GuardrailNumericalVersion.
* fix(bedrock): enforce guardrail length caps and resolve kmsKeyId to a key ARN
The AWS model caps description at 200 characters and both blockedInputMessaging
and blockedOutputsMessaging at 500, each with a minimum of 1. None of those were
checked, so an over-long value was stored and read back. name was already bounded
by its [0-9a-zA-Z-_]{1,50} pattern.
kmsKeyId on CreateGuardrail and UpdateGuardrail is a KmsKeyId: a key id, a key
ARN, an alias name or an alias ARN. kmsKeyArn on the read shapes is a KmsKeyArn,
which is only ever the full key ARN. The request value was echoed back verbatim,
so a bare key id or an alias produced a response that does not match the shape
GetGuardrail declares. It now resolves through KmsService.describeKey, the same
way RDS, DocDB and ElastiCache already resolve their KmsKeyId, and a key that is
missing, disabled or pending deletion is rejected with ValidationException.
* test(bedrock): drive the guardrail lifecycle from the AWS SDK v2 client
Adds the bedrock SDK module to the compatibility project, a BedrockClient
factory on TestFixtures, and a BedrockGuardrailTest covering create, read,
update, versioning, listing, tagging and delete. The test also submits kmsKeyId
as a bare key id and as an alias and asserts both read back as the same full KMS
key ARN.
* fix(bedrock): enforce the guardrail tag caps from the AWS model
The AWS model gives TagList a max of 200 items, and that shape backs the tags
member of both CreateGuardrail and TagResource. TooManyTagsException, declared
on both operations, documents a separate limit of 50 tags per resource counted
over the tags already on the resource together with the ones in the request.
parseTagList now rejects an array over 200 items with ValidationException, and
it moved to BedrockService so both entry points share it. CreateGuardrail and
TagResource raise TooManyTagsException once the total the guardrail would be
left holding passes 50, carrying resourceName as the model declares.
|
||
|
|
07d6cabd8a | feat(marketplace-discovery): emulate AWS Marketplace Discovery API (#3342) | ||
|
|
137a39add3 |
feat(appintegrations): add data and event integrations (#3379)
* feat(appintegrations): add data and event integrations
Amazon AppIntegrations over REST JSON, registered under the app-integrations
signing name: event integrations on /eventIntegrations, data integrations on
/dataIntegrations, and resource tagging through the shared /tags/{resourceArn}
dispatcher. Terraform's aws_appintegrations_event_integration and
aws_appintegrations_data_integration now round-trip against Floci instead of
failing on an unimplemented signing scope.
Event integrations are keyed by name, data integrations by generated id, and
both accept their own ARN wherever the API takes an identifier. The two PATCH
operations apply only the members present in the request body, matching how AWS
treats an optional member the caller did not send. Both tag writes answer 200,
which is what the 2020-07-29 model gives them.
* test(appintegrations): add an SDK compatibility test
Adds the appintegrations AWS SDK v2 module, a TestFixtures client factory,
and an AppIntegrationsTest that drives both integration types and the tag
round trip through the real SDK client.
|
||
|
|
2e79f5c766 |
feat(globalaccelerator): add the Global Accelerator management plane (#3378)
* feat(globalaccelerator): add the Global Accelerator management plane Emulates the AWS Global Accelerator management plane over JSON 1.1 under the GlobalAccelerator_V20180706 target prefix, signing name globalaccelerator: accelerators, listeners, endpoint groups, accelerator attributes and resource tags, 22 actions in all. Global Accelerator is a global service, so ARNs carry an empty region segment and listener and endpoint group ARNs extend the accelerator ARN. Nothing is keyed by the signing region, so a caller that signs outside us-west-2 sees the same accelerators. Accelerators report DEPLOYED and endpoints HEALTHY from the first read, so SDK and Terraform waiters complete on their first poll. Enum and range members are validated against the API model, and UpdateAcceleratorAttributes rejects an update that would leave FlowLogsEnabled true with no destination bucket. * fix(globalaccelerator): enforce the list caps and HealthCheckPath format from the API model The scalar ranges were already checked against globalaccelerator/2018-08-08, but the array-count caps were not. PortRanges, EndpointConfigurations and PortOverrides each declare max 10, and IpAddresses declares max 2 for the BYOIP case. All four were unbounded. HealthCheckPath declares max 255 and the pattern ^/[-a-zA-Z0-9@:%_\+.~#?&/=]*$, which was not checked at all. The new failures reuse InvalidArgumentException and the message shape the existing scalar validations already use, so they are indistinguishable in kind from those. * test(globalaccelerator): add the SDK compatibility test Adds the globalaccelerator SDK module, a TestFixtures client factory and a GlobalAcceleratorTest that drives accelerator, listener and endpoint group lifecycles through the AWS SDK v2 client, including the new PortRanges cap. --------- Co-authored-by: lex00 <artigues.dev@gmail.com> |
||
|
|
efcbc4d993 | feat(marketplace-metering): emulate AWS Marketplace Metering API (#3344) | ||
|
|
3c080e1ea6 | feat(marketplace-reporting): emulate AWS Marketplace Reporting API (#3343) | ||
|
|
48d2928061 | feat(marketplace-deployment): emulate AWS Marketplace Deployment API (#3341) | ||
|
|
2d51259120 |
feat(verifiedpermissions): add full service emulation (#3128)
* feat(verifiedpermissions): add full service emulation * fix(verifiedpermissions): harden OIDC and schema validation * test(verifiedpermissions): add service layer coverage * fix(verifiedpermissions): support native Cedar runtime * fix(verifiedpermissions): package Cedar native FFI * fix(verifiedpermissions): register Cedar deserializers for native * fix(verifiedpermissions): bound JWKS refreshes * fix(verifiedpermissions): avoid Cedar entity reflection * fix(verifiedpermissions): register Cedar native reflection * fix(verifiedpermissions): refresh rotated OIDC keys safely * fix(verifiedpermissions): retry failed JWKS refreshes * refactor(verifiedpermissions): isolate Cedar in sidecar * fix(verifiedpermissions): harden Cedar sidecar runtime * fix(verifiedpermissions): build cedar sidecar in compatibility CI * fix(verifiedpermissions): remove stale cedar jni config * fix(verifiedpermissions): recover cedar sidecar * fix(verifiedpermissions): bound OIDC document responses * fix(verifiedpermissions): start cedar sidecar in native sdk CI |
||
|
|
87f2c2d1a8 | feat(marketplace-entitlement): emulate AWS Marketplace Entitlement API (#3340) | ||
|
|
c99ecea0da | feat(marketplace-agreement): emulate AWS Marketplace Agreement API (#3339) | ||
|
|
50fa334dc5 | feat(marketplace-catalog): emulate AWS Marketplace Catalog API (#3338) | ||
|
|
d322d48bd5 |
fix(ram): emulate organization sharing side effects (#3279)
* fix: emulate RAM organization sharing side effects * test(ram): add SDK organization sharing coverage |
||
|
|
9d4e71f8a2 |
feat(securityhub): add organization configuration operations (#3161)
* feat(securityhub): add organization configuration operations * fix(securityhub): complete organization configuration contracts * fix(securityhub): harden organization contracts * test(securityhub): log tolerated organization state * test(securityhub): clean organization fixture state * test(securityhub): isolate organization cleanup failures * fix(securityhub): return modeled invalid access error |
||
|
|
4944764fa3 |
feat(inspector2): add organization configuration operations (#3162)
* feat(inspector2): add organization configuration operations * fix(inspector2): complete organization contracts * fix(inspector2): scope organization account state * test(inspector2): log tolerated organization state * test(inspector2): isolate organization cleanup |
||
|
|
d99675a512 |
feat(controlcatalog): add control lookup operations (#3130)
* feat(controlcatalog): add control lookup operations * fix(controlcatalog): complete control lookup contracts * test(controlcatalog): verify pagination continuation * fix(controlcatalog): move control model to package * fix(controlcatalog): integrate service storage lifecycle |
||
|
|
b9039fef1d |
feat(redshift-data): emulate the Amazon Redshift Data API (#3186)
* feat(redshift-data): resource resolver, connection factory, statement store, service registration * feat(redshift-data): field mapper, column metadata, SQL parameter binding * feat(redshift-data): execute, describe, and paged result retrieval * feat(redshift-data): batch execution, list statements, cancel * feat(redshift-data): schema introspection operations * test(redshift-data): end-to-end Data API over a real cluster plus SDK compatibility test * docs(redshift-data): document the Redshift Data API surface * fix(redshift-data): address code review findings - rejectMultiStatement now reuses the SQL tokenizer so a semicolon inside a comment, string literal, or dollar-quoted block no longer rejects a valid single statement - GetStatementResultV2 gains unit coverage for the typed and CSV envelopes - CSV output is RFC 4180 quoted (embedded comma, quote, CR, LF) - batch rollback is asserted transactionally in the integration test - RedshiftDataFieldMapper logs a swallowed blob-read SQLException - RedshiftPid/RedshiftQueryId use a non-negative hash - NextToken that decodes to a negative offset is rejected - CancelStatement leaves a FAILED statement FAILED - DescribeTable paginates ColumnList and emits NextToken - DbUser is echoed on the SecretArn path - the statement store no longer builds its sweeper executor in the test constructor * fix(redshift-data): address PR #3186 review findings - SQL scanner handles PostgreSQL escape strings (E'...'): a backslash-escaped quote no longer ends the literal and mis-detects a following :name as a bind marker; plain '...' literals still treat backslash as an ordinary character - ListStatements clamps MaxResults to 1..100 so MaxResults=0 no longer emits the same NextToken forever - DescribeTable matches Table / Schema exactly (=) instead of LIKE, so a name containing _ or % cannot merge other tables' columns into ColumnList - register the service in the README category table - drop a stray em dash from the neighbouring services.yaml comment * fix(redshift-data): bind string parameters untyped so real PostgreSQL infers the column type CI ran the integration test against a real Redshift (PostgreSQL 15) cluster and parameterisedStatement failed: a string bound to an int column via setString raised "operator does not exist: integer = character varying". H2 in PostgreSQL mode coerces it, so the unit test missed it. - RedshiftDataConnectionFactory adds stringtype=unspecified to the JDBC URL, so setString sends the value untyped and the server infers the target type, matching how AWS binds Redshift Data API parameters - ListStatements now rejects MaxResults above 100 with ValidationException instead of silently clamping (PR #3186 re-review) - RedshiftDataOperationsTest uses JBoss Logging, not java.util.logging (PR #3186 re-review) * fix(redshift-data): back the statement store with StorageFactory The store held a bare ConcurrentHashMap outside the configured storage and lifecycle model. It now obtains an account-aware backend through StorageFactory ("redshift-data", statements.json), the same as Athena's query store, resolved to the global storage mode via the catalog descriptor. Default mode stays memory, so statements are still lost on restart as documented; the 24h TTL sweep now walks every account partition and deletes per account since the sweep thread has no request context. StoredStatement is annotated for reflection and field-visible serialization so persistent modes round-trip it. * test(redshift-data): cover StoredStatement serialization round-trip and values() The StorageFactory-backed store serializes StoredStatement in persistent modes. Adds a round-trip test through the exact mapper PersistentStorage builds, covering the ArrayNode, enum, Instant, and nested sub-statement fields plus the field-visibility annotation, and a values() test. * fix(redshift-data): register the nested Status enum for reflection PersistedModelReflectionTest walks every type reachable from a StorageFactory persistence root; StoredStatement.status pointed at an unregistered enum, so native-image deserialization of a persisted statement would fail on restart. |
||
|
|
5864b013d2 |
feat(detective): add organization member operations (#3190)
* feat(detective): add organization member operations * fix(detective): align organization operations with AWS * docs(detective): clarify member listing * fix(detective): enforce organization administration contracts |
||
|
|
7a5ae965e5 |
feat(budgets): add full service emulation (#3165)
* feat(budgets): add budget and notification operations * feat(budgets): complete service emulation * fix(budgets): enforce account and action contracts |
||
|
|
6264b09a28 |
feat(identitystore): add full service emulation (#3159)
* feat(identitystore): add groups users and memberships * feat(identitystore): add full service emulation * fix(identitystore): validate update attribute paths |
||
|
|
d80734e6de |
feat(account): add alternate contact operations (#3118)
* feat(account): add alternate contact operations * fix(account): complete alternate contact contracts |
||
|
|
aebed6e15c |
feat(accessanalyzer): add analyzer lifecycle (#3117)
* feat(accessanalyzer): add analyzer lifecycle * fix(accessanalyzer): complete service contracts * test(accessanalyzer): make SDK cleanup best effort * test(accessanalyzer): use project logging for cleanup |
||
|
|
3927c66040 |
feat(macie2): add organization administration operations (#3105)
* feat(macie2): add organization administration operations * test(macie2): validate organization administration with sdk * fix(macie2): harden delegated administration routing |
||
|
|
1bf7494e99 |
feat(ssoadmin): add permission sets and assignments (#3103)
* feat(ssoadmin): add permission sets and assignments * test(ssoadmin): validate account assignments with sdk * fix(ssoadmin): complete pagination and lifecycle contracts |
||
|
|
0471d6f488 |
feat(bedrock-runtime): stream ConverseStream incrementally (#3043)
ConverseStream previously buffered the whole proxied response, translated it in one shot, and returned it as a single byte[]. Both backends now write frames through a JAX-RS StreamingOutput as they're known, and the proxy backend reads the upstream SSE response via HttpResponse.BodyHandlers.ofLines() instead of ofString() - text deltas reach SDK clients as the model generates them instead of landing all at once when the response finishes. Once the StreamingOutput starts writing, JAX-RS has already committed the 200 response, so a failure discovered only after streaming begins - a stream that never reaches a finish_reason or "[DONE]" (upstream connection dropped mid-generation) - can no longer become an HTTP error status. It's now reported as a modelStreamErrorException event, the same wire shape (:message-type: exception, :exception-type: <name>) and modeled exception real Bedrock uses for a mid-stream failure, verified to decode correctly through BedrockRuntimeAsyncClient's generated ConverseStreamResponseHandler. A stream that completes normally (finish_reason or "[DONE]" seen) with no content is now treated as a legitimate empty completion rather than an error, matching real Bedrock. Added a compatibility-tests/sdk-test-java case exercising BedrockRuntimeAsyncClient.converseStream end to end, proving the emitted event-stream frames decode correctly through the real AWS SDK rather than only Floci's own byte-level assertions. |
||
|
|
724be0a6a7 |
fix(s3): return composite multipart checksums and match S3 on UploadPart, GetObjectAttributes and CopyObject responses (#3093)
* fix(s3): return composite checksums for multipart uploads CompleteMultipartUpload stored the checksum of the whole object but labelled it COMPOSITE, so clients that recompute the composite value from the part checksums, as the AWS documentation describes, never matched it. Follow the AWS checksum type rules, verified against real S3: - SHA1/SHA256 are always COMPOSITE, CRC32/CRC32C default to COMPOSITE and CRC64NVME is always FULL_OBJECT. x-amz-checksum-type on CreateMultipartUpload selects FULL_OBJECT for CRC32/CRC32C; incompatible combinations fail with InvalidRequest, and the response echoes x-amz-checksum-algorithm/-type. - The composite value is the algorithm applied to the concatenated binary part checksums, Base64 encoded, with a "-<part count>" suffix. It is returned by CompleteMultipartUpload, HeadObject and GetObject (with x-amz-checksum-type), while GetObjectAttributes omits the suffix, as AWS does. - A checksum sent on CompleteMultipartUpload is validated against the stored type: a mismatching value is a BadDigest (the composite is accepted with or without its suffix), a checksum type different from the one the upload was created with is an InvalidRequest, per-part checksums in the request body that do not match the uploaded parts are an InvalidPart, and a COMPOSITE upload completed without the checksum of every part is an InvalidRequest (FULL_OBJECT uploads need none, as on S3). A non-numeric PartNumber is a MalformedXML instead of a 500. - UploadPart echoes the part checksum (x-amz-checksum-<algorithm>) when the upload declared an algorithm, as S3 does; without one no header is returned. - CopyObject writes a single object without a part manifest; a composite source gets a full-object checksum recomputed with its algorithm, and CopyObjectResult carries the checksum elements, matching AWS. - GetObjectAttributes lists part-level checksums only for COMPOSITE objects: a FULL_OBJECT multipart object reports its PartsCount alone and a single-part object has no ObjectParts element. The algorithm and type rules live in two new enums, ChecksumAlgorithm and ChecksumType, parsed once from the request headers; S3Checksum builds the full-object, composite and GetObjectAttributes views of a checksum. The boto3 compatibility suite gains multipart upload_file cases for SHA256 and for the SDK's default CRC32, asserting the composite value and the part list. The S3 docs drop the stale note that checksum responses focus on SHA-1 and SHA-256 (CRC32, CRC32C and CRC64NVME have been supported since #877) and list the AWS algorithms Floci rejects. * fix(s3): return the GetObjectAttributes ETag without quotes S3 returns the ETag element of GetObjectAttributes without the surrounding quotes that HeadObject, ListParts and CompleteMultipartUpload keep. Verified against real S3 with the same object: head_object gives "af3c...-3" while get_object_attributes gives af3c...-3, and the AWS CLI reference shows the same in its get-object-attributes example. Floci echoed the quoted value, so a client comparing both saw different strings on Floci and equal ones nowhere. * fix(s3): give a copied object its own ETag CopyObject kept the ETag of the source, so the copy of a multipart object carried the "<md5-of-md5s>-N" value of its parts. S3 writes a copy as a single object and returns the MD5 of the whole content as its ETag, in CopyObjectResult and HeadObject alike (verified against real S3: source "af3c...-3", copy "a5f04f..."). The copy now keeps the ETag storeObject computes. * fix(s3): send CopyObjectResult as application/xml The CopyObject response carried Content-Type: text/plain;charset=UTF-8 for an XML body. S3 labels it application/xml like every other XML response. * test(s3): cover multipart checksums in every SDK compatibility suite Each SDK implements flexible checksums differently, so the multipart flows are exercised per client rather than once: the Go transfer manager (what terraform-provider-aws uses), @aws-sdk/lib-storage for Node, the Java SDK v2 both low-level and through S3TransferManager on the multipart-enabled async client, the AWS CLI (s3api, aws s3 cp --checksum-algorithm and a plain aws s3 cp that goes multipart on its own) and boto3. Every case asserts the composite or full-object value computed in the test itself, the UploadPart echo, the suffix-less GetObjectAttributes checksum and unquoted ETag, the rejected Complete without part checksums, and the copy of a multipart object as a single full object with its own ETag. The default algorithm cases accept whatever the SDK version declares (CRC32 composite or full object, or none) and check the stored value against it. * test(terraform): upload a large aws_s3_object with Terraform and OpenTofu The IaC suites created buckets but never an object, so the code path that surfaced the composite checksum bug, an aws_s3_object above the provider's part size uploaded through the SDK transfer manager, was not covered. Both suites now upload a 12 MiB file generated by the test setup with checksum_algorithm SHA256 and check that HeadObject reports a COMPOSITE checksum equal to the composite computed locally over the part sizes GetObjectAttributes lists, that the state attribute holds the same value, and that re-planning the object shows no drift. compat-opentofu moves to the same aws-cli image as compat-terraform (2.34.32): 2.15 predates the S3 checksum type and cannot show ChecksumType in its output. * fix(s3): reject x-amz-checksum-type without a checksum algorithm CreateMultipartUpload only parsed x-amz-checksum-type when an algorithm was declared, so a type sent on its own, valid or not, was silently ignored. S3 validates the header regardless: an unknown value is InvalidRequest "Value for x-amz-checksum-type header is invalid." and a valid one without an algorithm is InvalidRequest "The x-amz-checksum-type header can only be used with the x-amz-checksum-algorithm header." (both verified against real S3). * test(s3): log cleanup failures in the multipart checksum compat tests The Java, Node and Go cases swallowed errors while deleting their objects and bucket. They now report what could not be deleted and why, so a leftover is diagnosable instead of silent. --------- Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
a1383fdd3d |
feat(redshift): implement Redshift emulation with snapshot and parameter group support (#2472)
* feat: add redshift domain models
* feat: add redshift service and test
* feat: add redshift query handler and routing
* feat(redshift): implement data plane container manager and wire storage
This commit implements Redshift Container Manager, wires the StorageFactory into RedshiftService, uses AwsException for error handling, implements Describe/Delete Clusters, and adds integration tests with AWS SDK in the compatibility tests project.
* feat: add redshift operations models and service logic
* fix: correct yaml indentation for redshift storage config
* fix: remove invalid redshift storage properties
* feat: implement pg_dump and psql for redshift snapshots
* feat: add redshift core operations query actions
* test: add redshift operations integration test
* fix(redshift): Write snapshot SQL dumps to file storage and add Parameter model
* docs: add redshift implementation plan, design spec, and PR description
* chore: remove superpowers working files
* fix(redshift): scope snapshots and cluster recovery per account, restore original password
- Scope snapshot SQL dump files under redshift-dumps/{accountId}/ so
same-identifier snapshots from different accounts no longer collide,
overwrite, or delete each other's data.
- Restore uses the source cluster's real master password instead of a
hardcoded value, falling back to "admin" only when the source cluster
no longer exists.
- Recreate Docker containers for all persisted "available" clusters on
startup, across every account (not just the default), fixing clusters
that were reloaded with stale endpoints but no running container.
- Add AccountAwareStorageBackend.accountId() accessor needed for the
account-scoped dump path.
* fix(redshift): add logging for cleanup failures in RedshiftOperationsTest
* fix(redshift): scope container identity per account, persist snapshot password
- RedshiftContainerManager now keys its in-memory container map and Docker
container name by accountId + clusterIdentifier, instead of just the
cluster identifier. Previously two accounts creating a cluster with the
same identifier would share (and clobber) the same Docker container,
so startup recovery for the second account silently skipped its own
cluster and left it advertised with a stale endpoint.
- Snapshot now captures masterPassword at snapshot-creation time, so
restoreFromClusterSnapshot can recover the original credential even
after the source cluster has been deleted, instead of falling back to
"admin".
- Clean up fully-qualified java.nio.file / commons-compress references in
RedshiftContainerManager in favor of imports.
* feat(redshift): implement adoptOrStart method to reuse existing containers
* chore: gitignore subagent-driven-development scratch workspace
* feat(redshift): add tagging support to RedshiftService
- Add tags field to Cluster, Snapshot, and ClusterParameterGroup models
- Inject RegionResolver into RedshiftService constructor
- Implement tag CRUD methods: createTags, deleteTags, describeTags, listTagsForResource
- Add resolveTagHandle ARN resolver for tagging operations
- Add 6 new unit tests covering tag operations and error cases
* feat(redshift): wire CreateTags/DeleteTags/DescribeTags into the query handler
* feat(redshift): store real parameter values on ClusterParameterGroup
* fix(redshift): use proper imports and preserve parameter metadata on modify
* feat(redshift): wire ModifyClusterParameterGroup, return real DescribeClusterParameters values
* feat(redshift): add ClusterSubnetGroup model and CRUD
* feat(redshift): wire ClusterSubnetGroup CRUD into the query handler
* feat(redshift): add ClusterSubnetGroupName/VpcSecurityGroupIds metadata to Cluster
* feat(redshift): add RedshiftContainerManager.alterUserPassword
* fix(redshift): prevent SQL injection in alterUserPassword via username validation
* feat(redshift): add RedshiftService.modifyCluster
* feat(redshift): add RedshiftService.rebootCluster (dump/restore based, no data loss)
* feat(redshift): wire ModifyCluster/RebootCluster into the query handler
* test(redshift): add compatibility coverage for tagging, subnet groups, modify/reboot
* fix(redshift): use imports and unique names in compatibility test
Follow this file's established conventions: proper imports instead of
fully-qualified SDK types, and TestFixtures.uniqueName() instead of
hardcoded resource names, matching the pattern used by the sibling
test methods.
* fix(redshift): address final whole-branch review findings
* fix(redshift): address PR review feedback and green the CI
Review comments:
- Translate three Vietnamese comments in RedshiftContainerManager and
RedshiftService to English (repo is English-only).
- alterUserPassword: reword the single-quote guard to cite the AWS
ModifyCluster MasterUserPassword constraint rather than the psql SQL
literal, and enforce the full documented set for parity — reject
' " \ / @, require length 8-64 and at least one upper/lower/digit.
- adoptOrStart: LOG.warnv on the container-gone branch so a fresh empty
cluster after a lost container is a searchable line, not a silent one.
- Move the .superpowers/ scratch ignore from the shared .gitignore to
.git/info/exclude (local tooling, not project output).
CI failures:
- Register redshift.model.Parameter for reflection so
PersistedModelReflectionTest passes and native-image persistence works
(fixes CI shard 3 and the native sdk-test-java compat run).
- Convert RedshiftQueryHandler.handle() from an if/else chain to
switch (action) so the docs action-table generator can extract the
action list, matching every other Query handler. Bodies unchanged.
- Register redshift in tools/docs/services.yaml, add docs/services/redshift.md
with the generated action table, and add the Service Matrix row in
docs/services/index.md (fixes Docs Action Tables / Action tables in sync).
* fix(redshift): reject path traversal in SnapshotIdentifier
createSnapshot spliced the request's SnapshotIdentifier straight into a
host path (<persistentPath>/redshift-dumps/<accountId>/<id>.sql). A value
with traversal segments or an absolute prefix escaped the account dump
directory: snapshot creation would write pg_dump output over an arbitrary
host file, and the resulting absolute path was persisted so a later
restore (arbitrary read into an attacker-controlled DB) or delete
(arbitrary unlink) trusted it.
- validateSnapshotIdentifier: enforce AWS's format (1-255 chars, leading
letter, letters/digits/non-consecutive hyphens) — rejects '.', '/', '\'
so no separator can appear.
- Keep a normalise + startsWith(dumpDir) containment check as defence in
depth.
- restore/delete now verify the stored sqlDump path still resolves inside
the account dump dir before touching it, so a path written by the
pre-fix code can't be acted on.
Also replace inline java.* fully-qualified names in RedshiftService and
RedshiftQueryHandler with top-of-file imports.
* fix(redshift): validate snapshot dump path before restore provisioning
The trusted-dump-path check added in the previous commit ran inside the
try block, after restoreFromClusterSnapshot had already persisted the
target cluster as "creating" and started its container. Rejecting an
untrusted path then left the container running and a "failed" cluster
record behind, blocking a retry with the same identifier
(ClusterAlreadyExists).
Move the check ahead of all provisioning — right after the snapshot is
loaded, before clusters.put and containerManager.start — so a rejected
restore creates no resources.
---------
Signed-off-by: Vũ Thế Huy <31652864+vuthehuyht@users.noreply.github.com>
|
||
|
|
277809fb41 |
feat(aps): add Amazon Managed Service for Prometheus workspaces (#2604)
* feat(aps): add Amazon Managed Service for Prometheus workspaces
Implements the AMP workspace lifecycle (CreateWorkspace,
DescribeWorkspace, ListWorkspaces, UpdateWorkspaceAlias,
DeleteWorkspace) plus tagging through the shared /tags/{resourceArn}
dispatcher via a TagHandler with service key aps. Previously the aps
service did not exist, so aws_prometheus_workspace could not be created
through Terraform or Pulumi at all.
Workspaces are ACTIVE from birth so the provider's create waiter
(CREATING to ACTIVE) completes on its first DescribeWorkspace poll, and
a deleted workspace answers DescribeWorkspace with the typed
ResourceNotFoundException its delete waiter matches. createdAt is
serialized as restJson1 epoch-seconds; the ListWorkspaces alias
parameter is a prefix filter, matching the provider's alias_prefix.
clientToken is accepted and ignored, kmsKeyArn is stored and echoed,
and no alertmanager/rulegroups/scraper/logging operations are included.
* refactor(aps): build ARNs via RegionResolver and parse tag ARNs with AwsArnUtils
Replaces the inlined AwsArnUtils.Arn.of + config.defaultRegion pair with
regionResolver.getRegion()/buildArn so a request signed for another
region gets an ARN and endpoint in that region, and drops the
EmulatorConfig dependency that existed only for that getter. The tag
dispatcher path now parses ARNs with AwsArnUtils.parse plus an explicit
workspace/ prefix check (the SchedulerTagHandler idiom), so a
non-workspace aps ARN fails with ValidationException instead of a
misleading workspace ResourceNotFoundException. Also makes the delete
and alias mutators void (their returns were unused) and removes a dead
DELETING status mutation.
* docs(aps): map the aps service key to managed-prometheus.md in the service matrix
The docs-check gate matches ResolvedServiceCatalog external keys against
docs/services/index.md rows by filename; aps is documented at
managed-prometheus.md, so it needs the same alias treatment as
kafka -> msk.
* fix(aps): partition workspaces by request region and align minor wire details
Review follow-ups from #2604:
- Key the workspace store by region (region::workspaceId, like
CloudWatchLogsService's groupKey), and thread the SigV4-resolved request
region through every lifecycle and TagHandler operation, so workspaces
created in one region are invisible to describe/list/delete/tag calls
served in another. Covered by unit and HTTP region-isolation tests.
- Default ListWorkspaces to pages of 100 (AWS's documented default) while
keeping the 1000 ceiling, via Pagination's seven-argument overload.
- Strip leading/trailing blanks from aliases at create, alias update, and
the list prefix filter, per the documented normalisation.
- Return DeleteWorkspace's 202 with an empty body instead of {}.
- Reject tag keys beginning with the reserved aws: prefix in TagResource
with a ValidationException.
* refactor(aps): align the reserved tag-key check with sibling services
- Match the aws: prefix case-insensitively as a plain loop, the same idiom
as FisService and BatchService, instead of a case-sensitive stream chain.
- Derive key() from keyPrefix() so the :: separator lives in one place, and
hoist the region prefix out of the scan predicate.
- Replace the two near-identical SigV4 Authorization literals in the
integration test with an auth(region) helper.
|
||
|
|
399bf20387 | fix(signin): preserve AWS token error modes (#2554) | ||
|
|
d3871e1f25 |
feat(resourceexplorer2): add AWS Resource Explorer 2 with cross-service resource discovery (#2485)
* feat(resourceexplorer2): Add AWS Resource Explorer 2 with cross-service resource discovery Resource Explorer 2 lets AWS SDK clients discover resources across S3, RDS, DynamoDB, ElastiCache, and OpenSearch through a single query interface — the same way real AWS Resource Explorer aggregates resources from multiple services. Architecture: a ResourceProvider CDI interface in core/resource/ decouples Resource Explorer from individual services. Each service implements the interface to expose its resources. Resource Explorer discovers all providers via CDI Instance<ResourceProvider> and queries them live on every request — no intermediate store, no eventual consistency. New services become discoverable by implementing the interface; Resource Explorer never imports service packages directly. Query parsing: hand-written character-by-character tokenizer that implements the full Resource Explorer filter syntax — all 10 filter attributes (accountid, application, id, region, resourcetype, resourcetype.supports, service, tag, tag.key, tag.value), comma-OR within filters, negation (-), wildcard suffix (*), quoted strings, backslash escaping, and free-form text keywords. ListResources rejects free-form text (filter-only mode); Search accepts both. Tokens are classified by splitting on the first unescaped colon and looking the prefix up against the known attributes, matching the documented grammar. API surface: 20 REST JSON endpoints covering ListResources, Search, ListSupportedResourceTypes, full Index CRUD (CreateIndex always creates LOCAL — promote via UpdateIndexType, matching real AWS), full View CRUD with Scope and FilterString, BatchGetView with Errors for missing ARNs, default view association, and pagination with NextToken on all list operations. Tag operations use the existing SharedTagsController + TagHandler infrastructure. A default AGGREGATOR index and default view with tags included are auto-provisioned on startup so ListResources works without setup. AWS behavioral fidelity (matched against the API reference, not guessed): ListResources/Search with no view and no regional default return UnauthorizedException (401), not 404; the default view is scoped per region; CreateView requires a unique, regex-valid ViewName (ConflictException 409 / ValidationException 400) and only accepts "tags" as an included property; promoting a second aggregator index returns ConflictException; ListResources suppresses NextToken at MaxResults=1000; Search/ListResources cap results at the first 1000 matches; QueryString is required (empty string allowed) and MaxResults is range-validated. Pagination offsets are clamped so a stale NextToken against a shrunk live result set returns an empty page instead of a 500. All response JSON uses PascalCase field names built via Jackson ObjectNode (never valueToTree on domain models) to match the AWS SDK wire format exactly. Verified by decompiling every SDK model class with javap and comparing field-by-field, then running 16 read-only SDK tests against production resource-explorer-2 in us-east-1. ElastiCache ReplicationGroup gains arn and region fields so Resource Explorer can discover it. RDS resources get tags via ResourceGroupsTaggingService (the cross-service tagging API) since floci's RDS service doesn't implement AddTagsToResource. Indexes and views are persisted (hybrid storage) in production; tests pin the service to in-memory storage so runs stay isolated and idempotent. Testing: - 50 query parser unit tests covering the full grammar - 20 filter evaluation unit tests against synthetic resources - 9 pagination unit tests for the offset clamp and 1000-result cap - 73 integration tests (@QuarkusTest + RestAssured), grouped with @Nested by behavior class: conditional/stateful response fields, data provenance across services, edge/boundary pagination, cross-service data consistency, filter semantics, and AWS API fidelity (401 no-default-view, conflict on duplicate view name and second aggregator, view-name and included-property validation) - 28 SDK compatibility tests using real AWS SDK v2 ResourceExplorer2Client, asserting every field the SDK model exposes. Dual-mode: run against floci or real AWS via FLOCI_TARGET=aws (mutating tests skipped against real AWS). * feat(lambda): expose functions to Resource Explorer 2 Implement ResourceProvider so Lambda functions surface via the Resource Explorer 2 ListResources/Search APIs and lambda appears in ListSupportedResourceTypes. Iterates $LATEST versions only so published versions don't produce duplicate function entries. * feat(sns): expose topics to Resource Explorer 2 * feat(kms): expose keys to Resource Explorer 2 * feat(sqs): expose queues to Resource Explorer 2 Queue ARNs aren't persisted on the model; reconstruct them from the region (recovered from the storage key) plus the queue name via regionResolver.buildArn. * feat(ecr): expose repositories to Resource Explorer 2 * feat(stepfunctions): expose state machines to Resource Explorer 2 * feat(msk): expose clusters to Resource Explorer 2 * feat(pipes): expose pipes to Resource Explorer 2 * feat(acm): expose certificates to Resource Explorer 2 * feat(cognito): expose user pools to Resource Explorer 2 * feat(iam): expose users and roles to Resource Explorer 2 IAM is a global service: its ARNs carry no region, and Resource Explorer reports global resources with the region "global" (not an empty string), matching real AWS. Emit two resource types, iam:user and iam:role. * test(resourceexplorer2): parameterize per-service ListResources coverage The ten single-service resource tests were byte-for-byte identical except for the service name and resource type — the same service-filter/assert-no-foreign-service/assert-type-present shape copied ten times. Fold them into one @ParameterizedTest whose CsvSource carries the (service, resourceType) pairs, so adding a service is one row instead of a new @Nested class. IAM stays separate: it reports the global region and two resource types, which the shared shape can't express. * feat(amazonmq): expose brokers to Resource Explorer 2 Amazon MQ arrived on main after this branch was cut. Implement ResourceProvider so brokers surface via Search/ListResources and mq appears in ListSupportedResourceTypes, matching the other services already wired into Resource Explorer. Brokers carry an ARN and tags, so the mapping is the same shape as the rest: one mq:broker resource per stored broker. * feat(lightsail): expose resources to Resource Explorer 2 Lightsail landed upstream (#1583) after this branch began and models taggable, ARN-bearing resources (instances, disks, static IPs, key pairs) that AWS Resource Explorer indexes. Without a ResourceProvider its resources were invisible to Search/ListResources, unlike every other resource-owning service on this branch. LightsailService now implements ResourceProvider: getResources() maps each stored resource node to an ExplorerResource, deriving region and account from the ARN and resourceType as lightsail:<Type>; getSupportedResourceTypes() advertises the four stored types (static IPs flagged non-taggable, matching AWS). Coverage: a focused unit test asserts the node->ExplorerResource mapping (arn, type, region, account, tags) without Quarkus, plus the parameterized RE2 integration test seeds a Lightsail instance and disk and asserts both surface via ListResources. * feat(rum): expose app monitors to Resource Explorer 2 CloudWatch RUM (added upstream in #1797) owns taggable, ARN-addressable app monitors, so it fits the ResourceProvider extension point the rest of this branch uses to surface resources to Resource Explorer 2 Search, ListResources, and ListSupportedResourceTypes. RUM is the first RE2 provider whose API model carries neither an ARN nor a region (GetAppMonitor returns neither), so getResources() reconstructs the ARN: the region comes from the storage key, and the owning account is captured at creation time on the AppMonitor. That owner account is @JsonIgnore'd so it never leaks into the RUM API body and is not persisted; getResources() falls back to the default account for monitors reloaded from disk. Resolving the account at creation rather than at query time is what keeps a monitor's identity stable — an earlier draft read the account from the request context inside getResources(), which stamped every resource with the account of whoever called ListResources instead of its true owner. Injecting RegionResolver into RumService (threaded through the existing unit tests) and adding RegionResolver.getDefaultAccountId() support this. Adds RumResourceProviderTest, including a regression test proving the owner account is the creator's, not the querying caller's, plus a RumServiceTest assertion that the owner account never appears in the serialized API body. Extends ResourceExplorer2IntegrationTest to seed an app monitor and assert rum:appmonitor surfaces via ListResources and ListSupportedResourceTypes. * feat(resourceexplorer2): complete the API surface and close the AWS gaps Follow-up to the Resource Explorer 2 branch, addressing the gaps found reviewing it against the AWS API reference and search-syntax documentation. Wire-level corrections: - MaxResults ceilings are now per-operation, as AWS models them: 1000 for Search/ListResources/ListSupportedResourceTypes, 100 for indexes, 50 for views, 10 for member indexes. ListSupportedResourceTypes previously rejected page sizes AWS accepts, and ListViews accepted ones it rejects. - ListViews is scoped to the calling Region. AWS returns "the views available in the AWS Region in which you call this operation"; every Region's views were being listed. - Free-form keywords are OR'd rather than AND'd, which is how AWS reads them. The remaining deviation — AWS ranks a non-matching resource lower instead of excluding it — is documented rather than emulated, since a keyword-only search returning the whole account is not a useful local answer. - A tag filter against a view whose IncludedProperties omit `tags` is rejected with a ValidationException, as AWS documents for tag: / tag.key: / tag.value: / application:, instead of being evaluated on data the view may not expose. - Backslash escaping is honoured throughout the query grammar: escapes now survive tokenization and are resolved only where the character's meaning is decided, so `\-`, `\:`, `\,` and `\*` are literal text and a quoted phrase neutralises every operator inside it. - application: matches the application name as well as the resource-group ARN; resourcetype.supports:tags consults the provider's declared tag support instead of passing everything through; free-form keywords match tag keys and values. The remaining 12 operations are implemented, taking the service to all 32: the multi-Region setup lifecycle (CreateResourceExplorerSetup, DeleteResourceExplorerSetup, GetResourceExplorerSetup) provisions real indexes and views and records each Region's outcome independently, so one Region's failure is reported through its ErrorDetails rather than abandoning the task. The organization and trusted-service surfaces answer with the wire-accurate empty result, since floci models neither. Eleven more services expose their resources: EC2 (instances, VPCs, subnets, security groups, volumes, internet and NAT gateways, route tables), CloudFormation, CloudWatch Logs, EventBridge, Secrets Manager, SSM, ECS, EKS, Kinesis, Firehose, and ELB v2 — thirty providers in total. API Gateway and Route 53 stay out: RestApi carries no Region and Route53Service resolves no account id, so each needs a field added to an unrelated service first. Also documents the service, which a new service requires: docs/services/ resource-explorer.md with the generated action table, the deviations above, and the routing note, plus the mkdocs nav, README, and environment-variable entries. Seven existing tests asserted on the emulator's total resource count, which thirty providers push past Search's 1000-result cap; they are scoped to a bounded slice so their arithmetic stays meaningful. 24 tests added for the new behaviour. * fix(rum): keep a monitor's owning account across updates UpdateAppMonitor rebuilds the AppMonitor from its current state and never carried ownerAccountId over, so an update silently reassigned the monitor to whichever account next called ListResources. Resource Explorer then reported a wrong ARN and OwningAccountId for any monitor not owned by that caller. getResources' fallback for monitors reloaded from disk — where the transient owner account did not survive — was the configured default account. monitorStore.keys() is already scoped to the calling account by the account-aware backend, so a monitor reachable there is owned by that caller by construction; the caller's account is the correct fallback. Also addresses review findings on the Resource Explorer branch: braces in the compatibility test's cleanup, a synchronized override in the Lightsail provider test's storage stub, and four unread locals in the integration test. * chore: drop the stray local-dev Dockerfile docker/Dockerfile.localdev was carried in with the Resource Explorer work but is unrelated to it: nothing in the repo references it, and its header points at a CI pipeline and dev cluster that do not exist in this org. * fix(resourceexplorer2): order paginated results before slicing NextToken is a bare offset, but the list it indexes into is rebuilt on every call by iterating Instance<ResourceProvider> and StorageBackend.scan, neither of which promises an order. Offset pagination is only well defined over a stable order: page through Search or ListResources with MaxResults smaller than the result set and the second page indexes into a differently arranged list, silently dropping or repeating resources. Sort on a unique key before every paginate call: ARN for resources and indexes, the view ARN for ListViews, the resource type for ListSupportedResourceTypes. The regression test drives a provider that reshuffles its resources on each call, which is what an unordered map-backed store is free to do; without the sort a 25-resource set pages down to 16 distinct ARNs. This also makes ResourceProvider#getResources()'s "ordering is not significant" contract true rather than merely permitted. * docs: add the Resource Explorer row to the service matrix The downmerge picks up #2465's service-matrix gate, which fails `make docs-check` for any service registered in ResolvedServiceCatalog without a row in docs/services/index.md — resource-explorer-2 was one. The descriptor's external key carries the API version suffix while the page is resource-explorer.md, so it also needs an alias entry, the same way apigatewayv2 and cognito-idp do. * test(resourceexplorer2): scope the tag-provenance lookup to the caller's Region dynamoDbTagResourceUpdatesResourceExplorer took Resources[0] from an unfiltered ListResources and tagged it. ListResources spans every Region the view covers while DynamoDB TagResource resolves the table in the request's Region, so the ARN it picked only worked as long as the first result happened to be local. Deterministic ARN ordering makes that assumption fail reliably instead of by luck: the first table is now eu-west-2's and TagResource reports it as not found. Filter on region:us-east-1, the same way the region-scoping tests in this class already do. --------- Co-authored-by: Marius Volkhart <marius@volkhart.com> Co-authored-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
943b4c1b45 |
feat(efs): add Elastic File System (file systems, mount targets, access points) (#2371)
* chore(efs): initialize service structure * feat: implement EFS service models for file system and mount target management * feat(efs): implement EFS metadata service emulator This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API. - Scaffolded and generated EFS DTO models with Jackson PascalCase mapping Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies Created EfsController for all mapped REST-JSON routes under /2015-02-01 Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle Created EFS service documentation in docs/services/efs.md * feat(efs): implement EFS metadata service emulator This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API. - Scaffolded and generated EFS DTO models with Jackson PascalCase mapping - Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies - Created EfsController for all mapped REST-JSON routes under /2015-02-01 - Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog - Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle - Created EFS service documentation in docs/services/efs.md * fix(efs): address code review comments - Fixed describe listings to be appropriately region-scoped - Ensured idempotency token caching for AccessPoint and FileSystem creations - Altered creation timestamps to use standard epoch seconds * fix(efs): register models for reflection to satisfy native-image requirements * fix(efs): resolve remaining review comments and add documentation - Prevented file system deletion when mount targets exist - Cleaned up policies and access points upon file system deletion - Validated parent file system exists during Access Point creation - Added proper logging for tolerated exceptions during mount target deletion - Created missing documentation page docs/services/efs.md * fix(efs): prevent deletion races by locking on file system ID Wraps all state-mutating operations on file systems and their dependent resources in synchronized blocks keyed by the file system ID. This guarantees that CreateMountTarget, CreateAccessPoint, and similar operations cannot race with DeleteFileSystem, satisfying the Greptile review for P1 Deletion races dependent creation. * fix(efs): resolve additional concurrency bugs identified by Greptile - Prevents duplicate access point creation when concurrent requests reuse the same ClientToken across different file systems by adding a dedicated token lock. - Prevents resurrection of deleted mount targets by wrapping modifyMountTargetSecurityGroups and deleteMountTarget in target-specific locks. * fix(efs): enforce idempotent parameter matching for access points * fix(efs): enforce parameter matching for idempotent creation requests - Compares all parameters in CreateFileSystem (PerformanceMode, ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps) when CreationToken matches - Compares all parameters in CreateAccessPoint (FileSystemId, PosixUser, RootDirectory) when ClientToken matches - Throws IdempotentParameterMismatch if parameters differ on a retried token, satisfying Greptile bot review * fix(efs): enforce idempotent parameter matching for nested access point fields - Compares PosixUser.SecondaryGids - Compares RootDirectory.CreationInfo (OwnerUid, OwnerGid, Permissions) - Throws IdempotentParameterMismatch if nested parameters differ on a retried token, satisfying Greptile bot review * fix(efs): enforce idempotent parameter matching for default field omission and tags - Treats null PerformanceMode as 'generalPurpose' for equality checks - Treats null ThroughputMode as 'bursting' for equality checks - Treats null Encrypted as false for equality checks - Strictly compares tag lists in both CreateFileSystem and CreateAccessPoint - Throws IdempotentParameterMismatch if these differ on a retried token, satisfying Greptile bot review * fix(efs): override equals and hashCode on Tag model to enable correct idempotency comparison - Resolves issue where identical tag values on retries were evaluated as mismatched due to object identity comparison - Satisfies Greptile bot review for Tag idempotency checks * fix(efs): enforce idempotent parameter matching for AvailabilityZoneName and Backup settings - Persists AvailabilityZoneName (and derived ID) on the FileSystem during creation if supplied - Implicitly creates an ENABLED/DISABLED BackupPolicy during CreateFileSystem to match AWS default behavior - Compares AvailabilityZoneName on retry - Evaluates Backup request flag against stored BackupPolicy status - Satisfies final Greptile bot review for missing idempotency parameters * fix(efs): evaluate creation-time backup configuration rather than current mutable policy during retries - Adds originalBackupParameter to FileSystem model to immutably capture the configuration at creation time - Refactors idempotency check to evaluate this stored value rather than querying the potentially modified live BackupPolicy - Addresses Greptile P1 defect where PutBackupPolicy broke CreateFileSystem retries * fix(efs): resolve backup retry snapshot persistence across emulator restarts - Replaces @JsonIgnore FileSystem property with a dedicated originalBackupStore - Ensures the original backup parameter is properly persisted and reloaded from disk - Maintains AWS API contract fidelity while preventing IdempotentParameterMismatch on restarts * fix(config): resolve EmrServerless and EFS configuration syntax * fix(efs): prevent stale mount targets by deleting them inside the file system lock * fix(efs): correct file-system policy endpoint path to singular /policy * fix(efs): apply query string filters correctly for describe operations * fix: align EFS emulator with AWS specifications - Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint - Implement modern TagResource, UntagResource, and ListTagsForResource APIs - Dynamically resolve regions and ARNs via RegionResolver - Detect mount target subnet conflicts and dynamically resolve AZs - Remove unused obsolete EFS model classes - Ensure UpdateFileSystem returns 202 Accepted status code * docs: generate EFS action table from controller Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list. * fix: align EFS emulator with AWS specifications - Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint - Implement modern TagResource, UntagResource, and ListTagsForResource APIs - Dynamically resolve regions and ARNs via RegionResolver - Detect mount target subnet conflicts and dynamically resolve AZs - Remove unused obsolete EFS model classes - Ensure UpdateFileSystem returns 202 Accepted status code * docs: generate EFS action table from controller Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list. * fix: prevent stale count on mount target deletion failure Removes the generic catch block in deleteMountTarget so that an unexpected exception during the file system update causes the entire operation to fail, leaving the mount target intact instead of silently deleting it and causing an inconsistent parent count. * fix: store original creation requests to prevent false idempotency conflicts When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state. * fix: store original creation requests to prevent false idempotency conflicts When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state. * refactor: remove unused idempotent parameter stores in EFS Dropping originalFileSystemRequestStore, originalAccessPointRequestStore, and originalBackupStore, as parameter matching is no longer performed by the EFS emulator. These stores were persistent and written to on every create but never read, unnecessarily keeping state files around. * fix(efs): resolve compliance issues and reviewer feedback - Populate AccessPointDescription.Name from tags during create and describe - Return 404 FileSystemNotFound for unknown IDs or CreationTokens in DescribeFileSystems - Implement Marker/MaxItems pagination for DescribeTags - Refactor AZ-ID generation to match exact AWS shapes (e.g. usw2-az1) - Clear ProvisionedThroughputInMibps on transition to elastic/bursting mode - Reject update requests setting ProvisionedThroughputInMibps on non-provisioned filesystems - Add trailing newline to ThroughputMode.java - Expand integration tests for ThroughputMode transitions --------- Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in> |
||
|
|
87e804492a |
feat(organizations): add AWS Organizations service (#2489)
* feat(organizations): add AWS Organizations service Implements the AWS Organizations control plane over JSON 1.1 (AWSOrganizationsV20161128.*): organizations and roots, the OU tree, member accounts, all policy types, tags, trusted service access, delegated administrators, the organization resource policy, and the invitation/handshake flow. Organizations is global and cross-account, so records are addressed through the explicit *ForAccount methods on AccountAwareStorageBackend rather than the request-context-derived get/put: a member account calling DescribeOrganization has a different request account than the one owning the data. The caller account is used for authorization instead — mutations are management-account only, members get read access to their own organization, and outsiders get AWSOrganizationsNotInUseException. Because Floci already resolves a 12-digit access key id to an account, an account created by CreateAccount is immediately usable as a caller identity against every other service. * fix(organizations): emit only AWS's handshake resource types Review feedback on #2489. The ORGANIZATION resource on an INVITE handshake was carrying a MASTER_ACCOUNT_ID child. HandshakeResourceType is a closed enum and that value is not in it, so the AWS SDK deserializes it as UNKNOWN_TO_SDK_VERSION rather than failing loudly. AWS's documented children are MASTER_EMAIL and MASTER_NAME; emit those instead. The javadoc already described the correct pair, so it was the code that deviated. Adds an integration test pinning the resource types against the enum so this cannot regress. Also from review: - POLICY_TYPES and EFFECTIVE_POLICY_TYPES are rendered into validation messages, but Set.of's iteration order is unspecified and salted per JVM run, so the same rejection could read differently between runs. Declare them as ordered Lists with companion Sets for O(1) membership. - listHandshakesForAccount called organizationById — itself a full scan — once per handshake. Build the orgId to management-account map once. |
||
|
|
04d120fdd5 |
feat(fis): add AWS FIS support (#2435)
* feat(fis): add AWS FIS support * refactor: add typed FIS persistence models * ci(fis): retrigger timed-out build * fix(fis): reject trailing JSON request bodies |
||
|
|
bba5ffb644 |
feat(firehose): honor CompressionFormat and FileExtension on S3 delivery (#2410)
Firehose accepted CompressionFormat on the control plane and echoed it back on DescribeDeliveryStream, but the delivery path never read it: every delivered object held the raw record bytes, with no compression extension in the key and no Content-Encoding. The divergence was silent, since only a consumer reading the delivered objects (Athena over .gz, Spark reading Snappy, anything that decompresses by extension or encoding) ever saw the wrong bytes. Deliveries are now compressed the way real AWS compresses them: UNCOMPRESSED (no extension) (no Content-Encoding) GZIP .gz gzip ZIP .zip zip single deflated entry, UUID name Snappy .snappy snappy-java xerial stream format HADOOP_SNAPPY .snappy hadoop-snappy Hadoop block framing Snappy is the xerial snappy-java stream format, not the official Snappy framing format, so a consumer must use snappy-java's own reader; HADOOP_SNAPPY is the block framing Hadoop and Spark consumers read. Both are reproduced byte for byte against real AWS. HADOOP_SNAPPY deliberately carries .snappy rather than the .hsnappy the S3 object name documentation tables: the service delivers .snappy, reproduced on two separate dates, and only Content-Encoding tells the two variants apart. Content-Type is now application/octet-stream for every format, including UNCOMPRESSED, matching AWS instead of the previous application/x-ndjson. Buffered records are concatenated as bytes rather than through a String. Record payloads are arbitrary bytes, and compression makes the corruption of anything that is not valid UTF-8 observable. FileExtension is implemented alongside it, since it governs the same part of the key: it replaces the extension the compression format contributes instead of being appended to it, the empty string means "not specified", and it changes only the key, never the body or its Content-Encoding. Building the extension into the key belongs to S3ObjectKeyResolver, which already owns the key format, so the resolver now takes the destination and resolves prefix, time zone and extension together. Both members are validated, with the code and message shape captured from real AWS's raw HTTP responses rather than from an SDK's rendering of them. Unsupported values answer ValidationException naming the shape that carried them, so the same bad value reports extendedS3DestinationConfiguration.compressionFormat, s3DestinationConfiguration.compressionFormat or extendedS3DestinationUpdate.compressionFormat, which is why the wire-shape check runs from the handler. snappy-java becomes a direct dependency: it is the only Java library that writes the xerial stream format, it already shipped as a runtime-scope transitive of kafka-clients, and its version comes from the Quarkus BOM. For the GraalVM native image the loader needs run-time initialization; left to build-time initialization the image still builds and then dies with UnsatisfiedLinkError on the first compression. Snappy and SnappyLoader are the only classes on the compression path with a static initializer, which jdeps and a set of Mandrel 25.0.4 builds confirm is the whole requirement. Two deviations from AWS are documented rather than changed, both newly verified while testing this: Floci appends a newline after records that lack one where AWS inserts no separator at all, and Floci accepts streams with no destination configuration where AWS requires exactly one complete destination. Closes #2328 Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
6779aa8270 | feat(guardduty): add GuardDuty detector and organization configuration emulation (#2346) | ||
|
|
1cc97d57c1 |
feat(cloudhsmv2): implement CloudHSM v2 service (#1776)
* feat(cloudhsmv2): implement CloudHSM v2 service * refactor(cloudhsmv2): delete HSM parameters and docs * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) * fix: greptile bot reviews * refactor(cloudhsmv2): delete HSM parameters and docs * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) * fix: greptile bot reviews * fix(cloudhsmv2): fix backup retention policy parsing and SDK test cert usage * fix(cloudhsmv2): fix CreateHsm IP generation, ModifyCluster validation, and duplicate test Order * docs(cloudhsmv2): add service to mkdocs, readme, and index matrices * fix(rds): preserve configured database images (#2035) * fix(cloudhsmv2): resolve remaining AWS-compatibility edge cases * feat(stepfunctions): run Map iterations concurrently honoring MaxConcurrency (#1810) * feat(stepfunctions): run Map iterations concurrently honoring MaxConcurrency A Map state ran its iterations one after another. AWS runs them concurrently up to MaxConcurrency (default 0 = unlimited), which is a correctness requirement, not just a speed-up: a Map whose iterations coordinate — e.g. a dependency-ordered fan-out where one child blocks until a sibling completes — deadlocks when the iterations are serialised. Run each iteration on the shared executor under the execution's account, gated by a Semaphore sized to MaxConcurrency (unlimited when 0). Results are written into per-index slots so the output array preserves input order regardless of completion order, MaxConcurrency=1 stays strictly sequential, and a failed iteration cancels the rest and fails the Map (fail-fast, matching the default ToleratedFailureCount of 0). * fix(stepfunctions): cap Map worker threads with a bounded pool + handle interruption Address review: submitting every iteration to the shared cached pool behind a Semaphore spawned one thread per item (a 1000-item Map with MaxConcurrency=5 created ~1000 threads, ~995 parked). Run iterations on a fixed-size per-Map ThreadPoolExecutor sized to MaxConcurrency so live threads are capped and the rest queue. shutdownNow() in finally stops the iterations on any exit, and an InterruptedException from the driver now preserves the interrupt status. * fix(stepfunctions): make Map concurrency bounded and fail-fast * docs(stepfunctions): document map concurrency * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after OpenTofu registry flake * test(stepfunctions): pin Map item selection order * perf(lambda): reuse a populated code volume across restarts via a completion marker (#1827) * perf(lambda): reuse populated code volumes across restarts * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after download outage * ci: retry transient gosu downloads --------- Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> * fix(apigateway): apply MOCK integration response headers (#1822) * fix(apigateway): apply mock response headers for OPTIONS * refactor(apigateway): drop the OPTIONS route in favour of #1955 Both this PR and #1955 added an @OPTIONS method on the same @Path in ApiGatewayExecuteController and ApiGatewayUserRequestController, so whichever merged second would not have compiled. #1955's version is the more complete one: it covers ApiGatewayAwsExecuteController (the /_aws/execute-api path) as well, forwards the request body, and skips GlobalCorsFilter for deployed-API paths -- without which a real browser preflight is short-circuited before it ever reaches the route. This PR keeps only its own contribution: invokeMock returned early on the empty-response-template path and dropped static method.response.header.* mappings. ApiGatewayMockCorsHeadersTest now exercises that over GET, since the dropped-header bug is verb-agnostic, leaving the two PRs independently mergeable in either order. * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after autoscaling test flake --------- Co-authored-by: abanna <abanna@users.noreply.github.com> * fix(cloudwatch): return logStreamName on FilterLogEvents results (#2259) FilterLogEvents is the cross-stream search API, so a match is only attributable if the response names the stream that emitted it. Floci served FilterLogEvents and GetLogEvents from one serializer emitting eventId, timestamp, message and ingestionTime, so a caller searching a whole log group could tell which group a hit came from but not which stream, and tooling written against real AWS lost that attribution without any error. Derive the stream from the event's storage key rather than persisting it on the event. Keys are already <region>::<group>::<stream>::<timestamp>::<uuid>, so the key is an authoritative record of the emitter for every event in the store, including ones written before this change. Storing the name on LogEvent instead would leave every already-persisted event with a null logStreamName and need a backfill pass to repair it. The stream is read back between the group prefix and the trailing timestamp and uuid, both generated here, so a stream name is recovered whole even though nothing stops a caller from creating one that holds a ':'. filterLogEvents walks the keyset once and pairs each event with its stream, which also collapses the stream-restricted branch: it previously ran one full keyset scan per requested stream, since a scan walks every key regardless of the prefix it filters on. GetLogEvents keeps its existing shape. Real AWS returns OutputLogEvent there, which carries no logStreamName, because the caller named the stream in the request. Closes #2210 * fix(ec2): start sshd even when run-instances omits a key pair (#2245) * fix(ec2): start sshd even when run-instances omits a key pair Reported in #2184: run-instances without --key-name left every container with no SSH daemon listening at all, "connection refused" regardless of image (alpine, Amazon Linux 2023, Ubuntu all affected). The cause: startSshd() only ran inside the same conditional as injectSshKey(), so no key pair meant sshd never started. Real AWS AMIs run sshd as part of normal boot regardless of whether a key pair is attached - the daemon is always there, it just has nothing to authenticate an unattached client with. Floci's behavior diverged by not running the daemon at all in that case, rather than running it and correctly having no way in. Splits the two: injectSshKey still only runs when a key was actually provided (nothing to inject otherwise), but startSshd now always runs. It's fully self-contained already (installs openssh-server if absent, generates host keys, starts the daemon) and never depended on anything injectSshKey sets up, so making it unconditional needed no other changes. Verified: new test launches an instance with no public key and asserts sshd still starts (and confirms nothing gets written to authorized_keys, since there's no key to inject). Confirmed it fails with the fix reverted (no /usr/sbin/sshd invocation happens without a key) and passes with it restored. Full ec2 package regression is green (268 tests) - including the several existing tests that already launched with no key pair and needed no changes to keep passing. * fix(ec2): stop silently claiming sshd started when it never actually did Follow-up on a comment from duytanisme on #2245: sshd not starting even when an SSH key IS provided, requiring a manual exec-in or a custom user-data script to work around it. Root cause: startSshd() ran every step through execInContainer(), which discards the exec's exit code entirely and only throws if the Docker API call itself fails. The install step's shell script is an if/elif chain with no matching branch, or whose install command itself failed (no network yet, apt lock held, etc.) - and a bash if/elif with no matching branch and no else clause exits 0 by convention. So a container without a package manager, or one where the install call failed for any reason, still reported success, ssh-keygen and sshd then both ran anyway against a daemon that was never installed, and "Started sshd in EC2 instance" got logged regardless. Switches every step to execInContainerForResult and checks its exit code explicitly, following the exact pattern already used by configureLinkLocalMetadataEndpoint for the same class of problem: bail out and log a specific warning with the actual command output at whichever step actually failed, instead of silently proceeding. Also adds an explicit "command -v sshd" as the last statement of the install script, so its own exit code is the real source of truth for whether sshd is actually available afterward, and switches the start command from a hardcoded /usr/sbin/sshd to a bare "sshd" resolved via PATH (matching how ssh-keygen is already invoked two lines above), since not every image installs it to that exact path. Verified: new test forces the install probe to fail and asserts ssh-keygen and the start command are never even attempted. Confirmed it fails (proceeds anyway) with the exit-code check disabled and passes with it restored. Updated the existing no-key-pair test for the new bare "sshd" command. Full ec2 package regression is green (269 tests). * feat(stepfunctions): add UpdateStateMachine and update in place on stack updates (#1867) * feat(stepfunctions): add UpdateStateMachine and update in place on stack updates * test(dynamodb): retain Quarkus port for cleanup * chore: rerun CI after download outage * fix(cloudformation): preserve log group on failed rename * fix(cloudformation): scope update rollback to attempted resources * fix(cloudformation): delete resources after stack updates * test(cloudformation): wire cloudfront fixture dependency * fix: include Step Functions update date in describe response * fix: preserve Step Functions describe response shape * fix: preserve generated Step Functions names * fix(s3): derive S3 host suffix matching from DNS config (#1843) * fix(s3): derive S3 host suffix matching from DNS config S3VirtualHostFilter hardcoded the wildcard-DNS suffixes (localhost.floci.io, localhost.localstack.cloud) in two places: the bare service-host check (isS3ServiceEndpointHost) and the virtual-hosted bucket fallback (isAwsS3Domain). Both now derive their suffix set from the embedded DNS source of truth plus any configured floci.dns.extra-suffixes, so a custom DNS suffix is recognised the same way the builtins are. Why: the two literal lists duplicated what the DNS server already knows and could drift from it silently. Deriving from EmbeddedDnsServer.BUILTIN_SUFFIXES keeps them in lockstep, and folding in extra-suffixes means a user migrating from LocalStack via a custom suffix gets consistent S3 host handling (bucket routing and service endpoint detection), not just the DNS resolution they get today. How: - buildServiceHostSuffixes() computes {localhost} + BUILTIN_SUFFIXES + extra-suffixes once per instance; isS3ServiceEndpointHost() checks membership instead of literals. - matchesConfiguredSuffixHost() routes the virtual-hosted forms bucket.<suffix>, bucket.s3.<suffix> and bucket.s3.<region>.<suffix> for every configured suffix, replacing the hardcoded localstack/floci branches in isAwsS3Domain. - EmbeddedDnsServer.BUILTIN_SUFFIXES widened to public so the filter reuses the list. The virtual-host match now requires the full builtin suffix (.localhost.localstack.cloud) rather than the bare parent domain (.localstack.cloud), matching LocalStack's actual wildcard DNS (*.localhost.localstack.cloud). * test(s3): derive DEFAULT_SUFFIXES from the production factory The test constant hardcoded a copy of the builtin suffix set, which would silently drift if a new builtin were added to EmbeddedDnsServer.BUILTIN_SUFFIXES. Widen buildServiceHostSuffixes() to package-private and reuse it in the test so the two stay in sync automatically. * fix(s3): include the configured hostname in the derived suffix set EmbeddedDnsServer resolves builtins + floci.hostname + floci.dns.extra-suffixes, but the derived service-host set carried only two of the three. The configured hostname reaches the filter as baseHostname, and matchesEndpointHost excludes the bare s3.<host> remainder by design, so the bucket form one level down (bucket.s3.<hostname>) matched nothing. DNS still resolves that host, so the request reached Floci and was then handled path-style, binding the first path segment as the bucket, rather than being refused. Carry the hostname into buildServiceHostSuffixes so all three DNS inputs are mirrored and a host that resolves by wildcard DNS routes under the same rules. * fix(ec2): assign a public IP only when the subnet opts in via MapPublicIpOnLaunch (#2023) * fix(ec2): assign a public IP only when the subnet opts in via MapPublicIpOnLaunch (#1984) Every instance was given PublicIpAddress 127.0.0.1 unconditionally in Ec2ContainerManager, so a private-subnet instance wrongly reported an internet-facing address (breaks the ssh-reachability / public-vs-private distinction). runInstances now flags the instance (associatePublicIp) from its subnet's MapPublicIpOnLaunch, and the container manager exposes a public address only when that flag is set. Private-subnet instances get no PublicIpAddress — DescribeInstances omits the element (XmlBuilder skips nulls), matching real EC2. The value for public instances stays the host-reachable 127.0.0.1 (unchanged). Unit test covers the public-vs-private flag. Supports the aws-bench project: un-excludes the ssh-reachability scenario. * fix(ec2): honor the launch-time AssociatePublicIpAddress override * fix(ec2): honor the top-level AssociatePublicIpAddress and an explicit-false launch configuration Two gaps left by the previous commit, both flagged in review. RunInstances only read the override off the primary network-interface spec (NetworkInterface.1.AssociatePublicIpAddress), so the legacy top-level AssociatePublicIpAddress parameter — what the CLI and older SDKs send — was silently dropped and the subnet default decided instead. It is now read as a fallback; AWS rejects both shapes at once, so the interface spec wins when present. The launch-configuration path was worse than before. LaunchConfiguration stored a primitive boolean, so an absent flag and an explicit false were indistinguishable, and the reconciler could only forward an explicit true. An LC that set AssociatePublicIpAddress=false in a MapPublicIpOnLaunch subnet still got a public address. The field is now a nullable Boolean the whole way through (service, query handler, CFN provisioner), so false overrides the subnet and only null falls back to it. DescribeLaunchConfigurations omits the element when it was never set, as AWS does. Tests: a handler-level test pins all four parse cases (top-level, interface spec, both present, absent), and the reconciler test pins true/false/null reaching runInstances unchanged. * feat(cloudfront): enforce signed private content (#1831) * feat(cloudfront): serve distribution requests from S3 and custom origins * feat(cloudfront): enforce signed private content * chore: re-run CI The Build and Test failure on the previous head was RuntimeApiServerTest's extension/stop race, a pre-existing flake unrelated to this change — it also failed on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it). Reproduced locally under `--cpus=1` and fixed separately. * fix(cloudfront): wildcard aliases match exactly one subdomain level wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the wildcard at that level only: "you can't add alternate domain names that are at levels higher or lower than the wildcard. For example, you can't add the alternate domain names example.com or marketing.product.example.com." https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html Practical effect: a distribution owning "*.example.com" would answer for a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to nobody. Require the label standing in for the wildcard to contain no dot. wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour (a.b.example.test resolving to the *.example.test distribution); it now asserts no match, plus the same for a deeper wildcard. * test(dynamodb): retain Quarkus port for cleanup * fix(cloudfront): isolate mocked storage backends * fix(cloudfront): match wildcards in signed policy queries * feat(cloudhsmv2): implement AWS CloudHSM v2 service (phased) - Fix malformed dummy certificate in sdk-test-java by generating a self-signed X.509 cert programmatically using BouncyCastle - Apply fixes for tag operations targeting backups - Escape backslashes in regex - Resolve compilation issues * fix(test): Add CloudFrontClient to TestFixtures to resolve merge conflict * revert(test): revert CloudFrontClient addition to TestFixtures * fix(cloudhsmv2): fix CSR public key mismatch in SDK tests by signing properly extracted CSR * test(ec2): fix Ec2PublicIpOnLaunchTest compilation after StorageBackend changes * fix(cloudhsmv2): remove explicit BouncyCastle JCA provider to fix native image certificate validation * fix(cloudhsmv2): add null check for DestinationRegion in copy backup * fix(test): correct storage imports in Ec2PublicIpOnLaunchTest after rebase * fix(cloudhsmv2): resolve code review comments including AZ lookup and validation * style(cloudhsmv2): remove trailing whitespace in CloudHsmV2Test --------- Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in> Co-authored-by: Aniket Shukla <aniketshukla619@gmail.com> Co-authored-by: Alex Banna <alexanderbanna@gmail.com> Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> Co-authored-by: TiM <tim@nuimarkets.com> Co-authored-by: Olamide Kosile <64154023+Mide69@users.noreply.github.com> Co-authored-by: lex00 <121451605+lex00@users.noreply.github.com> |
||
|
|
ba843013ec |
chore(compat): align pinned SDK versions across the Python, Java, and CDK suites (#2253)
* chore(compat): align pinned SDK versions across the Python, Java, and CDK suites Bump the exact-pinned SDK versions to a common recent baseline so the suites no longer span a wide release window: - sdk-test-python: boto3 / botocore 1.37.1 -> 1.43.69 - sdk-test-java: AWS SDK for Java v2 2.44.14 -> 2.52.0 - compat-cdk: aws-cdk-lib 2.171.1 -> 2.264.0, aws-cdk 2.171.1 -> 2.1135.1, aws-cdk-local ^2.0.0 -> ^3.0.4 Bumping boto3/botocore also restores the current SES v2 model (97 -> 112 operations, including the Tenant and ReputationEntity families). The aws-cdk 2.1000+ CLI (decoupled from the library version line) publishes template assets to S3 using virtual-hosted-style URLs and needs aws-cdk-local v3. Pointing AWS_ENDPOINT_URL_S3 at Floci's virtual-hosted domain (http://s3.localhost.floci.io:4566) makes the SDK build <bucket>.s3.localhost.floci.io, which resolves via public DNS locally and via Floci's embedded DNS (already injected with --dns in the compat workflow) inside the Docker network, instead of the unresolvable <bucket>.floci. The Go, Node, AWS CLI, Terraform, and OpenTofu suites float to the latest by design and are left unchanged. * chore(compat): let AWS_ENDPOINT_URL_S3 be overridden in the compat-cdk helper Use a ${:-default} fallback like the other endpoint/region variables in common-setup.bash so a caller or CI can point the CDK S3 virtual-host endpoint elsewhere (e.g. a non-4566 port), instead of hard-coding it. |
||
|
|
4e6e6df06d |
feat(bedrockagentcore): emulate the AgentCore control plane and InvokeAgentRuntime stub (#2316)
* docs(bedrockagentcore): add AgentCore emulation design + upgrade path
* feat(bedrockagentcore): add agent runtime CRUD control plane
Implements the bedrock-agentcore-control runtime registry (Phase 1):
Create/Get/List/Update/Delete AgentRuntime plus ListAgentRuntimeVersions,
with immutable version snapshots, cursor pagination, and ISO-8601 timestamps.
- REST-JSON controller + service + reflection-safe models
- ServiceRegistry descriptor + EmulatorConfig toggle
- Unit + RestAssured integration tests
- AWS SDK v2 compatibility test (sdk-test-java)
- Service docs page
Refs lex00/floci#2
* feat(bedrockagentcore): add agent runtime endpoints
Phase 2: Create/Get/Update/Delete/List AgentRuntimeEndpoint under
/runtimes/{id}/runtime-endpoints/, with a DEFAULT endpoint auto-created per
runtime and agentEndpoint/<uuid> ARNs. RestAssured + SDK v2 compat tests.
Refs lex00/floci#3
* feat(bedrockagentcore): add InvokeAgentRuntime data-plane stub
Phase 3: POST /runtimes/{agentRuntimeArn}/invocations returns a fixed,
configurable canned response ({"output":"yes"}) and echoes the runtime
session id. Opaque payload is never parsed; streaming is not emulated.
Separate stateless bedrock-agentcore service. RestAssured + SDK v2 compat tests.
Refs lex00/floci#4
* feat(bedrockagentcore): add tagging and workload identity
Phase 4:
- TagResource/UntagResource/ListTagsForResource for runtime ARNs via a
TagHandler on the shared /tags/{arn} route
- Workload identity RPC CRUD (POST /identities/<Op>); each runtime auto-creates
a resolvable workload identity
- Workload-identity timestamps are epoch-seconds (unixTimestamp), distinct from
the runtime ISO-8601 timestamps
RestAssured + SDK v2 compat tests.
Refs lex00/floci#5
* feat(bedrockagentcore): add gateway and memory primitives
Phase 5 (optional): metadata-only CRUD registries.
- Gateways (POST /gateways/) + gateway targets, standard REST
- Memory (POST /memories/create, GET /memories/{id}/details, ...), action-suffix
- Gateway timestamps are ISO-8601; memory timestamps are epoch seconds
RestAssured + SDK v2 compat tests.
Refs lex00/floci#6
* fix(bedrockagentcore): correctness fixes from adversarial audit
- Fix ListAgentRuntimeVersions pagination cycling for >=10 versions: sort by
the pagination cursor and zero-pad the version cursor (closes #7)
- Capture authorizerConfiguration/protocolConfiguration in version snapshots so
GetAgentRuntime?version returns the requested version's config (closes #8)
- Support tagging AgentCore gateways (AWS-taggable): add tags to Gateway,
dispatch the TagHandler by ARN resource type, store tags on CreateGateway;
non-taggable AgentCore ARNs now 400 (closes #9)
- Validate maxResults range (1..N) across all list operations (closes #12)
Adds regression tests: version-pagination multi-page, version-config snapshot,
gateway tag round-trip (REST + SDK), unsupported-ARN 400, maxResults + malformed
nextToken validation, and an HTTP-level multi-page pagination test.
Refs lex00/floci#14
* feat(bedrockagentcore): clientToken idempotency, invoke existence flag, config docs
- clientToken idempotency for Runtime/Endpoint/Memory create+delete (lenient:
same token returns the existing resource; completed-delete tokens tracked
in-memory so a replayed delete returns 202 not 404) (closes #10)
- InvokeAgentRuntime existence check behind floci.services.bedrock-agent-core
.validate-runtime-exists (default false, preserving permissive behavior);
when on, unknown runtime ARNs return ResourceNotFoundException (closes #11)
- Document that YAML config keys are hyphenated (bedrock-agent-core-control),
distinct from the reported service name (closes #13)
Adds unit tests (create/delete idempotency), a TestProfile integration test for
the existence flag, and an SDK v2 idempotency compat test.
Refs lex00/floci#10 lex00/floci#11 lex00/floci#13
* ci: trigger fork pipeline dry-run
* test(bedrockagentcore): add persistence, region-isolation, concurrency and boundary coverage
Closes the structural test gaps from the audit (issue #14):
- Persistence-across-restart: full AgentRuntime (JsonNode config, Instants,
version snapshots, endpoints, tags, env vars) round-trips through
PersistentStorage to disk and reloads intact
- Region isolation: a runtime is invisible/ungettable from another region
- Concurrency: concurrent creates all persist (no dropped inserts)
- Endpoint version retargeting, gateway + target update, duplicate-name 409,
and memory eventExpiryDuration boundaries (2/3/365/366)
Refs lex00/floci#14
* fix(bedrockagentcore): validate endpoint versions and the identity in a tagging ARN
createEndpoint and updateEndpoint stored agentRuntimeVersion without resolving
it against the runtime, so a version that was never published produced a READY
endpoint whose generated runtime ARN resolves to nothing. Both now reject one
the runtime has not published.
Tag operations resolved a resource from the ARN's id suffix alone, so an ARN
naming another account or region but a local id reached the local runtime or
gateway and could read or change its tags. The shared tag dispatch now checks
both fields against the request, which covers runtimes and gateways in one
place, and reports not found rather than a validation error so the response
does not confirm what sits behind the foreign identity.
|
||
|
|
b45de1bb7d |
feat(s3tables): emulate metadata service (#2322)
* feat(s3tables): emulate metadata service * fix(s3tables): serialize metadata updates |
||
|
|
ecad6acf58 |
feat(swf): add Simple Workflow Service emulation (#2257)
* feat(swf): add Simple Workflow Service emulation
Implements all 39 SWF operations over the JSON 1.0 protocol
(X-Amz-Target: SimpleWorkflowService.*): domain and type registration,
the workflow execution state machine, and the decider/worker task
lifecycle.
Behaviour was derived from botocore's swf-2012-01-25 model and verified
against the live service, which drove several details that are easy to
get wrong from the model alone:
- Faults carry a namespaced __type (com.amazonaws.swf.base.model#Fault)
in the body but the bare fault name in x-amzn-query-error. botocore
prefers the header, so a namespaced value there makes the CLI print
"com.amazonaws.swf.base.model#UnknownResourceFault" where SWF prints
"UnknownResourceFault". SwfException keeps the two spellings apart.
- Timestamps are epoch-second numbers, not ISO strings.
- Void operations answer 200 with an empty body rather than {}.
- An idle poll returns taskToken "" rather than omitting the member;
the SDKs read the empty token as "no task".
- ActivityTaskTimedOut reports startedEventId 0 for a task that never
started, and WorkflowExecutionStarted reports parentInitiatedEventId 0
on root executions, rather than omitting either member.
State machine:
- One decision task outstanding per execution. Events arriving while one
is outstanding set a pending flag that is satisfied when it completes,
so a signal cannot produce two concurrent decision tasks.
- Decisions apply in order; a decision after a closing decision is
dropped. A decision that cannot be applied appends its *Failed event
with the AWS cause and gives the decider a fresh task instead of
failing the request.
- Closing with open activities, timers, or children appends
UNHANDLED_DECISION and leaves the execution open.
- Timeouts (activity schedule-to-start, start-to-close,
schedule-to-close, heartbeat; decision start-to-close; execution
start-to-close; timers) expire from one background sweep rather than a
timer per task, so a restart leaves nothing to reconcile.
- Child executions link to their parent and report their outcome back;
the closing parent's childPolicy is applied to open children.
Tests: 29 unit tests drive timeout expiry through a controllable clock,
32 integration tests assert the wire shapes and fault strings captured
from the live service, and a compatibility suite exercises the same
flows through the AWS SDK v2 client so responses must deserialize into
the generated model and faults into typed exceptions.
Long polling, ScheduleLambdaFunction invocation, and retention-based
pruning are not implemented; docs/services/swf.md records each.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): report the child-started event id on ChildWorkflowExecution* events
A ChildWorkflowExecution* event carries two correlation ids, and they point at
different events in the parent's history: initiatedEventId is the
StartChildWorkflowExecutionInitiated id, startedEventId is the
ChildWorkflowExecutionStarted id. Both were reported as the initiated id, so a
decider correlating a child's outcome on startedEventId matched the wrong event.
Verified against the live service, where a parent that starts one child and sees
it complete produces:
5 StartChildWorkflowExecutionInitiated
6 ChildWorkflowExecutionStarted {initiatedEventId: 5}
8 ChildWorkflowExecutionCompleted {initiatedEventId: 5, startedEventId: 6}
The child now records the parent's ChildWorkflowExecutionStarted id at start
time and reports it back on every ChildWorkflowExecution* event.
The integration test asserts both ids against the events they name rather than
against a "greater than zero" placeholder, and fails on the previous behaviour
with "startedEventId Expected: <6> Actual: <5>".
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): reject a decision batch whose closing decision is not last
RespondDecisionTaskCompleted accepted a batch with decisions after a closing
decision and silently dropped the remainder. The live service rejects the whole
batch instead:
HTTP 400
{"__type":"com.amazon.coral.validate#ValidationException",
"message":"Close must be last decision in list"}
Silently accepting it hides a decider bug and diverges on both the status code
and the response body, so a decider that ships a malformed batch sees success
locally and a 400 against AWS.
The batch is now validated before any state is mutated, matching the live
service's behaviour of leaving the decision task outstanding so the decider can
retry with a corrected batch. Note this fault is namespaced
com.amazon.coral.validate rather than com.amazonaws.swf.base.model.
Tests assert the status code, both fault spellings, the message, that no
DecisionTaskCompleted event is appended, and that the same task token still
works afterwards. They fail on the previous behaviour with "Expected status code
<400> but was <200>".
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): name the scheduled event when an activity task has already closed
An activity task token that resolves to a task which is no longer open reported
"Unknown or expired task token". The live service distinguishes the two cases: a
genuine token whose task has closed names the scheduled event instead, because
the token itself was valid.
Captured from the live service, heartbeating a task that a cancel had already
closed:
HTTP 400
{"__type":"com.amazonaws.swf.base.model#UnknownResourceFault",
"message":"Unknown activity, scheduledEventId = 5"}
Both cases are UnknownResourceFault, so SDK error typing was already correct and
only the message diverged — but a worker that logs or matches on the message sees
a different string locally than against AWS.
A token that never existed still reports the bad token; only a resolved token on
a closed task reports the scheduled event. This required keeping the token's map
entry when an activity closes, since removing it made both cases indistinguishable;
reuse is still refused by the existing open-state check.
Test asserts both branches and fails on the previous behaviour with "expected:
<Unknown activity, scheduledEventId = 5> but was: <Unknown or expired task token>".
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): serialize execution mutation per domain and guard the sweep interval
Addresses three review findings.
Concurrent StartWorkflowExecution calls for one workflowId all scanned for an
open run before any of them inserted, so each persisted its own run key. Eight
concurrent starts produced eight open runs where SWF admits one, and later
operations without a runId then selected an arbitrary run. The open-run check
and the insert are now one atomic step.
A closing execution mutates its parent (ChildWorkflowExecution* events) and its
children (childPolicy), but held only its own lock, so event-id allocation and
the history list raced. Six children closing against one parent reproduced
ConcurrentModificationException.
Both come from the same mismatch: the lock was per execution while the
invariants span an execution family. The lock is now per domain. A parent and a
child always share a domain, so one lock covers the family and never has to be
nested — nesting would deadlock, since a closing child takes its parent while a
closing parent takes its children. Per-domain granularity is sufficient here:
the emulator serves a single developer's workload, not production concurrency.
A zero or negative timeout-sweep interval reached scheduleWithFixedDelay, which
threw IllegalArgumentException out of the StartupEvent observer and stopped the
whole emulator becoming ready — one bad SWF setting taking down every other
service. A non-positive interval now falls back to 1s with a warning.
Tests fail on the previous behaviour with "expected: <1> but was: <8>",
ConcurrentModificationException, and IllegalArgumentException respectively.
Verified over the wire too: eight concurrent starts yield one success, seven
WorkflowExecutionAlreadyStartedFault, and one open run.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): report the live service's TypeNotDeprecatedFault message
DeleteWorkflowType/DeleteActivityType against a still-registered type
reported the type descriptor, e.g. "WorkflowType=[name=W, version=1]". The
live service answers with prose instead, and uses the same wording for both
type kinds:
{"__type":"com.amazonaws.swf.base.model#TypeNotDeprecatedFault",
"message":"The type is currently registered and cannot be deleted in its
current state"}
Since both variants are identical, the two fault factories collapse into one.
The descriptor form is still correct for the other type faults
(TypeDeprecatedFault, TypeAlreadyExistsFault, UnknownResourceFault), which were
verified unchanged in the same probe.
Also adds integration coverage for the five actions that had none at either
test layer: DeprecateActivityType, UndeprecateActivityType, DeleteActivityType,
ListWorkflowTypes, and RespondActivityTaskFailed. Every assertion is taken from
a live-service capture, including that scheduling a deprecated activity type
appends ScheduleActivityTaskFailed with cause ACTIVITY_TYPE_DEPRECATED and
leaves the execution open, that ListWorkflowTypes filters by registration
status and name, and that a second RespondActivityTaskFailed on the same token
reports "Unknown activity, scheduledEventId = 5".
The message tests fail on the previous behaviour with "Expected: The type is
currently registered ... Actual: WorkflowType=[name=TestWf, version=1.0]".
Signed-off-by: Andre Kurait <akurait@amazon.com>
* feat(swf): invoke real Lambda functions for ScheduleLambdaFunction
The decision was recorded as ScheduleLambdaFunctionFailed with cause
LAMBDA_SERVICE_NOT_AVAILABLE_IN_REGION rather than invoking anything. SWF is
otherwise a pure coordination service — deciders and activity workers are the
user's own processes, so there is no user code for the emulator to run — but
ScheduleLambdaFunction is the one decision where SWF itself executes something,
and Floci already runs Lambda functions in containers. A decider that fans work
out to Lambda could not be exercised locally at all.
Floci now invokes the function through its own Lambda service, the same way the
EventBridge and Scheduler invokers do, and records the outcome. Verified against
the live service:
5 LambdaFunctionScheduled {control, id, input, name, startToCloseTimeout}
6 LambdaFunctionStarted {scheduledEventId: 5}
7 LambdaFunctionCompleted {result, scheduledEventId: 5, startedEventId: 6}
8 DecisionTaskScheduled
Four behaviours came from that capture and are easy to get wrong:
- A function that cannot be resolved is LambdaFunctionFailed with Lambda's own
error code as reason (ResourceNotFoundException) — not
ScheduleLambdaFunctionFailed — and it still reports Started first.
- An execution with no lambdaRole never starts the function at all: Scheduled is
followed by StartLambdaFunctionFailed with cause ASSUME_ROLE_FAILED and the
message "No IAM role is attached to the current workflow execution."
- lambdaRole resolves from StartWorkflowExecution's lambdaRole, falling back to
the workflow type's defaultLambdaRole, and is echoed in the started event.
- An absent input reaches the handler as {}, and reusing an id is accepted —
there is no ID_ALREADY_IN_USE for Lambda the way there is for activity ids.
SwfService takes a LambdaInvoker seam rather than LambdaService directly, so the
unit tests keep running without a Docker daemon while SwfLambdaInvoker wires the
real thing at runtime. The invocation is RequestResponse because the response
body is what gets recorded as result; the fire-and-forget invokers use Event for
the opposite reason.
The Lambda region comes from the execution's domain ARN, so a workflow in one
region does not invoke a function in another.
Tests: SwfServiceTest covers all four paths against a recording invoker and
fails on the previous behaviour with "the function must actually be invoked
==> expected: <1> but was: <0>". SwfLambdaIntegrationTest and the SDK
compatibility SwfLambdaTest deploy a real function and assert the recorded
result is what the container returned, so neither passes against a synthesised
event. Docker-backed cases live in their own class so a Docker-less run loses
only them rather than the whole SWF wire suite.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* fix(swf): scope state by region and paginate the registration lists
Addresses two AWS compatibility gaps from review.
SWF names are unique per region, but storage keys were the bare name, so
registering a domain in us-east-1 made the same name in eu-west-1 fail as a
duplicate, and describe/list could return the first region's domain and ARN.
Verified against the live service: the same name registers in both regions with
independent descriptions and retention periods, each ARN naming its own region;
a type registered in one region answers UnknownResourceFault in the other; and
executions, including their runIds, do not cross.
Keys are now region-qualified — `<region>:<domain>` for domains,
`<region>:<domain>/<name>/<version>` for types, and
`<region>:<domain>/<workflowId>/<runId>` for executions — and every store scan
is prefixed by region. The region reaches the service on each call and is stored
on the execution, which is also what task tokens resolve through, so a token
issued in one region cannot address another's execution. The per-domain
mutation lock is region-qualified too; leaving it bare would have let two
regions serialize against each other, and would have disagreed with the
sweeper's own lock derived from the storage key.
ListDomains, ListWorkflowTypes and ListActivityTypes ignored maximumPageSize and
nextPageToken and returned everything. They now share one paging helper with the
history and execution listings. Details taken from live captures rather than the
docs: nextPageToken is absent on the final page even when that page is exactly
full, a maximumPageSize of 0 or absent means "no caller limit", above 1000 is
rejected rather than clamped, and a corrupt token answers
`ValidationException: Invalid token` instead of silently restarting at the first
page — which would make a paging loop repeat forever.
Adds AWS SDK regression tests (SwfRegionPaginationTest) driving two clients at
different regions against the same emulator, plus wire-level integration
coverage. Against the previous implementation those SDK tests fail with
DomainAlreadyExists on the second region, "maximumPageSize must cap the page: 5",
and nothing thrown for an oversized page size.
Signed-off-by: Andre Kurait <akurait@amazon.com>
* test(swf): pin reverseOrder as applying before pagination
The registration lists reverse the whole result set and then page it, so with
maximumPageSize=3 and reverseOrder=true the first page is the tail of the
ascending order. That was already the behaviour but nothing asserted it, and the
shared paging helper makes "page first, then reverse the page" an easy
regression to introduce.
Measured against the live service: 5 types at page size 3 reversed returns
Paged4, Paged3, Paged2 and then Paged1, Paged0. Injecting the page-then-reverse
ordering fails the new test with
"Expected: <[Paged4, Paged3, Paged2]>".
Signed-off-by: Andre Kurait <akurait@amazon.com>
* test(swf): cover region scoping at the wire level
The region-scoping tests went in at the service and SDK layers, but every
SwfIntegrationTest request omitted an Authorization header, so nothing asserted
that the region is read from the SigV4 credential scope — the step that decides
which region's state a call addresses.
Adds a wire test that sends a credential scope naming the region, covering the
same name registering in two regions with independent descriptions, retentions
and ARNs, a type being unknown in the other region, and a same-region
re-registration still faulting.
Against
|