Repository navigation
Commit 65145d3
refactor(core)!: ResolveLocalizationInput takes organizationId; the tenantId key is retired (#26078)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XUMfNCBcFEpzSy2vfiLtxwL)_
Fixes #25555
Clause-②: no (narrowing)
Metadata-protocol: none
## What changes
`ResolveLocalizationInput.tenantId` (`@objectstack/core`) is renamed
`organizationId`. The rename is immediate: there is no alias and no dual
spelling. The key always meant the organization id: the settings service
stores `localization` under the organization (ADR-0131 D8), and the
direct `sys_setting` fallback reads that organization's rows. An
environment id passed under the old name type-checked, matched no
organization, and resolved every non-UTC organization as `UTC`. Under
the new name the mistake cannot be spelled. The old key is an
excess-property error at every object-literal call, and the resolver
reads no alias at run time.
- `packages/core/src/security/resolve-authz-context.ts`: the interface
key, with a doc comment saying it takes an organization id and never an
environment id. The two internal readers (the cached entry point and the
uncached resolve) and `localizationFallbackReach` read `organizationId`.
The cache-key docs follow the rename.
- The four in-repo callers are migrated:
`core/security/request-execution-context.ts`, `mcp/src/plugin.ts`,
`plugin-audit/src/audit-plugin.ts` and
`plugin-hono-server/src/current-user-endpoints.ts`. A re-grep of
`origin/main` at `bbf70614` (including `ui/`) found no others. hotcrm
has none either.
- The core localization tests are migrated: 100 call sites across 4
files, all mechanical key renames.
- New pin
`packages/core/src/security/resolve-localization-organization-id.pin.test.ts`
has two halves:
- Type: a `@ts-expect-error` on `tenantId`. `tsconfig.test.json`
compiles this file, and the reverse check below shows it is live.
- Runtime: the organization's timezone resolves through `organizationId`
on both legs, the settings service and the direct fallback. A `tenantId`
smuggled past the compiler reaches neither leg and resolves `UTC`.
- A changeset: patch for core, mcp, plugin-audit and plugin-hono-server,
with a BREAKING banner, the FROM / TO line, and ADR-0087 `not-required
(runtime-export-retired
@objectstack/core#ResolveLocalizationInput.tenantId)`. The gate verifies
it.
## Not moved
The settings service's own scope argument, `{ tenantId, userId }` on
`get` / `getMany`, keeps its spelling. It is a separate public surface
with its own callers across services, and renaming it is outside this
card's acceptance, which is about the localization input. The resolver
passes the organization id there unchanged, and the new pin asserts the
scope it receives.
## External caller
objectstack-ai/cloud is the named external caller: cloud#3150 repaired
its three AI entry points. This session cannot read that repository, so
its `@objectstack/core` pin is NOT MEASURED. The card says the callers
pass an object literal. If that holds, the rename turns red at cloud's
next core bump as a TS2353 excess-property error, and the fix is one key
per call site. It does not fail silently. A non-literal call would drop
the key without an error, so the changeset tells callers to grep for
`tenantId` beside `resolveLocalizationContext`.
## Verification (head `bcf5c8adf`; source change at `4c667539`)
- `pnpm --filter PKG typecheck` exit 0 for core, mcp, plugin-audit and
plugin-hono-server. This includes core's test layer:
`check:test-typecheck` OK, ledger unchanged at 4 files / 4 errors.
- `pnpm --filter PKG test` exit 0: core 120 files / 2772 tests, mcp 43 /
538, plugin-audit 60 / 993, plugin-hono-server 35 / 448.
- Reverse check of the type pin: with `tenantId?: string` added back to
the interface (`git hash-object` of the restored file equals the HEAD
blob), `check-test-typecheck` exits 1. It names exactly the new pin file
with 1 error, the unused `@ts-expect-error`.
- `eslint --no-inline-config` over the four packages' `src`: exit 0.
- `node scripts/check-platform-checklist.mjs --changed-from
origin/main`: OK, 8 anchors judged, 0 lost.
- Derived gates (`dispatch-gates.mjs --commands`, 76 commands): the
non-zero exits are listed in the report on the card.
`check:objectql-double-limit` caught the first version of the pin's
engine double, which is fixed in `bcf5c8adf`. `check:dts-closure` and
`check:dual-build-cjs-loads` need a full build and are NOT MEASURED
locally; CI runs both.
- Full dogfood battery (owed by the narrowing arm): result is in the
report on the card.
## Acceptance notes
- The card's acceptance: the name states it takes an organization id; an
environment-shaped value cannot be spelled under the old key; in-repo
callers are migrated; the changeset declares both lines.
---
_Generated by [Claude
Code](https://claude.ai/code/session_014xf92fjdDKjycyVbyxMKm8)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b50f5cf commit 65145d3
11 files changed
Lines changed: 267 additions & 116 deletions
File tree
- .changeset
- packages
- core/src/security
- mcp/src
- plugins
- plugin-audit/src
- plugin-hono-server/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
455 | | - | |
| 454 | + | |
| 455 | + | |
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
466 | 466 | | |
467 | 467 | | |
468 | | - | |
| 468 | + | |
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
479 | | - | |
| 478 | + | |
| 479 | + | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
| 482 | + | |
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
490 | | - | |
| 489 | + | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
| 510 | + | |
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
| 515 | + | |
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
| 528 | + | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
| 618 | + | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
633 | | - | |
| 633 | + | |
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
| 655 | + | |
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
| 664 | + | |
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
687 | | - | |
| 687 | + | |
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
| 695 | + | |
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
708 | | - | |
| 708 | + | |
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | | - | |
| 712 | + | |
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
| 719 | + | |
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| |||
0 commit comments