Repository navigation
docs(#1079): the Docker ZIP path is inert by decision, and what it answers is named - #1130
Merged
Merged
Conversation
…swers is named startZIPContainer mounts the deployment package without extracting it, so no handler can be imported from /var/task whatever the ZIP contains. The decision #1079 asked for is recorded as option 1: the archive stays unextracted, because extracting it would complete in-process execution of a caller's own code — which the scope boundary excludes by name and which no test here could cover without depending on container-start latency, the handler's I/O and clock, and a network image pull. The observable is not a stub, which is the part the documentation has to name: docker run succeeds, the readiness check succeeds, and invokePOST returns the runtime interface's own 200 with an import-error body and X-Amz-Function-Error: Unhandled. So Invoke reports that the caller's handler raised, for code that was never loaded. Also fixes LambdaExecutor's doc comment, which named a DockerEnabled field on LambdaExecCfg that has never existed; the gate is Config.Lambda.DockerEnabled, which is why #1079's stub-stays-the-default criterion already held. Closes #1079.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1079.
The issue asked for a decision, not an implementation. The decision is option 1: the Docker ZIP execution path does not extract the archive, and that is now documented rather than surprising. No observable behaviour changes — this is a doc-comment and service-reference PR.
What the path does
startZIPContainer(lambda_exec.go:134) writes the stored deployment package into a temp directory as a single file namedfunction.zipand mounts that directory at/var/task:ro. The Lambda runtime interface expects/var/taskto hold the module tree, so the container sees one archive and noindex.py. No handler can be imported whatever the ZIP contains.The observable is worse than a stub, and that is why this needed more than one sentence
The issue says every invoke down this path "is a function error rather than the caller's result". True, but it understates it in the direction that matters.
Executedegrades to the stub payload only when thedockerbinary cannot be run orgetOrStartContainerfails — and neither happens here.docker runsucceeds,waitReadysucceeds, the container is pooled, andinvokePOSTreturns the runtime interface's own answer:HTTP 200, an import-error body, and
X-Amz-Function-Error: Unhandled— whichinvokeResponse(lambda_plugin.go:710) forwards verbatim, because forwarding it is #393's whole point.So
Invokedoes not fail and does not stub. It reports, successfully, that the caller's handler raised — for code that was never loaded, indistinguishable from a genuineRuntime.ImportModuleError. That is the sentence the documentation has to contain; "it does not run your code" would leave a reader expecting a stub.Why not extract
Extraction is a handful of lines, which is exactly why the issue framed itself as a decision. It is the completion of in-process execution of a caller's own code, which
CLAUDE.mdexcludes by name ("Out of scope: actually running the work — … running a Lambda's code"), anddoc.go's reproducibility argument is why that boundary is drawn: a caller's handler is the nondeterministic part. And no test here could cover it — an extracted-and-running container depends on container-start latency, the handler's own I/O and clock, and an image pull over the network, all three of which## Testingforbids a test to depend on. So the capability would ship permanently unasserted, on the far side of the boundary, to make one already-documented failure mode into a different one.The ZIP write stays, as the recorded intent the same boundary asks for. Those bytes are not decoration: they are what
CodeSha256andCodeSizeare computed from, and what anUpdateFunctionCodereplaces.What a consumer actually needs from this surface —
X-Amz-Function-Error, aHandledvsUnhandleddistinction, a function-error payload — is already seedable throughPOST/DELETE /v1/lambda/invoke-error, which answers instantly and reproducibly where a real handler would not. That is the mechanism substrate offers in place of running the work, and the new docs subsection says so.Corrections to the issue
archive/zipis already imported (cfn_deployer.go:4), used to build the inline-ZipFilepackage. So its absence is not evidence about intent, and the issue's "noarchive/zipreader exists outsidelambda_code_size_test.go" is wrong.docs/services.mddoes discuss Docker execution.### Which operations drop a warm containeralready opens by saying it applies only when Docker execution is configured, and tables the three evicting operations against what a container is started from. The new text is a subsection beside it, not a section from nothing — and that was the right neighbour, because it is already about the container's relationship to the stored package.LambdaExecCfgis not where it held.LambdaExecCfghas exactly two fields and neither isDockerEnabled; the gate isConfig.Lambda.DockerEnabled, read once byRegisterDefaultPlugins, defaulting false.LambdaExecutor's doc comment named that nonexistent field — it claimed the executor falls back to the stub "when Docker is unavailable orDockerEnabledis false", a fallback it cannot make, since an executor exists only because the flag was set. Fixed, with the narrower fallback it does make stated instead.startZIPContaineris:134-190(not:139-190), the ZIP write is:147,startImageContaineris:193.Adjacent defect, filed rather than folded in
waitReadyprobes readiness by POSTing{}to the runtime interface's invocation endpoint and treats any HTTP answer as ready. So starting a container invokes the handler once, with an event the caller never sent, ordered before its own. Harmless on the ZIP path — nothing runs — but on the image path, which does run real code, it is an unrequested invocation that recurs on every cold start. Filed as #1129 with a TCP-dial recommendation, and marked with aTODO(#1129)at the site.What changed
LambdaExecCfg,LambdaExecutor,startZIPContainer,startImageContainerandwaitReadydoc comments.docs/services.md: a new### Docker execution runs an image, never a ZIPsubsection under## Lambda, with the two-path table and the observable named.CHANGELOG.mdunder### Changedand### Fixed.No
.gostatement changed, so coverage is unmoved.