Repository navigation
Commit a0e2d77
test(app-shell): pin Setup's SSO provider edit actions through the generic action form (#32370)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBXHkgowpKDfaVB6mkWcCXPt)_
Fixes #32185
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:只加测试。在共享的 action-runtime 测试夹具
`useConsoleActionRuntime.createUserRequiredField-28289.test.tsx` 里新增两个顶层
describe(8 个用例),钉住 Setup → SSO Providers 的「Edit SAML Settings」「Edit OIDC
Settings」走通用参数表单时的行为;夹具的 `useObjectLabel` 替身补了 `actionResultDialog`
透传。没有改产品代码。
- 为什么改:#32185 第 1 项约定,若通用表单能正确渲染这些字段,本卡只做一次实测。真实 showcase
实测(截图见下表)显示通用表单全部达标:证书是多行 textarea、粘贴的 PEM 逐字节(含换行)提交;Client Secret 是空的
password 输入、留空不提交;providerId/issuer 取自行;两类拒绝与结果弹窗都能读懂。因此无需专用表单。
- 风险与回滚:仅测试文件,零运行时影响;回滚即 revert。
- 先看:测试文件末尾 `objectstack#32185 item 1` 两个 describe;下方「实测表」。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/hooks/__tests__/useConsoleActionRuntime.createUserRequiredField-28289.test.tsx`,预期
22 passed。
- 需要你做的:无,席位落地。本 PR 关闭 #32185(第 2 项已由 #32235 落地,第 1 项是最后一项)。
## What changes
Two new top-level `describe` blocks in the shared action-runtime harness
(AGENTS.md: a new pin for a component with a shared harness file goes
into that file, ruling record 6583487846). They drive the declared
`edit_saml_provider` / `edit_oidc_provider` params (restated from
`packages/platform-objects/src/identity/sys-sso-provider.object.ts`,
help texts trimmed) through a real `ActionRunner`, the console runtime's
api, param and result-dialog handlers and the real `ActionParamDialog`,
with the door as the mocked authenticated fetch answering what
`runUpdateSsoProviderFromForm`
(`packages/plugins/plugin-auth/src/register-sso-provider.ts`) answers:
- SAML: the certificate input is a `TEXTAREA`; a PEM with line breaks
posts unchanged; `providerId` and `issuer` default from the row; a blank
`entryPoint` posts nothing; `keepCurrentCert` is not sent as on when
left alone; the result dialog shows the bridge's "updated: cert." line;
the linked-user `409` stays in the dialog's refusal box.
- OIDC: the client secret is an empty `type="password"` input; blank
secret, client id and scopes post nothing; a typed secret posts once and
never appears in the result dialog; the wrong-protocol `400` stays in
the dialog's refusal box.
The harness's `useObjectLabel` double gains `actionResultDialog: (_o,
_a, spec) => spec` so the runtime's result-dialog handler can run; the
existing cases do not call it.
No renderer change: no gap was measured, so there is no red-on-main leg
to show.
## Live check
Showcase boot at `e883c71f` with `OS_SSO_ENABLED=true` (`objectstack dev
--seed-admin`), console from `ui/apps/console` vite. Both providers were
registered through Setup's own Register forms (SAML with an `openssl`
self-signed cert; OIDC against a local discovery stub). Screenshots are
in the project files under `ui-orders/32185-item1/`.
| Check | Seen | Verdict | Shot |
|:--|:--|:--|:--|
| Certificate input is multi-line | `<textarea id="cert">`, empty on
open | fine | `10-edit-saml-open.png` |
| Pasted PEM posts byte-for-byte | action body `params.cert` equals the
PEM file exactly, 19 line breaks both sides; stored `samlConfig.cert`
equals it (bridge trims only the outer newline) | fine |
`11-edit-saml-pem-pasted.png`, `12-edit-saml-result.png` |
| Keep trusting current cert | checkbox posts `keepCurrentCert: true`;
stored `cert` becomes a 2-item list | fine | `13-…`,
`14-edit-saml-keep-current-result.png` |
| Client secret | `<input type="password" autocomplete="new-password">`,
empty on open and after a secret change; posted only when typed | fine |
`20-edit-oidc-open.png`, `23-edit-oidc-reopen.png` |
| Blank fields keep stored values | all-blank OIDC posts `{providerId}`
only and gets the bridge's "Nothing to change" sentence in the dialog;
after a secret-only and a scopes-only edit, stored `clientId` and SAML
`entryPoint` are unchanged; a field typed then cleared posts `""`, which
the bridge reads as keep | fine | `21-edit-oidc-all-blank.png`,
`52-oidc-header-scopes-result.png` |
| `providerId` / `issuer` default from row | both prefilled from the row
on row and record-header launches | fine | `10-…`, `20-…` |
| Identity change while users linked | `409` relayed: dialog stays open,
box leads with "…Cannot change SSO provider identity fields while linked
accounts exist." and keeps the bridge's hint behind **More**; the toast
shows the whole sentence | fine | `40-saml-identity-refused-linked.png`,
`41-…-more.png`, `51-oidc-header-clientid-refused-linked.png` |
| Wrong protocol | `400` relayed: "…is an OIDC provider, so cert does
not apply to it (that is "Edit SAML Settings")." with "Use "Edit OIDC
Settings"." behind **More**, and in full in the toast | fine |
`30-wrong-protocol.png` |
| `resultDialog` shows what changed | "SAML settings saved / Changed:
SSO provider "acme-saml" updated: cert."; OIDC likewise for
`clientSecret`, `scopes` | fine | `12-…`,
`22-edit-oidc-secret-result.png`, `52-…` |
| Record header | both actions under the record sheet's **More actions**
menu; same dialog | fine | `50-oidc-record.png`,
`50b-oidc-record-menu.png` |
| Hidden for a non-platform-admin | a member (`auditor.demo`) and an org
admin both get "You don't have access to this app" on Setup, so no row
or header is drawn; the action door answers both `403 PERMISSION_DENIED
… requires capability [manage_platform_settings]` | fine (the `visible`
term itself is not reachable without Setup access) |
`60-nonadmin-list.png`, `60-orgadmin-list.png` |
Notes, not gaps:
- The refusal box shows the first sentence and keeps the rest one click
behind **More** (objectui#13332's design); for the wrong-protocol
refusal the hidden part is "Use "Edit OIDC Settings"." The toast raised
beside it carries the whole sentence.
- The card text lists an OIDC issuer among the editable fields. The
server door deliberately does not offer it (bridge header: endpoints
come from discovery at registration only); the bridge refuses a changed
issuer with a sentence saying to register a new provider. That is
#32268's ruling, not a console gap.
## Verification
Tree: `objectstack-ai/objectstack` at `42300972` (base `e883c71f`). All
under `scripts/pm/os-verify-lock.sh` (one held turn).
- `pnpm --dir ui exec vitest run
packages/app-shell/src/hooks/__tests__/useConsoleActionRuntime.createUserRequiredField-28289.test.tsx`:
exit 0, 22 passed (14 existing + 8 new).
- `pnpm --filter @object-ui/app-shell run type-check`: exit 0.
- `npx eslint` on the test file from `ui/packages/app-shell`: 0 errors
(47 `no-explicit-any` warnings, the file's existing style).
- `node scripts/pm/dispatch-gates.mjs --commands` derived 26 commands;
all 26 ran with exit 0, and `--ran` gives `26 derived famil(ies)
accounted for — 26 run, 0 NOT-MEASURED`.
- No changeset: only a test in the private `@object-ui/app-shell`
changes (`skip-changeset`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzfXBsXXNG9DdUkrGnp
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3d744f1 commit a0e2d77
1 file changed
Lines changed: 221 additions & 0 deletions
File tree
- ui/packages/app-shell/src/hooks/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
526 | 527 | | |
527 | 528 | | |
528 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
0 commit comments