chore(scripts): standardize copyright headers to canonical 2026 format#2169
chore(scripts): standardize copyright headers to canonical 2026 format#2169WilliamBerryiii wants to merge 1 commit into
Conversation
- update canonical header to `Copyright (c) 2026 Microsoft Corporation. All rights reserved.` - add CopyrightHeader.psm1 shared module with header constants and regex helpers - add -Fix switch to Test-CopyrightHeaders.ps1 for idempotent in-place normalization - apply standardized headers across scripts, skill tests, workflows, and eval specs 📝 - Generated by Copilot
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2169 +/- ##
=======================================
Coverage 81.24% 81.24%
=======================================
Files 127 127
Lines 18831 18831
Branches 12 12
=======================================
Hits 15300 15300
Misses 3528 3528
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Eval Execution |
katriendg
left a comment
There was a problem hiding this comment.
Review summary
Thanks for tackling this — the bulk header standardization and the three-file tooling design (shared CopyrightHeader.psm1, idempotent -Fix, directive-aware placement) look solid. Holding off on approval because 3 CI checks are failing, and all three trace to changes in this PR rather than unrelated infra.
1. PowerShell Lint — 46 × PSUseBOMForUnicodeEncodedFile
The BOM removal strips the UTF-8 BOM from .ps1/.psm1 files that contain non-ASCII characters (emoji like ✅ Repair-FileHeaders also writes BOM-less (Set-Content -Encoding utf8), so fix-mode would re-introduce this on any non-ASCII file it touches.
Suggested fix: restore the BOM on the affected non-ASCII files, and have fix-mode emit utf8BOM when the file content contains non-ASCII characters.
2. PowerShell Tests — new fix-mode test fails
Test-CopyrightHeaders Fix Mode > Excludes plugin files from discovery during fix mode fails on the Linux runner:
Expected 'src/kept.ps1' to be found in collection ... but it was not found.
Looks like a path-normalization / exclude-matching issue on POSIX paths. The new test needs to pass before merge.
3. Eval Validation — generated-spec drift
eval:lint:vally runs Build-AgentBehaviorSpec.ps1 -WhatIf and reports drift. evals/agent-behavior/eval.yaml is banner-marked:
# Generated by Build-AgentBehaviorSpec.ps1 - do not edit by hand.
The header was added to it by hand, but the generator doesn't emit that line, so the committed file no longer matches generator output.
Suggested fix: revert the manual header edit on evals/agent-behavior/eval.yaml and add it (or its directory) to the exclusion list, or update the generator and regenerate. (Schema, text, and safety eval sub-checks all passed.)
Also worth a sweep
- Generated-file handling is inconsistent:
plugins/was excluded, but the generatedeval.yamlwas still edited (cause of #3). Worth checking for other "do not edit by hand" artifacts. - The "Required Automated Checks" in the PR description are all unchecked, with repo-wide linters deferred to CI — and CI is now red on three of them.
Once the BOM handling, the failing fix-mode test, and the generated eval.yaml are sorted and CI is green, this should be good to go.
Description
This PR standardizes copyright headers across the repository to a single canonical 2026 form and adds tooling so the format stays consistent going forward. The header line
# Copyright (c) Microsoft Corporation.becomes# Copyright (c) 2026 Microsoft Corporation. All rights reserved.in 592 files, while the adjacentSPDX-License-Identifier: MITline is preserved everywhere.The bulk of the diff is mechanical one-line header swaps. The substantive work is concentrated in three files that make the standardization repeatable and tested.
Tooling and logic
Get-CanonicalHeaderLinesplus header matching and generation helpers. Both validation and repair now read header text from this single source of truth.-Fixswitch that rewrites non-canonical headers and inserts missing ones in place, using the comment prefix appropriate to each file (#for shell, PowerShell, and Python;//for TypeScript). Fix mode is idempotent; the default behavior remains validation-only.$CopyrightPatternand$SpdxPatternconstants with the shared module, widened the header detection window from the first 10 lines to the first 15 lines to account for shebang and#Requirespreambles, and addedpluginsto the default excluded paths so generated plugin output is not scanned or rewritten.#Requiresdirectives stay first, and the header block is inserted or rewritten beneath them.Tests
Get-CanonicalHeaderLines, TypeScript//prefixes, fix-mode rewrite and insertion, idempotency, shebang preservation, plugin-output exclusion, and acceptance of 2027 headers during validation while fix mode rewrites them to 2026.Mechanical header updates
The remaining files are header-only swaps across .github/skills (skill bash and PowerShell scripts and tests), evals/agent-behavior specs, scripts/tests fixtures and Pester files, .github/workflows, docs/docusaurus sources, and smaller groups under scripts/, .devcontainer/scripts, and .github/instructions. The bash and pester instruction example headers were updated to match the new canonical form. Several PowerShell and test files also had a visible BOM artifact removed from before their first directive.
Related Issue(s)
Related to #2157
Type of Change
Select all that apply:
Infrastructure & Configuration:
Other:
.ps1,.sh,.py)Testing
npm run validate:copyright: 381 files scanned, 381 with headers, 0 missing, 100% compliance.npm run test:ps -- -TestPath "scripts/tests/linting/Test-CopyrightHeaders.Tests.ps1": 55 passed / 0 failed.Checklist
Required Checks
Required Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run validate:skillsnpm run lint:md-linksnpm run lint:psnpm run eval:lint:schemanpm run plugin:generatenpm run docs:testSecurity Considerations
Additional Notes
Header changes are text-only and backwards compatible. The new
-Fixswitch is additive and defaults off, so existing validation-only invocations are unaffected. Repository-wide linters were not run locally for this PR; CI is the gate for those checks.