refactor(api)!: rename organization to team - #9
Conversation
A requirement change renamed the tenant-scoping concept: what the gateway called an organization is now a team, and it expects the `x-oo-team-name` header in place of `x-oo-organization-name`. The client follows — `ClientConfig.team`, `CallOptions.team`, and the `ScopeOptions` pick rename with it. No deprecated `organization` alias. The package is pre-1.0 and the old header no longer exists on the gateway, so keeping the field callable would only let callers send a selector the backend never reads — a silent wrong-tenant bug where a type error is far kinder. While here, pin the `team` propagation in `#sourceConfig()` with a test. `using()` never folds the client-level default into the merged scope, so a scope omitting `team` depends on that line to reach `#resolveCall` — yet deleting it left all 181 tests green, and every `ClientConfig` field being optional puts it out of `tsc`'s reach too. It silently drops the header on scoped sub-clients. Also drops a stray `précise` from the French README's code comment, where it was neither English nor French. BREAKING CHANGE: the `organization` option is now `team` on `ClientConfig`, `CallOptions`, and `using()` scopes, and the wire header is `x-oo-team-name`. Rename the field at every call site; there is no compatibility alias. Signed-off-by: Kevin Cui <bh@bugs.cc>
Summary by CodeRabbit
WalkthroughThe SDK replaces the Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
examples/scoping-and-options.ts (1)
12-12: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse distinct team values to demonstrate precedence.
All three layers use
"acme", so the example cannot show whether per-callteamoverridesusing(), or whetherusing()overrides the client default.Proposed example values
- team: "acme", + team: "client-team", - const work = oomol.using({ connectionName: "work", team: "acme" }); + const work = oomol.using({ connectionName: "work", team: "scoped-team" }); - team: "acme", + team: "call-team",Also applies to: 21-23, 25-30
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/scoping-and-options.ts` at line 12, Update the team values in the scoping example so the client default, using() scope, and per-call options each use distinct values, allowing precedence to be observed. Apply the change to the related team declarations and calls in the example while preserving the existing scoping structure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Line 107: Align the precedence statement in README.md:107-107,
docs/README/README.fr.md:107-107, docs/README/README.ja.md:107-107,
docs/README/README.ru.md:107-107, docs/README/README.zh-CN.md:107-107, and
docs/README/README.zh-TW.md:107-107 so each translation identifies team and
connectionName as the only using() scope fields, while signal, timeoutMs, and
retries are per-call-only options that override client defaults.
---
Nitpick comments:
In `@examples/scoping-and-options.ts`:
- Line 12: Update the team values in the scoping example so the client default,
using() scope, and per-call options each use distinct values, allowing
precedence to be observed. Apply the change to the related team declarations and
calls in the example while preserving the existing scoping structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 719cd366-cc0e-4b19-89d4-8c3cca5f6ec1
📒 Files selected for processing (20)
README.mddocs/README/README.fr.mddocs/README/README.ja.mddocs/README/README.ru.mddocs/README/README.zh-CN.mddocs/README/README.zh-TW.mdexamples/scoping-and-options.tsfixtures/consumer/no-b/index.test-d.tsfixtures/consumer/partial-b/index.test-d.tsfixtures/consumer/with-b/index.test-d.tsfixtures/resolution/consumer.tssrc/connector.tssrc/open.tssrc/project.tssrc/registry.tssrc/types.tstest/apps.test.tstest/project.test.tstest/selectors.test.tstest/transport.test.ts
| - **`connectionName`** — *which* stored credential to use when you have more than one connection for a provider. | ||
|
|
||
| Per-call options (`organization`, `connectionName`, `signal`, `timeoutMs`, `retries`) override a `using()` scope, which overrides client defaults: | ||
| Per-call options (`team`, `connectionName`, `signal`, `timeoutMs`, `retries`) override a `using()` scope, which overrides client defaults: |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align the precedence text across all README translations.
using() scopes contain only team and connectionName; signal, timeoutMs, and retries are per-call-only options. Update each translation to distinguish scopeable fields from options that override only client defaults.
README.md#L107-L107: Documentteam/connectionNameas theusing()fields and the remaining options as per-call-only.docs/README/README.fr.md#L107-L107: Apply the same distinction in French.docs/README/README.ja.md#L107-L107: Apply the same distinction in Japanese.docs/README/README.ru.md#L107-L107: Apply the same distinction in Russian.docs/README/README.zh-CN.md#L107-L107: Apply the same distinction in Simplified Chinese.docs/README/README.zh-TW.md#L107-L107: Apply the same distinction in Traditional Chinese.
📍 Affects 6 files
README.md#L107-L107(this comment)docs/README/README.fr.md#L107-L107docs/README/README.ja.md#L107-L107docs/README/README.ru.md#L107-L107docs/README/README.zh-CN.md#L107-L107docs/README/README.zh-TW.md#L107-L107
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` at line 107, Align the precedence statement in README.md:107-107,
docs/README/README.fr.md:107-107, docs/README/README.ja.md:107-107,
docs/README/README.ru.md:107-107, docs/README/README.zh-CN.md:107-107, and
docs/README/README.zh-TW.md:107-107 so each translation identifies team and
connectionName as the only using() scope fields, while signal, timeoutMs, and
retries are per-call-only options that override client defaults.
A requirement change renamed the tenant-scoping concept: what the gateway called an organization is now a team, and it expects the
x-oo-team-nameheader in place ofx-oo-organization-name. The client follows —ClientConfig.team,CallOptions.team, and theScopeOptionspick rename with it.No deprecated
organizationalias. The package is pre-1.0 and the old header no longer exists on the gateway, so keeping the field callable would only let callers send a selector the backend never reads — a silent wrong-tenant bug where a type error is far kinder.While here, pin the
teampropagation in#sourceConfig()with a test.using()never folds the client-level default into the merged scope, so a scope omittingteamdepends on that line to reach#resolveCall— yet deleting it left all 181 tests green, and everyClientConfigfield being optional puts it out oftsc's reach too. It silently drops the header on scoped sub-clients.Also drops a stray
précisefrom the French README's code comment, where it was neither English nor French.BREAKING CHANGE: the
organizationoption is nowteamonClientConfig,CallOptions, andusing()scopes, and the wire header isx-oo-team-name. Rename the field at every call site; there is no compatibility alias.