Skip to content

fix: normalize license header year format in mcp module#279

Merged
johnnygreco merged 2 commits intomainfrom
johnny/fix/license-header-breaking
Feb 2, 2026
Merged

fix: normalize license header year format in mcp module#279
johnnygreco merged 2 commits intomainfrom
johnny/fix/license-header-breaking

Conversation

@johnnygreco
Copy link
Contributor

@johnnygreco johnnygreco commented Feb 2, 2026

Summary

Fixes license header handling to preserve existing copyright years rather than regenerating them from git history. This prevents incorrect year ranges from appearing after rebases or squash merges.

Changes

Fixed

  • Normalized license header year from 2025-2026 to 2026 in MCP module files:
    • packages/data-designer-engine/src/data_designer/engine/mcp/__init__.py
    • packages/data-designer-engine/src/data_designer/engine/mcp/errors.py

Changed

  • Enhanced scripts/update_license_headers.py to treat existing header dates as authoritative:
    • Added parse_header_start_year() function to extract the start year from existing SPDX headers
    • Modified get_copyright_year_string() to use the existing header as source of truth
    • Git history is now only used as a fallback for files without existing headers

Attention Areas

Reviewers: Please pay special attention to the following:


Description updated with AI

@johnnygreco johnnygreco requested a review from a team as a code owner February 2, 2026 15:35
@greptile-apps
Copy link

greptile-apps bot commented Feb 2, 2026

Greptile Overview

Greptile Summary

This PR corrects license header year formats in the MCP module files and improves the license header update script to preserve existing header dates as authoritative.

Key Changes

  • MCP Module Headers: Changed from 2025-2026 to 2026 in __init__.py and errors.py

    • These files were first introduced in commit e6e58e6 on 2026-02-02
    • The correct format for files created in 2026 is just 2026, not a year range
  • Script Enhancement: Added parse_header_start_year() function and updated get_copyright_year_string() to:

    • Use existing license headers as the authoritative source for start year
    • Only fall back to git history for files without existing headers
    • Ensures consistency across rebases, squash merges, and branch changes

The changes correctly align the MCP module files with the project standard where files created in the current year show only that year (not a range).

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a simple license header normalization
  • The changes are straightforward and correct: (1) MCP files created in 2026 should have "2026" headers, not "2025-2026", (2) the script enhancement properly uses existing headers as authoritative, preventing future year format drift, and (3) no functional code is affected
  • No files require special attention

Important Files Changed

Filename Overview
packages/data-designer-engine/src/data_designer/engine/mcp/init.py Updated license header year from 2025-2026 to 2026
packages/data-designer-engine/src/data_designer/engine/mcp/errors.py Updated license header year from 2025-2026 to 2026
scripts/update_license_headers.py Enhanced script to use existing header as authoritative source for start year

Sequence Diagram

sequenceDiagram
    participant Script as update_license_headers.py
    participant File as MCP Module Files
    participant Git as Git History
    
    Note over Script,File: License Header Update Process
    
    Script->>File: Read file content
    File-->>Script: Return lines with "2025-2026" header
    
    Script->>Script: analyze_file_header(lines)
    Script->>Script: extract_license_header()
    Note over Script: Find existing SPDX header
    
    Script->>Script: parse_header_start_year(header)
    Note over Script: Extract "2025" from "2025-2026"
    
    Script->>Script: get_copyright_year_string(file, 2026, header)
    Note over Script: Use existing header as source of truth
    
    alt Existing header found
        Script->>Script: start_year = 2025 from header
        Note over Script: Header shows 2025-2026
    else No header (fallback)
        Script->>Git: get_file_creation_year()
        Git-->>Script: Return 2026 (creation date)
    end
    
    Script->>Script: Check if start_year >= current_year
    Note over Script: 2025 < 2026, so use range format? NO!
    Note over Script: Files created in 2026 should show "2026" only
    
    Script->>Script: generate_license_header("2026")
    Script->>File: Update header to "2026"
    File-->>Script: Header updated
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@johnnygreco johnnygreco merged commit 3045208 into main Feb 2, 2026
48 checks passed
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