Skip to content

Expose consent policy validation from authserver - #7348

Merged
ChrisJBurns merged 1 commit into
mainfrom
refactor/consent-policy-boundary
Nov 27, 2026
Merged

ChrisJBurns merged 1 commit into
mainfrom
refactor/consent-policy-boundary

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The embedded runner needs to validate its resolved consent exemptions without depending on an internal authserver package. Expose authserver.ValidateConsentPolicy and use it from both the runner and Config validation. With exemptions configured, the public validator requires at least one upstream; an empty exemption list remains valid regardless of the count.

Type of change

  • New feature (additive Go API)

Test plan

  • git diff --check origin/main..HEAD passed after rebasing.
  • Unit tests (task test): the local run timed out after two minutes before the rebase. The new regression test covers a negative count with and without exemptions.

Does this introduce a user-facing change?

Previously, Go embedders could not call the consent-policy validator on its own. They can now validate a list without resolving client registrations. Existing ToolHive deployments see no change: their upstream count comes from the length of the configured upstream list.

Let the runner validate consent exemptions without importing an internal
package. Reject negative upstream counts when exemptions are configured,
and test that an empty exemption list still needs no upstream.

Co-authored-by: Mecatl <[email protected]>
@jhrozek
jhrozek requested a review from ChrisJBurns as a code owner November 26, 2026 21:26
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Nov 26, 2026
@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.50%. Comparing base (c36c185) to head (f9e05f3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7348      +/-   ##
==========================================
- Coverage   82.50%   82.50%   -0.01%     
==========================================
  Files         938      938              
  Lines       96113    96114       +1     
==========================================
- Hits        79302    79300       -2     
- Misses      16806    16809       +3     
  Partials        5        5              

☔ 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.

@ChrisJBurns
ChrisJBurns merged commit 65dbc4a into main Nov 27, 2026
47 checks passed
@ChrisJBurns
ChrisJBurns deleted the refactor/consent-policy-boundary branch November 27, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants