Skip to content

fix: add missing fields for local/remote template rendering#5057

Open
jes0131 wants to merge 1 commit intowailsapp:v3-alphafrom
jes0131:v3-alpha-bugfix/4815-generated-template-failed-to-initialize
Open

fix: add missing fields for local/remote template rendering#5057
jes0131 wants to merge 1 commit intowailsapp:v3-alphafrom
jes0131:v3-alpha-bugfix/4815-generated-template-failed-to-initialize

Conversation

@jes0131
Copy link

@jes0131 jes0131 commented Mar 15, 2026

Description

When using wails3 generate template to create a custom template and then initializing a project with wails3 init -t ./my-template, the init command failed with a template rendering error because several fields referenced in build_assets/windows/msix/app_manifest.xml.tmpl and build_assets/windows/msix/template.xml.tmpl were missing from the data struct used for local/remote template rendering.

The missing fields were: Publisher, ProcessorArchitecture, ExecutableName, ExecutablePath, OutputPath, CertificatePath, FileAssociations, and Protocols.

This fix adds those fields to the data struct in Install(), following the same defaulting logic used in GenerateBuildAssets().

Fixes #4815

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  1. Created a template with wails3 generate template -name mytemplate
  2. Initialized a project with wails3 init -n myproject -t ./mytemplate
  3. Verified the project is created successfully without errors
  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

 Wails (v3.0.0-alpha.74)  Wails Doctor

# System

┌───────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Pro                                                            |
| Version           | 2009 (Build: 26200)                                                       |
| ID                | 25H2                                                                      |
| Branding          | Windows 11 Pro                                                            |
| Platform          | windows                                                                   |
| Architecture      | amd64                                                                     |
| Go WebView2Loader | true                                                                      |
| WebView2 Version  | 145.0.3800.97                                                             |
| CPU               | 12th Gen Intel(R) Core(TM) i7-1260P                                       |
| GPU 1             | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 30.0.101.2079  |
| Memory            | 8GB                                                                       |
└───────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌───────────────────────────────┐
| Wails CLI   | v3.0.0-alpha.74 |
| Go Version  | go1.25.7        |
| -buildmode  | exe             |
| -compiler   | gc              |
| CGO_ENABLED | 0               |
| GOAMD64     | v1              |
| GOARCH      | amd64           |
| GOOS        | windows         |
└───────────────────────────────┘

# Dependencies

┌─────────────────────────────────────────────────────────────────────────────────────────┐
| NSIS                       | Not Installed                                              |
| MakeAppx.exe (Windows SDK) | Not Installed                                              |
| MSIX Packaging Tool        | Not Installed                                              |
| SignTool.exe (Windows SDK) | Not Installed                                              |
| npm                        | 10.9.3                                                     |
| docker                     | *Docker version 27.2.0, build 3ab4256 (daemon not running) |
|                                                                                         |
└──────────────────────────────── * - Optional Dependency ────────────────────────────────┘

# Checking for issues

 SUCCESS  No issues found

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features
    • Extended template system with support for file associations and protocol configurations.
    • Added metadata fields for enhanced project configuration, including processor architecture, certificate paths, and executable details.
    • Improved template data structure to support detailed packaging and distribution settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

Walkthrough

This PR introduces two new public type definitions (FileAssociation and ProtocolConfig) and expands the template data structure with additional fields including Publisher, ProcessorArchitecture, ExecutableName, and collections for file associations and protocols. These changes fix template rendering failures by providing previously referenced but missing fields.

Changes

Cohort / File(s) Summary
Template Data Structure Enhancement
v3/internal/templates/templates.go
Added FileAssociation and ProtocolConfig types; expanded template data struct with Publisher, ProcessorArchitecture, ExecutableName, OutputPath, CertificatePath, FileAssociations, Protocols, and other project metadata fields; injected Publisher from ProductCompany option.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Bug, templates, v3-alpha, Windows

Suggested reviewers

  • leaanthony

Poem

🐰 A Publisher field hops into sight,
Templates render, now all feels right!
FileAssociations and Protocols align,
Data flows smoothly through design.
Bug fixed with grace, the template's back in flight! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: adding missing fields for local/remote template rendering to fix initialization failures.
Description check ✅ Passed The PR description is mostly complete with clear problem statement, reproduction steps, and testing details, though some checklist items remain unchecked.
Linked Issues check ✅ Passed The PR successfully addresses issue #4815 by adding the missing fields (Publisher, ProcessorArchitecture, ExecutableName, ExecutablePath, OutputPath, CertificatePath, FileAssociations, Protocols) that caused template rendering errors.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the template rendering issue; no unrelated or extraneous code modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.16.4)
v3/internal/templates/templates.go

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
v3/internal/templates/templates.go (1)

83-95: Consolidate duplicated config structs to avoid schema drift.

FileAssociation and ProtocolConfig are duplicated here and in v3/internal/commands/build-assets.go (same fields/tags). Consider moving them to a shared internal package and reusing one canonical definition to prevent future divergence.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v3/internal/templates/templates.go` around lines 83 - 95, FileAssociation and
ProtocolConfig are duplicated and risk schema drift; extract a single canonical
definition (preserving the yaml/json tags) into a shared internal package (e.g.,
internal/templates or internal/types), remove the duplicate structs from
v3/internal/templates/templates.go and v3/internal/commands/build-assets.go,
update all references to use the new shared types (replace local FileAssociation
and ProtocolConfig usages with the new package's FileAssociation and
ProtocolConfig), and run a quick build to fix imports and ensure tags remain
identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@v3/internal/templates/templates.go`:
- Around line 83-95: FileAssociation and ProtocolConfig are duplicated and risk
schema drift; extract a single canonical definition (preserving the yaml/json
tags) into a shared internal package (e.g., internal/templates or
internal/types), remove the duplicate structs from
v3/internal/templates/templates.go and v3/internal/commands/build-assets.go,
update all references to use the new shared types (replace local FileAssociation
and ProtocolConfig usages with the new package's FileAssociation and
ProtocolConfig), and run a quick build to fix imports and ensure tags remain
identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cdb11200-deec-4454-9637-58bbb9e51718

📥 Commits

Reviewing files that changed from the base of the PR and between bb4fbf9 and 81060b0.

📒 Files selected for processing (1)
  • v3/internal/templates/templates.go

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