Skip to content

Refetch full content for generic show recordings#255

Merged
jeremy merged 3 commits intomainfrom
fix/show-generic-refetch
Mar 11, 2026
Merged

Refetch full content for generic show recordings#255
jeremy merged 3 commits intomainfrom
fix/show-generic-refetch

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 11, 2026

Summary

  • basecamp show <id> without a type uses the /recordings/ endpoint, which returns sparse data (no content body)
  • Now re-fetches using the type-specific endpoint derived from the response's canonical API type field
  • Maps SDK RecordingType constants to endpoints: Kanban::Card/card_tables/cards/, Schedule::Entry/schedule_entries/, Vault::Document/documents/, etc.
  • Falls through gracefully to sparse recording data for unrecognized types (no regression)
  • The refetch endpoint is derived from the type field, never from the url field, which could point off-origin and leak the bearer token

Test plan

  • basecamp show <message-id> → full message content (verified with explicit type and via URL)
  • basecamp show <todo-id> → full todo content (verified with explicit type and via URL)
  • basecamp show <card-id> → full card content (Kanban::Card mapping, verified with explicit type)
  • basecamp show <schedule-entry-id> → full schedule entry — no schedule entries in test accounts; endpoint mapping verified by unit test
  • basecamp show <nonexistent-id> → clean error (exit 2, structured JSON)
  • bin/ci passes
  • New unit tests: TestRecordingTypeEndpoint* (14 type cases + 3 edge cases)
  • New integration tests: TestShowGenericRecordingRefetchesTypeEndpoint (verifies 2nd GET to type endpoint) and TestShowGenericRecordingFallsBackOnRefetchError (verifies graceful fallback)

@jeremy jeremy requested a review from a team as a code owner March 11, 2026 03:38
Copilot AI review requested due to automatic review settings March 11, 2026 03:38
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) labels Mar 11, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/commands/show.go">

<violation number="1" location="internal/commands/show.go:203">
P1: `Question::Answer` is mapped to `/questions/` (the check-in question endpoint) instead of `/question_answers/` (the answer endpoint). When a user runs `basecamp show <answer-id>`, the refetch will hit the wrong endpoint and either return a 404 or a different resource entirely.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread internal/commands/show.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates basecamp show <id> (generic recording lookups) to re-fetch the full object payload using a type-specific endpoint derived from the recording’s canonical type field, and adds unit tests for the type→endpoint mapping helper.

Changes:

  • Adds a second GET for generic /recordings/<id> lookups to fetch richer JSON from the type-specific endpoint.
  • Introduces recordingTypeEndpoint(...) to map canonical API type strings to endpoint paths.
  • Adds table-driven unit tests covering known types and unknown/missing type fallthrough behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/commands/show.go Implements type-derived refetch for generic show and adds recordingTypeEndpoint helper.
internal/commands/show_test.go Adds unit tests validating recordingTypeEndpoint mappings and fallthrough behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/commands/show.go
Comment thread internal/commands/show.go
Comment thread internal/commands/show_test.go Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c76dbbbe64

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/commands/show.go Outdated
Comment thread internal/commands/show.go Outdated
When `basecamp show <id>` uses the generic /recordings/ endpoint, the
response is sparse (no content body). Now re-fetches using the type-
specific endpoint derived from the response's canonical API type field
(e.g. "Kanban::Card" → /card_tables/cards/, "Schedule::Entry" →
/schedule_entries/). Falls through to sparse data for unknown types.

The refetch endpoint is derived from the response type field, never
from the url field, which could point off-origin and leak the bearer
token. The type vocabulary matches SDK RecordingType constants.
@jeremy jeremy force-pushed the fix/show-generic-refetch branch from c76dbbb to 3b98d31 Compare March 11, 2026 03:54
Covers check-in questions (/questions/) and the alternate todo type
name (Todolist::Todo → /todos/) returned by some API contexts.
Copilot AI review requested due to automatic review settings March 11, 2026 04:27
@github-actions github-actions bot added the bug Something isn't working label Mar 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/commands/show.go
Tests verify that generic recording lookups make a second GET to the
type-specific endpoint, and that refetch errors fall back gracefully
to the sparse /recordings/ data.
@jeremy jeremy merged commit 18cdca6 into main Mar 11, 2026
26 checks passed
@jeremy jeremy deleted the fix/show-generic-refetch branch March 11, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants