Skip to content

CopyrightConfig declares a patterns field the Starlark never reads, and its design contradicts every header ruling #1000

Open

Description

@David-Noble-at-work

CopyrightConfig declares a patterns field, defaults it per language, and the Starlark never reads
it
. It is a documented configuration surface that does nothing, and its design contradicts every ruling
made about the header on 2026-09-30.

From cmd/star/extensions/com.noblefactor.star.LintCopyright/extension.yaml:

config:
  path: lint.copyright
  type: CopyrightConfig
  fields:
    patterns: "map[string]interface{}"
  defaults:
    patterns:
      go:
        match: '// SPDX-License-Identifier: \S+\s*\n// Copyright.*All rights reserved\.'
        replace: "// SPDX-License-Identifier: {license}\n// Copyright {holder}. All rights reserved."
      star:
        match: '# SPDX-License-Identifier: \S+\s*\n# Copyright.*All rights reserved\.'
        replace: "# SPDX-License-Identifier: {license}\n# Copyright {holder}. All rights reserved."
      shell:
        ...

lint-copyright.star uses SPDX_PATTERN, COPYRIGHT_PATTERN, build_expected_header and COMMENT_STYLES,
all hardcoded. patterns appears nowhere in it.

Why it cannot simply be implemented

It contradicts three rulings of 2026-09-30, recorded on
#994's plan:

patterns as declared The ruling
One template per language -- a go:, a star:, a shell: entry, each repeating the same sentence with a different comment marker "The template is the text; the comment prefix is the linter's." COMMENT_STYLES derives //, #, -- from the extension, so a consumer writes one template, not one per language they use
{license} and {holder} placeholders -- a fourth templating syntax in a codebase that already ships one Go template syntax, because pkg/op/provider/template already wraps text/template and Starlark already reaches it. "Inventing a {year} mini-syntax would put a second templating language beside one the codebase already has"
A match regex beside the replace -- check and fix described separately, which is how they drift "check_file should be setup to ensure check_file requires exactly what fix_file produces." One renderer, read in two directions. A separate match pattern is the defect of #997 written into the configuration schema

The third row is the sharpest: patterns does not merely fail to implement the design, it encodes the very
divergence #997 exists to remove
. A match regex and a replace template are two descriptions of one
header, and nothing makes them agree.

What #994 Phase 3 does with it

Replaces it. lint.copyright.header carries one Go template for the whole header; patterns is removed.

That is a breaking change to a declared field, which normally deserves a deprecation. It does not here, for a
reason worth stating plainly: the field has never done anything. No configuration can depend on behavior
that does not exist, and a star/config.yaml that sets patterns today is already being ignored. Removing it
changes no behavior; leaving it would keep a documented promise the code does not keep.

How it got here, which is the part worth not repeating

The manifest is the extension's declared interface, and nothing checks that the implementation reads what the
interface declares. patterns was designed, defaulted, documented and never wired up, and no gate noticed for
however long it has been there. enabled, license, holder and exclude are all read; patterns is the
one that is not, and it is indistinguishable from the others by inspection of the manifest alone.

Evidence of completion

  • patterns is removed from CopyrightConfig's fields and defaults.
  • lint.copyright.header replaces it: one Go template for the whole header, rendered by
    pkg/op/provider/template's RenderText, with the comment prefix applied per line by the linter.
  • A test asserts every field CopyrightConfig declares is read by the implementation, so the next dead
    field fails loudly. This is the general defect; patterns is one instance of it.
  • The removal is noted where a consumer would look, since the manifest documented the field.

Related documents

Document What it is
devlore-cli#994 Phase 3 replaces this field; the rulings it contradicts are recorded on that plan
devlore-cli#997 The checker-versus-fixer divergence that patterns' separate match regex would have made permanent
devlore-cli#999 The other contradiction found the same hour: 22 of our files declare MIT and the linter cannot see them
extension.yaml Where patterns is declared and defaulted
9-star-extensions.md Uses CopyrightConfig as its worked example, so it documents the dead field too

Activity

  1. David-Noble-at-work commented on Oct 1, 2026

    @David-Noble-at-work
    ContributorAuthor

    What replaces it, settled 2026-10-01

    patterns is removed and two fields replace it, splitting the one thing it conflated.

    # extension.yaml defaults -- shipped, so a consumer gets these free
    config:
      path: lint.copyright
      fields:
        enabled: bool
        header: string
        languages: "map[string]interface{}"
        exclude: "[]string"
      defaults:
        enabled: false
        languages:
          go:
            extensions: [".go"]
            comments: {line_comment: "//", detect: '^\s*//'}
          shell:
            extensions: [".sh", ".bash", ".zsh"]
            first_line: '^#!.*\b(sh|bash|zsh)\b'
            skip: '^#!'
            comments: {line_comment: "#", detect: '^\s*#'}
          dockerfile:
            filenames: ["Dockerfile", "Containerfile"]
            filename_patterns: ["Dockerfile.*", "*.dockerfile"]
            skip: '^#\s*syntax='
            comments: {line_comment: "#", detect: '^\s*#'}

    header is the text, once, for every language. A literal -- no template fields at all, since the year
    would need a clock no provider exposes and a holder placeholder substitutes one configured string into another.
    languages is identification and comment syntax, which is the part that genuinely varies per file type.

    That is the correction to this issue's third objection. patterns carried one template per language precisely
    because it mixed the text with the markers; separating them means a consumer writes one header and the
    linter supplies // or # from the file's type.

    The shape, and where it comes from

    Measured against how others split the same problem:

    Tool Identification Comment syntax
    VS Code extensions, filenames, filenamePatterns, firstLine a separate language-configuration.json with lineComment, blockComment
    license-maven-plugin extension-to-style map a HeaderType enum with firstLine, beforeEachLine, endLine, skipLinePattern, two detection patterns
    addlicense a switch on extension the same switch

    VS Code's shape is adopted -- language-keyed, so everything about a file type sits together -- plus two fields
    VS Code has no need for, because it only ever inserts a comment and never finds and replaces an existing
    header:

    • skip -- the line the header must follow. ^#! for a script; ^#\s*syntax= for a Dockerfile, whose
      parser directive stops being a directive if anything precedes it. The Linux kernel states the same rule
      in prose, and scripts/checkpatch.pl is a live example: shebang on line 1, SPDX on line 2.
    • detect -- matches a line of a header already present, which is what this issue's match regex was
      reaching for. The difference is that detect finds what to replace while match described what is
      correct
      , and only the second can disagree with replace.

    first_line is consulted only for a path with no extension, after filenames, filename_patterns and
    extensions all fail. It reads the file, so that precedence is what keeps it to a handful of reads rather than
    the whole tree. It is not optional: 14 of Personal's shell scripts have no extension --
    Build-DarwinInitializationPackage, Sync-CommonBuildTools, Install-UnixUserConfiguration -- and
    Install-* is used there for both zsh and PowerShell, so no name pattern separates them. Line 1 does.

    The general defect this issue named, and it stands

    nothing checks whether an extension's implementation reads what its manifest declares

    enabled, license, holder and exclude were read; patterns was not, and the manifest made them
    indistinguishable. A test asserting that every declared field is read is still the right acceptance, and it is
    the part of this issue that outlives the field.

    Note the ledger after this change: license and holder are deleted rather than read, so the same test
    would have to be written against the new field set -- enabled, header, languages, exclude.

    Tracked in #994's plan,
    Requirements 3 and 5, Phases 3 and 5. The design documents are updated:
    9-star-extensions.md uses CopyrightConfig as its worked example and showed this field, and
    configuration.md used it to illustrate !!map tag inference.

  2. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rule it breaks:

    • severity: a Bug whose Severity is blank; a bug is Critical, High, Medium or Low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions