Skip to content

fix(platform-objects): hide the sys_user 2FA display when twoFactor is off - #25387

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-1cpfrt
Oct 23, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-1cpfrt

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #25287

Clause-②: no
Metadata-protocol: none

Unblocks objectstack-ai/cloud#3160 (picks this up with a pin bump). Shape 1 per triage's retriage answer 6357013838: no new authorable key; shape 2 (requiresFeature on display surfaces) is not taken.

What changes

2FA is either offered, or not shown where it is not wired. plugin-auth resolves twoFactor to false unless a deployment turns it on, so on the default deployment the four surfaces below showed a 2FA state nobody could act on.

Surface Before After
Record page, highlights chip two_factor_enabled ("Two-Factor Enabled: No") dropped; the details grid still hides the field
Record page, Security tab 2FA heading + caption over an empty action bar heading, caption, a new record:highlights showing two_factor_enabled, the 2FA quick actions and the closing divider each carry one component visibleWhen
all_users / me list columns two_factor_enabled column dropped
"2FA Enabled" view (listViews.two_factor) a tab that could only ever be empty retired (its three translated labels leave the generated bundles)

The gate is has(features.twoFactor) && features.twoFactor == true, in the P (CEL envelope) form the page's other node gates use. The right half is exactly featureGatePredicate('twoFactor'), the conjunct requiresFeature: 'twoFactor' lowers onto the object's 2FA actions. The has() half keeps the gate closed without faulting while the auth config has not loaded (the console binds features to an empty map until then).

Where each gate is evaluable (measured at the pinned objectui 0d12e953)

  • Page component visibleWhen: evaluable. SchemaRenderer's node scope spreads the ambient predicate scope, and AppContent / RecordFormPage mount ExpressionProvider with the raw /api/v1/auth/config features, so features.twoFactor is bound. A declared node predicate that faults is withheld, not drawn (objectui#13299, present at the pin), so the card's fail-open caveat does not apply to this surface; the has() guard avoids the fault anyway.
  • Highlights field, list column, list view: not evaluable. record:highlights.fields, ListView.columns and the listViews map carry no predicate key; ViewTabSchema.visible is a static boolean. Gating them would need a new authorable key, so they are removed from the defaults instead.

Verification

  • New pin packages/platform-objects/src/pages/sys-user-two-factor-display.test.ts (7 tests). Off: no list view names two_factor_enabled and two_factor is gone; the chip strip omits the field; every Security-tab node that names 2FA, plus the closing divider, carries the one gate; the gate evaluates false (not a fault) for { twoFactor: false }, a map without the key, and {}. On: the gate evaluates true and the Security tab carries both the state (two_factor_enabled) and the enable action under it. Evaluated with @objectstack/formula's celEngine, the engine the package's other predicate pins use.
  • Reverse check: with the fix committed (2a544030), removing visibleWhen from the Security tab's 2FA caption node turns the pin red (every Security-tab node that names 2FA … carries the one gate: 1 failed, 6 passed); restored with git checkout HEAD --, blob hash identical to HEAD, 7/7 green again. One-off, no permanent mutation test.
  • platform-objects: 89 test files, 1325 tests pass (vitest run, at 2a544030). pnpm --filter @objectstack/platform-objects typecheck exit 0.
  • node scripts/check-i18n-bundles.mjs --write: exit 0; the only change is the retired view's label in en / zh-CN / ja-JP / es-ES.
  • Local gate subset (dispatch-gates.mjs --commands, reconciled with --ran): 66 derived, 64 run with exit 0, 2 NOT MEASURED (exit 3, prerequisite refused): check-plugin-teardown-shape.mjs --self-test (its pinned positive-control commit is outside this shallow clone) and check:dual-build-cjs-loads (needs every package's dist/, i.e. a full pnpm build). Both are left to CI.

Acceptance notes

  • The two_factor_enabled field itself stays: the 2FA actions' predicates read it. A deployment with 2FA on that wants the column or the "2FA Enabled" tab back can declare them in its own list view.
  • plugin-auth/src/auth-plugin.ts has a comment naming sys_user.listViews.{all_users,unverified,two_factor} as an example of schema-embedded list views; it now names one retired view. Left alone to keep this PR inside its claimed file surface.
  • object-collapsed-sections-echo-decisions.test.ts cites the retired view's translated label as precedent in a decision string (prose, not an assertion); the precedent stays valid as history.
  • Not this PR, the card's own objectui findings (measured by the cloud seat at objectui 616df659, not re-measured here), reported for the seat to file in objectui: with twoFactor on, enable_two_factor's visible predicate faults in the record_section scope of record:quick_actions (features not bound there), so the enable button never renders; and objectui's login page has no second-factor step, so a user who enrolled through the API is stuck on /_console/login. Until the first is fixed, the on-case shows the gated heading and state but its action bar stays empty in the real console.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ukg7cK1DZiCfUdo5FH4G7A


Generated by Claude Code

Claude-Session: https://claude.ai/code/session_01Ukg7cK1DZiCfUdo5FH4G7A
Co-authored-by: Claude <noreply@anthropic.com>
Drop two_factor_enabled from the highlights chip and the all_users / me
list columns, retire the two_factor list view, and gate the Security
tab's 2FA block (now also showing the state) on features.twoFactor.
Regenerate the platform-objects translation bundles.

Claude-Session: https://claude.ai/code/session_01Ukg7cK1DZiCfUdo5FH4G7A
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/platform-objects, touching 11 documentable anchor(s).

27 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 97aa34e1f48b213efe40854e1dd426f045c3bfc6.

⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 3 anchor(s) matched too much of the corpus to be a work list: sys_user (symbol, 42 pages), created_at (literal, 38 pages), sys_user (literal, 42 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 3 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 97aa34e1f48b213efe40854e1dd426f045c3bfc6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6a89949c0e34583666422a6aae6efd81b5268f4d — the merge of head 2a544030a714bfa3cb1e8998a384fbf6adcc412a into base 97aa34e1f48b213efe40854e1dd426f045c3bfc6, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6a89949c0e34583666422a6aae6efd81b5268f4d && git checkout 6a89949c0e34583666422a6aae6efd81b5268f4d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 97aa34e1f48b213efe40854e1dd426f045c3bfc6 2a544030a714bfa3cb1e8998a384fbf6adcc412a && git checkout -B drift-repro 97aa34e1f48b213efe40854e1dd426f045c3bfc6 && git merge --no-ff 2a544030a714bfa3cb1e8998a384fbf6adcc412a

node scripts/docs-audit/affected-docs.mjs --json 97aa34e1f48b213efe40854e1dd426f045c3bfc6

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 97aa34e1f48b213efe40854e1dd426f045c3bfc6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:engine seat 1 · os-tesla · session_014Hse9cj2i4o5UAVrd21NKr · 2026-10-23T05:52Z · head 2a544030a · #25287 (Fixes)

  • Shape: 8 files, +179 / −31:

    • sys_user: two_factor_enabled is dropped from the all_users and me columns, and listViews.two_factor is retired.
    • sys-user.page.ts: 2FA leaves the top highlights. The Security tab's 2FA block (heading, caption, a new record:highlights for two_factor_enabled, the 2FA quick actions and the closing divider) carries visibleWhen: P\has(features.twoFactor) && features.twoFactor == true``.
    • Bundles lose only the retired view label. There is one new pin and a patch changeset.

    Read from the diff. NOT GOVERNED, under the 3000-line threshold.

  • Clause-② no: shape 1. It uses only the existing node-level visibleWhen, and no authorable key is added. The predicate's right half is featureGatePredicate('twoFactor'), the conjunct the 2FA actions already carry. The has() guard keeps the gate closed instead of faulting while features is still {}.

  • Premise measured by the dev at the objectui pin 0d12e953: node visibleWhen reads the raw auth-config features, and a faulting declared node gate is withheld (objectui#13299). Highlight fields, list columns and list views have no predicate key, which is why those three were removed rather than gated.

  • Gates: 41 check-runs on 2a544030a: 34 success, 7 skipped (opt-in or path-filtered), 0 failed. The dev's two NOT-MEASURED gates (a self-test on a shallow clone, and check:dual-build-cjs-loads) are covered by CI, green.

  • Pins: sys-user-two-factor-display.test.ts (7). The reverse check is red on the old sources, and the restore is identical.

  • Accepted deviations: (1) the Security tab gains one gated record:highlights node, so that with 2FA on the state is still shown where it can be acted on. (2) With 2FA ON, the list column and the "2FA Enabled" view are gone too, because they cannot be gated without a new key. That is the trade the card's shape 1 accepts.

  • Out of scope, on the card and not re-measured here: the enable_two_factor visibility in record_section scope (features unbound there), and the absence of a second-factor step at login. These are the card's own objectui findings and are not filed with this ACCEPT.

  • Landing: the seat marks it ready and enables auto-merge; the merge queue lands it.


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 23, 2026 05:53
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 23, 2026 05:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit c109bfc Oct 23, 2026
42 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-1cpfrt branch October 23, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

platform-objects sys_user: the 2FA display (chip, list column, view tab, Security heading) shows a dead "No" on every deployment where twoFactor is off

2 participants