Skip to content

Add Repository Custom Instructions validation (existence + 4000-char limit)#9

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/validate-custom-instruction-file-limit
Draft

Add Repository Custom Instructions validation (existence + 4000-char limit)#9
Copilot wants to merge 3 commits into
masterfrom
copilot/validate-custom-instruction-file-limit

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

New Feature

GitHub Copilot silently truncates or ignores Repository Custom Instructions files that exceed 4,000 characters. This adds an explicit validation script that catches violations across all repositories and halts with a non-zero exit code.

What does this feature do?

  • Existence check: fails if no custom instruction files are found in any scanned repository
  • Size check: fails if any file exceeds 4,000 chars; emits a timestamped Excel report listing each violation
  • All error messages link directly to the GitHub Copilot documentation

Implementation details

validate_custom_instructions.py — follows the same patterns as existing assessment scripts (parallel ThreadPoolExecutor, rate-limit guard, CONFIG dict):

Files checked per repo:
  .github/copilot-instructions.md
  .github/instructions/*.instructions.md

Exit codes:
  0 — all validations passed
  1 — existence or size validation failed

Excel report (custom_instructions_violations_YYYYMMDD_HHMMSS.xlsx) columns: Repository · File Path · Character Count · Limit · Excess Characters · GitHub Copilot Rule. Falls back to CSV when openpyxl is not installed.

test_validate_custom_instructions.py — 19 unittest tests covering: no file found, file within limit, file over limit, exact-boundary (4000 chars valid / 4001 invalid), multi-repo violations, instructions/ directory scanning, Excel output integrity.

Other changes

  • .gitignore — added *.xlsx
  • README.md / AGENTS.md — documented new script, install step (pip install openpyxl), exit codes, and output format

Copilot AI changed the title [WIP] Validate 4000 character limit for custom instruction files Add Repository Custom Instructions validation (existence + 4000-char limit) May 12, 2026
Copilot AI requested a review from tcardosoMSFT May 12, 2026 14:04
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.

Validar se algum arquivo de custom instruction 4000 caracteres limite

2 participants