fix(logs): use project log search selectors#19
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates function/frontend runtime and deployment log retrieval to the project-level log search API, aligning request payloads with the newer nested resource selector shape and updating tests accordingly.
Changes:
- Switch function/frontend runtime & deployment log reads to
POST /projects/:id/logs/searchand consumeLogSearchResponse. - Introduce a small internal API helper to build nested
resource(+deployments) selectors and sanitize limit/cursor. - Update CLI and API client tests to validate the new request body shape (nested
resourceselectors).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/output/logs.go | Removes legacy list-logs pagination helper and standardizes on search-log pagination. |
| internal/function/function.go | Updates function deployment log service method to return LogSearchResponse. |
| internal/frontend/frontend.go | Updates frontend runtime/deployment log service methods to return LogSearchResponse. |
| internal/cmd/functions/logs.go | Routes function deployment logs through PrintSearchLogs. |
| internal/cmd/functions/logs_test.go | Updates expectations for nested resource (+ deployments) selectors. |
| internal/cmd/frontends/logs.go | Routes frontend runtime/deployment logs through PrintSearchLogs. |
| internal/cmd/frontends/logs_test.go | Updates expectations for nested resource (+ deployments) selectors and cursor handling. |
| internal/apiclient/client_test.go | Updates log activity request test to assert nested resource body shape. |
| internal/api/logs.go | Adds project log search request/selector types and shared searchProjectLogs helper. |
| internal/api/functions.go | Migrates function runtime/deployment log calls to searchProjectLogs with nested selectors. |
| internal/api/frontends.go | Migrates frontend runtime/deployment log calls to searchProjectLogs with nested selectors. |
| internal/api/frontends_test.go | Updates API client tests to validate POST /logs/search and nested selector payloads. |
| internal/api/client_test.go | Updates function API client tests to validate nested selector payloads for runtime/build logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marckong
left a comment
There was a problem hiding this comment.
Summary: Routes function/frontend runtime and build log reads through the project logs/search endpoint, sending the new nested resource: {type, ids, deployments} selector, and removes the now-unused PrintLogs/LogsFetcher path.
Clean, consistent refactor with good coverage — all three former PrintLogs callers are migrated, the dead code is fully removed (no dangling references), and the new logSearchRequest builder is centralized in internal/api/logs.go. Verified go build/vet/test pass. A couple of non-blocking observations:
- The migrated frontend/function methods now also handle
JSON400/JSON503responses (previously dropped) — a nice incidental improvement. TestGetProjectLogActivityUsesPostBodywas rewritten to a raw-body request and no longer exercises the typedGetProjectLogActivityJSONRequestBody; that's fine since no non-generated code calls log activity, but worth noting the typed path is now untested.
Overall correctness: correct. No bugs found. The frontend-in-search behavior depends on the server-side HOSTING-452 contract (out of CLI scope, and stated as a dependency).
Summary
resourceselectors for resource IDs and deployment IDsVerification
go test ./...make lint