mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
f952fffe77e9c44e05bbeadeeba8fb9d73a6f341
20
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2f0ef45978 |
fix(lambda): validate Layers ARNs eagerly on CreateFunction/UpdateFunctionConfiguration (#2282)
* fix(appconfig): add DeleteConfigurationProfile/DeleteHostedConfigurationVersion/ListDeploymentStrategies/DeleteDeploymentStrategy
These four operations had no route at all, so a request fell through
to S3's generic path-style catch-all (GET/DELETE /{bucket}[/{key}])
and returned a misleading NoSuchBucket 404 instead of a real AppConfig
response - confirmed via both raw HTTP and the real AWS SDK for Java.
Adds the missing routes + AppConfigService methods, mirroring existing
precedent (DeleteConfigurationProfile/DeleteHostedConfigurationVersion/
DeleteDeploymentStrategy follow DeleteApplication's idempotent-delete
convention - no upfront existence check; ListDeploymentStrategies
includes the three predefined strategies alongside custom ones,
verified against the API reference's own sample response).
DeleteDeploymentStrategy's real path is /deployementstrategies/{id}
(extra "e" - a genuine, documented quirk in AWS's own API model; every
other deployment-strategy operation correctly uses
/deploymentstrategies). Confirmed against the API reference and
reproduced against the real SDK, which sends the misspelled path
literally - matched it rather than "fixing" it, since wire-protocol
fidelity to what AWS actually does is the point.
Regenerated docs/services/appconfig.md's Supported Operations list
(hand-maintained for REST controllers - not yet covered by
tools/docs/regen_action_docs.py, confirmed via services.yaml's own
Phase-1 scope comment).
Tests: AppConfigIntegrationTest (+4), compatibility-tests/sdk-test-java
AppConfigTest (+1, covering all four operations via the real SDK).
Ran locally (JDK 25):
AppConfigIntegrationTest (unit): 29/29 passed
AppConfigTest (SDK compat, live): 16/16 passed
* fix(appconfig): scope profile deletion to its application, reject deleting predefined strategies
Review feedback on #2280 (Copilot + Greptile, both independently):
- deleteConfigurationProfile ignored appId entirely and deleted by the
bare, globally-keyed profileId - a caller could delete another
application's profile just by guessing/reusing its ID, since
sibling reads (getConfigurationProfile) already enforce this
ownership check but the new delete route didn't. Now rejects with
the same ResourceNotFoundException as a mismatched get; a profileId
that doesn't exist anywhere is still an idempotent no-op, matching
deleteApplication's existing convention - only an existing-but-
wrongly-scoped one is rejected.
- Same method also now cascades the delete to that profile's hosted
configuration versions - they aren't independently addressable
outside a profile's lifecycle, so leaving them in versionStore after
the profile was "deleted" let a caller keep fetching versions for a
profile that supposedly no longer exists.
- deleteDeploymentStrategy silently reported success (204) for a
predefined strategy (e.g. AppConfig.AllAtOnce) without doing
anything, since builtins were never in strategyStore in the first
place - the strategy would still exist and still show up in every
subsequent Get/List call despite the "successful" delete. Now
rejects with BadRequestException.
Also applied this project's own established cleanup-logging
convention (System.err.println on a best-effort catch, matching
several other compatibility-tests/sdk-test-java files) to the one new
try/finally block flagged by Greptile, rather than swallowing the
exception silently.
Tests: 2 new AppConfigIntegrationTest cases (cross-application delete
rejected + original untouched, predefined-strategy delete rejected +
still resolvable) and 2 new SDK compatibility tests using the real
AWS SDK for Java v2's exception types.
AppConfigIntegrationTest: 31/31 passed
AppConfigTest (SDK compat, live): 18/18 passed
* fix(lambda): validate Layers ARNs eagerly on CreateFunction/UpdateFunctionConfiguration
Real AWS rejects an unresolvable layer ARN at attach time with
InvalidParameterValueException. Floci accepted any ARN unconditionally
- CreateFunction/UpdateFunctionConfiguration never validated it at
all, so the only signal was a silent WARN log from ContainerLauncher
when it tried (and failed) to mount the layer's content at container-
launch time, well after the caller had already moved on believing the
attach succeeded.
Adds LambdaLayerService as a LambdaService dependency and validates
each Layers ARN via the existing resolveLayerByArn before setting it
on the function, on both CreateFunction and UpdateFunctionConfiguration.
Left ContainerLauncher's existing warn-and-continue behavior alone for
the one case it still legitimately covers: a layer deleted *after*
being attached (real AWS doesn't re-validate layers on invoke either).
The three package-private test-only constructors (predating layer
support) now assign the new field null and validateLayersResolvable
short-circuits on it, following this class's own existing convention
for optional test-nulled dependencies (see the s3Service/aliasStore/
esmStore null-guards already throughout this file) - existing tests
using those constructors are unaffected.
Also fixes docs/services/lambda.md, which still described layer
support as entirely stubbed/unimplemented (PublishLayerVersion,
GetLayerVersion, ListLayerVersions, ListLayers, and DeleteLayerVersion
were all actually implemented already, just never documented as such).
This intentionally does NOT add real cross-account layer content
fetching (e.g. resolving the actual AWS-owned AppConfig Extension or a
Datadog-published layer) - there is no AWS-SDK/credential-handling
infrastructure anywhere in Floci for that, and it's a materially
larger feature (new dependency, credential trust boundary into
Floci's own control-plane process, cache/failure-semantics design)
than this fix. Documented as a known limitation instead.
Tests: LambdaLayerIntegrationTest (+2, covering both CreateFunction
and UpdateFunctionConfiguration rejecting an unresolvable layer and
leaving existing state unchanged). Ran locally (JDK 25):
LambdaLayerIntegrationTest: 21/21 passed
LambdaServiceTest/PersistenceTest/
ImageConfigTest/EventInvokeConfigTest/
ContainerLauncherTest (constructor-affected): 114/114 passed
* fix(lambda): validate UpdateFunctionConfiguration's Layers before any field mutation
Review feedback on #2282 (Greptile): InMemoryStorage#get returns the
live object backing the store entry, not a copy, and this method
mutates that object's fields one by one with a single save() at the
end - validating Layers where it's applied (after Description,
Timeout, and several other fields are already set) meant a rejected
update could leave those earlier fields live on the stored function
even though the whole call returned 400.
Moves the Layers extraction + validateLayersResolvable call to the
very top of the method, before any field mutation, so a rejected
Layers ARN no longer has that side effect. CreateFunction didn't need
the same fix - its function object is newly constructed and never
touches the store until the very end, so a validation failure there
was already side-effect-free (confirmed by checking where zip
extraction happens relative to the existing Layers check - after it).
This is a narrow fix for the field this PR touches - the same
mutate-then-single-save pattern already existed for other fields
(e.g. the RevisionId check happens after Description/Handler/
MemorySize/Role/Runtime/Timeout/Environment are already mutated), so
it's a pre-existing gap for those, not something this PR introduces or
attempts to fix wholesale.
Strengthened the existing update-rejection test to bundle a Description
change into the same rejected request and assert it was NOT applied -
this is the actual regression check for the ordering fix, not just
that Layers itself was left alone.
LambdaLayerIntegrationTest: 21/21 passed.
|
||
|
|
573d4bdaff |
fix(lambda,iam): assume execution role for in-function SDK calls (#1909)
* fix(lambda,iam): assume execution role for in-function SDK calls - Run Lambda SDK calls as known execution roles so IAM policies and caller identity match AWS behavior. - Preserve unknown-role and mounted-credential fallbacks while leaving ECS behavior unchanged. - Revoke container-bound sessions on cleanup and sweep orphaned sessions after restart. - Resolve the session account from the function ARN when the model carries no account, so a published version enforces its execution role instead of dropping to the placeholder credentials, and revokes under the account it registered with. PublishVersion builds its snapshot field by field and leaves accountId unset (#2040), so the account has to come off the version ARN; routing every read through one helper keeps register and revoke in step. - Add unit, enforcement, lifecycle, and real Docker coverage, plus updated documentation. * fix(lambda): mint execution-role sessions from a CSPRNG and flag credential passthrough The session key and secret are what IamEnforcementFilter authorizes a caller against, so mint them from SecureRandom rather than ThreadLocalRandom, matching how CertificateGenerator already sources security-relevant values. Register the class for native-image run-time initialization so the static instance is not captured, frozen-seed, into the image heap. Credential passthrough (Floci's own AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/ AWS_SESSION_TOKEN forwarded into a launched container) applies whenever those variables are set, so a Floci started from a shell that exports real credentials hands them to every workload whose role it cannot resolve. Log a WARN carrying the access-key prefix the first time the fallback forwards host credentials, and say so in the docs, so the accidental case is visible instead of looking identical to the deliberate one. |
||
|
|
e1f389f61b |
feat(lambda): support EFS file system configs (#2053)
* feat(lambda): support EFS file system configs * fix(lambda): prevent stale and shared EFS mounts * fix(lambda): isolate warm pools by version * test(dynamodb): retain Quarkus port for cleanup * fix(lambda): scope warm pool invalidation by environment --------- Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> |
||
|
|
b543aa4baa |
feat(lambda): support extra /etc/hosts entries on Lambda launch (#2073)
* feat(lambda): support extra /etc/hosts entries via FLOCI_SERVICES_LAMBDA_EXTRA_HOSTS * feat(lambda): support ipv6 addresses. --------- Co-authored-by: Florian Overfelt <joverfelt@meso-scale.com> |
||
|
|
3b4e73ca5a |
docs(lambda): document Podman rootless support and Runtime API host override (#1340)
Adds a 'Running on Podman (rootless)' section to the Docker configuration docs with the known-working container config, and documents the existing FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE escape hatch for when Runtime API host auto-detection picks an unreachable address. Closes #876 |
||
|
|
2d30641479 |
fix(dns): resolve public hostnames from spawned containers (#1168)
Lambda/CodeBuild containers get Floci's IP as their only DNS, so all public-name resolution flows through Floci's embedded UDP/53 forwarder. The forwarder read responses into a hardcoded 512-byte buffer, silently truncating larger EDNS0 responses (e.g. CDN-backed hosts), so public lookups failed inside Lambda with ENOTFOUND/EBUSY. - Enlarge the forwarder receive buffer to 4096 bytes (EDNS0). - Forward across an ordered upstream list (resolv.conf + configurable public fallbacks), returning the first valid response; warn when all upstreams fail instead of dropping the response silently. - Append configurable fallback resolvers (default 8.8.8.8, 8.8.4.4) after Floci's IP on spawned containers' HostConfig.Dns, controllable via floci.dns.container-fallback-* / FLOCI_DNS_CONTAINER_FALLBACK_*. Closes #1110 |
||
|
|
ded329beac |
fix Lambda container networking when Floci runs in Docker (#765)
Automatically detect the Docker network of the running Floci container and use it for spawned containers when no explicit Docker network is configured. This lets Lambda containers reach Floci’s Runtime API in Docker Compose setups without requiring users to manually set FLOCI_SERVICES_LAMBDA_DOCKER_NETWORK. Also update Lambda/Docker docs to clarify the automatic network inheritance behavior. Tested with: ./mvnw -q -Dtest=ContainerBuilderTest,CurrentContainerNetworkResolverTest,DockerHostResolverTest,ContainerLauncherTest test |
||
|
|
9e35046647 |
Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml * docs: sync with main and new features * docs: reverting docker-compose.yml |
||
|
|
3ef99bc5e6 | docs(lambda): update description to clarify Docker container usage (#720) | ||
|
|
aee46fe2da |
feat(lambda): mount host AWS config for real credential discovery (#703)
When FLOCI_SERVICES_LAMBDA_AWS_CONFIG_PATH is set, bind-mount the host path read-only into Lambda containers at /opt/aws-config and set AWS_SHARED_CREDENTIALS_FILE and AWS_CONFIG_FILE env vars so the SDK discovers credentials regardless of container HOME directory. When unset, credentials are read from Floci's own environment with a fallback to test/test/test. Blank values are treated as absent. Closes #686 |
||
|
|
f9d4da69d2 | docs(lambda): clarify compose hostname for containers (#688) | ||
|
|
404b42bdc0 |
feat(lambda): bind-mount hot-reload via S3Bucket=hot-reload (#601)
* feat(lambda): add bind-mount hot-reload mode via S3Bucket=hot-reload Functions created with S3Bucket=hot-reload and S3Key=/absolute/path have their host directory bind-mounted into /var/task rather than packaged as a ZIP. Each invocation runs an ephemeral container so file changes on disk are picked up immediately without calling UpdateFunctionCode or re-uploading code. Feature is disabled by default; opt in with: FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ENABLED=true An optional path allowlist (FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ALLOWED_PATHS) restricts which host directories may be bind-mounted. * fix: missing hot reload enable env |
||
|
|
e023936a81 |
feat(lambda): embedded DNS server for virtual-hosted S3 resolution (#585)
* feat(lambda): embedded DNS server for virtual-hosted S3 resolution
Lambda containers cannot resolve virtual-hosted S3 URLs
(my-bucket.floci:4566) because Docker DNS has no wildcard support —
queries for *.floci fall through to public DNS and hit real AWS.
Adds a Vert.x UDP/53 DNS server that binds automatically when Floci
runs inside Docker. It resolves any *.{floci.hostname} query to
Floci's container IP and forwards everything else upstream. Lambda
containers receive Floci's IP as their DNS server via HostConfig.withDns().
An optional floci.dns.extra-suffixes config allows LocalStack migrants
to route *.localhost.localstack.cloud without changing Lambda code.
Netty NioDatagramChannel was tried first but silently dropped IPv4
UDP packets due to AF_INET6 socket defaults — Vert.x DatagramSocket
with setIpV6(false) resolves this.
* fix: adding missing dns class
|
||
|
|
4f0150870a | feat(docker): centralize Docker config and add private registry authentication (#549) | ||
|
|
114fade129 |
feat(lambda): implement reactive S3-to-Lambda sync for hot-reloading (#509)
* feat(lambda): implement reactive S3-to-Lambda sync for hot-reloading * fix: clean unused hotreload properties |
||
|
|
d8243b8803 |
feat(lambda): support ScalingConfig.MaximumConcurrency on SQS event source mappings (#490)
* feat(lambda): support ScalingConfig.MaximumConcurrency on SQS event source mappings
Wire-level support for ScalingConfig on CreateEventSourceMapping,
UpdateEventSourceMapping, GetEventSourceMapping, and
ListEventSourceMappings:
- New ScalingConfig model carrying MaximumConcurrency (Integer, nullable).
- Create and Update parse ScalingConfig from the request, validate range
(2-1000), reject non-SQS event sources with InvalidParameterValueException.
- Response includes ScalingConfig only when a cap is set; omitted when
null, matching AWS behavior.
- Update with an empty ScalingConfig clears the cap (AWS reset semantics).
The value is persisted on the EventSourceMapping but not yet enforced at
invocation time — the SQS poller today serializes to one concurrent
invocation per ESM regardless. Real parallel dispatch capped by
MaximumConcurrency is a follow-up (Scope B).
Tests:
- EsmIntegrationTest: 6 new cases covering round-trip, below/above range
rejection, non-SQS rejection, omission when unset, add-then-clear via
update.
- LambdaEsmScalingConfigTest (SDK compat): 5 cases verifying SDK typed
ScalingConfig round-trips, InvalidParameterValueException on range
violations, and add/clear lifecycle via update.
* fix(lambda): reject non-integer MaximumConcurrency and ScalingConfig on non-SQS sources
- parseScalingConfig now detects fractional values (e.g. 2.5) and
returns InvalidParameterValueException instead of silently truncating.
- Empty ScalingConfig ({}) on a non-SQS event source is now rejected.
Previously the non-SQS check only fired when MaximumConcurrency was
non-null, so an empty ScalingConfig on Kinesis / DynamoDB Streams
slipped through.
- Two new integration tests cover both cases.
* fix(lambda): tighten ScalingConfig input validation
- Reject non-object ScalingConfig (e.g. "foo", []) with 400 instead of
silently treating it as absent. In update paths this previously cleared
an existing cap unintentionally.
- Reject non-numeric MaximumConcurrency (e.g. string "7"). AWS expects a
JSON number on the wire; the previous toString + parseInt path accepted
strings that real AWS would reject.
- Use longValue() before range-checking to avoid intValue() overflow on
large inputs (e.g. 5000000000) that would produce a negative value and
a misleading error message.
- Two new integration tests: string MaximumConcurrency and non-object
ScalingConfig.
* fix(lambda): add NaN/Infinity guard and expand ScalingConfig test coverage
- parseScalingConfig now explicitly rejects NaN and Infinity rather than
letting them fall through to longValue() with a misleading error.
- The post-range non-SQS guard was flagged as dead code by the reviewer
but is in fact reachable (non-SQS + valid numeric MaximumConcurrency).
Retained and confirmed by the existing @Order(43) test.
- New tests: update range validation (below/above on PUT), and list
with mixed ScalingConfig presence across ESMs.
|
||
|
|
fb26731131 |
feat(lambda): enforce reserved and per-region concurrency (#424)
* feat(lambda): enforce reserved concurrency at invocation time
Introduce LambdaConcurrencyLimiter using AtomicInteger + CAS. Acquire a
permit before invoke and release in finally for both sync and async
paths. DryRun skips enforcement. Functions without a reserved value are
not enforced in this step (account-pool enforcement will follow).
Reset inflight counters when a function is deleted to prevent leaks.
* test(lambda): use JUnit Assertions in LambdaConcurrencyLimiterTest
AssertJ is not on the unit-test classpath; switch to the Jupiter
assertions already used by sibling tests.
* feat(lambda): enforce account-wide concurrency pool and validate Put
Extend LambdaConcurrencyLimiter with an account-shared unreserved pool
sized as accountLimit - Σreserved. Functions without a reserved value
now share this pool; exhaustion returns TooManyRequestsException.
PutFunctionConcurrency rejects values that would leave less than
unreserved-concurrency-min (AWS default: 100) available, matching AWS's
LimitExceededException behavior.
Config: floci.services.lambda.account-concurrency-limit (default 1000)
and floci.services.lambda.unreserved-concurrency-min (default 100).
Docs and controller javadoc updated accordingly.
* feat(lambda): rehydrate reserved concurrency and handle throttle in pollers
On startup, LambdaService walks functionStore.listAll() and re-registers
reserved values with the limiter so validatePut and the unreserved pool
see the correct totals before the first Put of the session.
SQS/Kinesis/DynamoDB Streams pollers now catch TooManyRequestsException
explicitly. SQS lets messages return via visibility timeout; Kinesis and
DynamoDB Streams skip advancing the shard iterator, so records are
redelivered on the next poll.
* test(lambda): add SDK compatibility tests for concurrency enforcement
Verify end-to-end wire behavior: LimitExceededException on Put that
violates unreserved-min, TooManyRequestsException on Event invoke when
reserved=0, and DryRun bypassing the concurrency gate.
* fix(lambda): close concurrency races in limiter and rehydrate
- Recompute cap inside the unreserved CAS loop so concurrent setReserved
does not leave permits granted above the live pool.
- Replace validatePut + setReserved with a single validateAndSetReserved
guarded by a reservedLock; concurrent Puts for different functions
can no longer each pass validation against stale totals.
- Rehydrate only $LATEST entries so published versions do not
double-count into totalReserved().
* fix(lambda): address PR review feedback
- Partition limiter state by region. AWS Lambda concurrency is per
account-per-region; functions in different regions no longer share
the same reserved totals or unreserved pool.
- PutFunctionConcurrency and DeleteFunctionConcurrency now roll back
the limiter update if functionStore.save() fails, so limiter and
persisted state stay consistent.
- Replace the awkward (InvokeResult) null cast in the DynamoDB Streams
poller with a plain forward declaration.
* refactor(lambda): rename account-concurrency-limit to region-concurrency-limit
The limit applies per-region (AWS Lambda's "account-level" quota is
actually per-account-per-region). Rename the config key, field, and
accessor to match what the value controls, and clarify the doc note.
No functional change.
* fix(lambda): O(1) region total and compare-and-rollback on save failure
- Maintain per-region AtomicInteger running total of reserved values,
updated under reservedLock on every mutation. acquireUnreserved reads
the cap in O(1) without iterating the map, eliminating the weakly-
consistent partial-sum window that existed when reads happened off
the lock while writes were serialized.
- Replace unconditional rollback with rollbackReservedIfExpected: the
limiter only restores the previous value if the current entry still
matches what the caller wrote, so a concurrent successful Put cannot
be clobbered by an earlier request's rollback after its save fails.
* docs(lambda): scrub remaining account-wide wording and document drain semantics
Replace lingering "account-wide" / "account pool" phrasing with
per-region terminology in the controller javadoc and unit-test comment.
Two references remain by design: EmulatorConfig and the lambda service
doc quote AWS's own "account-level" label to explain the renamed key.
Also fold two follow-up review items into this change:
- Replace fully-qualified AwsException / InvokeResult references in the
SQS, Kinesis, and DynamoDB Streams pollers with normal imports.
- Document that reducing or clearing a reserved value does not kill
already-inflight invocations, mirroring AWS behavior and causing a
brief drain window where total inflight may exceed the region limit.
* fix(lambda): serialize Put/Delete per function and preserve busy inflight
- Wrap PutFunctionConcurrency and DeleteFunctionConcurrency in a
per-function lock so concurrent requests for the same ARN can't
interleave the limiter update and the store save in a way that
leaves them out of sync.
- Retain the inflight counter on reset when permits are still open,
so an ARN recreated under load sees the remaining inflight rather
than starting fresh and briefly allowing more than reserved capacity.
Idle counters (value 0) are still dropped to prevent leaks.
- Tests now close acquired permits via try-with-resources and cover
both the retain-while-busy and drop-when-idle reset behaviors.
* test(lambda): close all permits via try-with-resources
Close the acquire() result in regions_areIndependent so the test leaves
no inflight state behind and accurately asserts both the exhausted and
recovered cases.
* perf(lambda): avoid regex split in regionOf on the invoke hot path
regionOf() runs on every acquire/release. Replace String.split(":"),
which uses regex and allocates an array, with a single pass that finds
the fourth ':' segment and returns a substring — same semantics, no
allocation beyond the returned region string.
* fix(lambda): keep per-function lock map and tighten compat assertion
- deleteFunction no longer removes the per-function entry from
concurrencyOpLocks. Removing it could race with a concurrent
Put/Delete still synchronized on the old lock object, letting the
next request create a fresh lock and run in parallel — defeating
the very serialization the map provides. The map grows by one
Object per deleted function, acceptable for a local emulator.
- LambdaConcurrencyTest now asserts the wire-level error identity
(400 status + "LimitExceededException" errorCode) for the Put
rejection. The Lambda SDK v2 model does not declare a typed
LimitExceededException class, so wire-level assertions catch
protocol-fidelity regressions more precisely than the previous
generic LambdaException check.
* fix(lambda): retain inflight counter on reset and allow over-committed reductions
- reset() no longer drops idle inflight counters. The previous
counter.get()==0 + remove pattern races with a concurrent
acquireReserved that has already obtained the AtomicInteger
reference and is about to increment it: a successful remove
between those two moments would leave the next acquire to
allocate a fresh counter and silently undercount inflight,
permitting reserved over-subscription.
- validateAndSetReserved now allows any value <= the function's
current reservation unconditionally. Reductions cannot worsen
unreserved capacity, so blocking them in an already over-committed
state (e.g. after lowering region-concurrency-limit at runtime)
prevented operators from recovering. Increases still go through
the unreserved-min check.
* fix(lambda): take per-function lock in deleteFunction
A concurrent deleteFunction + Put/DeleteFunctionConcurrency for the
same ARN could interleave the limiter reset and the store delete,
leaving the limiter holding (or clearing) state for a function the
store no longer knows about. Wrap the limiter+store mutations in the
same lockForConcurrencyOp(arn) used by the concurrency endpoints.
Tighten the surrounding comment so it describes the current code
rather than the lock-removal call that earlier revisions used to have.
* test(lambda): wire a real concurrency limiter into the test constructor
The package-private LambdaService constructor used by unit tests passed
null for concurrencyLimiter, so the null-guards in
putFunctionConcurrency / deleteFunctionConcurrency / deleteFunction made
those paths silently skip validation and limiter bookkeeping under tests.
That hid divergence from production behavior.
Construct a default LambdaConcurrencyLimiter (AWS defaults: 1000 / 100)
in the test ctor so the same enforcement runs in unit tests.
* test(lambda): cover concurrent PutFunctionConcurrency for the same ARN
Verify that the per-function lock in LambdaService serializes racing
Puts so the limiter and the functionStore always agree on whichever
write landed last. 50 iterations across two threads against the same
function exercise the lock discipline and assert store/limiter
consistency on every iteration.
* docs: document reserved concurrency config keys
- docs/services/lambda.md: drop redundant "(enforced at invocation)"
from the PutFunctionConcurrency table entry (the admonition below
already explains enforcement); add region-concurrency-limit and
unreserved-concurrency-min to the Configuration YAML sample.
- docs/configuration/application-yml.md: mirror the two new keys in
the top-level reference sample so every known lambda setting is
discoverable in one place.
* refactor(lambda): address review feedback (A)
- LambdaServiceTest.concurrentPutFunctionConcurrency now asserts against
limiter.totalReserved(region) instead of getFunctionConcurrency(), which
read the same field as the value under test. The new assertion actually
proves the limiter and the persisted store stayed in agreement.
- Expose a package-private concurrencyLimiter() accessor on LambdaService
so tests can inspect limiter state without reflection.
- Drop unused Permit.NOOP: the reserved=null path now runs through
acquireUnreserved and always returns a real decrement closure.
- Document the intentional unbounded growth of the inflight counter map
(race avoidance on reset) and concurrencyOpLocks (race avoidance on
deleteFunction). Both are acceptable for a local emulator workload.
* test(lambda): add rehydrate, multi-ARN race, and qualified-invoke coverage
- LambdaServiceTest.rehydrateConcurrency_restoresReservedFromStore
prepopulates a LambdaFunctionStore with reserved values, builds a
fresh LambdaService over it, and verifies totalReserved(region) goes
from 0 to the expected sum after the @PostConstruct hook runs.
- LambdaServiceTest.multiArnPutFunctionConcurrency_respectsRegionTotalUnderContention
races two Puts on different ARNs that would together push the region
below unreserved-min. reservedLock must let exactly one win; the
other must fail with LimitExceededException and the limiter's total
must reflect only the winning reservation.
- Compat LambdaConcurrencyTest.invoke_withVersionQualifier_stillHonorsReservedOnLatest
publishes a version, sets reserved=0, and invokes with the qualifier
set. Today Floci drops the qualifier and routes to $LATEST, so the
reservation throttles the call. This test locks the behavior in: a
future qualifier-routing change must either copy the reservation onto
the snapshot or key the limiter off the base ARN to keep it green.
* refactor(lambda): idempotent permits, warn on malformed ARN, more tests
- Wrap acquire()/release() counter closures in an AtomicBoolean guard so
a double-close of a Permit can never drive the inflight counter
negative. Future callers that mix try-with-resources with explicit
close, or that add retry logic around invoke, stay safe by default.
- regionOf() now warns once per unique malformed input instead of
silently coalescing everything into "unknown". The first occurrence
is logged so a bug that passes a bare function name into the limiter
is debuggable without spamming the log.
- New LambdaServiceTest.putFunctionConcurrency_rollsBackLimiterIfSaveFails
injects a failing LambdaFunctionStore and verifies the limiter total
is restored when functionStore.save throws.
- New LambdaServiceTest.deleteFunction_preservesInflightPermitUntilItCloses
holds a permit through a deleteFunction call and asserts the inflight
counter stays live until the permit is closed.
- New LambdaConcurrencyLimiterTest.permit_closeIsIdempotent locks in the
double-close guarantee.
|
||
|
|
3b6b5fb687 |
feat(lambda): add PutFunctionConcurrency stub (#325)
* feat(lambda): add PutFunctionConcurrency stub
Add PutFunctionConcurrency, GetFunctionConcurrency, and
DeleteFunctionConcurrency endpoints:
PUT /2017-10-31/functions/{FunctionName}/concurrency
DELETE /2017-10-31/functions/{FunctionName}/concurrency
GET /2019-09-30/functions/{FunctionName}/concurrency
The stored ReservedConcurrentExecutions value is persisted on
LambdaFunction and echoed back, but it is not enforced at invocation
time — invocation slots in LambdaExecutorService / WarmPool are not
bounded, and the account-level concurrent execution limit is not
validated.
* fix(lambda): tighten PutFunctionConcurrency validation
|
||
|
|
a32b7f1f3b |
docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
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 |
||
|
|
61433f59ab | firt commit |