Skip to content

🧹 Extract handlers from executeMediaOp to improve code health - #141

Closed
MarsLuay wants to merge 2 commits into
mainfrom
fix-execute-media-op-3824298026688391916
Closed

🧹 Extract handlers from executeMediaOp to improve code health#141
MarsLuay wants to merge 2 commits into
mainfrom
fix-execute-media-op-3824298026688391916

Conversation

@MarsLuay

@MarsLuay MarsLuay commented Sep 6, 2026

Copy link
Copy Markdown
Owner

🎯 What: The code health issue addressed
The executeMediaOp function in src/ai/pptxOpExecutor.ts was overly long and contained a complex switch statement with inline logic for each operation type. The PR extracts each of these cases into their own appropriately-named async functions.

💡 Why: How this improves maintainability
Extracting complex dispatch logic into smaller, isolated handlers makes the executeMediaOp function much easier to read (as a simple router) and isolates the variables and control flow of each unique media operation, preventing scopes from bleeding and making future testing or modifications simpler.

Verification: How you confirmed the change is safe
Ran npm run typecheck and npm run lint and verified that types flow correctly and there are no formatting violations. npm test suite was run (unrelated failures relating to esbuild chunks for DOCX exist, but the .pptx logic type checks).

Result: The improvement achieved
A much cleaner executeMediaOp router function and isolated, single-responsibility handler functions for each media operation type.


PR created automatically by Jules for task 3824298026688391916 started by @MarsLuay

Extracts switch cases from `executeMediaOp` into isolated helper functions (`handleSetImageCrop`, `handleFitImageToFrame`, `handleResetImage`, `handleReplaceImage`, `handleReplaceImageFromShape`) to improve code health, maintainability, and readability.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI lite review requested due to automatic review settings September 6, 2026 04:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Extracts switch cases from `executeMediaOp` into isolated helper functions (`handleSetImageCrop`, `handleFitImageToFrame`, `handleResetImage`, `handleReplaceImage`, `handleReplaceImageFromShape`) to improve code health, maintainability, and readability.
@MarsLuay

MarsLuay commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Closing as duplicate of #127 and #140: all three refactor executeMediaOp in src/ai/pptxOpExecutor.ts. This PR also has failing required Node.js build checks; please reopen a single corrected PR after CI is green.

@MarsLuay MarsLuay closed this Sep 8, 2026
@MarsLuay
MarsLuay deleted the fix-execute-media-op-3824298026688391916 branch September 8, 2026 21:57
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.

2 participants