Skip to content

feat: add created_by_subject in db in place of created_by - #568

Merged
thesujai merged 11 commits into
mainfrom
feat/created-by-field
Sep 3, 2026
Merged

thesujai merged 11 commits into
mainfrom
feat/created-by-field

Conversation

@thesujai

@thesujai thesujai commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

feat: add created_by_subject in db in place of created_by

Closes AGE-2067

Changes

[-](feat: add created_by_subject in db in place of created_by)

How was this tested?

With APIs, no UI testing was performed

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

High Risk
Breaking public API and DB schema with a data migration; creator-based authorization and list scoping must stay correct or resources become inaccessible or over-exposed.

Overview
Breaking change: API and persistence now expose a required created_by_subject object (subject_id, subject_type, subject_display_name) instead of string created_by on agents, sessions, and schedules, and instead of triggered_by on schedule runs. Agents also gain created_by_subject on list/create responses.

Ownership, session listing, schedule scoping, and metrics filters now key off created_by_subject.subject_id (with createdBySubjectFromRequestContext stamping rows at create time). OpenAPI, trueforge-core schemas/stores, Postgres/SQLite stores, and the generated SDK are aligned; the UI schedule adapter maps the new field into the existing “triggered by” display.

A Postgres migration backfills JSON from legacy columns, drops created_by / triggered_by, and adds (tenant_id, created_by_subject->>'subject_id') indexes. Changeset marks @truefoundry/trueforge-core and @truefoundry/trueforge as major.

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

@changeset-bot

changeset-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2205263

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

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Major
@truefoundry/trueforge Major

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

@thesujai
thesujai force-pushed the feat/request-context branch from 2d106c3 to e6df9b3 Compare September 3, 2026 05:51
Comment thread packages/trueforge/src/auth/identity.ts Resolved
Comment thread packages/trueforge/src/auth/identity.ts Resolved
@thesujai
thesujai force-pushed the feat/created-by-field branch from 17b89b5 to d65eb70 Compare September 3, 2026 06:02
@thesujai
thesujai force-pushed the feat/request-context branch from c34c21d to e593de8 Compare September 3, 2026 09:52
Base automatically changed from feat/request-context to main September 3, 2026 09:58
@thesujai
thesujai force-pushed the feat/created-by-field branch from d65eb70 to cd75e71 Compare September 3, 2026 10:28
…cing created_by fields with JSONB structure across agent, session, schedule, and schedule_run tables for improved data integrity and indexing

@chiragjn chiragjn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving with comments

thesujai and others added 3 commits September 3, 2026 18:42
…on logic for agent, session, schedule, and schedule_run tables
…ent, session, schedule, and schedule_run tables, ensuring consistent handling and improved transaction management
thesujai and others added 2 commits September 3, 2026 19:32
… session, schedule, and schedule_run tables, enhancing backfill strategy and ensuring consistent handling of JSONB data
@thesujai
thesujai enabled auto-merge (squash) September 3, 2026 16:18

@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 2205263. Configure here.

Comment thread .changeset/created-by-subject-json.md Resolved
@thesujai
thesujai disabled auto-merge September 3, 2026 16:34
@thesujai
thesujai merged commit 9bfcdaa into main Sep 3, 2026
12 checks passed
@thesujai
thesujai deleted the feat/created-by-field branch September 3, 2026 16:34
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