Skip to content

fix(plugin): deduplicate tracked ignored files in scoped inventories - #1077

Merged
mldangelo-oai merged 2 commits into
openai:mainfrom
LittleYier:fix/deduplicate-scoped-inventories
Sep 30, 2026
Merged

mldangelo-oai merged 2 commits into
openai:mainfrom
LittleYier:fix/deduplicate-scoped-inventories

Conversation

@LittleYier

@LittleYier LittleYier commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The non-diff inventory helper can collect the same tracked, ignored file from both ripgrep and Git when an ignored directory or file is explicitly scoped. Two selected files can therefore produce four inventory rows and an inflated count.

Deduplicate the combined results before writing the inventory. This fixes direct use of the retained helper; the public diff preparation tool already uses a separate, deduplicated path.

Changes

  • Write unique inventory rows in the existing byte-sorted order, preserving path spelling and atomic replacement.
  • Cover repository, directory, and file scopes, including relative paths, ./ prefixes, and absolute directory and file paths.
  • Verify helper-generated totals and distinct paginated items through the inventory reader.
  • Refresh against main while preserving the Git metadata exclusions and their regression tests.

Testing

  • Reproduced against current main: two tracked files in an ignored scoped directory produced four rows; this patch produces two.
  • python -m pytest -q plugins/codex-security/tests/test_generate_in_scope_files.py: 70 passed.
  • node --test plugins/codex-security/mcp-app/tests/test_artifact_inventory.mjs: passed.
  • python -m ruff check --config plugins/codex-security/pyproject.toml plugins/codex-security: passed.
  • python -m ruff format --check --config plugins/codex-security/pyproject.toml plugins/codex-security: passed, 136 files.
  • pnpm --dir sdk/typescript run build:ci: passed.
  • node .github/scripts/check_plugin_source_compatibility.mjs: passed.
  • node --test .github/scripts/test_check_plugin_source_compatibility.mjs: 9 passed.
  • Prettier check for the modified MCP test and git diff --check: passed.

Risk and rollout

Low risk: only duplicate byte-identical inventory rows are removed. Path validation, ordering, and atomic output replacement remain intact. No CLI options or defaults change.

The MCP regression calls the internal helper directly. It verifies totals and pagination without claiming that the current public diff tool or Standard scan workflow reaches the affected non-diff branch.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Copilot AI lite review requested due to automatic review settings September 28, 2026 13:33

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the bug Something isn't working label Sep 28, 2026

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for catching this and adding the regression tests. I confirmed the duplicate rows against main and checked the fix with relative and absolute scopes. The refreshed branch preserves the Git metadata exclusions, and all focused tests and portable source checks pass. This is a small, useful fix to the inventory helper. Looks good to me.

@mldangelo-oai
mldangelo-oai merged commit 4874724 into openai:main Sep 30, 2026
49 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants