Skip to content

拆分 lint rule-explanations.ts(7,567 行)为按规则族的文件加索引 #38666

Description

@objectstack-fleet

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

Filed on the maintainer's word: split card 3 of the large-file plan.

Filing gate: ③ maintainer-directed. Source: maintainer (Warren, os-warren), os-warren's fleet project thread, 2026-11-30T01:18:13Z 「同意,立卡」 and 2026-11-30T01:18:26Z 「按照 fable的方案」, approving the large-file plan of an isolated fable analysis (measured on origin/main f5da514; prior rulings 6624258595 on #29465 and 6897467376 on #33949: a split file carries a facade ceiling, an unsplit file none, "at most a warning"; #33949 closed 11-22 with "a future split that pays for itself can be filed on its own measurement").
Grading: area:build · Task (no behaviour change) · Suggested-grade: p2 · reach: every card that adds a lint rule · evidence: packages/lint/src/rule-explanations.ts 7,567 lines at f5da514, 5,485 → 7,567 in 30 days, 112 commits; 6 open PRs touched it at measurement (most of any file); a data catalog, not a class.
Blocked-by: #38550, #38643, #38650, #38651, #38662

维护者速读

  • 问题:所有 lint 规则的解释写在一个 7,500 行的文件里,测量时有 6 个 PR 同时改它,是全仓最挤的文件。
  • 做什么:按规则族拆成多个文件,再用一个索引文件汇总,只搬不改。
  • 要你做什么:无(超过 3,000 行变更时需您批准)。

Ask

  1. One file per rule family (the families the file's own // ── … ── section headers already mark), beside an index that builds RULE_EXPLANATIONS exactly as today (same keys, same order of insertion if anything reads it).
  2. Move-only: no explanation text changes; os explain <rule> output is byte-identical for every rule.
  3. It is a table, not a facade: no facade-delegation-registry.json row. A sentence in the index header says new families get their own file.
  4. One PR. Start from main after the blockers merge; land before another card opens a PR on the file.

Acceptance

  • os explain for every rule id prints the same bytes before and after (the PR body shows the comparison command and result).
  • Every lint test passes unchanged; the package's public declaration is unchanged.
  • No file in the new set exceeds 2,000 lines.

Not here

  • packages/lint/src/authoring-rules.ts (3,652 lines, 3 open PRs): a later card if it keeps queueing.

Activity

  1. objectstack-fleet commented on Nov 30, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    Triage: lands in packages/lint/src/rule-explanations.ts, split into per-family files plus an index · area:build · domain:spec · Task · p2 · pm:blocked · size M.
    Rationale: split card 3 of the large-file plan, maintainer-directed (「同意,立卡」「按照 fable的方案」, 2026-11-30T01:18Z, quoted in the body). It is the most contended file at the measurement (6 open PRs), so it takes p2. It waits on the body's Blocked-by: line (#38550, #38643, #38650, #38651, #38662). Routed to the area:build lane. Answers knock 7266133804.

  2. added
    domain:spec
    pm:blocked
    priority:p2
    on Nov 30, 2026
  3. objectstack-fleet commented on Nov 30, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    Triage: unlock · pm:blocked → pm:queue · grade unchanged.
    Every Blocked-by: target is merged: PR #38550 at 2026-11-30T11:30:40Z was the last; #38643, #38650, #38651 and #38662 merged earlier today.

  4. added
    pm:queue
    and removed
    pm:blocked
    on Nov 30, 2026
  5. objectstack-fleet commented on Nov 30, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

    Claim: PM loop round 10
    Session: session_01J8VVAmaT5PwLmXgonaxjYG
    Thread session: session_01J8VVAoVoLCk7JiHvytWEqY
    Account: huangyiirene
    Branch: claude/project-thread-bgdog9
    Worktree: objectstack-issue-38666
    Domain: domain:spec
    Seat: repo:objectstack@huangyiirene
    File surface: packages/lint/src/rule-explanations.ts (becomes the index), new per-family files beside it under packages/lint/src/rule-explanations/ (named in the report), any lint test or import that names the moved module path (only if the index cannot keep the path; named in the report), one changeset if the package's build output changes (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default, served default (opus) per the thread step 0 (dispatch-gates --tier: "Model tier — no path-derived mandate"; default tier), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: packages/lint rule-explanations.ts is the most contended file in the repo (7,680 lines, one table) | the maintainer approved the split plan (card filing gate ③) | every card that adds a lint rule
    Thread-read: 7277925353
    Premise: holds (seat's read-only reading at origin/main: blockers #38550, #38643, #38650, #38651, #38662 all merged; 7,680 lines, 65 // ── section headers; no open pull request touches the file)
    Serial constraints cleared: this seat's PR #38789, PR #38792 and PR #38799 (the three it waited on) are merged. rule-explanations.ts is touched by no open PR at claim time. Queued cards that will edit explanation sentences (#38801, #38804) land after this split, on the new files.

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 30, 2026
  7. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

    Claim amendment (of 7295777114): the File surface adds packages/lint/src/rule-explanations.test.ts, the one case at ~142-146 ("the module imports nothing, so its published entry stays free of the rule engine") and no other case.

    At origin/main 3000662 that case asserts the module has no import line and no export-from. An index built from family files must import them, so the card's "every lint test passes unchanged" and "index plus family files" cannot both hold. The seat takes option A: the case is rewritten to the split's equivalent invariant, which keeps its intent (the published entry reaches nothing outside its own files):

    • the index imports only from ./rule-explanations/*.js;
    • every file in that directory imports only from its siblings, or import type from the index;
    • no export-from anywhere.

    The PR shows that the built dist entry stays import-free (no chunk split). Every other lint test stays byte-unchanged. Dodging the regex (option C) is refused.

    This is the one accepted deviation from the card's acceptance list. The seat records it at ACCEPT, and the PR lands by the approver (Tier H by size).

  8. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

    Claim amendment 2 (of 7295777114): the File surface adds two ADR anchor lines, re-pointed by path only. The anchor sentence is untouched, and no anchor-exempt is used:

    • docs/adr/0055-master-detail-controlled-by-parent.md ~194: packages/lint/src/rule-explanations.ts#SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN_EXPLANATION → the family file that now declares it.
    • docs/adr/0141-inter-app-dependency-declared-checked-before-install.md ~124: packages/lint/src/rule-explanations.ts#LIST_VIEW_OBJECT_OUTSIDE_CLOSURE_EXPLANATION → the family file that now declares it.

    check:adr-symbol-anchors resolves a symbol at its declaration site, and the gate's own remedy for a moved mechanism is to re-anchor it where it now lives. Re-declaring the names in the index to satisfy the resolver (option B) is refused. check-handover.mjs --inflight on both files: no overlap read. docs/adr/** makes the PR governed. It is Tier H by size already, so the landing route does not change.

  9. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAoVoLCk7JiHvytWEqY
    os-dev-report

    {
     "issue": 38666,
     "status": "done",
     "branch": "claude/project-thread-bgdog9",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/38808",
     "head": "22efc34785b40c1b4da2883988c71452d2fbd4b5",
     "session": "session_01J8VVAoVoLCk7JiHvytWEqY",
     "premise_still_valid": true,
     "summary": "Move-only split of packages/lint/src/rule-explanations.ts (7,680 lines at 3000662c) into packages/lint/src/rule-explanations/ with 66 family files (65 section headers + field-consumers.ts) and shared.ts (UNPROVISIONED_ANCHOR_CAUSE, UNPROVISIONED_ANCHOR_REMEDY, AGGREGATE_PAIR_ROWS); rule-explanations.ts is the index with the RULE_EXPLANATIONS literal unchanged (same key order). Moved entries: security-owd-unset into security-posture.ts, seed-value-outside-state-machine under its empty header in seed-state-machine.ts. Within amendments 7295823844 (one test case) and 7296411486 (two ADR anchor paths); patch changeset because bundled JS bytes change.",
     "files_changed": {
      "index": "packages/lint/src/rule-explanations.ts",
      "families_dir": "packages/lint/src/rule-explanations/",
      "family_files": [
       "action-dispatch-contract.ts",
       "action-locations.ts",
       "action-name-refs.ts",
       "ai-agent-authoring.ts",
       "ai-context.ts",
       "ai-surface-references.ts",
       "analytics-members.ts",
       "approval-approvers.ts",
       "assignment-rules.ts",
       "capability-references.ts",
       "chart-bindings.ts",
       "cli-rule-ids.ts",
       "component-props.ts",
       "component-types.ts",
       "connector-credential-literals.ts",
       "dashboard-action-refs.ts",
       "dashboard-widget-options.ts",
       "data-model.ts",
       "dataset-references.ts",
       "empty-combinators.ts",
       "field-consumers.ts",
       "filter-tokens.ts",
       "flow-anti-patterns.ts",
       "flow-credential-literals.ts",
       "flow-reference-syntax.ts",
       "flow-template-paths.ts",
       "flow-trigger-readiness.ts",
       "form-items.ts",
       "functional-completeness.ts",
       "knowledge-source.ts",
       "list-view-field-refs.ts",
       "list-view-mode.ts",
       "list-view-sort-search.ts",
       "liveness-ledgers.ts",
       "managed-api-methods.ts",
       "mapping-connector-source.ts",
       "mapping-target-fields.ts",
       "nav.ts",
       "object-field-refs.ts",
       "object-references.ts",
       "org-axis-red-lines.ts",
       "page-field-bindings.ts",
       "page-source-styling.ts",
       "page-variables.ts",
       "page-visualization-bindings.ts",
       "predicate-path-refs.ts",
       "preset-comparands.ts",
       "publish-time-inert-refusals.ts",
       "react-page-props.ts",
       "record-title.ts",
       "record-writes.ts",
       "related-list-refs.ts",
       "report-date-range.ts",
       "report-runtime-filter.ts",
       "retired-permission-residue.ts",
       "rls-and-sharing.ts",
       "security-posture.ts",
       "seed-state-machine.ts",
       "semantic-roles.ts",
       "shared.ts",
       "transfer-cascades.ts",
       "translations.ts",
       "validation-rule-compile.ts",
       "view-containers.ts",
       "view-refs.ts",
       "visibility-predicates.ts",
       "widget-bindings.ts"
      ],
      "shared_file": "packages/lint/src/rule-explanations/shared.ts",
      "test": "packages/lint/src/rule-explanations.test.ts (case 'the module imports nothing' only)",
      "adr": [
       "docs/adr/0055-master-detail-controlled-by-parent.md (1 anchor path)",
       "docs/adr/0141-inter-app-dependency-declared-checked-before-install.md (1 anchor path)"
      ],
      "changeset": ".changeset/38666-lint-rule-explanations-by-family.md"
     },
     "line_budget": {
      "changed_lines": 15299,
      "additions": 7971,
      "deletions": 7328,
      "files": 72,
      "largest_new_file": "record-writes.ts 623",
      "index_lines": 745,
      "over_2000": 0,
      "tier": "H (over 3,000 changed lines; docs/adr governed)"
     },
     "tests": "os explain for all 292 RULE_EXPLANATIONS ids, CLI built at 3000662c, lint dist base vs head: diff -r clean, manifest sha256 c0705a6e... both sides; JSON.stringify(RULE_EXPLANATIONS) ESM+CJS sha256 d031c3c5... both sides; cmp of all 8 packages/lint/dist *.d.ts/*.d.cts: IDENTICAL x8; dist/rule-explanations.{js,cjs} import/require count 0/0; at 939ffdd2: lint build exit 0, typecheck exit 0, vitest 255 files / 10185 tests passed; ablation (ablation-replace.mjs, 3 legs on the rewritten case): all red, all restored to HEAD.",
     "gates": "dispatch-gates --commands: 77 derived (71 at be77abe2 + 6 at 22efc3478); --ran: 77 derived, 75 run (all exit 0 on final record), 2 NOT-MEASURED (check:dual-build-cjs-loads, check:published-readme-exports: PREREQUISITE NOT MET exit 3, need whole-repo dist). Cleared reds: check:adr-symbol-anchors (fixed 22efc3478), check-plugin-teardown-shape --self-test (shallow clone, green after fetching fixture commit). CI check runs: pending at report time, read from PR #38808.",
     "deviations": [
      "Dispatch order said dispatch an os-dev subagent; implemented in the thread per dispatch-runbook card-thread rule (seat confirmed).",
      "Gate batch 31-71 ran past the 600s foreground cap and finished as a background job (results read after completion)."
     ],
     "mcp_calls": "0",
     "api_writes": "1 relay stroke: pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST issues/38808/assignees), request fw-20261201T004729Z-025452, run 46548093398; plus this report comment",
     "classifier_refusals": [],
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: none · noted, not filed: packages/lint/tsup.config.ts and packages/cli/src/utils/format.ts comments say the entry imports nothing; still true of the published bundle"
     ]
    }
  10. added a commit that references this issue on Dec 1, 2026
    1aa9c57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:builddomain:specpm:dispatchedpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions