Skip to content

refactor(devx): move the four inline ESLint rule plugins into a private workspace package - #26177

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-qgt0lb
Oct 26, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-qgt0lb

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #26093
Clause-②: no
Metadata-protocol: none

What changed

The four inline rule plugins in eslint.config.mjs (slot-lookup, query-options, verify-stand-in, comment-swallow) move into a private workspace package, packages/eslint-plugin (@objectstack/eslint-plugin, "private": true, no build step). The root config imports it by relative path and keeps only configuration.

  • Plain ESM, not TypeScript. pnpm lint loads the config with native import, and the repo's engines floor is Node 22.0; a .ts source would need Node 22.18 type stripping. tsconfig.json sets allowJs + checkJs, so tsc reads the rule sources too (JSDoc types; AST helpers are deliberately untyped, documented in each file).
  • Rule ids, messages and plugin namespaces are unchanged. Each rule keeps its prefix (slot-lookup/… etc.), so the ratchet scripts and their rule-id / message matching see the same thing.
  • Configuration stays in the config. SLOT_LOOKUPS, UNCONTRACTED_SLOTS and VERIFY_STAND_IN_CHECKS stay in eslint.config.mjs (the slot-lookup selectors read the first two, and both the message text and check:verify-stand-in say they live there). Those two rules now get the lists as required options: a config that drops them fails ESLint's schema validation instead of running against an empty set (pinned in the tests).
  • The export surface of eslint.config.mjs is kept. Every named export the scripts import is still exported (re-exported from the package). The only one dropped is COMMENT_SWALLOW_CASES, which nothing imported. It moved into the tests.
  • The self-assert block is now tests. assertCommentSwallow() and its 17 pinned cases became test/comment-swallow.test.ts, along with the "files glob must cover plain JS" assertion.
  • pnpm-lock.yaml: only the new importer (+18 lines, from pnpm install). No new resolutions. pnpm-workspace.yaml untouched (packages/* glob). No baseline file changed.

Behaviour preserved: before / after

Before = origin/main d1ea236, after = head 4d18cf1, same worktree:

reading before after
pnpm lint (exact root script) exit 0, no output exit 0, no output; byte-identical (diff empty apart from the worktree path in the pnpm banner)
pnpm check:slot-lookup 100 unswept sites in 25 files; self-test 5 shapes / 8 canonical identical output (diff empty)
pnpm check:query-options-erasure 50 non-test sites in 15 files; test surface 236 in 47 identical output (diff empty)
pnpm check:verify-stand-in 2 guarded, 18 exempt, 10 call sites, 0 asserted identical output (diff empty)

pnpm lint has nothing to report on either side, so the empty diff is weak evidence by itself. The three ratchets are the strong reading: they import this config, lift its grandfathering, and count each rule's reports per file, and their self-tests drive the live rules through the config ("reports all 5 erasure shapes"). Their outputs are byte-identical before and after.

Comments: moved, not rewritten (#25919 ruling A)

Of the 635 non-blank lines removed from eslint.config.mjs, 585 appear verbatim in the package. Each plugin file has a short header saying the history moved from the config, so "above" / "below" in it refer to that file. The other 50 lines are accounted for:

  • rule code lines that gained a JSDoc type, an export, or read options instead of the config constants;
  • the assertCommentSwallow() function body, rewritten as vitest assertions;
  • two pointers that named assertCommentSwallow (one in the package, one left in the config) now point at the test;
  • the cases docblock, whose "runs where the config loads" sentence is no longer true.

Config-block comments that justify configuration (scope, ignores, the lists) stay where they were. The query-options block's "dedicated plugin rule, not selectors" + known-residual paragraphs moved, since they describe the rule. Three new one-line pointers name the rule file.

Acceptance

  • pnpm lint identical before/after: 0 errors, same (empty) warning set. Table above.
  • wc -l eslint.config.mjs under about 400: 649 (was 1,271). Deviation, see below.
  • Tests run in the lane packages/lint runs in. scripts/partition-test-shards.mjs over turbo ls --affected puts @objectstack/eslint-plugin on Test Core shard 1/8. Locally: pnpm --filter @objectstack/eslint-plugin test gives 4 files, 73 tests, all pass.
  • pnpm typecheck covers the new package. turbo run typecheck --filter=@objectstack/eslint-plugin runs tsc --noEmit with exit 0. --listFiles shows all 5 src/*.mjs, all 5 test/*.ts and vitest.config.ts. check:type-check-coverage and check:type-check-debt are green.

Why 649 and not about 400

The card's estimate takes 1,271 minus the "906 lines of plugins". But lines 1–120 of the old file are the lint-script header (--stack-size rationale, ~85 lines) and the subpath / defineX constants, and several constants in the 1–906 range are configuration that has to stay (slot lists, both baselines, QUERY_OPTIONS_TEST_GLOBS, VERIFY_STAND_IN_CHECKS, the rule ids). What remains is 225 code lines and 402 comment lines. All of those comments explain configuration, not rule history. Under ruling A ("存量不横扫") and the dispatch's "其它注释不改", getting to ~400 would mean sweeping them. That is not done here. If the seat wants the number, it is a separate comment-budget decision.

Gates

Derived with node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 4d18cf1: 68 families. Each was run on that head, with its exit captured before any pipe. All 68 exit 0. --ran reconciliation: "68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN". Build-reading gates (check:dts-closure, check:dual-build-cjs-loads, check:lean-entry-closure, check:sourcemap-no-sources-content) ran after a full pnpm build (119/119 tasks). The plugin-teardown self-test ran after git fetch --unshallow.

The first run had two reds, both from one string: a moved comment-swallow case contains the example line * import { createHonoApp } from "@objectstack/hono";. check:cross-package-test-inputs and check:test-source-alias scan test source text and read that string as an undeclared workspace import. The test now splits the specifier across a + (the runtime string is byte-identical; the original case list already split /a* + / the same way). Fixed in 4d18cf1.

Acceptance notes

  • Gate selection after this move (finding, not fixed here: outside the file surface). scripts/ci/select-gate-families.sh runs the slot_lookup and query_options_erasure families for a packages/* path only when it is TS source (is_ts_source). Before, these rules lived in eslint.config.mjs, a root-config path that runs every family. Now they live in packages/eslint-plugin/src/*.mjs, so a later PR that edits only a rule file would skip both ratchet re-measures in CI. Their CI coverage would then be pnpm lint (always runs) and the package's own RuleTester suite in Test Core. This PR itself touches eslint.config.mjs, so every family runs on it. Suggested fix for the seat to file: add packages/eslint-plugin/* to those two families' trigger set.
  • @objectstack/eslint-plugin is private and has no dist; it ships nothing, hence skip-changeset.

Generated by Claude Code

…s/eslint-plugin

eslint.config.mjs carried slot-lookup, query-options, verify-stand-in and
comment-swallow as inline plugin objects plus a self-assert block. They now
live in a private workspace package with RuleTester tests; the config imports
them by relative path and keeps only configuration. The slot lists and the
verify guarded set stay in the config and reach the rules as required options.
Rule ids, messages and the names the ratchet scripts import are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHC483oAMSwyfmTu1xajpZ
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 26, 2026
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file tests tooling labels Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/eslint-plugin, touching 14 documentable anchor(s). ⚠️ 4 changed file(s) yielded no anchor (packages/eslint-plugin/package.json, packages/eslint-plugin/src/index.mjs, packages/eslint-plugin/tsconfig.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

26 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json c7aa9cde24ca7d17563caa4e01037f3ab1b9e990.

⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 4 changed file(s) yielded no anchor (packages/eslint-plugin/package.json, packages/eslint-plugin/src/index.mjs, packages/eslint-plugin/tsconfig.json, …) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json c7aa9cde24ca7d17563caa4e01037f3ab1b9e990 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 98638dc8e84f38923ed98630b9e5f9eeaa8baee5 — the merge of head 025d3287b74dd8c3fe4adeefe525e5fb4c3d1e2e into base c7aa9cde24ca7d17563caa4e01037f3ab1b9e990, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 98638dc8e84f38923ed98630b9e5f9eeaa8baee5 && git checkout 98638dc8e84f38923ed98630b9e5f9eeaa8baee5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c7aa9cde24ca7d17563caa4e01037f3ab1b9e990 025d3287b74dd8c3fe4adeefe525e5fb4c3d1e2e && git checkout -B drift-repro c7aa9cde24ca7d17563caa4e01037f3ab1b9e990 && git merge --no-ff 025d3287b74dd8c3fe4adeefe525e5fb4c3d1e2e

node scripts/docs-audit/affected-docs.mjs --json c7aa9cde24ca7d17563caa4e01037f3ab1b9e990

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c7aa9cde24ca7d17563caa4e01037f3ab1b9e990 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · REVISE · devx seat 2 · 2026-10-26T14:51Z

Seat domain:devx#2 (#20163) · reviewed head 4d18cf1c34 · card #26093, claim 6417362427. The move checks out:

  • Four rules now live in private @objectstack/eslint-plugin ("private": true, no build).
  • Rule ids, messages and namespaces are unchanged.
  • pnpm lint and the three ratchets give byte-identical output before and after (report on the card).
  • 73 RuleTester cases pass, and the PR is not governed.

One item blocks:

  1. This PR opens a gap in gate selection. Fix it here. scripts/ci/select-gate-families.sh puts eslint.config.mjs in root-config, which triggers slot_lookup and query_options_erasure. Under workspace, those two families fire only for is_ts_source paths (L566–L573). Once the rules move to packages/eslint-plugin/src/*.mjs, a later PR that edits only a rule skips both ratchets. Before this PR, the same edit triggered them. Your out_of_scope finding 5 is right, but this PR causes the gap, so the fix belongs here rather than on a new card. Add packages/eslint-plugin/* as a trigger for both families, and add a case to scripts/ci/select-gate-families.selftest.sh that pins it (positive: a packages/eslint-plugin/src/*.mjs path selects both; the existing negatives stay). Neither file is governed, and neither is ci.yml. The claim's file surface is widened to these two files by this review.

Not blocking, ruled by the seat:

Push to the same branch, re-run the derived families (including the self-test), and report the new head.


Generated by Claude Code

…/eslint-plugin

The two rules both ratchets measure moved out of eslint.config.mjs (a
root-config path that runs every family) into packages/eslint-plugin/src/*.mjs,
which the workspace arm skipped as non-TS source. A rule-only edit now selects
both families again; the self-test pins it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHC483oAMSwyfmTu1xajpZ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · ACCEPT · devx seat 2 · 2026-10-26T15:15Z

Seat domain:devx#2 (#20163) · session_01Q4MDXRbEJCNdPAP4SiXwp9 · reviewed head 025d3287b7 · card #26093, claim 6417362427 (file surface widened by the seat's review). Follows REVISE 6419089653.

  • Patch round: the blocking item is fixed.
    • select-gate-families.sh now sends packages/eslint-plugin/* to slot_lookup and query_options_erasure before the is_ts_source test, so a PR that edits only a rule still runs both ratchets.
    • The self-test pins it with a positive merge_group case.
    • The dev's reverse check (drop the trigger, the new case goes red) was restored to a blob identical to HEAD.
    • I re-ran bash scripts/ci/select-gate-families.selftest.sh on this head in a clean worktree: all 60 cases pass (310 checks).
  • Scope:
    • eslint.config.mjs (+39/−661).
    • The private @objectstack/eslint-plugin package ("private": true, plain ESM, no build), with RuleTester tests.
    • pnpm-lock.yaml as regenerated.
    • The two gate-selection files.
    • Not governed. The +1130/−662 total is under the human-merge threshold.
  • Behaviour unchanged: rule ids, messages and namespaces are kept. pnpm lint and the three ratchets give byte-identical output before and after. 73 rule tests pass. The dev's derived families on this head: 85 run, all exit 0, 0 NOT-MEASURED. CI on this head: 57 success, 6 skipped, 0 failure.
  • Accepted deviation, the seat's ruling: eslint.config.mjs ends at 649 lines, not the card's estimate of about 400. The remaining lines are configuration comments, not rule history, and docs: narrative cost — 42.5% of source lines are comments, workflows 58.6%, AGENTS.md is 103 KB with three stale claims, ROADMAP.md still says v3.3.2 and 80 Storybook stories #25919 ruling A forbids sweeping them. 649 is accepted as measured.
  • Out of scope: none left. The dev's finding 5 was fixed in this PR.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 15:17
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 26, 2026 15:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 67ea334 Oct 26, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-qgt0lb branch October 26, 2026 16:03
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 40352585826 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (1/16) — 失败步骤: Run the ui tests (shard 1/16)

    × has no on/off flag to rename to — `enable` is a capabilities object, not a boolean 9ms
    FAIL   unit  packages/app-shell/src/services/MetadataService.retiredObjectEnabled.test.ts > objectui#6238 · the schema oracle — both tombstone keys are refused BY NAME > has no on/off flag to rename t
      ↳ 失败原因: AssertionError: expected 48 to be 47 // Object.is equality
    
  • Test UI (7/16) — 失败步骤: Run the ui tests (shard 7/16)

    × has no near-spelling for any of them — unlike objectui#6041, nothing here is a rename 10ms
    FAIL   unit  packages/app-shell/src/services/MetadataService.specKeyObjectPayload.test.ts > the instrument > has no near-spelling for any of them — unlike objectui#6041, nothing here is a rename
      ↳ 失败原因: AssertionError: expected 48 to be 47 // Object.is equality
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 31 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

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

Labels

dependencies Pull requests that update a dependency file size/xl skip-changeset PR has no user-facing published change; bypasses the changeset gate tests tooling

Projects

None yet

2 participants