Repository navigation
Commit 1d19acf
fix(objectql): withhold a disabled extender's rules from the packaged object base (#38622)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9St4eUWHFcCKuRUrCZPperJ)_
Fixes #34217
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:启用的扩展包里的校验规则提示,在中文等非默认语言下重新显示译文;停用包的同名规则不再顶替它。
- 为什么做:「停用就该全部消失」的延续——此前字段已修,这次补上校验规则这一半。
- 出错会怎样:最坏是某条规则提示退回源语言显示,不影响数据与校验本身;直接回滚这次改动即可。
- 要你做什么:无。
## What changes
- `getPackagedObjectBase`
(`packages/objectql/src/registry-platform-global.ts`) now drops a
disabled package's `extend` contributors ONCE, before every widening
read: the `extended` test, `packagedRules`, the added fields and the
placed tabs. Before, only the added fields and the tabs filtered
`isPackageDisabled`, so the rule half still merged a disabled later
extender's same-name rule over the enabled one, while the served fold
withholds it. The added-fields and tabs reads are byte-for-byte the same
filter as before, now applied at one place.
- The `getPackagedObjectBase` docblock in
`packages/objectql/src/registry.ts` said the rule half "still reads
every code extender, disabled ones included"; that sentence became false
with this change and is rewritten (same line count, the facade's).
- `packagedRules` itself is untouched: it stays a pure function of the
caller's list, as `packagedAddedFields` is.
- Pin: a new top-level `describe` in
`packages/rest/src/meta-object-field-patch-i18n.test.ts`, beside the
disabled added-field case it mirrors (same real `SchemaRegistry`
harness). The rule-side file the card names
(`meta-object-validation-message-i18n.test.ts`) mocks the protocol and
has no registry, so it cannot hold this pin.
## Tests
- New case: an enabled extender (priority 200) and a later disabled one
(priority 300) ship a rule `needs_title`. Asserts the served rule
message, the packaged base's rule message (both the enabled one's), and
that the zh-CN item read translates it.
- Red before the fix, on the built dist at `5e8988fc` (pin committed,
fix not): `AssertionError: expected [ 'Disabled says.' ] to deeply equal
[ 'A task needs a title.' ]`, `Tests 1 failed | 18 passed (19)`. Green
after the fix plus a rebuild of objectql: `Test Files 2 passed (2)`,
`Tests 22 passed (22)` (with the validation-message file alongside).
- `@objectstack/objectql`: `typecheck` exit 0, full `vitest run` `Test
Files 641 passed (641)`, `Tests 14544 passed (14544)`.
`@objectstack/rest`: `typecheck` exit 0.
## Acceptance notes
- `tenantRuleCopyRefusal` (`registry-object-registration.ts`) reads
`packagedRules` over the raw contributor list too, and shares the
defect: measured on the built dist (same shape as the pin, rule `r1`), a
tenant copy of the SERVED rule changing only its `message` is refused
(`INVALID_METADATA`, "this copy changes `condition`"), and a copy
carrying the disabled rule's condition is accepted. Not fixed here: the
same filter would also stop reserving a rule name only the disabled
package ships, so a tenant could save a rule of that name with its own
condition while the package is off. That is a behaviour change the card
does not rule on; it is reported to the seat as a separate finding.
- `reportChangedRuleCopies` is called with the contributors of the fold
it runs in. The served folds pass
`withholdDisabledExtensions(...).kept`; the storage fold
(`resolveStorageObject`) folds every contributor, disabled ones
included, and its rule judgment matches the rules that fold merges. Not
touched.
- The refused-write side (`engine-validation-messages`'
`packagedRuleLookup`) reads the same base, so it follows the fix. Read
in the code, not measured with its own test.
## Verification
Read first: `packages/objectql/src/registry-platform-global.ts` (the
`contributors` filter at the top of `getPackagedObjectBase`), then the
new `describe` at the end of the test file.
Two-minute check: `pnpm --filter @objectstack/rest exec vitest run
--maxWorkers=2 src/meta-object-field-patch-i18n.test.ts` after building
objectql. Expected: `Tests 19 passed (19)`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE)_
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmRar3Kkg6SpwVgaaVE -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent eec2bc3 commit 1d19acf
4 files changed
Lines changed: 61 additions & 10 deletions
File tree
- .changeset
- packages
- objectql/src
- rest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
529 | 533 | | |
530 | 534 | | |
531 | 535 | | |
532 | 536 | | |
533 | 537 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 538 | + | |
540 | 539 | | |
541 | 540 | | |
542 | 541 | | |
543 | 542 | | |
544 | 543 | | |
545 | | - | |
| 544 | + | |
546 | 545 | | |
547 | 546 | | |
548 | 547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3660 | 3660 | | |
3661 | 3661 | | |
3662 | 3662 | | |
3663 | | - | |
3664 | | - | |
| 3663 | + | |
| 3664 | + | |
3665 | 3665 | | |
3666 | 3666 | | |
3667 | 3667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
0 commit comments