Skip to content

Add first-class CODEOWNERS indexing and structural search #5198

Description

@Widthdom

Problem

CODEOWNERS is high-value repository structure for review, security, and change-impact workflows, but cdidx does not index it.

This repository's .github/CODEOWNERS is reported as a language_support_candidate; files, search, symbols, and outline cannot inspect its patterns or owners.

Environment

  • origin/main: c642bc4c3dda4ef659df8e6b699e10f61da3c836
  • cdidx v1.44.3, locally built
  • fresh repository index
  • full net8.0 and net9.0 suites pass

Reproduction

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll files \
  --db .cdidx/codeindex.db --path .github/CODEOWNERS --json

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll search '@' \
  --db .cdidx/codeindex.db --path .github/CODEOWNERS --json

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll languages \
  --extension CODEOWNERS --json

All return no indexed language/file/results, while status --json lists the file as an unknown extensionless language-support candidate.

Motivation

First-class CODEOWNERS data would let users and agents answer:

  • Who owns a file or directory?
  • Which patterns mention a team, user, or email?
  • Which rules are broad, ownerless, or overridden later?
  • Which reviewers are relevant to impact/dependency results?
  • Does a sensitive directory lack an effective owner?

Proposed solution

Add an exact-filename codeowners structural language/extractor.

At minimum:

  • recognize supported CODEOWNERS locations and exact filenames;
  • index raw text for ordinary search;
  • emit one ordered rule symbol per pattern;
  • retain owners and source line as structured metadata;
  • support files, search, outline, and symbols --lang codeowners;
  • remove successfully indexed files from unknown-extension diagnostics.

Effective owner resolution for arbitrary paths can be included only if its precedence and syntax are implemented authoritatively; structural extraction must not pretend to implement authorization.

Focused PR scope

One PR should:

  1. add exact-filename detection for CODEOWNERS;
  2. implement a bounded line-oriented parser;
  3. emit rule symbols with pattern, owners, path, order, and line;
  4. preserve raw chunks and useful outline output;
  5. add language capability/catalog/help documentation;
  6. update unknown-extension classification;
  7. expose minimal structured queries through existing symbol/field facilities;
  8. add the bilingual changelog fragment.

Non-goals

  • Do not call GitHub to resolve users or teams.
  • Do not treat CODEOWNERS as an authorization boundary or infer permissions.
  • Do not add every hosting provider's ownership format in this PR.
  • Do not advertise reference/call graph support without meaningful semantics.

Implementation guidance and cautions

  • GitHub searches .github/, repository root, then docs/; document whether cdidx indexes all candidates and which one is effective.
  • Preserve rule order because the last matching rule controls effective ownership.
  • Handle comments, escaped leading #, whitespace, ownerless rules, multiple owners, CRLF, and malformed lines conservatively.
  • CODEOWNERS differs from full .gitignore; do not add unsupported negation or character-range semantics.
  • Bound patterns and owner strings with existing symbol/string budgets.
  • Use a natural rule symbol kind unless a new kind is justified.
  • Keep @org/team, @user, and email owners searchable without treating them as code references.
  • If path matching is added, make precedence and unsupported syntax explicit and tested.

Required tests

  • .github/CODEOWNERS, root CODEOWNERS, and docs/CODEOWNERS.
  • Multiple candidate locations and effective-file precedence.
  • Comments, blank lines, escaped markers, whitespace, and CRLF.
  • Multiple/team/email owners and ownerless rules.
  • Duplicate and overlapping rules where later lines win.
  • Invalid/oversized lines with bounded diagnostics.
  • Files, raw search, symbols, and outline.
  • Status unknown-extension behavior.
  • Incremental add/update/delete and branch-switch indexing.

Acceptance criteria

  • .github/CODEOWNERS appears in files and raw search.
  • Every valid ownership rule has a stable ordered structural result.
  • Pattern and owners are directly queryable.
  • Rule order and effective-file semantics are documented.
  • CODEOWNERS is no longer reported as unknown after a current full scan.
  • No graph capability is advertised unless intentionally implemented.

Duplicate preflight

No open or closed issue was found for first-class CODEOWNERS indexing or structural search.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codedocumentationImprovements or additions to documentationenhancementNew feature or requesttests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions