Skip to content

fix: tighten pentest substring checks to anchored regex in signals.py#205

Merged
fazxes merged 1 commit intomainfrom
fix/0211-tighten-pentest-regex
Apr 9, 2026
Merged

fix: tighten pentest substring checks to anchored regex in signals.py#205
fazxes merged 1 commit intomainfrom
fix/0211-tighten-pentest-regex

Conversation

@fazxes
Copy link
Copy Markdown
Member

@fazxes fazxes commented Apr 9, 2026

Summary

  • Replace permissive substring matches ("source: pentest" not in fm, "target: recursive" not in fm) with anchored multiline regex patterns in count_pending_pentest_framework_tasks() and count_recent_pentest_tasks()
  • Prevents false matches on compound values like source: pentest-extended-v2 or target: recursive-framework
  • Makes source: and target: field matching consistent with how status: and priority: are already matched in the same file

Changes

File: .recursive/engine/signals.py

  • count_pending_pentest_framework_tasks(): replaced two substring checks with re.search(r"^source:\s*pentest\s*$", fm, re.MULTILINE) and re.search(r"^target:\s*recursive\s*$", fm, re.MULTILINE)
  • count_recent_pentest_tasks(): replaced one substring check with the same anchored source: regex pattern

Test plan

  • make check passes (925 tests, ruff, mypy, dry-run, shell syntax, ASCII checks all green)
  • Verify no existing pentest task files are accidentally excluded (anchored pattern ^source:\s*pentest\s*$ matches canonical frontmatter format)
  • Verify source: pentest-extended-v2 would NOT match the new regex (intended tightening)

Closes task #211.

Replace permissive substring matches ("source: pentest" not in fm and
"target: recursive" not in fm) with anchored multiline regex patterns
(re.search(r"^source:\s*pentest\s*$", ...)) in both
count_pending_pentest_framework_tasks() and count_recent_pentest_tasks().

This prevents false matches on compound values like source: pentest-extended-v2
and makes the matching consistent with how status: and priority: fields are
checked elsewhere in the same file. Closes task #211.
@fazxes fazxes merged commit 845c87c into main Apr 9, 2026
7 checks passed
@fazxes fazxes deleted the fix/0211-tighten-pentest-regex branch April 9, 2026 00:29
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73f072fc25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

for f in archive.glob("[0-9]*.md"):
fm = _read_frontmatter(f)
if not fm or "source: pentest" not in fm:
if not fm or not re.search(r"^source:\s*pentest\s*$", fm, re.MULTILINE):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Count pentest source variants in recent security signal

This exact-match filter drops real pentest tasks that include run metadata in source (for example archived tasks like 0154.md/0169.md/0184.md use source: pentest-...), so they no longer contribute to count_recent_pentest_tasks(). Because count_recent_security_sessions() uses this count as its structured fallback, the anti-loop demotion can fail to trigger when recent pentest work is present but tagged with the existing pentest-* convention and feature keywords are absent.

Useful? React with 👍 / 👎.

fazxes added a commit that referenced this pull request Apr 9, 2026
All four unanchored `^status:\s*pending` patterns now use `^status:\s*pending\s*$`
to prevent false matches on values like `status: pending-review`. Also tightens
`^priority:\s*urgent` to `^priority:\s*urgent\s*$` for consistency. Addresses
task #216 and the meta-reviewer advisory note from PR #205.
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