Skip to content

Add usage_caps_input slot to project settings page#4729

Open
elias-ba wants to merge 1 commit into
mainfrom
4724-sandbox-usage-caps
Open

Add usage_caps_input slot to project settings page#4729
elias-ba wants to merge 1 commit into
mainfrom
4724-sandbox-usage-caps

Conversation

@elias-ba
Copy link
Copy Markdown
Contributor

@elias-ba elias-ba commented May 9, 2026

Description

Adds a usage_caps_input view-extension slot at /projects/:project_id/settings, mirroring the existing concurrency_input slot pattern. Downstream apps register a component via route metadata (metadata: %{usage_caps_input: SomeComponent}) and Lightning renders it in the settings view.

Closes #4725.

Replaces the now-permanently-closed #4726 (which bundled this slot with the rejected cap-columns-on-Lightning approach from #4724). This PR keeps only the slot wiring; the cap data and cap UI live entirely in Thunderbolt's thunderbolt.project_caps table per OpenFn/thunderbolt#649.

Validation steps

  1. mix test test/lightning_web/live/project_live/settings_test.exs — existing settings tests should pass unchanged.
  2. With no downstream registration, the settings page renders identically to today (slot is empty).
  3. Register a stub component on the route via metadata: %{usage_caps_input: SomeStub} and confirm the component renders on the settings page.

Additional notes for the reviewer

The diff is three files: settings.ex refactors the route_metadata read into a single fetch and adds the :usage_caps_input lookup; settings.html.heex renders <.live_component :if={...}> when the assign is present; CHANGELOG.md documents the slot.

AI Usage

  • I have used Claude Code

Pre-submission checklist

  • I have performed a self-review of my code.
  • I have implemented and tested all related authorization policies. (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

Mirrors the existing `concurrency_input` slot pattern: read the
component module from the settings route's metadata, assign it to the
LiveView, render via `<.live_component :if={...}>` when set. Empty by
default in OSS Lightning; downstream apps populate it by attaching
`metadata: %{usage_caps_input: SomeComponent}` to the settings route.

Closes #4725.
@github-project-automation github-project-automation Bot moved this to New Issues in Core May 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

This PR adds a usage_caps_input view-extension slot to the project settings page, mirroring the existing concurrency_input slot pattern. It's a UI-only change: the LiveView reads route metadata and conditionally renders a registered live_component (no-op for OSS by default).

Security Review ✅

  • S0 (project scoping): The @project passed to the new live_component comes from the :project_scope on_mount hook (settings.ex:25), not spoofable params; no new queries are introduced.
  • S1 (authorization): N/A — no new handle_event, controller action, or write operation; the slot is a view extension that hands project and current_user (settings.html.heex:243-249) to a downstream component for its own gating, mirroring the existing concurrency_input precedent.
  • S2 (audit trail): N/A — no DB writes, mutations, or config-resource changes; this is purely a render-time component slot.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.95%. Comparing base (d8e1059) to head (00cfc81).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4729      +/-   ##
==========================================
+ Coverage   89.94%   89.95%   +0.01%     
==========================================
  Files         444      444              
  Lines       21979    21981       +2     
==========================================
+ Hits        19768    19772       +4     
+ Misses       2211     2209       -2     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

Add usage_caps_input slot to the project settings page

1 participant