aidd-lint rule: cross-section-duplication #103

Closed
opened 2026-07-23 11:31:06 +00:00 by jared · 3 comments
Owner

Problem

The same rule stated in two sections of one file, drifting independently. Verbatim, plugins/os-sdlc/skills/mine-lints/SKILL.md as of 5ea6bbf -- lines 54-56 (Workflow step 4):

   Before filing, verify internal consistency: the Correction diff must actually clear the
   offense under the ticket's own stated algorithm, and the algorithm's hit-count claims must
   match its own examples

and lines 75-76 (Forbidden Moves):

- Do not file a ticket whose Correction diff doesn't actually clear its own Detection
  algorithm, or implement a cop straight from a raw finding instead of its ticket.

Fixed in c6a4177 by moving the check into the ticket template and pointing at it.

Detection

  • Inputs: a markdown file; its top-level (##) section map.
  • Algorithm:
    1. Normalize prose lines: lowercase, strip markdown syntax and punctuation, tokenize.
    2. For every pair of normalized lines with >= 8 tokens each located in different top-level sections, compute token-set Jaccard similarity.
    3. Similarity > 0.8 -> one offense naming both locations.
  • Failure message (verbatim contract): "<file>:<line>: restates <file>:<other-line> (section '<other-section>'). State the rule once; point from the other location."

Correction

-   Before filing, verify internal consistency: the Correction diff must actually clear the
-   offense under the ticket's own stated algorithm, and the algorithm's hit-count claims must
-   match its own examples (both failed last batch -- tickets #87 and #89 shipped
-   self-contradictions that only surfaced during implementation).
+   ...body following `plugins/os-sdlc/reference/lint-rule-ticket-template.md` exactly,
+   including its pre-filing consistency check.

Pass/fail examples

  • Must fail: the 54-56 / 75-76 pair above (shared tokens: correction, diff, clear, offense, algorithm...).
  • Must pass: two sections that merely share short phrases under 8 tokens; a Workflow step and the Forbidden Move "Do not commit" (below token minimum).

Provenance

mine-lints simplification 2026-07-23, commit c6a4177. Part of the aidd-lint system (see mapping ticket).

Implementation plan

Same markdown-lint infra; TDD; threshold (0.8, 8 tokens) in .aidd-lint.yml config, tunable.

## Problem The same rule stated in two sections of one file, drifting independently. Verbatim, `plugins/os-sdlc/skills/mine-lints/SKILL.md` as of 5ea6bbf -- lines 54-56 (Workflow step 4): ``` Before filing, verify internal consistency: the Correction diff must actually clear the offense under the ticket's own stated algorithm, and the algorithm's hit-count claims must match its own examples ``` and lines 75-76 (Forbidden Moves): ``` - Do not file a ticket whose Correction diff doesn't actually clear its own Detection algorithm, or implement a cop straight from a raw finding instead of its ticket. ``` Fixed in c6a4177 by moving the check into the ticket template and pointing at it. ## Detection - **Inputs:** a markdown file; its top-level (##) section map. - **Algorithm:** 1. Normalize prose lines: lowercase, strip markdown syntax and punctuation, tokenize. 2. For every pair of normalized lines with >= 8 tokens each located in *different* top-level sections, compute token-set Jaccard similarity. 3. Similarity > 0.8 -> one offense naming both locations. - **Failure message (verbatim contract):** `"<file>:<line>: restates <file>:<other-line> (section '<other-section>'). State the rule once; point from the other location."` ## Correction ```diff - Before filing, verify internal consistency: the Correction diff must actually clear the - offense under the ticket's own stated algorithm, and the algorithm's hit-count claims must - match its own examples (both failed last batch -- tickets #87 and #89 shipped - self-contradictions that only surfaced during implementation). + ...body following `plugins/os-sdlc/reference/lint-rule-ticket-template.md` exactly, + including its pre-filing consistency check. ``` ## Pass/fail examples - **Must fail:** the 54-56 / 75-76 pair above (shared tokens: correction, diff, clear, offense, algorithm...). - **Must pass:** two sections that merely share short phrases under 8 tokens; a Workflow step and the Forbidden Move "Do not commit" (below token minimum). ## Provenance mine-lints simplification 2026-07-23, commit c6a4177. Part of the aidd-lint system (see mapping ticket). ## Implementation plan Same markdown-lint infra; TDD; threshold (0.8, 8 tokens) in `.aidd-lint.yml` config, tunable.
Author
Owner

Implemented on branch aidd-lint/tier-1 (plugins/os-aidd-lint, cop: cross_section_duplication.rb). 55-test suite green; report-only corpus scan run. Awaiting human review — open items noted on #109.

Implemented on branch aidd-lint/tier-1 (plugins/os-aidd-lint, cop: cross_section_duplication.rb). 55-test suite green; report-only corpus scan run. Awaiting human review — open items noted on #109.
Author
Owner

Implemented on branch aidd-lint/tier-1 (plugins/os-aidd-lint, cop: cross_section_duplication.rb). 55-test suite green; report-only corpus scan run. Awaiting human review — open items noted on #109.

Implemented on branch aidd-lint/tier-1 (plugins/os-aidd-lint, cop: cross_section_duplication.rb). 55-test suite green; report-only corpus scan run. Awaiting human review — open items noted on #109.
Author
Owner

This was generated by AI during triage.

Implemented on main: lib/aidd_lint/cops/cross_section_duplication.rb, registered in registry.rb (CrossSectionDuplication), tests at tests/cops/cross_section_duplication_test.rb (4 runs, 10 assertions, 0 failures). Closing.

> *This was generated by AI during triage.* Implemented on main: `lib/aidd_lint/cops/cross_section_duplication.rb`, registered in `registry.rb` (CrossSectionDuplication), tests at `tests/cops/cross_section_duplication_test.rb` (4 runs, 10 assertions, 0 failures). Closing.
jared closed this issue 2026-08-01 16:43:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#103
No description provided.