Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughReplaces manual URL path joins with url.JoinPath, centralizes digest computation and digest-based placeholder URLs, updates uploadArchive to use ArchiveType (MIME) and validate/normalize responses, tightens tar reproducibility fields, and expands tests for remote build context and upload flows. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as CLI (compose)
participant Server as Remote Upload Endpoint
participant Storage as Cloud Storage
CLI->>CLI: create archive stream, calcDigest(data)
CLI->>Server: HTTP PUT /upload/<project>/<stack>/<digest><ext> (body, Content-Type=archiveType.MimeType)
Server->>Storage: persist object, respond with HTTPS URL / Location
Server-->>CLI: 200 OK (Location header / URL)
CLI->>CLI: close response body, normalize URL (strip query, convert GCS https -> gs://)
CLI-->>User: return normalized uploaded URL (s3://... or gs://...)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter" Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pkg/cli/compose/context_test.go`:
- Around line 177-213: The Ignore-mode expectation is hardcoded to a macOS path;
update Test_getRemoteBuildContext so the UploadModeIgnore test computes the
expected path dynamically by calling filepath.Abs on the local test project path
(e.g. filepath.Join("testdata","testproj")), then normalize separators (e.g.
filepath.ToSlash) before comparing; modify the test case for uploadMode ==
UploadModeIgnore to use that computed, normalized path instead of the hardcoded
"/Users/$USER/..." string so it is OS-agnostic.
🧹 Nitpick comments (1)
src/pkg/cli/client/mock.go (1)
24-26: Avoid shadowing theurlpackage name.
Renaming the local variable improves readability.♻️ Proposed refactor
- url, err := url.JoinPath(m.UploadUrl, req.Digest) - return &defangv1.UploadURLResponse{Url: url}, err + uploadURL, err := url.JoinPath(m.UploadUrl, req.Digest) + return &defangv1.UploadURLResponse{Url: uploadURL}, err
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pkg/cli/compose/context_test.go`:
- Around line 90-93: The assertion's error message is inconsistent with the
condition: the code computes expectedPath (path + testproj + "/" +
ArchiveTypeZip.Extension) and compares url against server.URL+expectedPath, but
the t.Errorf message prints server.URL+path+ArchiveTypeZip.Extension which can
confuse failures; update the t.Errorf to use the same expected value
(server.URL+expectedPath) or directly print expectedPath so the message matches
the comparison involving expectedPath, referencing variables expectedPath,
server.URL, path, testproj, ArchiveTypeZip.Extension and url in the test.
🧹 Nitpick comments (1)
src/pkg/cli/compose/context_test.go (1)
245-245: Consider restoring debug state after test.
term.SetDebug(true)modifies global state which could affect other tests running in parallel. Consider saving and restoring the original value.♻️ Suggested fix
t.Cleanup(server.Close) - term.SetDebug(true) + oldDebug := term.DoDebug() + term.SetDebug(true) + t.Cleanup(func() { term.SetDebug(oldDebug) })
[no ci] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description
Fixes a regression from #1801 : missing
fallthroughcaused an empty Digest for all services in the project, causing them to overwrite each other's contexts.Checklist
Summary by CodeRabbit
Bug Fixes
Enhancements
Tests
✏️ Tip: You can customize this high-level summary in your review settings.