Skip to content

Support attachmentRecordId in association references - #125

Merged
cuibonobo merged 1 commit into
mainfrom
claude/adoring-hawking-9qvdyl
Sep 13, 2026
Merged

cuibonobo merged 1 commit into
mainfrom
claude/adoring-hawking-9qvdyl

Conversation

@cuibonobo

Copy link
Copy Markdown
Member

Summary

Adds support for an optional attachmentRecordId field in attachment associations. When multiple records share the same fileId, each can now reference the specific _attachment record whose upload established that reference, preserving the original uploader's filename context.

Changes include:

  • New test cases for associating and dissociating attachments with attachmentRecordId
  • Refactored firstRecordedAttachment to resolveReferencedAttachment with optional requester context for smarter filename resolution
  • Updated attachment download logic to use the new resolution function, falling back through requester's own uploads then first-recorded record
  • Updated dependencies to support the new wire contract

Docs

Updated docs/api.md to document the optional attachmentRecordId field in attachment associations and its use case for multi-record file sharing scenarios.

Verification

  • Added two new conformance tests: associate-attachment-record-id and dissociate-attachment-by-identity
  • Tests verify that attachmentRecordId is stored and retrieved correctly
  • Tests confirm that dissociation by identity (without attachmentRecordId) still matches and removes associations
  • Existing attachment and association tests continue to pass

Notes for reviewers

The attachmentRecordId is optional and travels verbatim in both directions—it annotates the reference rather than identifying it. Dissociation uses identity matching on (kind, label, fileId) regardless of whether attachmentRecordId is present, allowing flexible cleanup. The filename resolution logic now prefers the requester's own upload context when available, improving the download experience in multi-user scenarios.

https://claude.ai/code/session_01PmN3empkUtEnouGuDdCatb

Bumps @haverstack/core to 0.32.0 (and the lockstep wire-types,
adapter-local, commons, conformance-fixtures releases) for the new
optional attachmentRecordId pointer on attachment associations, which
names the _attachment record whose upload established a given
reference so shared bytes can resolve a per-reference filename.

POST/DELETE /records/:id/associations already pass Association bodies
through generically, so the field round-trips with no route change.
GET /attachments/:fileId now resolves its own-record/first-record
filename fallback via core's new resolveReferencedAttachment() instead
of reimplementing that order by hand.

Adds conformance coverage for the two new fixtures this release
introduces (associate-attachment-record-id,
dissociate-attachment-by-identity) and documents the field in
docs/api.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PmN3empkUtEnouGuDdCatb
@cuibonobo
cuibonobo merged commit 181a957 into main Sep 13, 2026
8 checks passed
@cuibonobo
cuibonobo deleted the claude/adoring-hawking-9qvdyl branch September 13, 2026 19:01
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.

2 participants