feat: enhance bundle upload with validation and auto-activation #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enhances the
synk app-bundle uploadcommand with comprehensive pre-upload validation, auto-activation capability, and improved user experience. This PR adds client-side validation that matches server-side logic, reducing unnecessary uploads and providing faster feedback to developers.Changes
--activate(or-a) flag to automatically activate uploaded version--verbose(or-v) flag for detailed bundle information--skip-validationflag for edge cases (with warning)Features Added
1. Validation Package (
pkg/validation/bundle.go)A new validation package that validates bundle structure before upload:
app/,forms/,renderers/top-level directories existapp/index.htmland required form files (forms/{formName}/schema.json,forms/{formName}/ui.json)synkronus/pkg/appbundle/validation.goexactly2. Enhanced Upload Command
The
synk app-bundle uploadcommand now includes:--skip-validation)--activateflag to automatically activate the uploaded version--verboseflag to show bundle statistics (size, file count, forms, renderers, manifest)Testing
Test Coverage
The validation package includes comprehensive tests for:
app/index.html,schema.json,ui.json)Example Usage
Basic Upload (with automatic validation)
$ synk app-bundle upload bundle.zip Validating bundle structure... ✓ Bundle structure is valid Uploading bundle... ✓ App bundle uploaded successfully! Version: 20250102-123456Upload with Auto-Activation
Upload with Verbose Output
$ synk app-bundle upload bundle.zip --verbose Validating bundle structure... ✓ Bundle structure is valid Bundle Information: Size: 245678 bytes Files: 15 Forms: 3 Renderers: 2 Uploading bundle... ✓ App bundle uploaded successfully! Version: 20250102-123456 Manifest: Version: 20250102-123456 Hash: abc123def456... Files: 15Validation Error Handling
Files Changed
New Files
pkg/validation/bundle.go- Validation logicpkg/validation/bundle_test.go- Test suite (13 test cases)Modified Files
internal/cmd/appbundle.go- Enhanced upload command with validation and new flagsREADME.md- Updated documentation with new flags and examplesgo.mod- Addedgit.colasdn.top/fatih/colordependencygo.sum- Updated dependency checksumsBreaking Changes
None - fully backward compatible. The upload command works exactly as before, with validation enabled by default. Users can use
--skip-validationif needed.Related
synkronus/pkg/appbundle/validation.goChecklist