Refetch full content for generic show recordings#255
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 APItypestrings 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.
There was a problem hiding this comment.
💡 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".
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.
c76dbbb to
3b98d31
Compare
Covers check-in questions (/questions/) and the alternate todo type name (Todolist::Todo → /todos/) returned by some API contexts.
There was a problem hiding this comment.
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.
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.
Summary
basecamp show <id>without a type uses the/recordings/endpoint, which returns sparse data (no content body)typefieldRecordingTypeconstants to endpoints:Kanban::Card→/card_tables/cards/,Schedule::Entry→/schedule_entries/,Vault::Document→/documents/, etc.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 testbasecamp show <nonexistent-id>→ clean error (exit 2, structured JSON)bin/cipassesTestRecordingTypeEndpoint*(14 type cases + 3 edge cases)TestShowGenericRecordingRefetchesTypeEndpoint(verifies 2nd GET to type endpoint) andTestShowGenericRecordingFallsBackOnRefetchError(verifies graceful fallback)