Skip to content

test(ptc): drive the two-tier publication rule as a data-driven matrix - #1020

Closed
Thatgfsj wants to merge 1 commit into
card/d3-full-publicationfrom
card/v3-two-tier-matrix
Closed

Thatgfsj wants to merge 1 commit into
card/d3-full-publicationfrom
card/v3-two-tier-matrix

Conversation

@Thatgfsj

@Thatgfsj Thatgfsj commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #992

What was wrong

The two-tier OPS-PTC publication rule (disclosurePolicy on-demand vs full, plus the legacy off variants) was verified by per-case suites, so a name that exists in a catalogue but is not callable in the current step could slip through if only one view (a name list, a description, or a binding) was checked. Issue #992 asked for one data-driven acceptance matrix covering both publication paths with the same comparison logic.

The change

  • test/ptc-two-tier-matrix.test.mjs (new, 357 lines, 16 checks): eight canonical rows as data — legacy default, the four legacy-off variants (global dynamicTools:false, row dynamicTools:false, that row plus alwaysLoaded:[stat], residentTools:false), on-demand first step, on-demand after loading, the explicit full first round, read-only, a narrow pool, and a custom profile:'ptc' integration — plus a hideOfficialTools:false pin row. Each row carries its inputs and the exact expected business names, measured through one shared comparator (expectCell) across three views: SDK text (declared), step admission (admitted) and run_code bindings (callable), with the no-toolSet diagnostic assembly collected as a clearly separate registration superset.
  • Every row executes a real no-side-effect sentinel through the real worker; the read-only row's inspect runs under a read-only sandbox, and write authority is asserted with a safe rejection (ops_load_sdk with tools:['write_file'] answers INVALID_ARGUMENT naming the API, effectState 'none').
  • The drift property is itself asserted: deleting any single expected name fails exactly its cell and prints the culprit; an invented name fails as extra; reading the diagnostic registry view where a step view is required fails with the pool names.
  • fix(ptc): hide replaced official file tools under PTC presets #961 is out of baseline, so the official read/glob/grep trio is pinned visible under both hideOfficialTools states (the switch is inert for PTC rows today); when fix(ptc): hide replaced official file tools under PTC presets #961 lands those pins flip and must be updated together with it.
  • Docs: a V3 addendum section in both docs/design-decisions-20261119.md and docs/设计决策-20261119.md, plus a docs/CHANGELOG.md ## [Unreleased] entry.
  • Deliberately not done: byte accounting (V2) and real-model rounds (V5); test/ptc-declaration-surface.test.mjs is untouched (P5 owns it); no src/ changes — this card is tests plus assertion helpers only.

Validation

Red first (honest sequence): the initial run failed 5 rows on boot mechanics (the unset sandbox mode suppressed every publication) and, after that fix, 3 rows on wrong expectations — each correction either matched shipped behaviour (loaded sets must include result; the directory text disappears when the pool is exhausted; the custom integration admits its own ops_status diagnostics reader) or fixed the suite's own probe (a raw-name tools.glob vs ops_glob binding typo, a sentinel that broke lossless JSON, run_code not being part of the registry views).

Green after (npm run build first; worker DSH_OPS_WORKER_BIN=runtime/linux-x64/dsh-ops-worker, sha256 2b5f988d…):

$ DSH_OPS_WORKER_BIN=$PWD/runtime/linux-x64/dsh-ops-worker node test/run.mjs ptc-two-tier-matrix
dsh-ops ptc-two-tier-matrix: all 16 checks passed
dsh-ops test: 1 suite(s) passed in 10s

$ node test/run.mjs ptc-full-disclosure        # 8/8 (unchanged)
$ node test/run.mjs ptc-declaration-surface    # 5/5 (unchanged, not touched)
$ node test/run.mjs ptc-config-truth           # 13/13 (unchanged)
$ node test/run.mjs resident-switch            # 24/24 (unchanged)

$ npm run check:size
check-file-size: 825 code file(s) checked, all at or under 1000 lines

撤回即红 demonstrated live: corrupting the global-off row's expected set (as if the dynamic admission condition had been removed) fails with

matrix cell global-off:first/declared(ops) drifted: missing [ops_load_sdk], extra []

and restoring the row returns the suite to 16/16 green. The in-suite drift-property checks reproduce this mechanically on real collected views.

CI: not run per card instruction (定向验证 only; the full gate is deliberately out of scope for this slice).

@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/v3-two-tier-matrix 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