Skip to content

feat!: Add Copilot content exclusion set and enterprise endpoints - #4675

Merged
gmlewis merged 2 commits into
google:masterfrom
JamBalaya56562:feat/4526-copilot-content-exclusion
Oct 26, 2026
Merged

gmlewis merged 2 commits into
google:masterfrom
JamBalaya56562:feat/4526-copilot-content-exclusion

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: CopilotOrganizationContentExclusionDetails is renamed to CopilotContentExclusionDetails.

Fixes #4526.
Closes: #4527

This takes over #4527 by @Tens1des, which has had no activity since the review on 2026-09-08. Thank you, @Tens1des, for the original implementation! #4526 is assigned to @Tens1des, so if you would like to finish #4527 yourself, I'm happy to close this one.

Changes from #4527:

  • Addressed the review by @alexandear: removed the NOTE about the breaking change from the doc comment, and the set methods now take CopilotSetContentExclusionDetailsRequest and return CopilotSetContentExclusionResponse.
  • In the OpenAPI descriptions, each rule in the PUT request body is anyOf a path string, {"ifAnyMatch": [...]}, or {"ifNoneMatch": [...]}, so CopilotSetContentExclusionDetailsRequest is map[string][]*CopilotContentExclusionRule, and CopilotContentExclusionRule.MarshalJSON encodes a rule with Path set as a plain string. The GET responses only contain path strings, so both GET methods return CopilotContentExclusionDetails (map[string][]string), as @gmlewis asked in feat!: Add Copilot content exclusion set and enterprise endpoints #4527.

New methods:

  • SetOrganizationContentExclusionDetails (PUT /orgs/{org}/copilot/content_exclusion)
  • GetEnterpriseContentExclusionDetails (GET /enterprises/{enterprise}/copilot/content_exclusion)
  • SetEnterpriseContentExclusionDetails (PUT /enterprises/{enterprise}/copilot/content_exclusion)

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.63%. Comparing base (a636dc9) to head (93f28b8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4675   +/-   ##
=======================================
  Coverage   98.63%   98.63%           
=======================================
  Files         201      201           
  Lines       18912    18943   +31     
=======================================
+ Hits        18653    18684   +31     
  Misses        259      259           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

Comment thread github/copilot_test.go
Comment on lines +1273 to +1279
func TestCopilotContentExclusionRule_Marshal(t *testing.T) {
t.Parallel()

testJSONMarshalOnly(t, CopilotContentExclusionRule{Path: new("/src/some-dir/kernel.rs")}, `"/src/some-dir/kernel.rs"`)
testJSONMarshalOnly(t, CopilotContentExclusionRule{IfAnyMatch: []string{"*.env"}}, `{"ifAnyMatch":["*.env"]}`)
testJSONMarshalOnly(t, CopilotContentExclusionRule{IfNoneMatch: []string{"*.go", "*.md"}}, `{"ifNoneMatch":["*.go","*.md"]}`)
}

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.

Could you please write table-driven tests?

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.

Done in 93f28b8 — converted to a table-driven test with subtests. Thanks!

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra 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.

LGTM

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 26, 2026
@gmlewis

gmlewis commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis
gmlewis merged commit 5c03e76 into google:master Oct 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Copilot content exclusion set/get enterprise and org set endpoints

3 participants