Skip to content

Comments

feat: validate layouts before applying slides#475

Merged
k1LoW merged 2 commits intomainfrom
validate-layouts
Dec 19, 2025
Merged

feat: validate layouts before applying slides#475
k1LoW merged 2 commits intomainfrom
validate-layouts

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Dec 19, 2025

Fix: #199

This pull request adds validation to ensure that all slide layouts specified in a deck exist in the presentation before applying changes. It introduces a new validateLayouts method and comprehensive unit tests to prevent errors caused by referencing nonexistent layouts.

Validation improvements:

  • Added a new method validateLayouts to the Deck type, which checks that all layouts used in the provided slides exist in the presentation. If any are missing, it returns an error listing the missing and available layouts.
  • Integrated the validateLayouts check into the ApplyPages method, so layout validation occurs before processing slides.

Add early validation of layout names before sending requests to
Google Slides API. This prevents mid-process failures due to typos
or non-existent layout names.
@k1LoW k1LoW self-assigned this Dec 19, 2025
@github-actions

This comment has been minimized.

@k1LoW k1LoW marked this pull request as ready for review December 19, 2025 13:51
@k1LoW k1LoW requested a review from Copilot December 19, 2025 13:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds upfront layout validation to prevent errors when applying slides with nonexistent layouts. The validation occurs before any slide processing, providing early feedback with helpful error messages that list both the missing layouts and the available alternatives.

Key changes:

  • Introduced validateLayouts method that checks all slide layouts against available presentation layouts
  • Integrated validation into ApplyPages to fail fast before slide processing
  • Added comprehensive unit tests covering valid layouts, invalid layouts, empty layouts with defaults, and multiple invalid layouts

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
deck.go Implements the validateLayouts method with layout existence checking and descriptive error messages
apply.go Integrates layout validation after presentation refresh but before slide processing
deck_test.go Adds TestValidateLayouts with 4 test cases covering various validation scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

Code Metrics Report

main (eea4594) #475 (a5dff82) +/-
Coverage 33.2% 33.8% +0.5%
Code to Test Ratio 1:0.9 1:0.9 +0.0
Test Execution Time 10s 9s -1s
Details
  |                     | main (eea4594) | #475 (a5dff82) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          33.2% |          33.8% | +0.5% |
  |   Files             |             31 |             31 |     0 |
  |   Lines             |           3382 |           3405 |   +23 |
+ |   Covered           |           1126 |           1151 |   +25 |
+ | Code to Test Ratio  |          1:0.9 |          1:0.9 |  +0.0 |
  |   Code              |           6985 |           7020 |   +35 |
+ |   Test              |           6453 |           6581 |  +128 |
+ | Test Execution Time |            10s |             9s |   -1s |

Code coverage of files in pull request scope (1.6% → 5.3%)

Files Coverage +/- Status
apply.go 1.4% -0.1% modified
deck.go 11.6% +9.5% modified

Reported by octocov

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@k1LoW k1LoW merged commit 06c7ff9 into main Dec 19, 2025
7 checks passed
@k1LoW k1LoW deleted the validate-layouts branch December 19, 2025 14:42
@github-actions github-actions bot mentioned this pull request Dec 19, 2025
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.

Discussion: Error termination when layout does not exist

1 participant