Skip to content

Writeme: integrate folder exclusion into writeme and fix validation issues #7539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

beqqrry-aws
Copy link
Member

  • Add folder exclusion functionality to runner.py as a core feature
  • Support excluding multiple configurable folders (.kiro, .git, node_modules, pycache)
  • Add proper exit code handling to writeme.py wrapper
  • Fix malformed snippet-end tag in BatchActions.java
  • Update generated README files for KMS and Lambda services
  • Ensure proper validation error reporting

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@beqqrry-aws beqqrry-aws self-assigned this Jul 25, 2025
@github-actions github-actions bot added Python This issue relates to the AWS SDK for Python (boto3) Java-v2 This issue relates to the AWS SDK for Java V2 Tools This issue relates to a custom tooling to streamline development tasks labels Jul 25, 2025
@beqqrry-aws beqqrry-aws requested review from a team and rlhagerm and removed request for a team July 25, 2025 21:10
@beqqrry-aws beqqrry-aws added the Task A general update to the code base for language clarification, missing actions, tests, etc. label Jul 25, 2025
- Add folder exclusion functionality to runner.py as a core feature
- Support excluding multiple configurable folders (.kiro, .git, node_modules, __pycache__)
- Add proper exit code handling to writeme.py wrapper
- Fix malformed snippet-end tag in BatchActions.java
- Update generated README files for KMS and Lambda services
- Ensure proper validation error reporting
- Remove 'patch' references from function names and comments
- Rename apply_folder_exclusion_patches() to _configure_folder_exclusion()
- Rename patched_skip() to enhanced_skip()
- Rename patched_get_files() to enhanced_get_files()
- Update comments to reflect natural functionality rather than retrofitted patches
@beqqrry-aws beqqrry-aws force-pushed the writeme-validation-fixes branch from ef3baa2 to e32c8db Compare July 25, 2025 21:45
))

except Exception as e:
# Skip files that can't be read (binary files, etc.)
Copy link
Contributor

Choose a reason for hiding this comment

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

All exceptions are files that can't be read? What if the file is missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

At least log them

Copy link
Member Author

Choose a reason for hiding this comment

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

how would this know if a file is missing? It just wouldn't show up in the list to check then, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or, misnamed, maybe. I was questioning the very wide net cast by that except, and the assumption that all the errors are of one type.

@@ -24,7 +24,14 @@

from typer import run

run(writeme)
# Run writeme and ensure proper exit code handling
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we added exit code handing by using typer.exit in runner.py? Is this necessary here also?

Copy link
Member Author

Choose a reason for hiding this comment

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

should writeme.py assume runner.py is handling all possibilities?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say yes.


# Check that every snippet-start has a corresponding snippet-end
for tag, start_line in snippet_starts.items():
if tag not in snippet_ends:
Copy link
Contributor

Choose a reason for hiding this comment

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

This code that checks for matching starts and ends, doesn't it duplicate what's in -tools in snippets.py. Is there a problem with that logic or a reason we should duplicate it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is at least some problem with the previous logic, because this caught the error in BatchActions.java which boils down to a missing end tag (malformed)

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, could you upstream a fix for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, not a missing tag, but a malformed one? Yeah, I bet the existing logic (and related tests) should be modified to handle that.

root: Path, skip: Callable[[Path], bool] = lambda _: False, fs: Fs = PathFs()
) -> Generator[Path, None, None]:
"""Get files using enhanced skip function."""
for path in file_utils.walk_with_gitignore(root, fs=fs):
Copy link
Contributor

Choose a reason for hiding this comment

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

if walk_with_git_ignore is ignoring everything in the git ignore, can we just add these directories to that?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think they're guaranteed to be 1:1, but it's probably pretty close

Copy link
Contributor

@rlhagerm rlhagerm Jul 28, 2025

Choose a reason for hiding this comment

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

Ok, then, this seems like duplicated functionality.

Copy link
Contributor

Choose a reason for hiding this comment

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

walk_with_gitignore should work at any level of gitignore granularity.

{'.kiro', '.git', 'node_modules', '__pycache__'}

These should definitely be in your .gitignore already? I suppose I can see an argument for .kiro

return path.suffix.lower() not in validator_config.EXT_LOOKUP or path.name in validator_config.IGNORE_FILES

Again, seems like *.ext in the .gitignore or path in the folders' .gitignore would be equivalent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java-v2 This issue relates to the AWS SDK for Java V2 Python This issue relates to the AWS SDK for Python (boto3) Task A general update to the code base for language clarification, missing actions, tests, etc. Tools This issue relates to a custom tooling to streamline development tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants