Skip to content

fix: harden wizard input validation and make generation atomic - #37

Merged
aoreshkov merged 1 commit into
mainfrom
fix/review-2026-10-06
Oct 6, 2026
Merged

aoreshkov merged 1 commit into
mainfrom
fix/review-2026-10-06

Conversation

@aoreshkov

Copy link
Copy Markdown
Owner

Summary

Fixes from a review pass. User-facing changes are in CHANGELOG.md under ## Unreleased → Fixed:

  • Keyword validation: Kotlin and Java keywords are rejected as package segments and as feature or field names. The package proposed from the project name is always valid, for example for projects named "Object", "Class" or "2FA".
  • Android Studio name handling: feature and field names are normalized (My Feature → my_feature). A name that can't become an identifier stops generation with a notification that names the field, instead of reporting success.
  • Test value escaping: quotes, backslashes and $ in the test value are escaped in the generated tests.
  • Package name trimming: stray spaces in the package name are removed.
  • Rollback on failure: a failed generation removes every file it wrote and restores every file it replaced. In Android Studio, the default project files are replaced only after rendering succeeds.
  • Single apiDump: the post-sync apiDump runs at most once, even when two sync events arrive together.

Internal:

  • generateTemplates now also writes RENAMES.txt (the forward dotfile rename table), and a test asserts that RESTORED_FILE_NAMES reverses every entry.
  • KMPLicense.isLicensed() delegates to an injectable licenseState(...) so its tri-state mapping can be unit-tested. A new expired-license .p12 test fixture was added.

Test plan

  • ./gradlew test: new and updated tests for validation, staged generation and rollback, Studio scaffold, license state, substitution and rename symmetry, and apiDump listener once-only behavior
  • ./gradlew verifyPlugin: Compatible with IU-261/262/263 and Android Studio 261/262

🤖 Generated with Claude Code

- Reject Kotlin/Java keywords as package segments and feature/field names;
  the package proposed from the project name is always valid.
- Android Studio: normalize feature/field names and fail generation with a
  notification naming the field when a name can't become an identifier.
- Escape quotes, backslashes and `$` in the test value.
- Trim stray spaces in the package name.
- Roll back a failed generation (remove written files, restore replaced
  ones); in Android Studio replace default files only after rendering.
- Run the post-sync apiDump at most once.
- Ship RENAMES.txt alongside SUBSTITUTIONS.txt so tests catch drift in the
  dotfile rename tables; make KMPLicense's tri-state mapping unit-testable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aoreshkov
aoreshkov merged commit bdef8a3 into main Oct 6, 2026
3 checks passed
@aoreshkov
aoreshkov deleted the fix/review-2026-10-06 branch October 6, 2026 16:58
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