Skip to content

docs(claude): capture SDK-field gotcha and update worktree workflow#56

Merged
srgfrancisco merged 1 commit into
mainfrom
docs/claude-md-sdk-and-worktree-guidance
May 12, 2026
Merged

docs(claude): capture SDK-field gotcha and update worktree workflow#56
srgfrancisco merged 1 commit into
mainfrom
docs/claude-md-sdk-and-worktree-guidance

Conversation

@srgfrancisco

Copy link
Copy Markdown
Owner

Summary

Three small CLAUDE.md tweaks driven by the PR #55 incident-state bug and a shift in the local worktree workflow.

1. Gotcha: verify SDK field names against openapi_types

PR #55 fixed a real-tenant bug where getattr(attrs, "status", "") always returned "" because the v2 SDK exposes state (not status) on IncidentResponseAttributes, and writes go through fields["state"] (dropdown), not a top-level attribute. Documenting this prevents recurrence across the ~20 other modules wrapping the same SDK.

2. Sharpen the Mock(spec_set=...) note in Testing Patterns

The existing note explains the mechanic. The new wording explains why it matters for SDK response mocks: bare Mock(field=...) accepts any attribute name and lets typos like Mock(status=...) pass tests while breaking against the real SDK.

3. Drop git gtr from Development Workflow / Gotchas

Local preference is now claude --worktree (auto-creates a worktree under .claude/worktrees/), falling back to plain git worktree add / git worktree remove when a session was started without it. The previous git gtr guidance predates the --worktree CLI flag.

Test plan

  • Documentation-only change, no code paths affected
  • git diff --stat: 1 file changed, 4 insertions, 4 deletions

Three small CLAUDE.md tweaks driven by the PR #55 incident-state bug
and a shift in the local worktree workflow:

- Add a Gotcha for the datadog_api_client SDK: verify model field
  names against openapi_types before reading or writing. v2 incidents
  expose `state` (not `status`), and lifecycle changes flow through
  `fields["state"]` as a dropdown, not a top-level attribute.
  `getattr(obj, "wrong_name", "")` masks this silently.
- Sharpen the Mock(spec_set=...) note in Testing Patterns to explain
  why it matters for SDK response mocks: bare Mock(field=...) accepts
  any attribute name, which is exactly how the incident bug shipped.
- Drop the `git gtr` recommendations from Development Workflow and
  Gotchas. The local preference is now `claude --worktree`, falling
  back to plain `git worktree add` / `git worktree remove` when a
  session was started without it.
@srgfrancisco srgfrancisco merged commit 2a4ad20 into main May 12, 2026
11 checks passed
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.

1 participant