* fix(sqs): reject DelaySeconds outside 0-900
* fix(sqs): don't let a json DelaySeconds outside the int range wrap around
* docs(sqs): document the DelaySeconds range
* feat(sqs): publish AWS/SQS queue metrics to CloudWatch
Every active queue now reports the AWS/SQS metrics once a minute on the
QueueName dimension: the depth gauges, ApproximateAgeOfOldestMessage, the
send, receive, delete and empty-receive counters, SentMessageSize, and for
FIFO queues the in-flight groups and deduplicated sends. The samples follow
what SQS sends on AWS, so alarms, GetMetricData and GetMetricStatistics see
queue metrics without PutMetricData.
The CloudWatch metric store is now journaled under persistent mode, as the
CloudWatch Logs event store is, since it takes a write per metric per active
queue every minute.
Closes#6275
* fix(sqs): stamp queue metrics with the minute that ended
The publisher now ticks just after each minute boundary and stamps its
samples with the minute that ended, so a call counts in the minute it was
made instead of the minute of a startup-relative tick. A queue whose write
fails no longer stops the others, and the log names it. A queue deleted and
created again between the snapshot and the lookup is skipped instead of
reporting the old queue's depth under the new one.
* fix(sqs): bound AWS/SQS metric history and finish the tick on shutdown
The publisher now drops AWS/SQS datapoints older than the 15 days AWS keeps
one-minute data, once an hour, so the history it generates for an active
queue stays bounded. On shutdown it stops before the storage flush and waits
for a running tick, so the last minute is not written after the store closed.
* test(sqs): keep the scheduled metrics tick out of the test run
The acceptance test publishes its own ticks, but the scheduled one could
still stamp the test queue's depth into a complete period newer than them,
since a tick stamps the minute that just ended. floci.services.sqs.
cloudwatch-metrics-enabled now turns the tick off, and the test
configuration does, as it does for the S3 lifecycle sweep. It also lets a
user opt out of the AWS/SQS metric volume.
* test(sqs): build the metrics test's queue service with SqsServiceFactory
ListQueues ignored MaxResults and NextToken on every protocol path and
returned all matching queues without a token.
The paging now lives in SqsService, so the Query, JSON and CBOR paths
share it. It follows the API reference and the botocore model:
MaxResults must be 1 to 1000, a NextToken is returned only when
MaxResults was set and more queues remain, and without MaxResults the
response holds at most 1,000 queues and no token. Queues are ordered by
name, the token is the shared Pagination cursor under its own
namespace, and QueueNamePrefix filtering applies before paging. An
out-of-range MaxResults or an unreadable NextToken returns
InvalidParameterValue.
Fixes#6219
With a path in FLOCI_BASE_URL, such as http://localhost:4566/sqs, both endpoint
strategies find the same queues. Queues saved under the longer path move to the
new key at startup. An entry saved without an account prefix moves to the
account its queue path names and is removed by its stored key. An entry whose
new key already holds a different value stays in place, with a warning.
* feat(sqs): opt-in AWS QueueUrl form via endpoint strategy
FLOCI_SERVICES_SQS_ENDPOINT_STRATEGY=standard returns queue URLs in the AWS
form, https://sqs.<region>.<dnsSuffix>/<account>/<name>. The default, path,
keeps the current form. Every input form resolves under either setting.
* fix(sqs): endpoint strategy accepts path or standard
* refactor(sqs): queue URL forms are floci and aws, with shared round-trip tests
* test(sqs): strategy names in tests and config comments read floci and aws
* docs(sqs): list endpoint-strategy on the application.yml page
The yml block and the env var table both list the setting, and the base-url comment names the aws strategy.
* fix(sqs): compare CreateQueue attributes against effective values
CreateQueue on an existing name compared requested attributes against the
raw stored map. SqsManagedSseEnabled is derived on read and never stored, so
re-creating a default queue with SqsManagedSseEnabled=false returned the
existing queue instead of QueueAlreadyExists.
Extract the read-time derivation from GetQueueAttributes into one helper
and use it for both the read path and the conflict check.
* fix(sqs): treat a padded MaximumMessageSize as equal to its canonical form on re-create
* fix(sqs): treat an empty MaximumMessageSize as its default on re-create
CreateQueue accepts an empty MaximumMessageSize and the effective value it
reports is the configured default, but the conflict check skipped
canonicalising empty requests, so an identical retry raised
QueueAlreadyExists instead of returning the existing queue.
* fix(sqs): reject empty, malformed and foreign receipt handles
* fix(sqs): accept receipt handles of gone and re-received messages
* fix(sqs): reject expired FIFO receipt handles
* fix(sqs): reject receipt handles that were never issued
* chore(sqs): parse receipt handles once and share the handle checks
* fix(sqs): sign receipt handles with a configurable secret
* test(sqs): merge the receipt handle error tests into one table
* fix(sqs): give a message moved by a move task a new message id
* feat(sqs): expire messages after MessageRetentionPeriod
ReceiveMessage, GetQueueAttributes counts, the inspection endpoint and
StartMessageMoveTask skip messages older than the queue's retention
period. A sweeper frees expired messages every 60 seconds.
As on AWS, a standard DLQ keeps the original enqueue time, while a FIFO
DLQ and StartMessageMoveTask start the retention period over.
SentTimestamp is kept in all cases.
* fix(sqs): drop messages that expire during a rate-limited move task
* test(sqs): cover a failing retention sweep
* test(sqs): make the rate-limited move task expiry test deterministic
* test(sqs): assert the expiring message is live when the move task starts
* fix(sqs): reject MessageRetentionPeriod outside 60 to 1209600 seconds
* fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range
A new queue reported MaximumMessageSize 1048576, four times the AWS default
and above the AWS maximum, and nothing rejected an out-of-range value on
CreateQueue or SetQueueAttributes. GetQueueAttributes with All also omitted
SqsManagedSseEnabled, which AWS returns for every standard queue.
Default max-message-size is now 262144, values outside 1024 to 262144 are
rejected with InvalidAttributeValue, and All returns the AWS attribute set
including SqsManagedSseEnabled (true unless KmsMasterKeyId is set). Raising
FLOCI_SERVICES_SQS_MAX_MESSAGE_SIZE above the AWS maximum widens the accepted
range with it, so the configured default stays settable explicitly.
* fix(sqs): address review findings
Cover the shipped default itself: ApplicationDefaultsTest now reads
src/main/resources/application.yml and the EmulatorConfig @WithDefault, so
reverting either one fails a test rather than passing on the explicit value in
src/test/resources/application.yml.
Report the MaximumMessageSize that SendMessage enforces. A queue persisted by a
build that allowed 1 MB advertised a payload the send path would then reject;
GetQueueAttributes and the size check now share parseMaxMessageSize, which also
trims like the validation path does.
Pin the SNS fan-out size boundary. SNS accepts a publish up to 262144 bytes and
SQS accepts a message up to the same 262144, so a non-raw sqs subscriber whose
notification envelope pushes the body past the limit is dropped with a warn.
That mirrors AWS, and SnsSqsFanoutMessageSizeTest now holds it in place from
both sides.
Trim the InvalidAttributeValue message to the bare AWS form used elsewhere in
the file.
* fix(sqs): keep SqsManagedSseEnabled consistent when KmsMasterKeyId changes
Creating a queue with a KmsMasterKeyId stored SqsManagedSseEnabled=false. That
value outlived the key: clearing KmsMasterKeyId left the stored false behind,
and the read path, which only fills the attribute in when absent, kept
reporting managed SSE as disabled for a queue that no longer had a KMS key.
Stop storing the derived value at all. CreateQueue no longer writes
SqsManagedSseEnabled, so anything stored under that name is a value the user
set, and it survives. GetQueueAttributes derives the answer on every read: a
KMS key wins, an explicit setting stands, and a queue with neither reports the
AWS default of true. There is no derived state left to go stale.
AWS does not document crisply what happens to SSE-SQS when a KMS key is
cleared, so returning to the default is a deliberate choice; the code and
docs both say so rather than implying it is copied behaviour.
* fix(sqs): raise MaximumMessageSize bounds to the AWS value of 1 MiB
The previous commits on this branch set MaximumMessageSize to a default and
maximum of 262144 bytes. That was wrong: it is SNS's Publish limit, not SQS's.
AWS raised both the SQS maximum and the SQS default from 262144 to 1048576
bytes in August 2025, so the valid range is 1024 to 1048576 with a default of
1048576.
Corrected AWS_MAXIMUM_MESSAGE_SIZE, the EmulatorConfig fallback, both
application.yml files and the docs. The reject-out-of-range path in
validateMaximumMessageSize is unchanged apart from its bounds, as are the
SqsManagedSseEnabled derive-on-read behaviour and the DelaySeconds,
ReceiveMessageWaitTimeSeconds, MessageRetentionPeriod and VisibilityTimeout
backfills.
Several tests had been shrunk to fit the wrong ceiling and are restored to the
payload sizes they had before this branch. getQueueAttributes now stores an
above-ceiling 2097152 so the clamp path stays covered, and a new test pins the
ceiling itself: with a lowered configured maximum, a queue may still be set to
1048576, which the old constant rejected.
Deleted SnsSqsFanoutMessageSizeTest. Its premise was that an SNS notification
envelope reliably pushes a body past the queue's MaximumMessageSize, which no
longer holds for the ordinary text it published: SNS caps a publish at 262144
bytes and SQS now accepts 1048576, so the envelope overhead alone does not
cross the limit. The boundary has not disappeared, it has moved somewhere the
test did not look. Because the envelope is serialized as JSON, escaping expands
every control character below 0x20 to six bytes, and publish validates size
without inspecting character classes, so a publish made largely of control
characters can still overflow a 1 MiB queue. That case is untested; covering it
needs a test built around the expansion rather than around envelope overhead.
The SNS comment that asserted SQS shared the 262144 ceiling is corrected, and
states the escaping caveat rather than claiming the envelope can never cross
the queue limit.
* fix(sqs): honour ReceiveMessageWaitTimeSeconds when ReceiveMessage omits WaitTimeSeconds
ReceiveMessage treated a missing WaitTimeSeconds as 0 and returned
immediately, ignoring the queue's ReceiveMessageWaitTimeSeconds
attribute. AWS applies that attribute as the default wait, and only an
explicit WaitTimeSeconds in the request overrides it, so consumers that
enable long polling on the queue were short polling against Floci.
Both protocol handlers now pass -1 when the parameter is absent, and the
service resolves the wait from the queue attribute, mirroring the
existing VisibilityTimeout fallback. CreateQueue stores the AWS default
of 0 so GetQueueAttributes reports the attribute like AWS does.
* fix(sqs): reject ReceiveMessage WaitTimeSeconds outside 0 to 20
An explicit negative or non-integer WaitTimeSeconds was parsed to the
"omitted" sentinel and inherited the queue's long poll instead of
failing. Carry the parameter as a nullable Integer, reject malformed
values at the protocol boundary and out-of-range values in the service
with InvalidParameterValue, and cap the queue attribute fallback at the
AWS maximum of 20 seconds.
* fix(sqs): reject fractional WaitTimeSeconds on the SQS JSON protocol
canConvertToInt() accepts fractional JSON numbers such as 1.5, which
asInt() then truncated before the range check, so a malformed request
ran as a one second poll instead of failing with InvalidParameterValue.
Signed-off-by: Kurt McAlpine <kurt.mcalpine@halter.co.nz>
---------
Signed-off-by: Kurt McAlpine <kurt.mcalpine@halter.co.nz>
* feat(docs): generate Supported Actions tables from handler source
The "Supported Actions" tables in docs/services/*.md were hand-maintained and
drifted from the handlers. For example secrets-manager.md omitted RestoreSecret,
which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate,
which is not implemented anywhere in src/.
Derive the action list from handler source so it cannot drift, while keeping the
hand-written Description column:
- tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms
(including multi-label arms) and JAX-RS REST controllers, and rewrites only the
rows between the <!-- floci:actions --> markers. Descriptions are preserved by
action name; new actions get a "-" placeholder. PascalCase-only matching avoids
picking up SCREAMING_CASE labels from non-action switches.
- tools/docs/services.yaml registers 18 single-table switch services and lists the
remaining switch handlers under deferred_handlers, so the new-service sentinel
fires only on a genuinely unregistered handler.
- make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that
gates on handler, doc, and tooling changes.
- Migrate 18 service docs into marker blocks, reconciling real drift (adds
RestoreSecret, ImportCertificate, and others; drops the unimplemented
RenewCertificate).
Revives the parser and CI gate from #738 by @ericbsantana and completes the
description-preservation its spec described. REST-mode, mixed-mode, multi-table,
non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers.
* docs: drop standalone design spec from action-docs tooling
Remove ideas/auto-generated-action-tables.spec.md and the four references
to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring,
services.yaml). It was a planning artifact; the operational docs live in
CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana
credit is preserved in the PR description.
* chore: address review on action-docs tooling
- pin actions/checkout to v7.0.0 in docs-actions workflow to match the
repo-wide bump (#1690), so dependabot does not immediately flag the new file
- document in the generator docstring that a switch case label counts as
supported purely by existing, so a per-action UnsupportedOperation stub
would be a false positive (handlers here reject from the default arm)
* docs: regenerate action tables against current handler source
Resync the generated Supported Actions tables to handler source after
rebasing onto the latest main:
- cloudformation: add DescribeStackInstance and DescribeStackSetOperation
now emitted by the handler, and keep the implemented StackSet descriptions
- cloudtrail: add LookupEvents
- firehose: add UpdateDestination
- step-functions: add PublishStateMachineVersion, ListStateMachineVersions,
DeleteStateMachineVersion
- register the cloudcontrol handler in deferred_handlers so the strict
unregistered-handler gate passes (no standalone action table yet)
* fix(docs): prevent action-table generator from silently dropping actions
Address the latest review pass on the action-docs tooling:
- switch extraction now captures case arms whose labels wrap across lines
(valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries,
so it spans newlines between labels but stops at the arm's `->`. A wrapped
arm was previously missed, and docs-check would stay green because the doc
and the generated output agreed on the omission, defeating the whole
drift-prevention guarantee.
- REST extraction skips Javadoc / inline comments between a verb annotation
and the method signature; such a line otherwise reset the lookahead and
dropped the action.
- parse_marker_block raises a descriptive error when a marker is not on its
own line, instead of a bare "substring not found".
- doc, source, and registry reads/writes are pinned to UTF-8 so generation is
locale-independent (the docs contain non-ASCII text).
- the docs-actions push trigger watches Makefile and the workflow file,
matching its pull_request trigger.
Adds regression tests for the multi-line arm and comment-skip paths (20 total).
- Translate LocalStack env vars (LOCALSTACK_HOST, PERSISTENCE, LAMBDA_DOCKER_NETWORK, etc.)
to Floci equivalents automatically at startup; opt out with LOCALSTACK_PARITY=false
- Serve /_localstack/init and /_localstack/health alongside /_floci/* equivalents
- Report executed scripts with path, state, and return_code in /_floci/init response
- Add /_aws/sqs/messages GET (non-destructive peek) and DELETE (purge) inspection endpoint
- Add /_aws/execute-api/{apiId}/{stageName} LocalStack-compat path for REST API invocation
- Add four-phase init hook lifecycle (boot/start/ready/stop) with dual-path discovery
(/etc/floci/init/ and /etc/localstack/init/ compat paths)
- Install Python 3, AWS CLI, boto3 in standard image; wrap aws binary to pre-configure
--endpoint-url=http://localhost:4566 so init scripts need no extra flags
- Wire entrypoint.sh + gosu privilege drop into all Dockerfile variants
- Add migration guide and update README, docker-compose, docker-images, SQS, and
initialization-hooks docs
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.
- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
(they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
following the 1.5.2 upstream release