Skip to content

fix(deploy-on-aws): check file extension before defusedxml dependency#132

Merged
scottschreckengaust merged 4 commits into
awslabs:mainfrom
Sagargupta16:fix/validate-drawio-early-exit
Apr 30, 2026
Merged

fix(deploy-on-aws): check file extension before defusedxml dependency#132
scottschreckengaust merged 4 commits into
awslabs:mainfrom
Sagargupta16:fix/validate-drawio-early-exit

Conversation

@Sagargupta16
Copy link
Copy Markdown
Contributor

@Sagargupta16 Sagargupta16 commented Apr 15, 2026

Summary

  • Move the defusedxml dependency check after the file extension filter in validate-drawio.sh
  • Non-drawio files now exit early and silently instead of showing a dependency warning on every Edit/Write

Problem

The PostToolUse hook on Edit|Write runs validate-drawio.sh for every file write. The script checked for the defusedxml dependency before checking whether the file was a .drawio file, causing every non-drawio write (markdown, JSON, etc.) to emit:

Missing required dependency: defusedxml. Install it with: pip3 install defusedxml>=0.7.1

Fix

Reordered the script to:

  1. Read stdin and extract file path
  2. Check file extension (exit early for non-drawio files)
  3. Check defusedxml dependency (only reached for actual drawio files)

Related

Fixes #129

Changes

Reordered validate-drawio.sh to check file extension before checking the defusedxml dependency, so non-drawio file writes exit early and silently.

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Move the defusedxml dependency check after the file extension filter
so non-drawio files exit early and silently. Previously, every
Edit/Write hook invocation showed a "Missing required dependency"
warning even for unrelated files like markdown, JSON, etc.

Fixes awslabs#129
Copy link
Copy Markdown
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

Reorders validate-drawio.sh so non-.drawio file writes exit immediately, avoiding the noisy defusedxml missing-dependency warning on every Edit|Write hook invocation (fixes #129).

Changes:

  • Moves the defusedxml availability check to occur only after the .drawio / .drawio.xml extension filter passes.
  • Ensures non-drawio files exit early and silently before any dependency validation.

Copilot AI review requested due to automatic review settings April 26, 2026 16:08
Copy link
Copy Markdown
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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copy link
Copy Markdown
Member

@scottschreckengaust scottschreckengaust left a comment

Choose a reason for hiding this comment

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

LGTM

@scottschreckengaust scottschreckengaust added this pull request to the merge queue Apr 30, 2026
Merged via the queue into awslabs:main with commit 8e50d4b Apr 30, 2026
22 checks passed
@Sagargupta16 Sagargupta16 deleted the fix/validate-drawio-early-exit branch May 20, 2026 17:29
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.

deploy-on-aws: validate-drawio hook fires dependency warning on every file write, not just .drawio files

4 participants