Skip to content

feat: session metadata on create/update/read - #544

Merged
sr07asthana merged 11 commits into
mainfrom
sr-add-metadata-session
Sep 2, 2026
Merged

feat: session metadata on create/update/read#544
sr07asthana merged 11 commits into
mainfrom
sr-add-metadata-session

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Adds a required API field and DB migrations (including a SQLite session table rebuild); behavior is additive for clients that ignore unknown fields but breaking for strict SDK consumers expecting the old session shape.

Overview
Adds caller-owned session metadata as a string map (Record<string, string>) separate from existing session custom, with validation aligned to gateway header limits (keys 1–32 chars, values ≤128, at most 50 keys).

API & core: Optional metadata on create and PATCH; metadata is required on session responses. PATCH uses full replace when metadata is sent ({} clears); omitted fields leave the map unchanged. Sessions.create defaults missing metadata to {}; SessionHandle exposes a metadata getter.

Persistence: New session.metadata JSON column (Postgres jsonb with default {}; SQLite table rebuild). Postgres and SQLite session stores read/write and validate metadata on load; in-memory store matches the same contract.

SDK/OpenAPI: SessionMetadata type and wire serialization updates across generated SDK and OpenAPI specs.

Reviewed by Cursor Bugbot for commit e539158. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e539158

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@truefoundry/trueforge Patch
@truefoundry/trueforge-core Patch
@truefoundry/trueforge-sdk Patch
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c6aa107. Configure here.

Comment thread packages/trueforge/src/schemas/session.ts Outdated

@heerambavi1998 heerambavi1998 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please confirm the expected behaviour on PUT requests where metadata is not sent.

@sr07asthana
sr07asthana merged commit b654052 into main Sep 2, 2026
10 checks passed
@sr07asthana
sr07asthana deleted the sr-add-metadata-session branch September 2, 2026 10:00
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