Skip to content

feat(tags): add delete_tag_definition + document track/tag probe findings#63

Merged
arapov merged 1 commit into
masterfrom
feat/delete-tag-definition
May 29, 2026
Merged

feat(tags): add delete_tag_definition + document track/tag probe findings#63
arapov merged 1 commit into
masterfrom
feat/delete-tag-definition

Conversation

@arapov
Copy link
Copy Markdown
Collaborator

@arapov arapov commented May 29, 2026

Summary

Acts on the post-v1.6.6 connector-gap audit — but only after a wire-trace probe (scripts/wire-trace-v167.ts) graded each proposed tool buildable-or-not against the live API, instead of trusting the audit's confident-but-unchecked claims.

Probe Result Outcome
GET /tracks 405 Method not allowed No tenant-wide track-instance list → list_tracks NOT buildable (the audit's "highest-leverage addition" has no endpoint). Documented in NOTES §33.
DELETE /<entity>/tags/{id} 204, gone tenant-wide on re-read Tag definitions ARE deletable → ships delete_tag_definition

The audit had also flagged "no people-at-org lookup" and "no party-type filter" as gaps — both already exist (list_employees, filter_parties type), and team-membership / custom-field-read-depth are hard Capsule API limits. So this one tool is the entire actionable surface from the audit.

delete_tag_definition

  • Write, destructive, confirm-gated. Schema {entity, tagId, confirm: true}entity selects the tag namespace (parties/opportunities/kases), same selector as add_tag / list_tags.
  • Handler: DELETE /<entity>/tags/{tagId}, idempotent on 404 (alreadyDeleted: true), invalidates the list_tags cache, explicit confirm guard for direct callers (mirrors defineDelete).
  • Annotation: delete_ prefix auto-applies destructiveHint via inferAnnotations — no register-tool.ts change.
  • Distinct from remove_tag_by_id: that DETACHES a tag from one record (definition survives); this removes the definition from the namespace and from every record that shared it. The description spells out that blast radius; the confirm gate guards it.

Test plan

  • 529 → 536 tests (+7 in tags.test.ts): per-entity DELETE path, idempotent 404, confirm-false/missing schema rejection, unknown-entity rejection, direct-call confirm guard
  • mcp-integration.test.ts: catalog 87 → 88, present in writes / absent in read-only (delete_ prefix → hidden in read-only mode)
  • tool-annotations.test.ts: destructive 7 → 8, total 88, aggregate buckets re-balanced (49 read / 8 destructive / 31 routine)
  • Typecheck / lint / format:check / build clean
  • Tool-count + bundle figures synced across README / DEPLOY / DESIGN / HOWTO / bundle-shape canary (some were stale from earlier un-synced merges)
  • Privacy sweep clean — probe-run record ids exist only at runtime, never committed

Notes

  • scripts/wire-trace-v167.ts ships for re-runnability (same ZZZ-* throwaway + cleanup pattern as v164–v166). Its probe-2 run was fully clean — the throwaway tag was created, deleted via the endpoint under test, and confirmed gone; nothing stranded.

🤖 Generated with Claude Code

…ings

Resolves the one genuinely-buildable gap from the post-v1.6.6
connector audit, and records why the other headline gap isn't
buildable. Both gated on endpoint existence, settled by
scripts/wire-trace-v167.ts before any code was written:

  - GET /tracks → 405 Method not allowed. No tenant-wide track-
    instance list exists (the route only accepts POST/create).
    Orphan tracks (NOTES §25) stay reachable only by known id, so a
    `list_tracks` tool is NOT buildable — declined on evidence, not
    assumption. Documented in NOTES §33.

  - DELETE /<entity>/tags/{id} → 204, verified gone tenant-wide on a
    follow-up read. Tag definitions ARE deletable, so this ships
    `delete_tag_definition`.

delete_tag_definition (write, destructive, confirm-gated):
  - Schema {entity, tagId, confirm: true}; entity selects the tag
    namespace (parties/opportunities/kases), same as add_tag/list_tags.
  - Handler: DELETE /<entity>/tags/{tagId}, idempotent on 404
    (alreadyDeleted), invalidates the list_tags cache, explicit
    confirm guard for direct callers (mirrors defineDelete).
  - `delete_` prefix auto-applies destructiveHint via inferAnnotations
    — no register-tool.ts change needed.
  - Distinct from remove_tag_by_id (DETACH from one record); this
    removes the definition from every record that shared it.

Catalog 87 → 88 tools; destructive-hinted 7 → 8. 529 → 536 tests
(+7). Bundle 167.37 KB stdio / 195.24 KB http. Tool-count + bundle
figures synced across README / DEPLOY / DESIGN / HOWTO /
bundle-shape canary. scripts/wire-trace-v167.ts committed for
re-runnability.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@arapov arapov merged commit cc5dbef into master May 29, 2026
1 check passed
@arapov arapov deleted the feat/delete-tag-definition branch May 29, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant