fix(unit-only): include harness Dockerfile content in deploy hash (#1380)#36
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(unit-only): include harness Dockerfile content in deploy hash (#1380)#36aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
A content-only edit to a harness-referenced Dockerfile did not change the project deploy hash, so deploy/dev reported 'No changes detected' and the cloud Harness kept running the previously-built container image. computeProjectDeployHash now parses each harness.json, and when a dockerfile field is set, reads and hashes the referenced Dockerfile's content (under try/catch so a missing file degrades gracefully). Adds a unit test asserting a content-only Dockerfile change produces a different hash.
Coverage Report
|
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.
Refs aws#1380
Issues
Root cause
computeProjectDeployHash (change-detection.ts:14-43) hashes harness.json (line 26) + system-prompt.md (line 32) + aws-targets.json + projectSpec, but never reads the harness Dockerfile content. harness.json stores only the Dockerfile filename (HarnessPrimitive.ts:256), so a content-only edit leaves the hash unchanged; canSkipDeploy (change-detection.ts:52-75, runtimes-length guard at line 56) returns true and short-circuits handleDeploy at useDevDeploy.ts:76-80 and progress.ts:56-62. Note: the brief's cited CDK construct AgentCoreHarnessEnvironment.ts does NOT exist in CDK alpha.19 — harness synth (which passes hasDockerfile/dockerfile/codeLocation to drive the container build) is in the CLI's vended src/assets/cdk/lib/cdk-stack.ts + bin/cdk.ts:102-104 via @aws/agentcore-cdk HarnessDeploymentConfig. Owner is still CLI.
The fix
In computeProjectDeployHash, after hashing each harness.json, parse it and when harnessSpec.dockerfile is set, readFile the Dockerfile from the harness dir (join(harnessDir, harnessSpec.dockerfile)) and hash.update its content inside a try/catch so a missing file degrades gracefully. Extend change-detection.test.ts (whose readFile mock currently returns only harness.json/system-prompt.md) to mock a Dockerfile and assert a content-only Dockerfile change produces a different hash. This is exactly what open PR aws#1587 ('fix: include harness Dockerfiles in deploy hash', +13 in change-detection.ts, +36/-4 in change-detection.test.ts) implements; it just needs to land.
Files touched: /local/home/aidandal/workplace/issues/agentcore-cli/src/cli/operations/deploy/change-detection.ts (computeProjectDeployHash, harness loop lines 23-37) plus /local/home/aidandal/workplace/issues/agentcore-cli/src/cli/operations/deploy/tests/change-detection.test.ts. Tracked by open PR aws#1587 (branch fix/harness-dockerfile-deploy-hash).
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.