Skip to content

Conversation

@Mishael-2584
Copy link
Contributor

Description

Fixes bundle validation to support the v1 extension format while maintaining backward compatibility with the legacy format (PR #226). This resolves bundle upload failures for AnthroCollect and other apps using the newer extension system.

Problem:
Bundle uploads were failing with:

Error: bundle validation failed: invalid extension file: app/forms/ext.json: 
invalid renderer CustomText: json: cannot unmarshal object into Go struct field 
ExtensionRenderer.renderer of type string

Root Cause:

Solution:
Updated validation to support both formats with auto-detection:

  1. v1 Format: Object-based renderer/tester with path/export
  2. Legacy Format: String-based (backward compatible)
  3. HTML Format: Added "html" to known formats (used by HtmlLabelRenderer)

Type of Change

  • Bug Fix
  • New Feature / Enhancement
  • Refactor / Code Cleanup
  • Documentation Update
  • Maintenance / Chore

Component(s) Affected

  • formulus (React Native mobile app)
  • formulus-formplayer (React web app)
  • synkronus (Go backend server)
  • synkronus-cli (Command-line utility)
  • Documentation
  • DevOps / CI/CD

Related Issue(s)

PR #226.

Changes Made

Core Implementation

  1. Updated ExtensionDefinition struct:

    • Added Version, Description, and Schemas fields for v1 format
    • Kept Definitions for legacy support
  2. Created ExtensionModuleReference struct:

    • Represents path and export fields used in v1 format
  3. Updated ExtensionRenderer struct:

    • Changed Renderer from string to *ExtensionModuleReference (supports objects)
    • Changed Tester from string to *ExtensionModuleReference (supports objects)
    • Kept legacy fields (Name, Format, Module) for backward compatibility
  4. Updated validation logic:

    • Auto-detects format type (v1 vs legacy)
    • Validates v1 format: checks renderer.path/export and tester.path/export
    • Validates legacy format: checks name, format, module fields
    • Uses renderer key (e.g., "CustomText") as format name for v1 format
  5. Fixed ext.json file handling:

    • Excluded ext.json files from form file validation
    • Prevents ext.json from being treated as invalid form files
  6. Added HTML format support:

    • Added "html" to knownFormats list in both schema and UI schema validation
    • Supports HtmlLabelRenderer which uses format: "html"

Test Coverage

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manually tested
  • Tested on multiple platforms (if applicable)

Unit Tests

✅ All tests pass (16/16):

  • v1 format extension test - ✅ PASS
  • Legacy format extension test - ✅ PASS
  • All existing validation tests - ✅ PASS

Real Bundle Testing

✅ Tested with actual AnthroCollect bundle (bundle-v1.0.6.zip):

✅ Validation PASSED!
Bundle structure is valid and ready for upload.

Test Results

=== RUN   TestValidateBundle/v1_format_extension_with_renderer/tester_objects_(PR_18_format)
--- PASS
=== RUN   TestValidateBundle/legacy_format_extension_(PR_#226_format)
--- PASS
PASS

Breaking Changes

  • This PR introduces breaking changes
  • This PR does NOT introduce breaking changes

Documentation Updates

  • Documentation has been updated (code comments)
  • Documentation update is not required

Files Modified

  • synkronus-cli/pkg/validation/bundle.go - Main validation logic
  • synkronus-cli/pkg/validation/bundle_test.go - Test cases

Impact

  • Fixes: AnthroCollect bundle uploads now succeed
  • Backward Compatible: Existing bundles using legacy format continue to work
  • Future-Proof: Supports the newer v1 format going forward
  • Low Risk: Validation-only change, no runtime behavior affected

Related PRs

Checklist

  • Code follows project style guidelines
  • All existing tests pass
  • New tests added for new functionality
  • PR title follows Conventional Commits format
  • Manually tested with real bundle

- Add support for v1 extension format (PR #18) with renderer/tester objects
- Maintain backward compatibility with legacy format (PR #226)
- Add 'html' to known formats list for HtmlLabelRenderer support
- Fix ext.json file handling to prevent form validation errors
- Add comprehensive test cases for both formats

Fixes bundle upload failures for AnthroCollect and other apps using v1 format.
Tested with real bundle (bundle-v1.0.6.zip) - validation passes.
@Mishael-2584 Mishael-2584 changed the title # fix(validation): Support v1 Extension Format in Bundle Validation # feat(validation): Support v1 Extension Format in Bundle Validation Jan 14, 2026
@Mishael-2584 Mishael-2584 changed the title # feat(validation): Support v1 Extension Format in Bundle Validation feat(validation): Support v1 Extension Format in Bundle Validation Jan 14, 2026
@Mishael-2584 Mishael-2584 requested a review from r0ssing January 14, 2026 13:07
Copy link
Contributor

@r0ssing r0ssing left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for fixing this @Mishael-2584

@Mishael-2584 Mishael-2584 merged commit 85c16e5 into dev Jan 14, 2026
17 of 19 checks passed
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.

3 participants