Skip to content

fix(logs): use project log search selectors#19

Merged
swkeever merged 2 commits into
mainfrom
skeever/hosting-452-cli-updates
Jun 25, 2026
Merged

fix(logs): use project log search selectors#19
swkeever merged 2 commits into
mainfrom
skeever/hosting-452-cli-updates

Conversation

@swkeever

Copy link
Copy Markdown
Collaborator

Summary

  • route function and frontend runtime/build log reads through project log search
  • send nested resource selectors for resource IDs and deployment IDs
  • update log command/API tests for the new request body shape

Verification

  • go test ./...
  • make lint

@swkeever swkeever marked this pull request as ready for review June 25, 2026 19:14
@swkeever swkeever requested a review from a team as a code owner June 25, 2026 19:14
Copilot AI review requested due to automatic review settings June 25, 2026 19:14
@swkeever swkeever enabled auto-merge June 25, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/search and consume LogSearchResponse.
  • 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 resource selectors).

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.

Comment thread internal/apiclient/client_test.go Outdated

@marckong marckong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/JSON503 responses (previously dropped) — a nice incidental improvement.
  • TestGetProjectLogActivityUsesPostBody was rewritten to a raw-body request and no longer exercises the typed GetProjectLogActivityJSONRequestBody; 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).

@swkeever swkeever added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit 637cd91 Jun 25, 2026
8 checks passed
@swkeever swkeever deleted the skeever/hosting-452-cli-updates branch June 25, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants