Skip to content

fix(detection): search policy body text in search_policies - #208

Open
rudycelekli wants to merge 1 commit into
uber:mainfrom
rudycelekli:fix/detection-policy-search-body
Open

rudycelekli wants to merge 1 commit into
uber:mainfrom
rudycelekli:fix/detection-policy-search-body

Conversation

@rudycelekli

Copy link
Copy Markdown

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related issue: N/A (found by reading the code; reproduced on main at 6b33dff)

What changed?
Add the policy field to the searched text (requirements still searched if present).

Why?
Context_providers/policy_store_server.py search_policies (line 65) searches name + description + requirements, but no entry in context_providers/data/policy_store.yaml has requirements; the main text is under policy. The reasoning agent's search_policies(["least privilege"]) returns 0 matches although 4 policies contain that phrase ("multi-factor": 0 vs 2, "MCP requests": 0 vs 9).

How did you test it?

  • Reproduction: two new tests in tests/test_policy_store.py (synthetic data + shipped policy store). main: 2 failed; branch: 3 passed.
  • Test suite: pytest tests/ -q -> 258 passed.
  • Not tested: a live ADR reasoning run (search results the agent sees will now be broader).

Potential risks
The change only affects the input described above; other paths go through the same code as before, and the component's existing tests pass.

AI assistance: Claude Code (model Claude Opus 5.5) found this bug, wrote the fix and test, and drafted this description; submitted by @rudycelekli.

🤖 Generated with Claude Code

policy_store.yaml keeps each policy's main text under `policy`, but
search_policies only looked at name, description, and a `requirements`
field that no policy has. Keywords from the policy body, such as
"least privilege" or "multi-factor", never matched. Include the
`policy` text in the searched fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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