Skip to content

CM-69233 ai guardrails respect ignores#499

Open
Ilanlido wants to merge 3 commits into
mainfrom
CM-69233-ai-guardrails-respect-ignores
Open

CM-69233 ai guardrails respect ignores#499
Ilanlido wants to merge 3 commits into
mainfrom
CM-69233-ai-guardrails-respect-ignores

Conversation

@Ilanlido

Copy link
Copy Markdown
Collaborator

Two fixes so AI guardrails honors .cycode/config.yaml exclusions like
regular scans do:

  • Gate hook block/warn decisions on issue_detected (post-exclusion)
    instead of the raw detections_count, so detections ignored by
    value/sha/rule no longer trigger a block claiming 0 violations.
  • Skip the file-read content scan when the file path is covered by a
    configured path exclusion (cycode ignore --by-path), reusing the same
    check as the file collector.

Ilanlido and others added 2 commits July 21, 2026 18:19
Two fixes so AI guardrails honors .cycode/config.yaml exclusions like
regular scans do:

- Gate hook block/warn decisions on issue_detected (post-exclusion)
  instead of the raw detections_count, so detections ignored by
  value/sha/rule no longer trigger a block claiming 0 violations.
- Skip the file-read content scan when the file path is covered by a
  configured path exclusion (cycode ignore --by-path), reusing the same
  check as the file collector.

Co-Authored-By: Claude Fable 5 <[email protected]>
…tials

test_set_credentials_update_only_client_id left update_oidc_credentials
unmocked, so every test run wrote client_id='new client id' into the
developer's real ~/.cycode/credentials.yaml.

Rewrite the file in seeded-files style: run everything on pyfakefs,
seed real YAML files as the current state, mock only typer.prompt, and
assert on final file contents instead of writer-method calls. This
exercises the real managers/YAML layer and can't miss an unmocked
writer by construction.

The typer app is converted to a click command once at import time —
building it under pyfakefs breaks typer's pathlib.Path parameter
introspection (fake Path is not a subclass of the real one).

Co-Authored-By: Claude Fable 5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

The test seeded a hardcoded POSIX exclusion path, but is_sub_path
compares the raw stored path against os.path.commonpath of the
absolutized paths - on Windows abspath adds the drive prefix, so
'/project/secrets' never matched. Build the paths with
os.path.abspath/join the way  stores them.

Co-Authored-By: Claude Fable 5 <[email protected]>
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