Skip to content

Revert STIG source file handling changes#122

Merged
sketch0395 merged 1 commit into
mainfrom
revert-stig-file-changes
Jun 1, 2026
Merged

Revert STIG source file handling changes#122
sketch0395 merged 1 commit into
mainfrom
revert-stig-file-changes

Conversation

@sketch0395

Copy link
Copy Markdown
Collaborator

This pull request refactors and simplifies the source file selection and batching logic in run-stig-assessment.py, with the goal of making file inclusion rules clearer and reducing the complexity of handling large files. The changes also tighten file size limits, update directory exclusion logic, and streamline how files are selected and presented for assessment.

File inclusion and exclusion logic:

  • Simplified the SOURCE_EXTENSIONS and INCLUDE_FILENAMES sets to remove rarely used or redundant file types and combined related categories for easier maintenance. (scripts/shell/run-stig-assessment.py scripts/shell/run-stig-assessment.pyL85-R105)
  • Refactored the _is_excluded_dir function to use a more concise check for hidden and excluded directories, removing the _ALLOWED_HIDDEN_DIRS variable and inlining its logic. (scripts/shell/run-stig-assessment.py scripts/shell/run-stig-assessment.pyL337-R321)

File size and batching policy:

  • Reduced MAX_FILE_BYTES from 100,000 to 50,000, so only files up to 50 KB are included in the assessment; files above this size are now skipped entirely instead of being truncated. (scripts/shell/run-stig-assessment.py [1] [2]
  • Updated the file collection logic to skip files exceeding MAX_FILE_BYTES instead of truncating them, simplifying content handling and reducing the risk of partial file analysis. (scripts/shell/run-stig-assessment.py scripts/shell/run-stig-assessment.pyL374-L396)

Batch construction and context management:

  • Removed the excerpting logic for over-budget files in build_code_context; now, files are either fully included or fully skipped, and a note is added listing any files omitted due to context limits. (scripts/shell/run-stig-assessment.py scripts/shell/run-stig-assessment.pyL777-L823)
  • Clarified comments and logic regarding the context budget, reflecting the latest model capabilities and simplifying the rationale for batch size and file inclusion. (scripts/shell/run-stig-assessment.py [1] [2]

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Copilot AI review requested due to automatic review settings June 1, 2026 12:50
@sketch0395 sketch0395 merged commit 943f7ea into main Jun 1, 2026
1 of 2 checks passed
@sketch0395 sketch0395 deleted the revert-stig-file-changes branch June 1, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants