validate-package.py: duplicated pattern section in SKILL.md passes validation (dict key collapse defeats the numbering check)

オープン
#340 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

@TanmayShah29 がすでに取り組んでいます。

2026年11月18日 から。

  • #342 @TanmayShah29 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
github-actions, python
領域
testing, tooling

調査の方向性

Read scripts/validate-package.py and inspect how it parses pattern headings from SKILL.md and README.md. Reproduce the duplicate heading case, then check that validation rejects duplicate numbers in both files before checking the numbering range. The issue names .github/workflows/validate.yml as the CI entry point; done means the validator reports the duplicate clearly and the existing CI check runs it.

索引モデルが issue の本文から書いたものです。

説明

Summary

scripts/validate-package.py collects the pattern headings from SKILL.md (and README.md) into a dict keyed by pattern number:

skill_patterns = dict((int(number), name) for number, name in re.findall(r"(?m)^### ([0-9]+)\. (.+)$", SKILL))
pattern_numbers = list(skill_patterns)
if pattern_count == 0 or pattern_numbers != list(range(1, pattern_count + 1)):
    raise SystemExit(...)

Because the headings go into a dict keyed by number, a duplicated ### N. heading overwrites the first occurrence instead of registering as an extra pattern. The numbering check only ever sees the unique keys, so it cannot detect a duplicated (shadowed) pattern section.

Reproduction

On a clean checkout of v4.0.0 (commit b48c832):

  1. Duplicate one pattern section in SKILL.md verbatim — e.g. copy the whole ### 7. Repeated sentence openings section so SKILL.md contains 27 pattern headings with two §7 sections.
  2. Run the validator:
$ grep -c '### 7\.' SKILL.md
2
$ python3 scripts/validate-package.py
Humanizer package v4.0.0 is valid

Exit code 0 — the package validates despite the duplicated pattern.

Expected

The validator should fail when a pattern number appears more than once in SKILL.md (and likewise for README.md, which is parsed the same way).

Actual

Validation passes. A merge that duplicates or shadows a pattern section would ship green through CI (.github/workflows/validate.yml runs exactly this script).

Related symptom of the same root cause: if the duplicated heading's name differs from the original, the validator does fail, but with a misleading message blaming the README ("Match the README pattern names to SKILL.md: 7: … should be …") rather than reporting the duplicate heading in SKILL.md.

Suggested direction

Collect the matches as a list and check for duplicate numbers explicitly (or compare the number of regex matches against the dict size) before the range check, for both SKILL.md and README.md.

Environment

  • Repo at commit b48c832 (v4.0.0)
  • Validator run locally with Python 3
主要言語
Python
スター
53.9k
フォーク
4.3k
平均マージ
6日 11時間
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

blader/humanizer のほかの issue

blader/humanizer の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。