Skip to content

feat(metadata): optional name display-title Upload-Metadata key - #56

Merged
morepriyam merged 4 commits into
mieweb:mainfrom
jlocala1:feat/artifact-name-metadata
Jul 29, 2026
Merged

feat(metadata): optional name display-title Upload-Metadata key#56
morepriyam merged 4 commits into
mieweb:mainfrom
jlocala1:feat/artifact-name-metadata

Conversation

@jlocala1

Copy link
Copy Markdown
Contributor

Add an optional name display-title to Upload-Metadata

Carries a free-form, human-facing artifact title (e.g. the draft name typed on the capture device) from create → sidecar → consumer, so a downstream service can label an artifact instead of inventing a title from the opaque artifactId.

What

  • Parse a name Upload-Metadata key; trim + hard-cap at 512 server-side; drop empty/whitespace to no-name.
  • Thread it through ReserveUploadParams; persist in the local and S3 sidecars alongside relatedTo/checksum.
  • Expose via a new optional getName storage method (both adapters).

Docs

  • PROTOCOL.md §4.1 metadata table + a note that free-form values must be UTF-8 base64 (a browser btoa() alone corrupts accents/emoji).
  • README metadata table + sidecar layout; CHANGELOG entry under [Unreleased] → Added.

Tests

Round-trip to sidecar + getName; UTF-8 fidelity (accents/emoji); absent and whitespace-only → no name; length cap; unknown id. npm test117/117 green.

Compatibility

Optional everywhere — clients that don't send name and consumers that don't read it are unaffected. A non-normative extension per PROTOCOL.md §9; no protocolVersion bump.

Carry a free-form, human-facing artifact title (e.g. the draft name typed
on the capture device) from create -> sidecar -> consumer, so a downstream
service can label an artifact instead of inventing a title from the opaque
artifactId.

- Parse `name` from Upload-Metadata; trim + hard-cap (512) server-side,
  drop empty/whitespace to no-name.
- Thread through ReserveUploadParams; persist in both the local and S3
  sidecars alongside relatedTo/checksum.
- Expose via a new optional `getName` storage method (both adapters).
- Docs: PROTOCOL.md 4.1 (+ UTF-8 base64 note), README metadata table +
  sidecar layout, CHANGELOG.
- Tests: round-trip, UTF-8 fidelity, absent/whitespace -> no name, length
  cap, unknown id.

Optional everywhere -- old clients that don't send it and consumers that
don't read it are unaffected (PROTOCOL 9 non-normative extension).
@jlocala1
jlocala1 force-pushed the feat/artifact-name-metadata branch from b1497a8 to 982de79 Compare July 28, 2026 19:37
jlocala1 added 2 commits July 28, 2026 15:47
Read the new Upload-Metadata.name off the sidecar (`sidecar.name ?? null`)
so the reference demo shows the display title, not just persists it — and
documents how a consumer reads the field. Free-form/client-supplied, so the
comment notes a UI must escape it.
Publishable version carrying the optional `name` Upload-Metadata field, so
downstream consumers (PulseClip) can pin `@mieweb/pulsevault@0.1.2` once this
lands and is published.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for an optional human-facing artifact display title via the TUS Upload-Metadata.name key, threading it through the upload reservation path into sidecar metadata and exposing it via a new optional storage accessor.

Changes:

  • Parse and normalize Upload-Metadata.name server-side (trim + cap) and pass it through ReserveUploadParams.
  • Persist name in both local and S3 sidecars and expose it via storage.getName(artifactId).
  • Add tests and documentation updates describing the new metadata key and sidecar shape.

Reviewed changes

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

Show a summary per file
File Description
test/helpers.mjs Extends TUS test helpers to send name in Upload-Metadata.
test/artifact-name.test.mjs New test suite covering name round-trip, trimming/cap, UTF-8, and null behavior.
src/storage/types.ts Adds ReserveUploadParams.name and optional PulseVaultStorage.getName.
src/storage/local.ts Stores/loads/caches name in the local sidecar and implements getName.
src/storage/s3.ts Stores/loads/caches name in the S3 sidecar and implements getName.
src/lib/pulsevaultTus.ts Parses name from upload metadata and passes it into reserveUpload.
README.md Documents the new name metadata key and local sidecar layout update.
PROTOCOL.md Documents name as an Upload-Metadata key in the protocol table.
examples/fastify-demo/server.mjs Surfaces sidecar name in the demo “videos” listing output.
CHANGELOG.md Adds an entry describing the new name metadata feature.
package.json Bumps package version to 0.1.2.
package-lock.json Updates lockfile version fields to 0.1.2.

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

Comment thread src/lib/pulsevaultTus.ts Outdated
Comment thread PROTOCOL.md
Comment thread README.md
…Name

- Cap the `name` metadata by Unicode code point (Array.from) instead of
  UTF-16 units, so truncating at the 512 boundary can't split a surrogate
  pair into a lone half. Adds a boundary-emoji regression test.
- PROTOCOL.md: note that a free-form metadata value (name) must be base64 of
  its UTF-8 bytes, not a Latin-1 btoa.
- README.md: list getName/name in the local + S3 adapter method summaries,
  the S3 sidecar layout, and the custom-adapter example.
@morepriyam
morepriyam merged commit b7afa79 into mieweb:main Jul 29, 2026
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.

3 participants