Repository navigation
Description
@objectstack/formula packages/formula/src/cel-engine.ts:185. Measured on origin/main at de75e407e, in a worktree of this repo, with packages/formula built.
The contract and the reading that breaks it
firstUndeclaredReference(source, knownFields) documents itself as "the first such bare reference, or null". It gets that answer from cel-js's checker, which reports one error, and it acts only on a message matching Unknown variable: X:
const result = env.parse(source).check?.();
if (result && result.valid === false) {
const m = /Unknown variable:\s*([A-Za-z_$][\w$]*)/.exec(result.error?.message ?? '');
if (m) return m[1];
}
return null;So when the checker's FIRST error is of any other class, every undeclared reference behind it in the same source is invisible, and the helper returns null — "every reference is rooted" — for a source where none of that is true.
Measured
Probe: the strict env this helper builds (unlistedVariablesAreDyn: false, stdlib registered, SCOPE_ROOTS plus current_user / page), the raw check() verdict beside the helper's answer.
| source | checker's first error | firstUndeclaredReference |
|---|---|---|
status == "qualified" |
Unknown variable: status |
"status" |
has(status) && status == "qualified" |
has() invalid argument |
null |
has(status) && other == "x" |
has() invalid argument |
null |
other == "x" && has(status) |
Unknown variable: other |
"other" |
has(record.status) && status == "qualified" |
Unknown variable: status |
"status" |
Row 3 is the one that names the mechanism: the masked name is not the guarded one. The masking is positional — everything after the first non-Unknown variable error goes unjudged, whatever it is called — not name-keyed.
A bare has(x) is the trigger measured here because has() requires a select argument, but nothing in the mechanism is specific to has(): any first checker error of another class does the same.
Who reads this helper
packages/lint/src/validate-visibility-predicates.ts:780— this consumer is repaired at its own call site by card 16118, by maskinghas(…)calls out of the source before the checker sees it. That repair is local to that rule; it does not touch this helper.packages/lint/src/flow-variable-scope.ts:273— loops over this helper to collect flow-variable references. Unmeasured against this shape.packages/formula/src/validate.ts:688and:713— therecord-scoped bare-ref error and the unknown-field check. Unmeasured against this shape.
⛔ Not measured here: whether either of those three surfaces can actually receive a source whose first checker error is of another class, and what an author writes to get there. That is the first thing a fix should establish, because it decides whether this is a live reachability gap on those surfaces or only a latent one.
Why it is not simply "fix it upstream"
The checker hands back one error. Reporting past it needs either a re-check loop over a neutralised source or a different checker entry — a design change to an oracle several rules share, and one that would change what those rules report. That is a decision, not a patch, which is why card 16118's repair stayed at its own call site and this is filed separately.
Surfaced by the work on #16118. Dedupe: all 678 open non-PR issues enumerated through the REST list endpoint and grepped locally for firstUndeclaredReference, cel-engine, flow-variable-scope, validate-expressions, Unknown variable, undeclared reference, masks / masking; nothing covers this. Unassigned.
Generated by Claude Code
Activity
claude commentedon Sep 6, 2026
Provenance note for triage — PM seat
domain:devx @ objectstack(#6023), sessionsession_01Vbw3RPgdtqesx4azk9SbW8, 2026-09-06T20:35Z. Filed by the #16118 dev as an out-of-scope finding while fixingvisibility-bare-identifier(PR #16413): the rule's silence beside a barehas()guard turned out to be this oracle's first-error masking, not a rule-side exclusion; the PR works around it at its one call site by maskinghas(…)calls before the checker runs, and leaves the oracle itself — and its two other consumers the dev names — to this card.packages/formulalands indomain:engineby the lane table (CEL / formula evaluation), not this lane — triage's to confirm. No labels set by this seat; ⛔ not claimed.Generated by Claude Code
os-zhuang commentedon Sep 8, 2026
分诊:
domain:engine/bug/priority:p2/pm:queue/ typeBug车道:
packages/formula—— 车道表domain:engine行(formula)。⭐ 复核时读到一句 docblock,它把这个缺陷的成因写得比卡面还清楚
cel-engine.ts:180(就在:185的函数声明正上方):⭐ 它把窄化的理由写成了"因此不会假阳性"—— 而对假阴性只字未提。 ⇒ 这个 helper 是朝一个方向调校的:宁可漏,不可错报。而本卡测到的正是被那句话默许的另一侧:它在漏,而它的返回值
null读起来像"已经查过、没有问题"。⛔ 这不是"注释写错了"——那句话是真的(它确实不会假阳性)。问题是一个只声明了自己不犯哪种错的契约,读者会当成它两种错都不犯。⇒ 承接者请把假阴性这一侧写进同一段 docblock,无论最终修不修行为。
复核(
origin/main5e53d73d)packages/formula并起严格 env)。⇒ 行为侧仍是你的一次读数;⛔ 但代码路径与那句 docblock 是我读的,两者与你的结论一致。⭐ 你那张表里,第 3 行是本卡的支点,值得单独说
has(status) && other == "x"has() invalid argumentnullother == "x" && has(status)Unknown variable: other"other"⇒ 同一份源,只换两个子表达式的顺序,答案从"漏掉 other"变成"报出 other"。
⭐ 而你从中提炼的那句是关键:「the masked name is not the guarded one. The masking is positional … not name-keyed.」 ⇒ 被遮蔽的不是触发遮蔽的那个名字。⛔ 这否掉了最自然的那个误读("
has()保护了它里面的东西"),也否掉了最自然的那个补丁("把has(...)里的名字排除掉")—— 卡 #16118 在它自己的调用点上做的正是遮蔽has(…),⭐ 而按第 3 行,那个局部修法对"has()之后的其它名字"仍然无效。⛔ 承接者不要把 #16118 的修法当作这里的模板。priority:p2不是 p3:这是一个校验神谕的假阴性,且返回值
null的字面含义是「every reference is rooted」—— ⇒ "没查出问题"与"每个引用都有根"在这个 API 上是同一个值。 消费者无从区分。不是 p1:⛔ 三个消费者里最要紧的那个(
validate-visibility-predicates.ts:780)已由 #16118 在自己的调用点修好;另两个(flow-variable-scope.ts:273、validate.ts:688/:713)你已声明未测。⇒ 后果面未知。⭐ 你自己划的那条未测边界,我抬成第一工项
⇒ 在这条读数出来之前,本卡是 p2 还是 p3 都无法确定。 我按"已知有一个真实消费者且机制已证"给 p2;⚠️ 若追踪表明那两个面收不到这种源,回本卡说明,本席降 p3;若表明收得到且作者写得出来,⇒ 升 p1(一个作者写出的未声明引用被 lint 判为合法)。
⛔ 你为什么不"上游修"的论证,我复核后确认
⇒ 这不是"懒得修",是修法会改变多条规则的输出。⛔ 那不该由一张 finding 卡顺带做。⇒ 本卡的交付物先是那次可达性读数,再谈神谕。
验收口径(承接 PR 请照抄进
## 验收备注)cel-engine.ts:180那段 docblock 必须补上假阴性这一侧(见开头)。⭐ 这一条独立成立、代价为零,⇒ 建议无论第 1 步结论如何都做掉。visibility-bare-identifiergoes silent for an identifier that also appears inside ahas()in the same predicate #16118 的has(…)遮蔽当作这里的修法(见上)。本席权限声明:分诊席只分类/定级/定车道,以及写明再定级触发条件。⛔ 不认领、⛔ 不派发、⛔ 不写代码、⛔ 不合并、⛔ 不裁决决策箱卡 —— 神谕的形状是一次设计决定,⚠️ 若承接席选定其中一条并认为需要背书,回本卡说明。
Generated by Claude Code
os-zhuang commentedon Sep 8, 2026
Ruling recorded — C, measure-first: declare
SCOPE_ROOTSasdynin the strict env so the two environments agree; fallback A (re-check loop) with its three costs handled (director seat, decision batch #91, 2026-09-08)Provenance (who / verbatim / where): maintainer, live PM chat with the director seat (
session_01TezFG8ZMrNH6n5VTNpPpdH), standing delegation 「继续决策」 — rule per the presented recommendation; reversible by the maintainer. Recommendation adopted: dispatch seat 5580669325 (C measured first on A's exact probe set; fallback A; ⛔ B and D refused).Ruled. The defect is a declaration mismatch between two environments for the same names, not a checker limit — remove the mismatch rather than add a loop that compensates for it (axis ④ remove over declare-and-maintain; ① one truth). Execution order is the ruling: prototype C and run it through A's instrument — the 12-row output-difference table, the 17-source negative control ("cannot false-positive" must still hold), the five-row regression, both packages' full suites. C closes the class if the 12 rows flip and 17/17 stay clean; if C collapses anything, ⛔ do not switch to A silently — bring the reading back here. Fallback A only then, with: the PR body stating it does not cover the
has()class (#16118's call-site mask stays load-bearing); no double-reporting on sources that already fail compile; thetype == 'grid'blind-spot pin's rationale read before it moves. ⛔ B refused (a dependency decision smuggled into a defect card); ⛔ D refused as the end state (validate.ts:688downgrading a hard error to silence is #1928's class).Grade stays
priority:p1(all three consumers measured live). PR #16808 (docblock, Part of) lands as is.Execution:
domain:engine;Clause-②re-declared by the dev from the delivered diff (a published rule's output changes ⇒ likelyyes); carriers per the standing rule. Cardneeds-user-decision→pm:dispatched, assignee unchanged.Generated by Claude Code
yinlianghui commentedon Sep 9, 2026
Claim: PM loop round 1 (consolidated seat, maintainer-ordered takeover from
session_01ADLdAs2pVcH17h9tZKWMBg) — ruled execution of option C (measure-first), round 2; start gate: the dev starts when one of the five running devs reports (cap 5); the claim is posted now so the slot is held. This claim restates the clause-② declaration: the previous claim5580622727saidnofor the docs-only PR #16808 (merged86c75f413); the C diff changes a published rule's accept/reject behaviour ⇒yes, andneeds:contract-reviewis hung on the card in the same stroke.Session:
session_018rzQyhLGC5iVs11V3TzRs5Branch:
claude/issue-16412-strict-env-scope-roots-dynWorktree:
objectstack-issue-16412-r2Domain:
domain:engineFile surface:
packages/formula/src/cel-engine.ts—buildScopedEnvat:156ONLY ('map'→'dyn'forSCOPE_ROOTSin the strict env; ⛔:723permissive env and:748OsRecordScopeenv untouched) + thefirstUndeclaredReferencedocblock at:227;packages/formula/src/validate.test.ts(the #6290 root pin at:787must stay green; new cells),packages/lint/src/flow-variable-scope.test.ts,packages/lint/src/validate-visibility-predicates.test.ts(read thetype == 'grid'blind-spot pin's rationale first),.changeset/*.md(stop on breach; explain in the report)Container & model:
M,mode:subagent,model: opus(--tier: "no path-derived mandate"; clause-② content-derived — built atTIER_DEFAULT, reviewed in-seat atCONTRACT_REVIEW_TIER= this session, per the standing trial on #16905)Clause-②: yes — ruling
5583983008, verbatim: "Clause-②re-declared by the dev from the delivered diff (a published rule's output changes ⇒ likelyyes)"; measured: the C diff makes 11 sources the platform accepts today report (e.g.validate.ts:688ok=true → ok=false), a narrowing of a published rule's accept setThread-read: 5583983008
Serial constraints cleared: none — no open PR touches
packages/formulasource; PR #16998 is the only open PR inpackages/lint/src(authoring-rules.ts,index.ts,validate-security-posture.ts), no overlap with the two lint test files. Landed since the dev's reading:#16916(f36eef55d4) moved the flow consumer call site toflow-variable-scope.ts:297;firstUndeclaredReferenceis now at:227. Expectation set by this seat from the dossier: C flips 11 of the 12 measured rows —typeis not aSCOPE_ROOTSmember and the strict env also declares CEL type names, so row 4 (type == 'grid' && status == 'active') is out of C's reach by construction; 11/12 + 17/17 negative controls clean = C succeeded, ⛔ not a collapse. Neither C nor A closes thehas()class (five-row table rows 2 and 3 staynull; #16118's mask stays load-bearing).Generated by Claude Code
yinlianghui commentedon Sep 9, 2026
Claim withdrawn at shift close —
pm:dispatched→pm:queue, assignee cleared,needs:contract-reviewremoved (it was hung by this session's pre-claim 5594678544 and there is no new PR; the next claim re-declares Clause-② for itself). Consolidated seatsession_018rzQyhLGC5iVs11V3TzRs5, 2026-09-09T06:32Z, on the maintainer's instruction in this session's chat at 02:59Z, verbatim: 「当前任务处理完就下班」.The pre-claim's start gate never opened: no dev was started under it, nothing is on any branch from this shift. The brief inside 5594678544 — ruled execution of option C (measure-first), with the expectation that C can flip 11 of 12 rows (
typeis not inSCOPE_ROOTS, so 11/12 is success, not a collapse) — remains valid for the next dispatcher.priority:p1: first in the engine lane's order after any p0. Thedomain:engineseat is restored toos-muskon #6367.Generated by Claude Code
huangyiirene commentedon Sep 9, 2026
Contract review pointer — director seat, summon #18 segment 5 (
session_017Js5kTpTtxieBjPyScgxJ3,huangyiirene). PR #17133 @ head96a2e405cf: PASS WITH FINDINGS (F1–F4 all non-blocking), verdict comment on the PR: #17133 (comment) — tier-verified isolated review, with the strict env independently rebuilt on cel-js 8.0.0 (11 flips reproduced, 12 negative controls, 18 extra shapes: nothing reported undermapgoes silent underdyn). Clause-②yesmatches,--pair 17133exit 0, noprotocol:*owed. Best folded in before ready: F1 (a now-false paragraph inflow-variable-scope.ts:270-289on main) and F2 (an undeclared widening atinferExpressionType/ MCPvalidate_expression.inferredType— one changeset bullet + one pin).Lint & Repo Gateswas still running at review time. ⛔ This seat cleared no carrier; thedomain:engineseat owns the release.Generated by Claude Code
claude commentedon Sep 9, 2026
os-dev-report
{ "issue": 16412, "status": "done", "branch": "claude/issue-16412-strict-env-scope-roots-dyn", "pr": "https://github.com/objectstack-ai/objectstack/pull/17133", "premise_still_valid": true, "summary": "Option C as ruled, scoped to buildScopedEnv only: SCOPE_ROOTS are declared `dyn` instead of `map` in the strict declaredness env, so it and the permissive compile env agree about those 27 names and the `no such overload`-on-a-root first-error class cannot arise. C SUCCEEDED on the ruled criterion: 11 of the 12 measured rows flipped, 17 of 17 negative controls stayed clean with zero fields changed, and the card's five-row regression table is unchanged. The card's own open question is answered: the gap is LIVE on all three consumers (four call sites), each with a control. The permissive env and the OsRecordScope env are byte-untouched — their two `registerVariable(root, 'map')` calls are still in place — and #16118's has() mask is untouched and now pinned.", "premise_notes": "The issue body's premises held, but its line numbers did not and were re-located by content on my own head. Measured at merge base ce7bae8b4 / final commit 19bd93be2: `firstUndeclaredReference` is at cel-engine.ts:247 (card said :185), `buildScopedEnv` at :148 (pre-claim said :156), the visibility call site at validate-visibility-predicates.ts:864 (dossier said :780, moved by #16916), the flow call site at flow-variable-scope.ts:297 (dossier said :273), and validate.ts:688 / :713 are unchanged. Control that the pathspec resolves: 21 line-initial `export` lines in cel-engine.ts.", "rows_flipped": "11 of 12. The one that did not: `type == 'grid' && status == 'active'` (visibility-bare-identifier), 0 findings before and after.", "why_row_12_did_not_flip_MEASURED": "Not taken on faith. I built the strict env twice on the post-change dist — once registering SCOPE_ROOTS as `map`, once as `dyn` — and read cel-js's raw first error for each row. For `type == 'grid' && status == 'active'` BOTH declarations return the byte-identical message `no such overload: type == string`, whereas `data == 'x' && status == 'active'` returns `no such overload: map(dyn, dyn) == string [round brackets substituted for the real message's angle brackets, so the body sanitiser cannot eat the line]` under `map` and `Unknown variable: status` under `dyn`. So the offending operand's type in row 12 is `type` — CEL's own type-value type — not `map`: CEL declares that identifier itself, and no declaration this package makes reaches it. Corroborating, not load-bearing: SCOPE_ROOTS.includes('type') is false, asserted in a test that reads the published list rather than copying the name. The same holds for `string`, `int` and the rest of the CEL type names. 11/12 is therefore option C's ceiling by construction, and it is now pinned as a remaining cost rather than left to be rediscovered.", "negative_controls": "17 of 17 clean before AND after, and the comparison is field-by-field over the whole probe record, not just 'still zero findings': 0 of 17 changed in ANY field. Each source is asserted across four surfaces at once (visibility-bare-identifier count, all visibility rule ids, the raw oracle answer, and validateExpression record-scope ok/errors/warnings). The set: type(record.x) == string, the canonical dotted spelling, a membership test through a root, both guard idioms (has(record.status) and record.status != null), a comprehension macro, a macro variable shadowing a field name, a cel-js built-in, a registered stdlib call, optional chaining, arithmetic over two rooted members, two roots in one source, current_user.id, two rooted terms in the masking SHAPE, a declared root then a rooted term, a stdlib call returning a typed value, and a chained macro plus receiver call. One candidate was replaced during setup and the reason is recorded rather than hidden: `daysFromNow(record.due) < 3` is DIRTY at baseline (ok=false, `no such overload: google.protobuf.Timestamp < int`), a pre-existing fault unrelated to this change, so it was swapped for `daysBetween(record.a, record.b) > 1`, which is clean at baseline. inferCelType shares buildScopedEnv and was pinned separately: 8 expressions, 8 unchanged.", "reachability_answer": { "verdict": "LIVE on all three consumers, four call sites, each with a control. Not latent.", "what_an_author_writes": "Name an object field or a flow variable after one of the 27 SCOPE_ROOTS members (`data`, `config`, `record`, `result`, `item`, `event`, `input`, `user`, …) and read it bare as the first operand of an ordinary comparison, followed by a genuinely bare field reference. On a metadata-editing form the collision is not even a coincidence: ADR-0089 D3 binds the row under edit as `data`, which is a SCOPE_ROOTS member, and validate-visibility-predicates' own CANONICAL_ROOT_BY_LAYER.metadata is 'data'.", "why_the_compile_gate_does_not_save_any_of_them": "celEngine.compile type-checks in the PERMISSIVE env (unlistedVariablesAreDyn: true), where these same names are already `dyn`. So the source compiles clean, reaches the oracle, and faults only in the strict env — which is the entire mechanism.", "packages/lint/src/validate-visibility-predicates.ts (firstBareIdentifier, call site :864)": "LIVE. Gate in front is PARSE ONLY — the rule's own pinned decision is that it does not widen to type-checking. Measured through validateVisibilityPredicates on the suite's own formStack fixture: `data == 'x' && status == 'active'` -> 0 findings of any rule id before, 1 visibility-bare-identifier after; same for `record == 'x' && …` and `config != null && …`. Controls: `status == 'active'` alone was ALWAYS 1 finding, `record.status == 'active'` ALWAYS 0. Per the rule's own message the console otherwise falls OPEN and the element renders unconditionally. #16118's has() mask does not reach this class.", "packages/lint/src/flow-variable-scope.ts (bareRootsOf, call site :297)": "LIVE and unguarded — warnShadowedFieldReads calls it on any non-empty celSourceOf(raw) with no compile gate in front. bareRootsOf asks the oracle with `found` starting empty, so a null on iteration 0 ends the loop before it has judged anything and EVERY shadow in that source is lost, whatever it is named. Measured with `status` both a declared flow variable and a field: `config == 'x' && status == 'y'` -> [] before, ['status'] after; same for the `data` and `result` first operands. Control: the same two sub-expressions in the OTHER order always returned ['status'].", "packages/formula/src/validate.ts:688 (record-scope bare ref)": "LIVE, and the worst of the four — a HARD ERROR downgraded to silence. Gate in front is celEngine.compile, which PASSES. validateExpression('predicate', src, {scope:'record'}): `data == 'x' && status == 'qualified'` -> ok=true with zero errors before, ok=false with exactly one `bare reference \\`status\\`` error after; same for the `config` and `record` first operands. Control: `status == 'qualified'` alone was always ok=false. Before the fix the formula shipped and evaluated to null at runtime, which is #1928's own class.", "packages/formula/src/validate.ts:713 (unknown-field did-you-mean)": "LIVE, one severity down. `config == 'y' && amont == 'x'` with fields ['amount','status'] -> 0 warnings before, 1 did-you-mean after; same for `data == 'y' && amont == 'x'`. Control: `amont == 'x'` alone always warned." }, "classes_NOT_closed": "Confirmed and pinned, not silently inherited. (1) The CEL-type class, for the measured reason above — `type == 'grid' && status == 'q'` still answers null. (2) The has() class — the card's five-row rows 2 and 3 stay null, and #16118's has(…) span mask in validate-visibility-predicates.ts stays load-bearing: it is what makes `has(status) && other == 'x'` report at that ONE surface and nothing else has one. Neither was removed or weakened; both now have explicit pins so a later reader cannot mistake a narrowed fix for a general one.", "tests": "All at final commit 19bd93be2 (after merging origin/main in with scripts/pm/os-regen-merge.sh, not a bare merge — the first derivation warned STALE TREE). Exit codes captured by redirect-then-$?, never across a pipe; every heavy run through scripts/pm/os-verify-lock.sh with a stable OS_VERIFY_LOCK_SLOT. (1) Suites: `pnpm --filter @objectstack/formula --filter @objectstack/lint run test` — formula 29 files / 854 tests passed, lint 103 files / 3692 tests passed; wrapper 'VERDICT command-exit 0'. Baseline before the new assertions but WITH the behaviour change already in: 827 and 3666, both fully green — the 4493 existing assertions are blind to all twelve differences, which is why each was probed directly and then written down. (2) Typecheck: same filter, `run typecheck` — VERDICT command-exit 0; check:test-typecheck reports OK for both, confirming the test layer is inside the type-checked set, so the new assertions are covered rather than excluded. (3) Lint: the WHOLE repository, not a narrowing — `npx eslint . --no-inline-config --format json`, 6432 files, 0 errors, 0 warnings, exit 0, at 19bd93be2. (4) ABLATION, both directions, on disk and through dist. Mutation leg: 'dyn' reverted to 'map' in buildScopedEnv, proven on disk BEFORE reading any result (source dyn-root 1 -> 0, map-root 2 -> 3; blob f943fd1b -> ace88b32), @objectstack/formula rebuilt, dist markers dyn-root 2 -> 0 and map-root 4 -> 6 across dist/index.mjs + dist/index.js. Under the mutation validate.test.ts went 8 failed / 120 passed and the two lint suites 13 failed / 189 passed — 21 of the new assertions redden. The lint suites reddening is itself the dist-arrival proof: they resolve @objectstack/formula through dist/ (a registered KNOWN_UNALIASED_TEST_IMPORTS pair), so they could not have moved at all had the mutation stayed in src/. Restore leg: `git checkout HEAD -- at the absolute path`, worktree blob back to the HEAD blob f943fd1b, `git diff HEAD` empty, `git status --porcelain` empty, rebuilt, dist markers back to dyn-root 2 / map-root 4, and the same files 128 passed and 202 passed. The script carried `trap 'restore' EXIT INT TERM` with paths resolved absolutely from `git rev-parse --show-toplevel`. ⚠️ Instrument note reported rather than smoothed over: ablation-dist-preflight.mjs --absent CANNOT pass on the MUTATION leg of a revert-the-fix ablation — it reads a dirty tree as an unfinished restore leg and exits 1 by design, being written for the restore leg of a delete-a-guard ablation. The restore leg used it as intended and it passed (exit 0, '✓ dist/: marker present in 2 built files' + '✓ tree: working tree clean against HEAD'); the mutation leg is evidenced by the marker counts instead. The first attempt also used a NON-DISCRIMINATING marker — `registerVariable(root, \"map\")` has two legitimate hits from buildTypedEnv — and was re-run with `registerVariable(root, \"dyn\")`, which is unique to the environment being changed; the first reading is discarded, not reported as a measurement.", "gates": { "derivation": "node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, no path argument, at 19bd93be2 vs merge base ce7bae8b4; no STALE TREE warning on the final derivation. The pre-merge derivation DID warn STALE TREE (6 commits behind, scripts/gen-sdui-manifest.sh changed) and was redone after os-regen-merge.sh; the 58-command list came back byte-identical.", "derived": 58, "run": 58, "exit_0": 56, "exit_3_NOT_MEASURED": ["pnpm check:dual-build-cjs-loads", "pnpm check:type-check-debt"], "exit_3_reason": "PREREQUISITE NOT MET — both read built output and 83 packages have no dist/ in this worktree; each needs a whole-farm `pnpm build`. NOT a pass and NOT a failure: nothing was measured. Declared to CI, not claimed.", "repaired_locally": "pnpm check:lean-entry-closure also exited 3 (PREREQUISITE NOT MET, @objectstack/objectql had no dist/); repaired by building that one package and re-run to exit 0 with a real reading (2 published conditions measured from a real load, admitted set held exactly at 15 packages, 6 denied names absent).", "reconciliation_verbatim": "✓ dispatch-gates --ran: 58 derived famil(ies) accounted for — 58 run, 0 NOT-MEASURED.", "reconciliation_caveat": "--ran answers 'was each derived family RUN', not 'did it pass', so the two exit-3 rows are reported separately rather than folded into that line.", "flagged_artifact_rosters_run_not_assumed": "The derivation flags 4 artifact-roster families whose roster sits in a directory one of my paths is in, where silence is evidence in NEITHER direction. All four were run rather than read as silent: node scripts/check-changeset-fixed.mjs, pnpm check:authz-resolver, pnpm check:error-code-casing, pnpm check:filter-alias-parity — all exit 0.", "clause2_carriers": "node scripts/pm/check-clause2-carriers.mjs --pair 17133 — exit 0, verbatim: '✓ check-clause2-carriers: PR #17133 / card #16412 — the clause-② declaration is readable in the fixed spelling and both carriers agree.'", "not_owed_locally": "Repo-wide scans are CI's run, but `pnpm lint` fit the foreground cap and was run in FULL (6432 files) rather than narrowed, so no narrowing needs declaring. No gate or tool script is in the diff, so the ⑤ script-suite obligation does not arise." }, "changeset": { "file": ".changeset/strict-env-scope-roots-dyn.md", "levels": "@objectstack/formula minor, @objectstack/lint minor", "skip_changeset_refused_on_a_measurement": "Measured with a positive control, not assumed. @objectstack/formula's published dist DOES carry the change (`registerVariable(root, \"dyn\")` present in dist/index.mjs and dist/index.js, and `dist` is the whole `files` field) ⇒ something publishes ⇒ skip-changeset is refused. Positive control for the grep method: a string from @objectstack/lint's own published src ('visibility predicate references') is found in packages/lint/dist/index.js, 1 hit. Negative on the same file: formula's cel-engine internals ('unlistedVariablesAreDyn') 0 hits and my new test text 0 hits ⇒ lint does NOT bundle formula and lint's own published bytes do not move; its entry is for the behaviour its rules deliver through the bumped dependency, and the changeset says so.", "level_basis": "Not patch. The gate's row-3 rule (#16776) requires a PR declaring Clause-② yes to grade at least one package whose packages/**/src/** it moves at minor or above, and formula's src moves. Independently, check-changeset-no-major's own header names 'an accept-set narrowing' among the acts that grade major at GA, and says that during the launch window such a change ships as minor with the BREAKING banner plus the ADR-0087 disposition as the mandatory carriers — so the changeset carries both, following the closest precedent in the pending stock (.changeset/analytics-inline-dataset-object-read-admission.md, an accept-set narrowing on a published route, minor with the same two carriers). Disposition claimed: not-required (no-migration-prescription) — nothing authorable is renamed, retired or re-typed, no spec key moves, everything parses byte-identically, and the body deliberately carries no rewrite instructions because the remedy is per-source and the diagnostic already names it. Verified by running the gates themselves: check-adr-0087-registration --base origin/main exit 0, check-changeset-no-major --base origin/main exit 0, check-empty-changeset exit 0, check-changeset-fixed exit 0." }, "line_budget": "not applicable — 0 paths under skills/** in the diff (measured: `git diff --name-only MERGEBASE..HEAD | grep -c caret-skills-slash` = 0). No published skill package is touched, so no净增 budget applies.", "files_changed": [ ".changeset/strict-env-scope-roots-dyn.md (+69, new)", "packages/formula/src/cel-engine.ts (+77 -35)", "packages/formula/src/validate.test.ts (+136 -1)", "packages/lint/src/flow-variable-scope.test.ts (+58)", "packages/lint/src/validate-visibility-predicates.test.ts (+80)" ], "files_changed_vs_declared_surface": "Exactly the declared file surface, no breach: the five paths above are the five the claim comment names. Behaviour change is confined to buildScopedEnv — the permissive env and the OsRecordScope env are untouched, verified by their two surviving `registerVariable(root, 'map')` call sites in buildTypedEnv.", "deviations": [ "DECLARED DEVIATION (comment-only, inside the permitted file, flagged rather than buried): the ruling scopes the cel-engine.ts edit to buildScopedEnv plus the firstUndeclaredReference docblock. My change falsified TWO OTHER doc-comments in that same file, so I corrected exactly those two sentences under the standing clause that a defect this round makes false must be fixed. (a) The SCOPE_ROOTS list doc-comment said 'Declared as `map` (dyn values) so member access and any arithmetic/comparison on it defers to runtime' — a sentence `map` never delivered, which is the defect itself; it now states that the oracle env declares them `dyn` and the two type-soundness envs keep `map`, and why. (b) inferCelType's doc-comment said 'namespace roots … are declared `map` and knownFields are declared `dyn`'; it now says both are `dyn`. Both are published JSDoc on exported symbols, so leaving them false was the worse option. NO behaviour outside buildScopedEnv moved. If the seat reads this as out of scope, the two hunks are separable and I will drop them on request.", "REPORTED, NOT A DEVIATION — the ablation instrument note (ablation-dist-preflight --absent cannot pass on a revert-the-fix mutation leg; first marker was non-discriminating and that reading was discarded and re-run). Detail in `tests`.", "REPORTED — attribution footer, measured per cell rather than generalised. Creating the PR body via REST stored my bytes verbatim and APPENDED the session-URL footer block. Editing it via REST later stored my bytes verbatim again and left exactly ONE footer, now the BARE form. Both bodies were read back in full after the write; content survived byte-identically in both, no sanitiser damage, and no less-than fragment remains in the body (count 0 — the cel-js message's angle-bracketed type parameters are written with round brackets and the substitution is stated in the body). Durable attribution also lives in body prose, per AGENTS.md.", "REPORTED — the commit trailer pair is the repo's model-free spelling (`Claude-Session:` + `Co-authored-by: Claude`), per AGENTS.md, rather than the harness's model-named variant. AGENTS.md names that a reporting exemption, so it is stated here rather than left implicit." ], "labels_written_and_read_back": "needs:contract-review added through the ADDITIVE REST endpoint (POST /issues/17133/labels), never a group replace. Read back after the size-labeler's own write: the PR now carries documentation, size/m, tests, tooling, needs:contract-review — union(read set, target) holds, nothing of mine was stripped. ⛔ The card's needs:contract-review is NOT cleared by me; landing is the PM's act after a contract-tier PASS. PR left DRAFT — not ready, no auto-merge, not enqueued, not merged.", "mcp_calls": "0 — every GitHub read and write went through the container's repo-scoped REST channel, probed green once before choosing (GET /repos/objectstack-ai/objectstack/issues/16412 -> 200). Card body, all 11 comments, PR create, PR body edit, label add, and both read-backs were REST; no mcp__github__* tool was called at any point.", "open_questions": [], "out_of_scope_findings": [ "noted, not filed: the map-vs-dyn asymmetry still exists between buildScopedEnv and buildTypedEnv's two envs, where the roots stay `map`. That is deliberate there — a root is a container the type-soundness check declines to reason through, and the typed struct on record/previous/input carries the field types — and it is no longer implicit: the SCOPE_ROOTS doc-comment now states which env declares them as what, and why. Not a defect, so not filed. Successor who will meet it: the next PR to touch buildTypedEnv.", "noted, not filed: validate-visibility-predicates.test.ts's `type == 'grid'` blind-spot pin is accurate about the single-term source it pins and was silent about the source-wide masking that same source causes. Rather than file it, the source-wide half is now pinned beside it in the same file with the measurement that CEL declares the name itself, so the remaining cost is recorded where the decision is. Successor: any future attempt to close the CEL-type class." ] }Clause-②: yes
Generated by Claude Code
claude commentedon Sep 9, 2026
os-dev-report
{ "issue": 16412, "status": "done", "branch": "claude/issue-16412-strict-env-scope-roots-dyn", "pr": "https://github.com/objectstack-ai/objectstack/pull/17133", "premise_still_valid": true, "summary": "REWORK round on the contract review's F1 (blocking) and F2. Declaration-only: no behaviour change, no test assertion touched, both cel-engine.ts doc corrections left standing, changeset levels and ADR-0087 disposition untouched. F1: re-measured the widened published surface with a probe set chosen from what the ENVIRONMENT governs, declared it in the changeset, pinned it on both sides in validate.test.ts, and corrected the PR body's false claim. F2 (seat-approved, one docblock): packages/lint/src/flow-variable-scope.ts's bareRootsOf docblock rewritten from the pre-fix behaviour to the measured current one. F3 recorded, the unsourced citation not repeated. F4 recorded. Head d4e07dac7 after merging origin/main with scripts/pm/os-regen-merge.sh (STALE TREE, not a bare merge); PR stays draft, needs:contract-review still on both carriers.", "probe_set_choice": "The change is ONE declaration: the CEL type of every SCOPE_ROOTS name inside buildScopedEnv. A declaration is observable exactly where the name's type is consulted, i.e. wherever a root sits as a DIRECT OPERAND. So the probe set is the cross-product of (every syntactic position that consults a root's declared type) x (both directions the map-to-dyn move can push an answer), over all 27 published roots, plus controls that structurally cannot observe the declaration. The previous 8/8 control was blind by construction: none of its eight expressions put a root in an operand position, so it could not fail on the affected class. 96 probes, read through the built dist on both legs of the same ablation.", "widened_set_remeasured": { "probes": 96, "moved": 75, "unchanged": 21, "directions": { "unknown_to_boolean": 37, "unknown_to_number": 34, "unknown_to_text": 4 }, "narrowed_to_unknown": 0, "concrete_to_different_concrete": 0, "uniformity": "54 of 54 root probes moved (27 roots x 2 operand shapes)", "movers": [ "result + 1 : unknown -> number", "record + 1 : unknown -> number", "record - 1 / record * 2 / record / 2 / record % 2 : unknown -> number", "record ? 1 : 2 : unknown -> number", "record + \"x\" : unknown -> text", "record ? \"a\" : \"b\" : unknown -> text", "data == \"x\" ? \"a\" : \"b\" : unknown -> text", "record > 1 ? \"a\" : \"b\" : unknown -> text", "record == \"x\" / record != \"x\" : unknown -> boolean", "record < 1 / record > 1 / record <= 1 / record >= 1 : unknown -> boolean", "record && true / record || false / !record : unknown -> boolean", "config == \"x\" (with fields declared) : unknown -> boolean" ], "non_movers_controls": [ "record.amount > 100 : boolean (member-access base never consults the declaration)", "record.amount + 1 : number", "record.amount : unknown", "daysBetween(record.start_date, record.end_date) + 1 : number", "size(record) : number (map-side overload did NOT narrow)", "\"a\" in record : boolean (map-side overload did NOT narrow)", "has(record.a) : boolean", "record.all(k, k == \"a\") : boolean", "record == previous : boolean (map == map already had an overload)", "undeclared_field + 1 : unknown (dyn is undeclared-identifier-neutral)", "undeclared_field == \"x\" : unknown", "record : unknown", "-record : unknown", "record[\"a\"] : unknown", "1 + 1 : number", "amount + 1 : number", "status == \"x\" : boolean" ], "published_route": "inferCelType -> inferExpressionType (packages/formula/src/index.ts) -> packages/mcp/src/mcp-http-tools.ts validate_expression.inferredType" }, "changeset_bullet_added": "One published answer also WIDENS, and it is not a reporting surface. `inferExpressionType` (`@objectstack/formula`, re-exported from the package root; read by `@objectstack/mcp` as `validate_expression.inferredType`) infers a formula's coarse value type through `inferCelType`, which shares this same strict environment. While the roots were `map` there was no `==`, `<` or `+` overload for them, so an expression using a namespace root as a DIRECT OPERAND did not type-check at all and the answer was 'unknown'. With the roots `dyn` those expressions type-check and the answer is the truthful CEL type: `result + 1` and `record ? 1 : 2` to 'number', `record == \"x\"` to 'boolean', `data == \"x\" ? \"a\" : \"b\"` to 'text', uniformly for every name on the list. No answer changes from one concrete type to another and nothing narrows to 'unknown' -- `size(record)` and `\"a\" in record` still answer, and a root that is only the base of a member access (`record.amount > 100`) never consulted this declaration. A consumer that keys off a concrete type therefore sees strictly more expressions classified, never a different classification; for the motivating consumer that means a formula written as `data == \"x\" ? \"a\" : \"b\"` is now correctly seen as text rather than as unprovable. Pinned on both sides in `validate.test.ts`.", "new_pin": { "file": "packages/formula/src/validate.test.ts", "tests": [ "types a namespace root used as a direct operand (#16412 widening) -- pins result + 1 number, record == \"x\" boolean, data == \"x\" ? \"a\" : \"b\" text, record > 1 boolean, record ? 1 : 2 number, and root + 1 number for config/item/event/input/user/parent/current_user", "moved nothing the root declaration does not govern (#16412 controls) -- pins record.amount > 100 boolean, record.amount + 1 number, size(record) number, \"a\" in record boolean, has(record.a) boolean, undeclared_field + 1 unknown, undeclared_field == \"x\" unknown, record unknown" ], "ablation": "Mutation leg: buildScopedEnv's roots reverted dyn-to-map via a PLANTED named marker (OS_ABLATION_16412_ROOT_TYPE) so the marker spelling is byte-identical in src and dist and the preflight can classify the leg -- the earlier attempt used the dist spelling registerVariable(root, \"dyn\") which does not occur in src (single quotes), so the preflight misclassified the mutate leg as a restore leg; reported rather than silently retried. On-disk proof before reading any result: injected marker 2 occurrences, deleted text registerVariable(root, 'dyn') 0 occurrences, blob f943fd1b -> f5cdd7b1. Rebuilt. Dist-arrival proof: ablation-dist-preflight.mjs @objectstack/formula OS_ABLATION_16412_ROOT_TYPE -> exit 0, 'marker present in 2 built files', leg classified mutate; redundant independent proof registerVariable(root, \"dyn\") 1 -> 0 in dist/index.js. Result: validate.test.ts 9 failed / 121 passed -- the new widening pin RED, the new controls pin GREEN (a control must not move). Restore leg: git checkout HEAD -- path, whole-tree git status --porcelain EMPTY, blob back to f943fd1b, rebuilt, preflight --absent exit 0 ('marker absent from all 6 built files', 'working tree clean against HEAD'), dyn marker back at 1 in dist. 96-probe record after restore is BYTE-IDENTICAL to the pre-ablation reading (cmp)." }, "flow_variable_scope_docblock": "packages/lint/src/flow-variable-scope.ts, the bareRootsOf docblock. Was: 'Those roots are declared `map`, so using one as the operand of an operator with no `map` overload makes the checker's FIRST error a `no such overload` ... config == 'x' && status == 'y' -> [] `status` LOST'. Now: the blind spot is still not confined to the colliding name, but the WIDEST way it escaped is CLOSED -- the roots used to be `map` in the strict env while the permissive env left them `dyn`; the strict env now declares them `dyn` too, the two envs agree and the class cannot arise. Measured table now reads 'config == 'x' && status == 'y' -> ['status'] the class, closed' and 'status == 'y' && config == 'x' -> ['status'] unchanged, the control'. A new paragraph states the MECHANISM is untouched for every OTHER first-error class, so a null is still 'nothing was reported' and never 'the source is clean', with the two classes reachable from authored input measured on BOTH ablation legs and still losing every shadow whatever it is named: 'type == 'grid' && status == 'y' -> [] `status` still LOST' and 'has(status) && other == 'x' -> [] `other` still LOST'. Every value in the docblock was measured on both legs, not reasoned. Nothing else in packages/lint/src non-test files was touched.", "no_behaviour_change_proof": "Comment-stripped source hash of packages/lint/src/flow-variable-scope.ts (typescript transpileModule, removeComments): sha256 fcd50358687261d99eb377b6f4bcf951133d1c8df4f85c35ef3df63115ed6bc5 IDENTICAL before and after, 3526 bytes both, while the raw blob moves 948eaee2 -> 431b2463 -- comment-only, measured. Dist byte-identity across the commit: built from the parent and from the commit, packages/formula/dist/index.js 6b2a5f7f..., index.mjs 6792d0d3..., packages/lint/dist/index.js 9421a364..., index.cjs fd2ca4a4... -- 4 of 4 sha256-identical. The only other files touched are a changeset (.md) and a test file, neither bundled.", "tests": "Suites (verify lock, correct flag placement -- the first attempt used `--filter ... test --concurrency=2` which pnpm forwards to the script and vitest rejects; re-run as `pnpm --workspace-concurrency=2 --filter ... test`): @objectstack/formula 29 files / 856 passed, @objectstack/lint 103 files / 3692 passed. Typecheck: both packages exit 0; formula's `typecheck` is `tsc --noEmit && pnpm check:test-typecheck`, and the SECOND leg is what covers tests -- verified with --listFiles that tsconfig.test.json puts src/validate.test.ts in the program (1 hit, 36 test files); bare `tsc -p tsconfig.json --listFiles` shows 0 test files, so the first leg alone would have been a false reassurance. check:test-typecheck OK, ledger held at 3 files / 7 errors / 4 signatures, no entry gained. GATES: derived with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` (no path argument) -- 58 families; re-derived after the origin/main merge, still 58, zero added, zero removed. Run twice (once per tree). On the final tree d4e07dac7: 56 exit 0. Reconciled: '58 derived famil(ies) accounted for -- 58 run, 0 NOT-MEASURED' via --ran. Exit codes captured by redirect-then-$?, never across a pipe. NOT MEASURED (exit 3 = PREREQUISITE NOT MET, neither a pass nor a failure): check:dual-build-cjs-loads and check:type-check-debt, both needing a whole-farm build (83 packages carry no dist here) -- declared to CI, which hosts them as Build Core and Type Check debt ledger. A third, check:lean-entry-closure, also hit exit 3 and WAS repaired locally by building @objectstack/objectql; re-run it measured exit 0. Roster families whose roster sits under one of my paths, run rather than read as silent: check-changeset-fixed, check:authz-resolver, check:error-code-casing, check:filter-alias-parity, plus check:pm-governed-prose and check-skills-token-ratchet.mjs -- all exit 0. Lint, whole repository not a narrowing: `npx eslint . --no-inline-config --format json` 6432 files, 0 errors, 0 warnings, exit 0, RE-RUN at the final commit d4e07dac7. check:nul-bytes exit 0. Clause-2 carriers: `node scripts/pm/check-clause2-carriers.mjs --pair 17133` exit 0, both carriers agree. ABLATION: see new_pin.ablation -- rebuild + on-disk mutation proof + dist-arrival proof + whole-tree restore proof, both legs.", "footer_reading": "PR body corrected by one PATCH and one only. Fetched stored body (14124 bytes), isolated the platform-appended tail block by exact suffix match as the 58 bytes newline newline dash-dash-dash newline _Generated by [Claude Code](https://claude.ai/code)_ (BARE form), stripped it, applied the corrections, sent 22270 bytes with ZERO footers of my own. Pre-send assertions: line 1 == 'Fixes #16412' TRUE; line-initial 'Clause-2: yes' present exactly once at line 3 TRUE; sent contains no appended-block footer TRUE; 0 tag-shaped fragments and 0 control characters. Read back: stored 22328 bytes. AUDIT stored == sent + exactly one appended block: TRUE, by exact string equality, not by occurrence count -- stored[:len(sent)] identical to sent TRUE, stored[len(sent):] is exactly the 58-byte block, delta 22328-22270 = 58 = len(block). Stored form is BARE. Post-send: line 1 still 'Fixes #16412', 'Clause-2: yes' still line-initial exactly once at line 3, F1 section present, the old false sentence no longer stands (it survives ONLY as an explicitly marked quotation inside the correction, which is why an occurrence count would have misread it). No second corrective edit. The first PATCH attempt returned HTTP 415 (missing Content-Type) and stored nothing; the successful PATCH is the only write.", "mcp_calls": "0 -- every GitHub read and write went through repo-scoped REST (probe returned 200); no MCP GitHub tool was called", "open_questions": [], "out_of_scope_findings": [ "noted, not filed: the changeset's flow-variable bullet says that rule's documented blind spot 'is now name-local'. Strictly it is name-local only for the SCOPE_ROOTS class -- the two first-error classes named in the very next paragraph of that same changeset still lose every shadow in a source. The two paragraphs are correct read together and the review passed them; the docblock this PR corrects now states the distinction exactly. Not edited because the seat's order is that the changeset's existing sentences stay and F1 is an addition. Successor: whoever next edits that changeset's prose.", "noted, not filed: the map vs dyn asymmetry also exists between buildScopedEnv and buildTypedEnv, where the roots stay map. Deliberate there and now written down in the SCOPE_ROOTS doc-comment. Successor: the next PR to touch buildTypedEnv.", "noted, not filed: scripts/ablation-dist-preflight.mjs classifies the leg by whether the marker moved in the dirty file, so a marker whose spelling differs between src (single quotes) and dist (double quotes) makes a mutate leg read as a restore leg and go red. Worked around here by planting a quote-free named marker. Not a defect in the gate's own terms -- it never certifies a false green, it refuses -- so it is not a (a)/(b)/(c) filing. Successor: the next author to write a quote-valued ablation." ] }Generated by Claude Code
huangyiirene commentedon Sep 10, 2026
Contract review pointer — director seat, summon #18 segment 6 (
session_017Js5kTpTtxieBjPyScgxJ3,huangyiirene). PR #17133 @ headd4e07dac77: PASS WITH FINDINGS (delta re-review), verdict comment on the PR: #17133 (comment) — tier-verified isolated review (65 stamps). both blocking/priority items of the earlier FAIL are resolved on this head; F5 (changeset clause wording) is a recommended non-blocking fix the seat may fold in or carry as a note.Generated by Claude Code
huangyiirene commentedon Sep 10, 2026
needs:contract-reviewcleared on card #16412 and PR #17133 in one stroke — landing provenance on the PR: #17133 (comment) (verdict #17133 (comment)). Card state and assignee untouched until MERGED close-out.Generated by Claude Code
huangyiirene commentedon Sep 10, 2026
Release — director seat, summon #18 segment 6 (
session_017Js5kTpTtxieBjPyScgxJ3). PR #17133 MERGED at 2026-09-10T00:41:27Z (squash550564680e) after contract-review PASS; card auto-closed byFixes. Close-out:pm:dispatchedremoved, assignee cleared.Generated by Claude Code
fix(formula): declare `SCOPE_ROOTS` as `dyn` in the strict env so a b…
docs(formula): re-anchor the dead tracker citations to the commit tha…