Repository navigation
Commit 475277b
feat(pm): read a decision analysis's Served-tier / Analysed-by pair, judge it at write, and list the decision box by tier (#38867)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB1hPSUXVWWaX4kvGfBzBT7q)_
Fixes #38492
Clause-②: no
Metadata-protocol: none
Rule-change: ruled
Ruling-ref: 「升 p2,交 fleet 区现在做」 — the maintainer, a decision card in
this account's fleet project, 2026-12-01T06:29Z, recorded on the card as
comment 7303021478 (his words behind it, 2026-12-01T04:45Z: 「之前已经用 fable
分析过的不用重复分析吧?」「卡片上会有记录吗?是否用 fable 分析过」「立 skills卡优化」)
## 维护者速读
-
用户能看到什么变化:用户无感;席位每轮呈裁决前,一条命令就能看到每张待裁卡的分析是否达档、是否仍现行,达档且仍现行的照原样呈给你,只复核前提、不再重跑。
- 为什么做:回应你问的「之前已经用 fable
分析过的不用重复分析吧?」——把「卡上有没有记录、是否达档」交给脚本读,并在写分析时核对档位证据(车队决策轮工具)。
- 出错会怎样:只影响席位工具;最坏是某张卡多重跑一次分析,或写达档分析时被要求补交证据;可直接撤回。
- 要你做什么:无。
## What changes
Scope is ruling record 7303021478: the card's Ask 1 and Ask 2, plus the
two additions in pull reading 7301124099 (a per-card "still current"
reading, and the rule text for presenting an at-tier, still-current
analysis as it stands).
- **Ask 1, the reader** — `record-recognisers.mjs` gains
`readDecisionAnalysisTier(text)` and `readAnalysedBy(text)`: the
`Served-tier:` / `Analysed-by:` pair on a decision analysis, read with
the record's own parser (`readServedTier`, verdict `servedTierStands` at
`CONTRACT_REVIEW_TIER_NAME`, the N/M stamp control included). States:
`at-tier`, `below-tier`, `unreadable`, `missing`. A text is an analysis
when it carries the four-facet marker outside code or an `Analysed-by:`
line; a `## Contract review` record never is one; fenced code is a
citation and is not read.
- **Ask 1, the listing plus addition 1 (still current)** —
`check-owed-reviews.mjs --decisions` (report-only, exit 0, no new gate):
one row per open `needs-user-decision` card with the tier read on the
newest trusted text that carries a line of the pair (body or comment),
the carrying comment id, `Analysed-by`, and `current` or `stale` — stale
when a ruling comment (`classifyRulingComment`) follows the carrier,
when the body carries a `Ruled:` record at or after it, or (comment
carrier) when the body's newest protocol stamp is at or after its
minute. The act column says `present as it stands, premise re-check`
only for at-tier and current; every other row `re-run at tier before
presenting`. Body and comments are read through the queue guard's author
binding (`recordTrustedAuthors`), drops counted on the row.
- **Ask 2, the writer** — `recordTierEvidenceRefusal`
(`post-stamped.mjs`) now judges a decision analysis as it judges a
contract review record: an analysis comment declaring `Served-tier:
CONTRACT_REVIEW_TIER` is refused unless `--tier-evidence=PATH` passes
`verify-review-tier.mjs`; the refusal names which of the two it is
about. `label-write.mjs --comment-file` gets it through `judgeBody`
unchanged. A card BODY is judged on the analysis half alone
(`analysisTierEvidenceRefusal`; a record is a comment, never a body):
`issue-create.mjs --tier-evidence=PATH` on a new card, and
`post-stamped.mjs --body=N --tier-evidence=PATH` on a refresh that
INTRODUCES an at-tier analysis line the stored body lacks
(`bodyTierEvidenceRefusal`; a refresh keeping an existing line is
untouched). The analysis reader reads the record heading outside fences,
so an analysis quoting a record in a fence stays an analysis; on a
comment the analysis is judged first, so a fenced record quoted above
the comment's own at-tier pair cannot route it past the analysis half,
and the refusal then names an analysis.
- **Addition 2, the rule text** — `references/decision-analysis.md`
〈落卡分析模板〉: the reading line names `check-owed-reviews.mjs --decisions`; a
new line says an analysis at tier and still current (no ruling after the
carrying comment, body unchanged) is presented as it stands with only
the premise re-check, ⛔ not re-run, and is re-run at tier when the
premise moved; 「⛔ 不沿用他席推荐」 gains the carve-out 「(照原样呈达档现行分析除外)」 so the
two lines do not contradict; the `--tier-evidence=` parenthetical, which
said it judged only L2 records, now names the three writes that judge an
analysis (a comment, a new card, a body refresh introducing the line).
- **Ratchet** — `decision-analysis.md` ceiling 5580 → 5855, **+275
bytes, the measured landed delta**, by **ruling record 7303021478**; the
row quotes the ruling, and the raise is recorded under `ruledRaises` on
that file's existing cross-file move declaration (otherwise the move
arithmetic would price it as part of the move). The other ratchet rows,
including #38367's, are untouched.
## Out of scope (Ask 3) — carried to #38874
Carried to follow-up #38874, per the seat's routing record on #38492
(comment 7305087335), which also carries the contract review's nits N-a,
N-b, N-c, N-d and N-g. Not implemented here:
- N1: no branch for an at-tier author whose own transcript
`verify-review-tier.mjs` refuses (the precedent sentence in
`contract-review.md`).
- N2: once a delta re-analysis exists, which line a later reader takes,
and that a changed recommendation also updates the card-top 速读. (The
listing reads the newest carrier; the rule text does not yet say so.)
- N3: `Analysed-by:` has no stated value for a sub-agent, which has no
session id of its own. (The reader takes the first token: a prose value
such as "an isolated sub-agent of …" reads `an`.)
- N4: every card already in the decision box is re-run before it is next
presented, and while the contract tier cannot be had those cards cannot
be presented; say so where the rule is read.
- N-a (contract review 7305024877): an analysis posted after the carrier
with no line of the pair is skipped by the carrier search, so the
listing still reads the earlier at-tier carrier as `current`; belongs
with N2.
- N-b: `stale` after a ruling reads only the prior-rulings reader's
three first-line shapes, so a ruling in another shape (such as a
`Ruling-ref:` comment) is not seen by the comment check.
- N-c: a seat that posts its delta comment and then refreshes the
card-top summary reads `stale` on the next listing; the order is worth
one clause where N2 is settled.
- N-d: `label-write.mjs` usage and its two `--tier-evidence` refusal
texts still describe the option as a contract review record's alone
(outside the claim's file surface).
- N-g: `Analysed-by:` reads its first token, so a prose value reads its
first word (the same question as N3).
## Tests
Final head: `00fbbe54` (patch round 3: S3 and N-h from contract review
7305739488). Round 2 readings were taken at `807b7ac2` and round 1
readings at `67f80f5f`; the newest round is listed first.
<details><summary>Patch round 3 at 00fbbe5 — S3, readings and
ablation</summary>
- `post-stamped.mjs --self-test` → exit 0, 863 cases (analysis battery
17 → 19: a comment quoting a record in a fence ahead of its own at-tier
pair is refused without evidence as an analysis, read `at-tier` by the
listing's reader, and passes on at-tier evidence; when the quoted record
names the contract tier too, the refusal still speaks of an analysis).
- Ablation, restored from the fixed file: the old routing (record
heading on the raw comment, no analysis half) → both new rows fail, 2 of
863.
- Derived gates at 00fbbe5: 67 of 71 run, exit 0 each
(`check:pm-skill-ratchet`: decision-analysis.md 5855 / 5855;
`check:pm-post-stamped`; `check:pm-label-write`;
`check:pm-record-recognisers`; `check:pm-issue-create`);
`check-self-test-workflow-commands` hit a spawn timeout once under load
and passed on its re-run; 4 NOT MEASURED as before; `dispatch-gates
--ran` → 71 accounted for, 67 run, 4 NOT-MEASURED. The self-test-reads
declaration is still on line 77.
</details>
<details><summary>Patch round 2 at 807b7ac — S1, S2, readings and
ablations</summary>
- `post-stamped.mjs --self-test` → exit 0, 861 cases (analysis battery
12 → 17: a refresh introducing an at-tier line refused without evidence,
replacing TIER_DEFAULT refused, at-tier evidence passes and off-tier
does not, a refresh keeping the line untouched, a non-analysis / another
tier / a body quoting a record untouched, structural: `main` calls
`bodyTierEvidenceRefusal` on the stored body right after the unread
check).
- `issue-create.mjs --self-test` → exit 0, 77 cases (battery 8 → 10: a
body quoting a record, bare and fenced, planned with no evidence; an
analysis quoting a fenced record still judged; structural: never the
record half).
- `record-recognisers.mjs --self-test` → exit 0, 507 cases (battery 18 →
19: an analysis quoting a record in a fence stays an analysis).
- Ablations, each restored from HEAD: `issue-create` back on the whole
judge → 2 failing (the quoted-record row, the structural row);
`bodyTierEvidenceRefusal` ignoring the stored body → the keep-the-line
row fails; the record heading read on raw text → the quoting-analysis
row fails.
- Derived gates at 807b7ac: 67 of 71 run, exit 0 each
(`check:pm-skill-ratchet`: decision-analysis.md 5855 / 5855;
`check:pm-skill-id-lint`; `check:pm-post-stamped`;
`check:pm-issue-create`; `check:pm-record-recognisers`, which runs
`check-owed-reviews --self-test`; `check:pm-label-write`),
`check-handover --self-test` exit 0; 4 NOT MEASURED as in round 1;
`dispatch-gates --ran` → 71 accounted for, 67 run, 4 NOT-MEASURED.
</details>
<details><summary>Round 1: self-tests of the touched scripts
(67f80f5)</summary>
- `node scripts/pm/record-recognisers.mjs --self-test` → exit 0, 506
cases; new battery (18): at tier (present), stamp control, below tier
(TIER_DEFAULT, partial control, prefix/suffix), missing (marker only;
Analysed-by only), unreadable, one parser (same reading as
`readServedTier`), not an analysis, a contract review record, a fence,
an inline-span marker, Analysed-by decoration, a model id never quoted
back, empty value, placement.
- `node scripts/pm/post-stamped.mjs --self-test` → exit 0, 856 cases
across 31 batteries; new battery (12): refused without evidence, passes
at tier, refused off tier, no model id or path in the refusal, a delta
with Analysed-by and no facet block judged, TIER_DEFAULT / no line /
fenced pair / non-analysis untouched, the label-write fold, body refresh
not judged (stated bound), structural import.
- `node scripts/pm/issue-create.mjs --self-test` → exit 0, 75 cases; new
battery (8).
- `node scripts/pm/check-owed-reviews.mjs --self-test` → exit 0, 117
cases in 11 batteries; new battery (16): at tier and current, stale
after a ruling, a ruling before stays current, body `Ruled:` stamped and
unstamped, body stamp, body carrier, below tier, missing with and
without an analysis, newest carrier both ways, untrusted comment and
body, a record is no carrier, unjudged thread, the live read through one
reader with a gap, report order and the printed bound.
- `node scripts/pm/check-skill-line-ratchet.mjs --self-test` → 116
cases; `node scripts/pm/check-handover.mjs --self-test` (imports
post-stamped) → 116 cases.
</details>
<details><summary>Round 1: ablations (on-disk mutation, restored from
HEAD, tree clean after each)</summary>
- `recordTierEvidenceRefusal` with the analysis branch removed →
post-stamped self-test exit 1, 10 failing cases (the analysis battery).
- `decisionCurrency` with the ruling-comment check disabled →
check-owed-reviews self-test exit 1 (the stale-after-a-ruling case).
- `readDecisionAnalysisTier` grading any readable value as at tier →
record-recognisers self-test exit 1 (the three below-tier cases).
</details>
<details><summary>Round 1: derived gates (dispatch-gates --commands, 71
families, at 67f80f5)</summary>
- 67 run, exit 0 each — including `pnpm check:pm-skill-ratchet` (then
5803 bytes, ceiling 5803, headroom 0; the move into it +557 less 223 of
ruled raise against a source decrease of 592), `pnpm
check:pm-skill-id-lint` (134 files clean),
`check:pm-record-recognisers`, `check:pm-post-stamped`,
`check:pm-issue-create`, `check:pm-label-write`,
`check:pm-prior-rulings`, `check:pm-half-states`,
`check:pm-governed-merges`, `check-governed-queue-guard --self-test`,
`check:nul-bytes`, `check:doc-authoring`.
- 4 NOT MEASURED, left to CI: `node
scripts/check-comment-mask-corpus.mjs` (whole-tree sweep killed at its
280 s timeout on the shared container), `pnpm --filter @objectstack/lint
run check:doc-formula-expressions` and `pnpm check:i18n-coverage` (both
exit 3, PREREQUISITE NOT MET: the workspace CLI is not built; this diff
touches no package), `pnpm check:pm-dispatch-gates` (killed at a 570 s
foreground timeout, still printing passing cases).
- `dispatch-gates --ran` → `71 derived famil(ies) accounted for — 67
run, 4 NOT-MEASURED`.
</details>
## Acceptance notes
- PM mechanism assumptions, measured: `recordTierEvidenceRefusal`
returned null unless the body was a `## Contract review` record, and
`issue-create.mjs` had no `--tier-evidence` (both held);
`readServedTier` / `servedTierStands` are reused, no second parser; a
decision analysis is recognised by the facet marker outside code (the
reading `post-stamped.mjs` and the handover check already give it) or by
its `Analysed-by:` line; `check-owed-reviews.mjs` took the listing as a
mode, not a new gate.
- `record-recognisers.mjs` is over 1,000 lines; the pair reader (about
60 lines with its docblocks) sits beside `readServedTier` as part of the
same line's reader family rather than in a new sibling module, because
the claim's file surface binds and names this file.
`check-owed-reviews.mjs` grows 937 → 1,142 lines.
- Stated bound, `current`: the REST issue carries no body-edit time (the
measurement is stated in `check-half-states.mjs`), so an edit to the
body that writes no stamp is not seen; the listing prints this under its
rows, and the rule's premise re-check is what covers it. An unstamped
`Ruled:` record counts as after the carrier (the safe direction).
- Stated bound, writer: a `post-stamped.mjs --body` refresh is judged
only when it INTRODUCES an at-tier analysis line the stored body lacks;
a refresh that keeps an existing line (such as the director's `Ruled:`
edit) has no transcript to show and is untouched. The check reads the
stored body the refresh already fetches, so like the unread check it
runs on a live write, not on `--dry-run`.
- Live reading, `node scripts/pm/check-owed-reviews.mjs --decisions` at
2026-12-01T06:49Z: 10 open decision cards, all `missing` (5 carry an
analysis without the line, 5 no analysis). Positive controls read
through the same row function: #38624 (now out of the box) `below-tier`
on comment 7258301085; #38352 (on hold) `at-tier` on comment 7247373051,
`stale` after ruling comment 7247382346.
- No changeset: `scripts/pm/**` and `.claude/**` publish nothing
(`skip-changeset`).
## Verification
Read first, by risk:
1. `scripts/pm/post-stamped.mjs` `recordTierEvidenceRefusal` — the only
hunk that can refuse a write; check that a non-analysis comment and a
TIER_DEFAULT analysis stay untouched.
2. `scripts/pm/record-recognisers.mjs` `readDecisionAnalysisTier` — what
counts as an analysis, and that the tier is the record's parser.
3. `scripts/pm/check-owed-reviews.mjs` `decisionCurrency` /
`decisionAnalysisRow` — carrier choice and the stale reasons.
Two-minute check: `node scripts/pm/check-owed-reviews.mjs --decisions` —
expect one row per open `needs-user-decision` card ending in `re-run at
tier before presenting` or `present as it stands, premise re-check`, a
summary line with the counts, and the body-edit bound printed under the
rows; exit 0.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzfWWgrLkABDvbRjhAk)_
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzfWWgrLkABDvbRjhAk -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 46d996e commit 475277b
6 files changed
Lines changed: 516 additions & 38 deletions
File tree
- .claude/skills/pm-dispatch/references
- scripts/pm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
0 commit comments