Repository navigation
fix(validate): stop reading capability words as description-no-when cues #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1ba06a4
0b9fe76
cc8e3f7
fee007b
96705f7
927c4ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ### Fixed | ||
|
|
||
| - **`description-no-when` no longer takes a capability word for a "when" cue** — a description with no | ||
| "when" clause lost the `warn` when it held Japanese `思いつく`/`追いつく`/`こいつ` (read as `いつ`), Chinese | ||
| `耗时调用`/`超时调用`/`延时执行`/`当事人`, or German `Hilft beim …`/`Unterstützt beim …`. Now `いつ` counts only | ||
| before a use verb in the same sentence, `时` after `耗`/`超`/`延` is no cue unless a comma or `请` and a use verb | ||
| follow, and `beim` counts only with `verwenden`, `nutzen`, `benutzen`, `einsetzen`, `aufrufen` (also `verwende`, | ||
| `nutze`, `benutze`, `ruf … auf`, `setz … ein`) in the same sentence, in either order. Run `catalog check` again to see the warnings that come back. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,17 @@ | |
| import re | ||
| from typing import Optional | ||
|
|
||
| # German `beim` is a cue only in a sentence with a use verb, in either order; a full stop that is | ||
| # followed by a capitalised word or an acronym ends the sentence, so `z. B.` does not. | ||
| _DE_S = r"(?:[^.;!?]|\.(?!\s*(?-i:[A-ZÄÖÜ][A-Za-zäöüß])))*?" | ||
| _DE_USE = r"\b(?:verwende[nst]?|nutze[nst]?|benutze[nst]?|einsetzen|aufrufen)\b" | ||
| _DE_BEIM = ( | ||
| rf"{_DE_USE}{_DE_S}\bbeim\b|\bbeim\b{_DE_S}{_DE_USE}|" | ||
| rf"\bruf(?:e|en|t)?\b{_DE_S}\bbeim\b{_DE_S}\bauf\b|\bbeim\b{_DE_S}\bruf(?:e|en|t)?\b{_DE_S}\bauf\b|" | ||
| rf"\bsetz(?:e|en|t)?\b{_DE_S}\bbeim\b{_DE_S}\bein\b|\bbeim\b{_DE_S}\bsetz(?:e|en|t)?\b{_DE_S}\bein\b|" | ||
| rf"\bruf(?:e|en|t)?\b{_DE_S}\bauf\b{_DE_S}\bbeim\b|\bsetz(?:e|en|t)?\b{_DE_S}\bein\b{_DE_S}\bbeim\b" | ||
| ) | ||
|
|
||
| # A "when" clause or use phrase per language: the model chooses a skill from its description alone. | ||
| # Latin cues take word boundaries, CJK cues are substrings; bare 使用 (use) or 用于 (for) are too broad. | ||
| WHEN_CUES = { | ||
|
|
@@ -19,14 +30,14 @@ | |
| r"whenever\b)", | ||
| "es": r"(?<!vez en )\bcuando\b|\bcuándo\b|\bsiempre que\b|\bcada vez que\b|\ben caso de\b|\bal (?:usar|utilizar|invocar|ejecutar)\b", | ||
| "fr": r"\bquand\b(?!\s+même)|\blorsqu\w*|\bdès que\b|\bchaque fois que\b|\ben cas de\b|\blors (?:de|d')", | ||
| "de": r"\bwenn\b|\bbeim\b|\bsobald\b|\bimmer dann\b", | ||
| "de": r"\bwenn\b|" + _DE_BEIM + r"|\bsobald\b|\bimmer dann\b", | ||
| "pt": r"(?<!vez em )\bquando\b|\bsempre que\b|\bcada vez que\b|\bem caso de\b|\bao (?:usar|utilizar|invocar|executar)\b", | ||
| "ru": r"\bкогда\b(?![-‑])|\bкогато\b|\bколи\b|\bвсякий раз\b|\bкаждый раз\b|" | ||
| r"\bпри (?:работе|использовании|необходимости|запросе|наличии|вызове|запуске|получении)\b", | ||
| "zh": r"(?<!任)何时|(?<!任)何時|什么时候|什麼時候|的时候|的時候|(?<![相适適恰应應妥得充担擔])[当當](?![前然即作做成地天日晚年初今中])[^。;!?;!?]{1,80}?(?<![实實同隨随及定按即暂暫不准準])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)[时時](?![间間区區])|(?<![实實同隨随及定按即暂暫不准準])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)[时時][,,]?(?:请|請)?(?:使用|调用|調用|触发|觸發|启用|啟用|激活|运行|運行|执行|執行)|" | ||
| r"适用于[^。]{0,20}?(?:场景|场合|情况|(?<![实實同隨随及定按即暂暫不准準])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)时(?![间間段区區序代]))|適用於[^。]{0,20}?(?:場景|場合|情況|(?<![實実同隨随及定按即暫暂不準准])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)時(?![間间段區区序代]))|(?:适用|適用|使用)(?:场景|場景)[::]|使用时机|使用時機|触发条件|觸發條件|用[户戶](?:[说說](?![明的])|提到(?!的)|要求(?!的)|[请請]求(?!的|数据|數據|时间|時間|参数|參數|内容|內容|日志|日誌|头|頭|量))", | ||
| "zh": r"(?<!任)何时|(?<!任)何時|什么时候|什麼時候|的时候|的時候|(?<![相适適恰应應妥得充担擔])[当當](?![前然即作做成地天日晚年初今中])(?!事人[^。;!?;!?时時]*[耗超延用][时時][^。;!?;!?时時]*(?:[。;!?;!?]|$))[^。;!?;!?]{1,80}?(?<![实實同隨随及定按即暂暫不准準])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)[时時](?![间間区區])|(?<![实實同隨随及定按即暂暫不准準耗超延])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)[时時][,,]?(?:请|請)?(?:使用|调用|調用|触发|觸發|启用|啟用|激活|运行|運行|执行|執行)|[耗超延][时時](?:[,,]\s*(?:请|請)?|[请請])(?:使用|调用|調用|触发|觸發|启用|啟用|激活|运行|運行|执行|執行)|" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| r"适用于[^。]{0,20}?(?:场景|场合|情况|(?<![实實同隨随及定按即暂暫不准準耗超延])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)时(?![间間段区區序代]))|適用於[^。]{0,20}?(?:場景|場合|情況|(?<![實実同隨随及定按即暫暂不準准耗超延])(?<!(?<![水])平)(?<!(?<![没沒])有)(?<!(?<![合来來])[适適临臨])(?<!(?<![较較很过過太更最])小)時(?![間间段區区序代]))|(?:适用|適用|使用)(?:场景|場景)[::]|使用时机|使用時機|触发条件|觸發條件|用[户戶](?:[说說](?![明的])|提到(?!的)|要求(?!的)|[请請]求(?!的|数据|數據|时间|時間|参数|參數|内容|內容|日志|日誌|头|頭|量))", | ||
| "ja": r"(?<!ひ)(?:とき(?!どき|おり|たま|には)|(?<=[^\s、。,,.!?はもがでにをとやか])ときには)|(?<![同当一平瞬即随適臨戦日])(?<!(?<![一-鿿])定)(?<!(?<![一-鿿])常)(?:時に(?!は)|(?<!ある)時は|(?<=[^\s、。,,.!?はもがでにをとやか])時には)|(?<!ほとんどの)(?<!多くの)(?<!大半の)場合(?!によ|分け|の数)|(?:場面|シーン)で(?:使う|起動|発動)|使(?:う|用)タイミング|トリガー[::]|(?:など|」|』|))で(?:起動|発動)|" | ||
| r"(?<![実国交])際(?:に|は)|いつ(?!まで|も|でも|か|の間)", | ||
| r"(?<![実国交])際(?:に|は)|(?<![こそあど思追食つ])いつ(?!まで|も|でも|か|の間)(?=[^。!?!?]{0,20}?(?:使|呼び出|起動|発動|実行|参照|用))", | ||
| "ko": r"(?:(?<=할 )|(?<=하는 )|(?<=한 )|(?<=될 )|(?<=되는 )|(?<=된 )|(?<=받을 )|(?<=받는 )|(?<=받은 )|(?<=인 )|(?<=일 )|(?<=있는 )|(?<=있을 )|(?<=없는 )|(?<=없을 ))경우" | ||
| r"|(?<![그한이])(?<!그 )(?<!이 )때(?![문로때])|언제(?!나)|상황에서|상황이면|트리거(?:\s*(?:키워드|조건|문구|단어))?\s*[::]|트리거(?:가|는)?\s*(?:되면|될 때|되었을 때)|사용 시점|사용 시기|(?<=[가-힣])(?<!(?<![가-힣])매)(?<!현대)(?<!고전)(?<!서울)(?<!부산)(?<!대구)(?<!인천)(?<!광주)(?<!대전)(?<!울산)(?<!세종) 시(?=[\s에,.:]|$)", | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must-fix — German sentence-boundary detection produces incorrect validation verdicts. Trigger:
Beim Deployen mit z. B. GitHub Actions verwende diesen Skill.is rejected, whileNutze das Tool. „Hilft beim Schreiben“ beschreibt seine Funktion.is accepted. Evidence: the negative lookahead blocks the period afterBbecauseGitHubstarts with an uppercase letter followed by another letter, but permits the actual sentence-ending period before„Hilftbecause the quote bypasses that check. Neither example has another matching cue. Impact:catalog checkemitsdescription-no-whenfor the valid instruction and suppresses it for the capability-only description. Handle abbreviations and quoted sentence starts explicitly, and add both regression cases (including warning assertions). Workaround: use an explicitwennclause for instructions. Severity: medium, because this is a concrete but bounded validation-verdict failure.