[superlog] Add manage:websites scope to insights service auth#512
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Clean replacement for #471, rebased onto current What changed:
Local verification passed:
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR grants the insights service the
Confidence Score: 5/5Safe to merge — the change is a narrow scope addition and a refactor into a well-tested helper with no behavioural changes to generation logic. The diff is small and well-contained: a new two-function module, a one-line call-site swap, and a focused test. The manage:websites scope is already established across the codebase (Slack integration, MCP tools, API key model) so its semantics are known and the insights agent legitimately needs it for website updates. No edge cases or regressions were identified. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Gen as generation.ts
participant SA as service-auth.ts
participant RPC as @databuddy/rpc
Gen->>SA: createInsightsServiceAuth(organizationId)
SA->>SA: spread INSIGHTS_SERVICE_AUTH_SCOPES ["read:data", "manage:websites"]
SA->>RPC: createServiceAuth(organizationId, scopes)
RPC-->>SA: "PreResolvedAuth { apiKey: { organizationId, scopes, type: "automation" }, session: null }"
SA-->>Gen: PreResolvedAuth
Gen->>Gen: "set context.serviceAuth = auth"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Gen as generation.ts
participant SA as service-auth.ts
participant RPC as @databuddy/rpc
Gen->>SA: createInsightsServiceAuth(organizationId)
SA->>SA: spread INSIGHTS_SERVICE_AUTH_SCOPES ["read:data", "manage:websites"]
SA->>RPC: createServiceAuth(organizationId, scopes)
RPC-->>SA: "PreResolvedAuth { apiKey: { organizationId, scopes, type: "automation" }, session: null }"
SA-->>Gen: PreResolvedAuth
Gen->>Gen: "set context.serviceAuth = auth"
Reviews (1): Last reviewed commit: "fix(insights): grant service auth websit..." | Re-trigger Greptile |
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant Agent as Insights Agent (generation.ts)
participant ServiceAuth as Insights Service Auth (service-auth.ts)
participant RPC as @databuddy/rpc (createServiceAuth)
Note over Agent,RPC: NEW: Scopes now include "manage:websites"
Agent->>ServiceAuth: createInsightsServiceAuth(organizationId)
ServiceAuth->>RPC: createServiceAuth(orgId, ["read:data", "manage:websites"])
RPC-->>ServiceAuth: serviceAuth (apiKey + scopes)
ServiceAuth-->>Agent: serviceAuth
Note over Agent,RPC: Agent uses serviceAuth for RPC calls<br/>(e.g., updating websites)
Shadow auto-approve: would auto-approve. Adds required manage:websites scope for website updates; centralizes scopes in a helper with a focused unit test. The change is small, isolated, and well-structured.
Re-trigger cubic
Summary
Supersedes #471 with a clean branch from current staging.
Verification
Summary by cubic
Add the
manage:websitesscope to insights service auth so insights can update websites. This unblocks website updates and centralizes the scope list behind a small helper with tests.Bug Fixes
manage:websitesto insights service auth to allow website updates without permission errors.Refactors
createInsightsServiceAuthandINSIGHTS_SERVICE_AUTH_SCOPESin service-auth, and switch the agent ingeneration.tsto use it (wraps@databuddy/rpc).Written for commit b42063e. Summary will update on new commits.