Skip to content

Rectify: Mention Guard Prose-Zone Immunity#3358

Merged
Trecek merged 2 commits into
developfrom
mention-guard-safe-tokens-has-no-python-decorator-exemptions/3330
May 31, 2026
Merged

Rectify: Mention Guard Prose-Zone Immunity#3358
Trecek merged 2 commits into
developfrom
mention-guard-safe-tokens-has-no-python-decorator-exemptions/3330

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 31, 2026

Summary

The plan consolidates three duplicate _strip_examples / _strip_code_fences implementations (in tests/docs/test_banned_phrases.py, tests/docs/test_glossary_spelling.py, and tests/skills/test_investigate_design_intent_contracts.py) into a single shared strip_markdown_code_regions() utility in tests/_helpers.py. The mention-guard test (test_no_hardcoded_username_mentions_in_skill_mds) is updated to skip code zones, eliminating false positives from Python decorators in code examples. New regression tests and unit tests for the utility are added. The false-claim comment about decorator exclusion in the lookbehind is corrected.

Requirements

Conflict Resolution Decisions

The following files had merge conflicts that were automatically resolved.

Changed Files

New (★):

  • tests/arch/test_helpers_exports.py
  • tests/test_helpers_strip.py

Modified (●):

  • tests/CLAUDE.md
  • tests/_helpers.py
  • tests/arch/CLAUDE.md
  • tests/docs/test_banned_phrases.py
  • tests/docs/test_glossary_spelling.py
  • tests/skills/test_investigate_design_intent_contracts.py
  • tests/workspace/test_skills.py

Closes #3330

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/remediation-20260530-152530-777371/.autoskillit/temp/rectify/rectify_mention_guard_prose_zone_immunity_2026-05-30_153500.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
rectify* opus[1m] 1 9.4k 20.8k 5.0M 125.7k 387 151.7k 23m 44s
review_approach* sonnet 1 76 7.6k 342.8k 50.1k 80 39.6k 5m 13s
dry_walkthrough* opus 2 82 13.4k 695.1k 54.0k 146 83.9k 8m 50s
implement* sonnet 2 677 18.9k 2.6M 161.4k 248 95.9k 9m 52s
audit_impl* sonnet 2 1.1k 25.8k 617.4k 58.3k 61 82.8k 8m 8s
make_plan* sonnet 1 81 4.2k 297.9k 43.4k 29 31.5k 1m 53s
prepare_pr* sonnet 1 56.3k 2.5k 182.9k 31.0k 17 15.9k 1m 14s
compose_pr* sonnet 1 46.9k 1.7k 213.8k 31.0k 14 15.6k 54s
review_pr* sonnet 1 126 32.9k 784.6k 84.2k 55 69.4k 7m 26s
resolve_review* sonnet 1 151 19.5k 950.3k 72.7k 51 57.6k 11m 24s
Total 114.8k 147.3k 11.6M 161.4k 643.8k 1h 18m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
rectify 0
review_approach 0
dry_walkthrough 0
implement 217 11822.8 441.8 86.9
audit_impl 0
make_plan 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 0
Total 217 53505.4 2966.8 678.7

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 9.4k 20.8k 5.0M 151.7k 23m 44s
sonnet 8 105.4k 113.1k 6.0M 408.2k 46m 6s
opus 1 82 13.4k 695.1k 83.9k 8m 50s

Trecek and others added 2 commits May 30, 2026 17:22
…n guard false positives

Adds strip_markdown_code_regions() to tests/_helpers.py as a single
shared utility for stripping fenced code blocks and inline code spans
from markdown text before content scanning.

- Replaces three independent duplicate implementations (_strip_examples
  in test_banned_phrases.py and test_glossary_spelling.py, and
  _strip_code_fences in test_investigate_design_intent_contracts.py)
- Updates test_no_hardcoded_username_mentions_in_skill_mds to skip code
  zones via a line-by-line fence toggle with inline stripping per-line,
  preserving accurate line numbers in violation messages
- Fixes the false positive bug where Python decorators (@DataClass,
  @pytest.mark.parametrize) in code fences would trigger the @-mention
  guard test
- Corrects the misleading comment claiming the lookbehind prevents
  matching decorator patterns (it only prevents email local-parts)
- Adds regression tests (decorators in fences = no violation, prose
  @-mention = violation)
- Adds tests/arch/test_helpers_exports.py to guard against silent
  removal of the shared utility
- Adds tests/test_helpers_strip.py with unit tests for the utility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gions fail-open contract

Verifies that an unclosed fence is not consumed by strip_markdown_code_regions,
preserving all prose before, inside, and after the unclosed fence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Trecek Trecek force-pushed the mention-guard-safe-tokens-has-no-python-decorator-exemptions/3330 branch from 2b292cd to 9b5bcbb Compare May 31, 2026 00:22
@Trecek Trecek added this pull request to the merge queue May 31, 2026
Merged via the queue into develop with commit 3f5dae0 May 31, 2026
3 checks passed
@Trecek Trecek deleted the mention-guard-safe-tokens-has-no-python-decorator-exemptions/3330 branch May 31, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant