Skip to content

feat(settings): let the user pick the PTC disclosure tier - #1022

Closed
Thatgfsj wants to merge 1 commit into
card/d4-integration-diagnosticsfrom
card/d5-settings-entry
Closed

Thatgfsj wants to merge 1 commit into
card/d4-integration-diagnosticsfrom
card/d5-settings-entry

Conversation

@Thatgfsj

Copy link
Copy Markdown
Collaborator

Closes #989

What was wrong

D3 (#987) published the explicit full tier and D4 (#988) aligned the diagnostics, but the disclosurePolicy key stayed YAML-only: the row settings page had no entry, so an operator could not pick the tier without hand-editing the profile. Two suites were red on top of the in-progress D5 worktree:

$ node test/run.mjs settings-ui
  FAIL the disclosure card picks the tier, cancels edits, and never writes an untouched old profile
       AssertionError [ERR_ASSERTION]: the disclosure card renders
  FAIL a saved full tier reads back through the real host and other saves keep it
       TypeError: Cannot read properties of undefined (reading 'querySelectorAll')
dsh-ops settings-ui: 2 of 26 check(s) failed

$ DSH_OPS_WORKER_BIN=$PWD/runtime/linux-x64/dsh-ops-worker node test/run.mjs settings-disclosure
  FAIL a full choice saved through the real writer boots a loader-less first round
       first round carried the whole 16-name default pool, not the permitted [grep, stat] pool
  FAIL switching the tier between saves applies to the next session
dsh-ops settings-disclosure-e2e: 2 of 3 check(s) failed

The e2e red had a second cause worth recording: the suite booted the session from the host settings describe view, which is the editable surface only — it strips YAML-only keys such as the allowedTools cap and the worker path, so the full tier published the default pool even though the real writer had persisted everything correctly to cordis.patch.yml.

The change

  • src/client/row-schema.ts: readDisclosure / disclosureDiffers / disclosureOps — the saved rows read as one tier or mixed; full pins both PTC rows, on-demand returns every row that carries the key to the absent default, so a profile saved through the card is letter-identical to one that never met it.
  • src/client/row-form.tsx: the PTC disclosure tier card — two radios, one choice for both PTC rows, folded into the page's single revision-checked save. A cancelled edit writes nothing; a mixed disagreement is named and unified by the next choice; while the dynamic-tools bundle switch is off the card names the suspension (sign-off item 2 keeps its veto) and the saved choice is kept.
  • src/client/locales.ts: en/zh strings for the card.
  • src/settings/merged.ts: disclosurePolicy joins the merged row page as a volatile string beside bashPath (the legacy per-mode form stays YAML-only); absent stays the on-demand default.
  • test/settings-disclosure-e2e.test.mjs (new): the production chain twice over — the card's operations go through the real host settings writer and persist to the profile patch; the session then boots from the config the loader hands the row (profile layers merged, YAML-only keys included), runs the real native worker, and asserts the settled first-round surface plus one real binding call. The full leg proves a loader-less first round carrying exactly the permitted pool; the untouched old profile keeps the two-step on-demand path letter for letter; switching the tier between saves applies to the next session.
  • test/settings-ui.test.mjs, test/settings-rows.test.mjs, test/settings-host.test.mjs, test/ptc-disclosure-policy.test.mjs: card interactions through real DOM events, schema/ops derivations, persistence through the real host writer, and the descriptor contract.
  • docs/CHANGELOG.md: ## [Unreleased] entry (bilingual).

Deliberately not done: no publication-semantics change (D3/D4 own that), no teaching-copy change (P2), no diagnostics change (D4); no new dependency; lib//runtime/ untouched.

Validation

  • CI run: deferred per the maintainer's batch policy (CI runs at the build stage, not per PR); local full battery below.
  • npm run build, settings suites, ptc-disclosure-policy, worker-backed e2e, npm run check:size — real outputs below.
  • Reverting the implementation turns the checks red (behaviour-level, not structure): removing the card from row-form.tsx fails the disclosure card renders and drops the e2e full leg back to the loader first round; removing the volatile field from merged.ts fails the Config.dict assertions in settings-rows/ptc-disclosure-policy and the host writer rejects the path op; removing disclosureOps fails the disclosure tests in settings-rows/settings-host.
  • docs/CHANGELOG.md ## [Unreleased] entry added.
  • Behaviour-change docs: CHANGELOG entry covers it; no model-facing descriptions or schemas changed.
  • No new dependencies; package.json untouched.
$ npm run build
build: bundled 11 browser modules (102001 bytes)
build: generated PTC declarations for 18 capabilities (120684 bytes)
build: compiled src/ to lib/ and copied 60 assets

$ node test/run.mjs settings
dsh-ops settings-client: all 3 checks passed
dsh-ops settings-host: all 11 checks passed
dsh-ops settings-runtime: all 14 checks passed
dsh-ops settings-rows: all 15 checks passed
dsh-ops settings-ui: all 26 checks passed
dsh-ops test: 5 suite(s) passed, 1 skipped in 1s
  (settings-disclosure-e2e skips without a staged worker; run separately below)

$ node test/run.mjs ptc-disclosure-policy
dsh-ops ptc-disclosure-policy: all 8 checks passed

$ DSH_OPS_WORKER_BIN=$PWD/runtime/linux-x64/dsh-ops-worker node test/run.mjs settings-disclosure
dsh-ops settings-disclosure-e2e: all 3 checks passed

$ npm run check:size
check-file-size: 826 code file(s) checked, all at or under 1000 lines (longest: native/crates/ops-search/src/search.rs (930))

Environment

Linux x86_64, Node 24, based on card/d4-integration-diagnostics @ 27af626 (upstream main @ 58f6e28), local worktree install.

Add the row page's PTC disclosure tier card (#989): one choice unifies both PTC rows in a single revision-checked save. An untouched old profile is never written, on-demand returns both rows to the absent key, disagreeing rows are named mixed and unified by the next choice, and a cancelled edit writes nothing. The tier rides the merged row page as a volatile string beside bashPath; the legacy per-mode form stays YAML-only. While the dynamic-tools bundle switch is off the card names the suspension and keeps the saved choice. The end-to-end suite saves through the real host writer, boots the shipped apply from the loader-merged profile, and asserts the full tier's loader-less first round carries exactly the permitted pool; switching the tier between saves applies to the next session.
@Thatgfsj

Copy link
Copy Markdown
Collaborator Author

Superseded by #1033:18 张 OPS-PTC 卡的实现已随统一 PR 合入 main(本 PR 的提交已在 main 中),保留为评审记录。

@Thatgfsj Thatgfsj closed this Nov 20, 2026
@Thatgfsj
Thatgfsj deleted the card/d5-settings-entry branch November 20, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant