Skip to content

12 处测试 fixture 用 triggerType: 'record-created' —— 平台自己的 lint 判它永不触发(#5762 后是 error) #5957

Closed

Description

@os-zhuang

#5762 做消费半径清查时顺带发现的,观察类记录。未指派,交分诊定级;当前无人踩到。

事实

全仓 12 处 fixture 把 flow start node 的 triggerType 写成 'record-created':

  • packages/lint/src/validate-flow-template-paths.test.ts —— 10 处(:35、:120、:161、:179、:200、:221、:250、:333、:363、:402)
  • packages/lint/src/reference-integrity-suite.test.ts:194
  • packages/services/service-automation/src/record-lookup-expand.integration.test.ts:53

record-created 在文法之外:引擎认的是 record-{before,after}-{create,insert,update,delete,write}(triggerTypeToHookEvents,packages/triggers/trigger-record-change/src/record-change-trigger.ts:115)。它缺相位段,所以映射到零 hook event —— 正是 flow-trigger-unknown-event 命中的形状。#5762 之后该规则是 error。

为什么今天不红(也是为什么它是观察类而非缺陷)

这些 fixture 所属的测试各自直接调用自己的规则(validateFlowTemplatePaths / validateReferenceIntegrity / 运行时 expand 集成),都不经过 validateFlowTriggerReadiness,也不跑授权规则注册表。已逐一核对:validateFlowTriggerReadiness 不在 REFERENCE_INTEGRITY_RULES 成员内。所以 #5762 的升级对它们零影响 —— PR #5952 的三个示例 A/B 也逐字一致。

为什么仍值得记一笔

两点,都是「以后」而不是「现在」:

  1. 哪天这些测试改用注册表跑(例如收敛到 runAuthoringRules 以获得跨规则覆盖),12 处 fixture 会一起变 error 红,而红的原因与被测规则毫无关系 —— 排查成本远高于现在改掉。
  2. fixture 是会被读的样例。 一个 token 被平台自己的 lint 判为「永不触发」,却在仓内测试里出现 12 次,对照着读的人(以及以仓库为语料的 AI 作者)会当成正确写法抄走。这正是 flow-trigger-unknown-event 存在的理由被自己的测试语料反向抵消。

修法(若分诊认为值得)

机械替换为符合文法的 token —— 这些 fixture 里 triggerType 都只是「让 flow 看起来是 record 触发」的陪衬,不是被测对象,所以 record-after-create 直接替换即可,无断言需要跟着改。建议连带扫一遍其余非文法 token(同批实测:on_create 2 处、on_update 1 处、onCreate 1 处,均不以 record- 开头,故连 flow-trigger-unknown-event 都不会命中 —— 它们是另一个形状:引擎把非 record- 前缀的 token 整体当作「无 record 触发器」,静默降级为 manual flow,值得单独判断是否要有诊断)。

关联:#5762 / PR #5952(发现出处)、#3427 / #3457 / #3481(flow-trigger-unknown-event 的三条来源)。

Activity

  1. claude commented on Aug 6, 2026

    @claude
    Contributor

    发现分诊轮(#4949 纪律):晋级 pm:queue,摘 finding。域维持 domain:devx(落点全部在 packages/lint 的测试 fixture + 一处 service-automation 集成测试 fixture,按域表 lint 归 devx;⛔ 不改判为 services —— 被改的是 fixture 常量,不是 automation 行为)。

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  2. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    Collaborator

    Claim: PM loop round 1 (devx seat, new tenure)
    Session: session_01F8q5J1MQyocgtNspb15fSn
    Branch: claude/issue-5957-flow-trigger-fixture-tokens
    Worktree: objectstack-issue-5957
    Domain: domain:devx
    File surface: packages/lint/src/validate-flow-template-paths.test.ts, packages/lint/src/reference-integrity-suite.test.ts, packages/services/service-automation/src/record-lookup-expand.integration.test.ts, plus skip-changeset or a changeset.
    Container: S — mode:subagent, shared container.
    Serial constraints cleared: all three files last touched by 82bf47b (#6471, this lane, merged); no open in-lane claim on them. #6381 shares packages/lint and is deliberately held to a later round rather than riding this batch — its file surface (validate-visibility-predicates.ts / validate-translatable-sections.ts / validate-form-layout.ts) is disjoint from these three, but step 3 serializes on same-package doubt.

    Premise re-verified at origin/main a36db28, per-file rather than from the card: 12 hits of triggerType: 'record-created', distributed exactly as the body claims — validate-flow-template-paths.test.ts 10, reference-integrity-suite.test.ts 1, record-lookup-expand.integration.test.ts 1. Control probe: record-after-create has 23 hits, so the scanner is reading the tree correctly and the 12 is not a false positive of a broken path filter.

    Scope stays pinned as the triage comment nailed it: the 12 mechanical replacements only. The non-record- prefixed family (on_create ×2, on_update ×1, onCreate ×1) is a different shape and is explicitly out of scope.


    Generated by Claude Code

  3. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    Collaborator

    ACCEPT — PR #6636 (devx seat review, round 2).

    What shipped: the 12 out-of-grammar record-created fixture tokens replaced with record-after-create, +12/−12 across exactly the three declared files, no assertion changed, no lint rule added.

    Review notes:

    • The evidence is not "tests still green" — and the PR says so itself. These fixtures are inert by hypothesis, so a green suite proves nothing on its own. The deliverable is carried by the token census (12 → 0 out-of-grammar, 0 → 12 in-grammar, same 10/1/1 distribution, repo-wide record-created now zero) plus a reverse verification with the direction predicted first: the live rule reports the error for the old token and not the new one, while an unrelated control finding survives both runs — proving the probe kept reading the stack rather than going blind. The mapper measurably goes from zero hook events to afterInsert.
    • Per-site inertness verified against the actual short-circuit (flow.type === 'record_change' is always taken before the token is read), not against the card's claim.
    • Grammar verified at the source (triggerTypeToHookEvents and the rule's VALID_RECORD_TRIGGER copy), located by content rather than the card's stale line numbers.
    • Full gate list run (31 ESLint steps + 22 type-check steps + workspace build/typecheck) — appropriate caution given packages/lint is one of the test-exclusion packages where local-green/CI-red is structurally possible.
    • Scope boundary held: the non-record- family (on_create ×2, on_update ×1, onCreate ×1) untouched, per the ruling.
    • Two acceptance-time repairs by the PM: (1) skip-changeset applied — the PR body claims it was applied but read-back showed zero labels; applied and confirmed. (2) ⚠️ The PR body's claim that the non-record- family "is filed as its own unassigned finding issue" is not yet true — no matching issue exists as of this review (searched all issues created since 07:00Z). Dev: file it (search-first per the filing discipline) and return the real issue number in your report's out_of_scope_findings, or correct the claim. The acceptance of this PR does not depend on it, but the claim and the record must converge before the report is closed out.

    Ready + auto-merge armed 07:53Z.


    Generated by Claude Code

  4. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    Collaborator

    Close-out of the acceptance's open item — the claim and the record have converged.

    The out-of-scope family is now filed as #6637 (07:53Z, minutes after the acceptance flagged it): finding-labelled, unassigned, no self-applied domain label (correctly left to the triage seat), search-first documented in the body. It also corrects this card's own census: of the 4 non-record--prefixed tokens this card counted as one group, only one is the silent-degradation shape (onCreate in a CLI test fixture); the other three are a FlowRuntimeState inventory field that merely shares the name (×2, pass-through assertion) and a deliberately-invalid literal inside the #1535 unknown-key rejection test (@ts-expect-error, correct as written). So the follow-up question is one site, not four — the kind of correction that changes what triage should conclude.

    Dev's final report also confirms: CI converged with 33 check runs zero failures (both gate jobs read by their own conclusions), label union preserved through the bot settle (size/s, tests, skip-changeset), worktree cleaned. PR #6636 is in the merge queue; the issue closes on landing. Nothing further owed on this card.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions