Skip to content

Remove dead options, update tiers, link artifacts in PR comments#6

Merged
ritikrishu merged 1 commit intomainfrom
chore/cleanup-dead-options
Feb 17, 2026
Merged

Remove dead options, update tiers, link artifacts in PR comments#6
ritikrishu merged 1 commit intomainfrom
chore/cleanup-dead-options

Conversation

@ritikrishu
Copy link
Contributor

@ritikrishu ritikrishu commented Feb 17, 2026

Summary

  • Remove dead inputs: renderer and output-dir from action.yml and all supporting code (types, config, main). Delete src/renderers/metadata.ts entirely.
  • Update tier description: service-api-key now reflects correct limits (1K free / 5K with key / 10K with demo)
  • Link artifacts in PR comments: Wire artifactUrl through CommentData and DiffCommentData so both full-mode and diff-mode comments show a download link for screenshot artifacts
  • Fix artifact formatting: Remove leading \n\n from createArtifactsSummary (spacing handled by comment builder)

Test plan

  • npm run build && npm run package passes locally (verified)
  • Merge into test/design-update, trigger with empty commit, verify:
    • Workflow passes
    • PR comment renders with before/after screenshots
    • PR comment includes artifact download link at the bottom
    • No "renderer" or "output-dir" references in workflow logs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated service API key description with new pricing and usage details
  • Chores

    • Removed renderer configuration option
    • Removed output-dir configuration option
    • Updated artifact download link text to "Download all screenshots"

…ents

- Remove `renderer` and `output-dir` inputs from action.yml (service is the
  only renderer; output dir is hardcoded)
- Delete src/renderers/metadata.ts (unused since service renderer is mandatory)
- Clean up types, config, and main.ts to remove all RendererType/outputDir refs
- Update service-api-key description with correct tier limits
- Wire artifactUrl into CommentData/DiffCommentData so PR comments include a
  download link for screenshot artifacts
- Fix createArtifactsSummary leading \n\n (spacing handled by comment builder)
- Remove renderer row from README inputs table

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

This PR consolidates the codebase to use only the service renderer, removing the metadata renderer option entirely. It eliminates the renderer and output-dir configuration inputs, replaces user-configured output directories with a centralized constant, and updates comment generation to include artifact download links.

Changes

Cohort / File(s) Summary
Configuration & Input Schema
README.md, action.yml
Removed renderer input option and output-dir input; updated service-api-key description with new pricing details.
Type Definitions & Config
src/types.ts, src/config.ts
Removed RendererType, renderer, and outputDir fields from ActionInputs; added artifactUrl to CommentData types; eliminated renderer validation logic and now unconditionally require service-url.
Renderer Implementation
src/renderers/metadata.ts
Deleted entire MetadataRenderer class that previously generated JSON metadata placeholders per frame.
Core Logic & Comments
src/main.ts, src/comment-builder.ts
Consolidated to always use ServiceRenderer (removed conditional renderer selection); replaced user-provided outputDir with centralized OUTPUT_DIR constant; added artifact download links to both full and diff comment builders.
Supporting Changes
src/github/artifacts.ts, src/pen-parser.ts
Updated artifact summary text from "View" to "Download" and removed leading newline; updated pen-parser comment to reflect frame extraction for design files rather than metadata renderer.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Add diff review mode with before/after comparisons #4: Updates renderer usage signatures and modifies comment-building logic, with overlapping changes to ServiceRenderer paths and comment generation.
  • Test design update #2: Modifies ServiceRenderer's data model (imageUrl vs imageBase64) and download logic, complementing this PR's consolidation to service-renderer-only usage.

Poem

🐰 Hop away, metadata friend!
Service reigns supreme, no more to bend,
Output DIR fixed, configurations compressed,
Artifact links added—downloads blessed! 🎁

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing dead options (renderer and output-dir), updating service tier information, and adding artifact links to PR comments.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/cleanup-dead-options

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/github/artifacts.ts (1)

88-97: ⚠️ Potential issue | 🟡 Minor

The fileCount parameter represents frame counts, not file counts — the label (N files) is misleading.

In buildComment, this receives summary.successfulRenders (a frame count), and in buildDiffComment, it receives totalAddedFrames + totalModifiedFrames (also a frame count). The rendered markdown will say something like "Download all screenshots (12 files)" when the number actually refers to rendered frames, not files.

Consider renaming the parameter and adjusting the display text:

Proposed fix
 export function createArtifactsSummary(
-  artifactUrl: string | undefined,
-  fileCount: number
+  artifactUrl: string | undefined,
+  screenshotCount: number
 ): string {
   if (!artifactUrl) {
     return '';
   }
 
-  return `📦 [Download all screenshots (${fileCount} files)](${artifactUrl})`;
+  return `📦 [Download all screenshots (${screenshotCount} frames)](${artifactUrl})`;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/artifacts.ts` around lines 88 - 97, The label misrepresents frames
as files: update createArtifactsSummary to accept a descriptively named
parameter (e.g., frameCount or renderedFrameCount) instead of fileCount and
change the returned text to reflect frames (e.g., "Download all screenshots (N
frames)"); then update callers (buildComment and buildDiffComment) that pass
summary.successfulRenders and totalAddedFrames + totalModifiedFrames to use the
renamed parameter so the displayed markdown matches the actual value.
🧹 Nitpick comments (3)
src/main.ts (2)

350-358: Non-null assertion on inputs.serviceUrl! is safe but brittle.

This works because getInputs() throws when serviceUrl is falsy, but the type still declares it as string | undefined. If the type in ActionInputs is tightened to serviceUrl: string (as suggested in the config.ts review), this assertion can be dropped.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main.ts` around lines 350 - 358, The code uses a brittle non-null
assertion on inputs.serviceUrl in initializeRenderer when calling
createServiceRenderer; instead update the ActionInputs type so serviceUrl is
declared as string (not string | undefined) and adjust getInputs() to always
return that type, then remove the unnecessary '!' from inputs.serviceUrl in
initializeRenderer (call createServiceRenderer(inputs.serviceUrl, ...)). This
keeps initializeRenderer, ActionInputs, getInputs, and createServiceRenderer
consistent and removes the brittle assertion.

221-221: Redundant as ServiceRenderer cast.

initializeRenderer (line 350) already returns Promise<ServiceRenderer>, so the as ServiceRenderer cast here is unnecessary.

Proposed fix
-  const renderer = await initializeRenderer(inputs) as ServiceRenderer;
+  const renderer = await initializeRenderer(inputs);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main.ts` at line 221, The code redundantly casts the result of
initializeRenderer to ServiceRenderer; remove the unnecessary "as
ServiceRenderer" cast and simply assign with: const renderer = await
initializeRenderer(inputs); ensure you update any usages expecting
ServiceRenderer only if typescript inference needs an explicit type annotation
(prefer a typed declaration like const renderer: ServiceRenderer = await
initializeRenderer(inputs) only if necessary), referencing the
initializeRenderer function and the ServiceRenderer type.
src/config.ts (1)

18-24: serviceUrl || undefined on line 24 is dead code after the guard on line 18.

Since you throw on line 18 when !serviceUrl, line 24 is guaranteed to have a truthy serviceUrl — the || undefined fallback can never be reached.

Additionally, ActionInputs.serviceUrl is typed as string | undefined (optional), but this function now enforces its presence. Consider tightening the type to serviceUrl: string (non-optional) so callers like initializeRenderer don't need the ! non-null assertion.

Proposed fix for the redundant fallback
   const inputs: ActionInputs = {
     githubToken: core.getInput('github-token', { required: true }),
-    serviceUrl: serviceUrl || undefined,
+    serviceUrl,
     serviceApiKey: serviceApiKey || undefined,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/config.ts` around lines 18 - 24, The guard in the config loader throws if
serviceUrl is falsy, so the "serviceUrl: serviceUrl || undefined" fallback is
dead; remove the "|| undefined" and make ActionInputs.serviceUrl a non-optional
string (i.e. change its type to string) so callers (e.g., initializeRenderer) no
longer need to use the non-null assertion; update the ActionInputs
interface/type to reflect serviceUrl: string and adjust any callers that assumed
undefined to use the guaranteed string instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/comment-builder.ts`:
- Around line 305-311: The artifact download count currently uses
totalAddedFrames + totalModifiedFrames (computed as totalRendered) which
overstates files for diff-mode artifacts because modified frames are rendered
via the diff endpoint and may not produce local files; update the call that
builds the artifact link (the createArtifactsSummary invocation in
src/comment-builder.ts) to pass a correct count—either use only
data.summary.totalAddedFrames for diff-mode artifacts or compute the actual
number of uploaded/output files from the upload/OUTPUT_DIR logic and pass that
value—so the label matches the real artifact contents.

---

Outside diff comments:
In `@src/github/artifacts.ts`:
- Around line 88-97: The label misrepresents frames as files: update
createArtifactsSummary to accept a descriptively named parameter (e.g.,
frameCount or renderedFrameCount) instead of fileCount and change the returned
text to reflect frames (e.g., "Download all screenshots (N frames)"); then
update callers (buildComment and buildDiffComment) that pass
summary.successfulRenders and totalAddedFrames + totalModifiedFrames to use the
renamed parameter so the displayed markdown matches the actual value.

---

Nitpick comments:
In `@src/config.ts`:
- Around line 18-24: The guard in the config loader throws if serviceUrl is
falsy, so the "serviceUrl: serviceUrl || undefined" fallback is dead; remove the
"|| undefined" and make ActionInputs.serviceUrl a non-optional string (i.e.
change its type to string) so callers (e.g., initializeRenderer) no longer need
to use the non-null assertion; update the ActionInputs interface/type to reflect
serviceUrl: string and adjust any callers that assumed undefined to use the
guaranteed string instead.

In `@src/main.ts`:
- Around line 350-358: The code uses a brittle non-null assertion on
inputs.serviceUrl in initializeRenderer when calling createServiceRenderer;
instead update the ActionInputs type so serviceUrl is declared as string (not
string | undefined) and adjust getInputs() to always return that type, then
remove the unnecessary '!' from inputs.serviceUrl in initializeRenderer (call
createServiceRenderer(inputs.serviceUrl, ...)). This keeps initializeRenderer,
ActionInputs, getInputs, and createServiceRenderer consistent and removes the
brittle assertion.
- Line 221: The code redundantly casts the result of initializeRenderer to
ServiceRenderer; remove the unnecessary "as ServiceRenderer" cast and simply
assign with: const renderer = await initializeRenderer(inputs); ensure you
update any usages expecting ServiceRenderer only if typescript inference needs
an explicit type annotation (prefer a typed declaration like const renderer:
ServiceRenderer = await initializeRenderer(inputs) only if necessary),
referencing the initializeRenderer function and the ServiceRenderer type.

Comment on lines +305 to +311
// Add artifact download link
const totalRendered = data.summary.totalAddedFrames + data.summary.totalModifiedFrames;
const artifactLink = createArtifactsSummary(data.artifactUrl, totalRendered);
if (artifactLink) {
lines.push(artifactLink);
lines.push('');
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

The screenshot count passed for diff mode may not reflect actual artifact contents.

totalAddedFrames + totalModifiedFrames is used as the display count, but in diff mode, modified frames are rendered via the service's diff endpoint and may not produce local files in OUTPUT_DIR. The actual artifact would primarily contain screenshots from added files only. This could show a higher number than the actual files in the downloaded artifact.

Consider using only totalAddedFrames or computing the count from the actual files uploaded, for a more accurate label.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/comment-builder.ts` around lines 305 - 311, The artifact download count
currently uses totalAddedFrames + totalModifiedFrames (computed as
totalRendered) which overstates files for diff-mode artifacts because modified
frames are rendered via the diff endpoint and may not produce local files;
update the call that builds the artifact link (the createArtifactsSummary
invocation in src/comment-builder.ts) to pass a correct count—either use only
data.summary.totalAddedFrames for diff-mode artifacts or compute the actual
number of uploaded/output files from the upload/OUTPUT_DIR logic and pass that
value—so the label matches the real artifact contents.

@ritikrishu ritikrishu merged commit 1f993a4 into main Feb 17, 2026
1 check passed
@ritikrishu ritikrishu deleted the chore/cleanup-dead-options branch February 17, 2026 15: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.

1 participant