🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Improve GitLab codeowners parsing - #11999

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
daniel.mohedano/codeowners-improvements
Jul 20, 2026
Merged

Improve GitLab codeowners parsing#11999
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
daniel.mohedano/codeowners-improvements

Conversation

@daniel-mohedano

@daniel-mohedano daniel-mohedano commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

  • Extends CODEOWNERS parsing to support GitLab section syntax.
    • Section default owners are inherited by entries that don't declare their own.
    • Owners are combined across all matching sections, including the unnamed section before the first header.
    • Duplicate section names are merged into one single section.
    • Optional-section markers and required approval counts are accepted.
    • Malformed lines are skipped with a warning instead of aborting the parse.
  • GitHub CODEOWNERS behavior is unchanged.

Motivation

CODEOWNERS files using GitLab section syntax did not produce proper ownership for Test Optimization.

Additional Notes

CodeownersTest has been migrated to JUnit5.

test-environment-trigger: skip

Contributor Checklist

Jira ticket: SDCT-690

@daniel-mohedano daniel-mohedano added type: feature Enhancements and improvements comp: ci visibility Continuous Integration Visibility labels Jul 20, 2026
@daniel-mohedano daniel-mohedano changed the title Improve Gitlab codeowners parsing Improve GitLab codeowners parsing Jul 20, 2026
@daniel-mohedano

Copy link
Copy Markdown
Contributor Author

@codex review

@daniel-mohedano

Copy link
Copy Markdown
Contributor Author

@autotest review

@datadog-official

datadog-official Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 89.04%
Overall Coverage: 57.21% (-0.09%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8bbf56a | Docs | Datadog PR Page | Give us feedback!

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

GitLab section support correctly combines owners across all matching sections while preserving GitHub CODEOWNERS "last-match-wins" behavior within sections. Section name merging (case-insensitive), owner inheritance from defaults, and malformed line handling all work as intended. GitHub-style CODEOWNERS files remain unaffected.

Was this helpful? React 👍 or 👎

📊 Validated against 9 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 8bbf56a · What is Autotest? · Any feedback? Reach out in #autotest

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 8bbf56a5c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dd-octo-sts

dd-octo-sts Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.98 s 13.97 s [-0.7%; +0.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.95 s 12.95 s [-0.8%; +0.9%] (no difference)
startup:petclinic:appsec:Agent 16.78 s 16.73 s [-0.7%; +1.4%] (no difference)
startup:petclinic:iast:Agent 16.77 s 16.91 s [-1.6%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 16.62 s 16.64 s [-1.2%; +1.0%] (no difference)
startup:petclinic:sca:Agent 16.89 s 16.85 s [-0.9%; +1.3%] (no difference)
startup:petclinic:tracing:Agent 15.95 s 16.17 s [-2.2%; -0.5%] (maybe better)

Commit: 8bbf56a5 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@daniel-mohedano
daniel-mohedano marked this pull request as ready for review July 20, 2026 12:37
@daniel-mohedano
daniel-mohedano requested a review from a team as a code owner July 20, 2026 12:37

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

PR extends CODEOWNERS parsing to support GitLab section syntax with proper owner inheritance and combination. Comprehensive code analysis and adversarial validation of critical scenarios—section merging, default owner inheritance, character-class pattern detection, and empty ownership handling—confirms implementation is correct. GitHub baseline behavior unchanged. No production defects detected.

Was this helpful? React 👍 or 👎

📊 Validated against 10 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 8bbf56a · What is Autotest? · Any feedback? Reach out in #autotest

@daniel-mohedano

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 20, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-20 12:44:03 UTC ℹ️ Start processing command /merge


2026-07-20 12:44:08 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-07-20 13:44:03 UTC ℹ️ MergeQueue: This merge request was merged

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bbf56a5c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +72 to +76
SectionHeader header = entryBuilder.parseSectionHeader();
if (header != null) {
sectionDefaultOwners = header.getDefaultOwners();
String key = header.getName().trim().toLowerCase(Locale.ROOT);
currentSection = namedSections.computeIfAbsent(key, k -> new ArrayDeque<>());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve flat precedence for GitHub headings

When CodeownersProvider.build feeds a .github/CODEOWNERS or GitHub-style root file through this parser, bracketed headings that were previously ignored now switch currentSection. Because getOwners combines one winning match from every section, a file like * @all before [Docs] and docs/ @docs after it now returns both owners instead of the later docs/ rule winning, which breaks the stated unchanged GitHub behavior for files that use bracketed headings as ignored labels.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

although technically possible, the edge case is based on an incorrectly built github codeowners file while we don't have a good way of determining whether a file is intended for github or gitlab

Comment on lines +74 to +75
if (owners.isEmpty()) {
owners = sectionDefaultOwners;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not inherit defaults for exclusion entries

In a GitLab section with default owners and an exclusion line, this turns an ownerless exclusion such as !generated.rb into a default-owned entry. Since the existing ! matcher matches every path except the excluded one, that entry wins over earlier rules for normal files, while the excluded file falls through to earlier owners instead of being exempt, so sections using exclusions produce incorrect code-owner tags.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

addressing in a follow-up pr

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit b85908e into master Jul 20, 2026
593 of 602 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the daniel.mohedano/codeowners-improvements branch July 20, 2026 13:44
@github-actions github-actions Bot added this to the 1.65.0 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ci visibility Continuous Integration Visibility type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants