Skip to content

feat(pluginkit): let a plugin hide its admin screens from a caller - #172

Merged
SirLouen merged 3 commits into
mainfrom
feat/171
Nov 22, 2026
Merged

SirLouen merged 3 commits into
mainfrom
feat/171

Conversation

@SirLouen

@SirLouen SirLouen commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Closes #171

What

  • ScreenGate is a new optional interface beside RouteProvider and PublicPathProvider. Its ShowsScreens(ctx) (bool, error) says whether a plugin's admin menu entries and screens show for the caller the context carries.
  • No new function. An application asks through NewHook and Filter, which already recover each call, share one budget and keep the incoming value on an error or a panic.
  • A new feature file shows the way to ask. The plugins whose screens hide are listed in registration order, and a plugin without the interface is never asked. An answer that fails, panics or comes after the budget ran out hides nothing, and the report names its plugin.
  • One line under Unreleased in the CHANGELOG.

Why

A downstream application's plugin can have admin screens that are of no use to a caller yet, for example before the caller has set up the mailbox the plugin reads mail from. Until now a plugin's menu entries were a fixed list in its manifest, and a screen hid only by capability.

Testing Instructions

The repository's own gates cover this. go test ./... in pluginkit/features runs the three new scenarios.

Summary by CodeRabbit

  • New Features
    • Added an optional way for plugins to indicate whether their admin menu entries and screens should be shown in the current context. Plugins that do not provide an answer remain visible.
  • Documentation
    • Documented the new screen visibility option in the changelog.

@greptile-apps

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds the exported ScreenGate interface and documents it. Feature tests cover screen visibility answers, including registration order, unanswered plugins, failures, panics, and answers that exceed the hook budget.

Changes: ScreenGate

Layer / File(s) Summary
ScreenGate contract
pluginkit/pluginkit.go, pluginkit/CHANGELOG.md
Adds ScreenGate.ShowsScreens(ctx) to report whether a caller should see a plugin’s admin menu entries and screens. The Unreleased changelog documents the interface.
Behavior scenarios
pluginkit/features/steps_screen_gate_test.go, pluginkit/features/screen-gate.feature, pluginkit/features/features_test.go
Adds feature scenarios and test steps for ordered hidden-plugin results, unanswered plugins, failed or panicking answers, and answers that exceed the hook budget.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • gopherium/framework#137: Adds NewHook and Filter, whose recovery, budget, registration-order, and value-preserving behavior is used by the ScreenGate scenarios.

Suggested reviewers: codescene-access

Merge Risk: Minimal · up to 37ece

This adds an optional ScreenGate interface and tests for it. Existing plugins without the interface are unaffected, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a new optional ScreenGate interface that lets a plugin hide its admin screens from a caller. The changeset adds the ScreenGate interface in pluginkit.go, a CHANGELOG e…
Linked Issues check Passed Issue #171 has one direct coding scope, with no active parent or sibling targets. Its requirements are: (1) an optional ScreenGate interface with ShowsScreens(ctx) (bool, error) in pluginkit.go; (2) n…
Out of Scope Changes check Passed Every changed file maps to issue #171. pluginkit.go adds the requested ScreenGate interface. screen-gate.feature, steps_screen_gate_test.go, and the TestScreenGate entry in features_test.go implement …
Full details: Title check

Explanation

The title names the main change: a new optional ScreenGate interface that lets a plugin hide its admin screens from a caller. The changeset adds the ScreenGate interface in pluginkit.go, a CHANGELOG entry, a feature file with three scenarios, step definitions, and a TestScreenGate function. The title is specific, follows conventional commit form, and is one sentence. The title is 66 characters, which is acceptable.

Full details: Linked Issues check

Explanation

Issue #171 has one direct coding scope, with no active parent or sibling targets. Its requirements are: (1) an optional ScreenGate interface with ShowsScreens(ctx) (bool, error) in pluginkit.go; (2) no new function, with the application asking through NewHook and Filter; (3) plugins without the interface are never asked; (4) failed, panicking, or late answers hide nothing; (5) scenarios for registration order, omission of plugins without the interface, and reporting of failed, panicking, or late answers by plugin; (6) one Unreleased CHANGELOG line.

Evidence at head: the summary shows the exported ScreenGate interface added in pluginkit/pluginkit.go (+6 lines). pluginkit/hook.go at head shows NewHook filtering plugins by the type parameter C with a type assertion, so a plugin without ScreenGate is not asked (req. 3). Filter and Fire run each call through run(), which recovers panics, and Filter keeps the prior value when the call returns an error (req. 4 for failures and panics). fire() applies a context deadline equal to the budget, so late answers see an ended context. The test helper hiddenOf in steps_screen_gate_test.go turns an answer that completes after ctx.Err() is set into an error, so Filter keeps the value (req. 4 for late answers). The steps check the ordered hidden list (req. 5, registration order). The steps register a bystander plugin without an answer (req. 3 test). The summary lists screen-gate.feature with +40 lines covering order, unanswered plugins, failed or panicking answers reported by plugin name, and answers after the 2 ms budget (req. 5). features_test.go adds TestScreenGate (+4 lines). The CHANGELOG.md adds one Unreleased line and no release entry (req. 6).

Limit: the repository diff tool could not return text for the changed blobs. Assessment of hook.go depends on the file read at head. The PR summary lists no change to hook.go, so the NewHook and Filter behavior is treated as existing code at head.

Full details: Out of Scope Changes check

Explanation

Every changed file maps to issue #171. pluginkit.go adds the requested ScreenGate interface. screen-gate.feature, steps_screen_gate_test.go, and the TestScreenGate entry in features_test.go implement and test the requested scenarios. CHANGELOG.md adds the requested Unreleased line. No production change to hook.go, routes, settings, or other packages appears in the PR summary. The test helpers (gatePlugin, gateWorld, hiddenOf, askHidden) serve only the new scenarios. The unavailable text diff prevents a line-by-line check of the full change set, but the summary lists no unrelated file.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d2fa5f86-305a-4fdd-81c8-65acb688600e
Commits

Reviewing files that changed from the base of the PR and between 434a9b2 and 37ece8b.

Files selected for processing: 5

  • pluginkit/CHANGELOG.md
  • pluginkit/features/features_test.go
  • pluginkit/features/screen-gate.feature
  • pluginkit/features/steps_screen_gate_test.go
  • pluginkit/pluginkit.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@codescene-access codescene-access 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.

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Adds optional ScreenGate.ShowsScreens(ctx) so applications can ask whether a plugin's admin screens should show.

  • Plugins can hide their admin screens for a caller.

Reviews (1) · Last reviewed commit: "docs(pluginkit): list the screen gate un..." · Reviewed by Greptile

@SirLouen
SirLouen merged commit 28b54d7 into main Nov 22, 2026
51 checks passed
@SirLouen
SirLouen deleted the feat/171 branch November 22, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a plugin hide its admin screens until they are of use to the caller

1 participant