Tighten NameSchema to hyphen-only 2–64 and migrate legacy ./_ names - #536
Tighten NameSchema to hyphen-only 2–64 and migrate legacy ./_ names#536bhaveshpatel640 wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: ab5cf4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
22b6e2a to
5229921
Compare
a62baaa to
8b89256
Compare
ccc20d0 to
c381c0a
Compare
91598c9 to
a0c3c76
Compare
b442af5 to
1081bee
Compare
8bd15a3 to
d1879c2
Compare
9927e2b to
a569517
Compare
ae2ac25 to
50d82db
Compare
b9f437a to
561a438
Compare
6f9428d to
a964381
Compare
8cd8b58 to
ab9ec81
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 83940f2. Configure here.
5e580ff to
975885d
Compare
77b41c1 to
63133da
Compare
| for (const row of providerRows.rows) { | ||
| const providerTo = planHyphenOnlyName(row.name) ?? row.name; | ||
| if (providerTo !== row.name) { | ||
| providerRenames.push({ tenant_id: row.tenant_id, from: row.name, to: providerTo }); |
There was a problem hiding this comment.
can we do this after 286 check.
|
Current version of PR was reviewed by /review-bugbot with additional instructions on Sep 11, 16:31 GMT+5:30. It flagged 1 finding. Show 1 finding1. Provider rename map without row update
In the model-provider loop, a provider rename is appended to Bugbot on commit |

Summary
Align TrueForge shared
NameSchema(ResourceName) with ServiceFoundry agent-identity / RemoteAgentV2: hyphen-only, 2–64 (^[a-z][a-z0-9-]{0,62}[a-z0-9]$).One schema for local resource names (agents, skills, MCP servers, models, schedules). Postgres + SQLite migration rewrites legacy local names that used
./_.Closes AGE-2065
Why
PUT /internal/tfg/agents/ agent-identity (source=trueforge).ResourceNameallowed./_; that breaks SVC sync and diverges from RemoteAgentV2.NameSchemaover a separateAgentNameSchemaso standalone create/list/update stay consistent after migrate.Changes
Schema
NameSchemainpackages/trueforge/src/schemas/common.tsto hyphen-only 2–64.ResourceName(CI regenerates OpenAPI + SDK; no hand-edits).NameSchema.API / validation impact
NameSchemareject names with.or_(e.g.my.agent,my_agent).tfg,trueforge) unchanged.TrueFoundry mode
NameSchema(must satisfy SVC identity).NameSchema-checked on those paths (FQNs / longer SVC MCP names OK).NameSchema.Standalone mode
NameSchema.Migration (
20260911_000001_name_hyphen_only)planHyphenOnlyRenames.tsapplyNameHyphenOnlyMigration.ts./_)./_→-, always append-<4 hex>; truncate to ≤ 64agent.name+ denormsession.agent_name/schedule.agent_nameskill.namemcp_server.name(+ manifest.name)model_provider.name(+ nestedmodels[].name, custom manifest.name)schedule.namedownthrows); originals not retained; no occupancy / collision check on suffixTests
nameSchema.test.ts— accept/reject matrixplanHyphenOnlyRenames.test.ts— rename + FQN skip + AgentSpec rewrite mapsagents.test.ts— API rejectsmy.agent/my_agenttrueFoundryNaming.test.ts— TFY runtime: agent name still NameSchema; skill FQN / long MCP / model FQN work on create/update, stores, mappers; OpenAPI MCP schemas may still be stricter than runtime (documented)Release
@truefoundry/trueforge@truefoundry/trueforge-sdkregenerate in CI after merge (do not hand-edit)Out of scope / known skew
TrueFoundryAgentManifest(3–32, no--) is not the TF ensure path; TF aligns to agent-identity (2–64).NameSchema; some OpenAPI MCP types still declareResourceName— runtime path does not re-parse those schemas today../_local names must switch to post-migration names.How was this tested?
nameSchema,planHyphenOnlyRenames,trueFoundryNaming, agents API reject casespnpm test(as needed before merge)pnpm smoke/ migrate against a DB that still has legacy./_names (recommended)Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
High Risk
Irreversible multi-table data migration renames user resources and embedded references; API validation breaks clients still using
./_local names.Overview
ResourceName /
NameSchemanow allows only lowercase letters, digits, and hyphens (2–64 chars), aligned with ServiceFoundry agent identity. Dotted and underscored local names are rejected on create/update; OpenAPIResourceNamepattern matches.A one-time, irreversible Postgres/SQLite migration renames existing local rows whose names still used
.or_: providers (including nested model names), skills, MCP servers, schedules, and agents, then fixessession/scheduleagent_name and model / MCP / skill refs inside agent and session JSON. Renames hyphenate, append a short random suffix, and skip FQNs and names already compliant.Tests cover schema rules, rename planning, SQLite migration integrity, agent API rejection, and TrueFoundry mode where agent names stay strict while manifest refs can remain FQNs or long SVC names.
Reviewed by Cursor Bugbot for commit 2d7604c. Bugbot is set up for automated code reviews on this repo. Configure here.