Skip to content

fix(template): emit the project's licence, once, instead of a literal MPL-2.0 - #64

Open
hyperpolymath wants to merge 1 commit into
mainfrom
fix/launcher-header-uses-project-license
Open

hyperpolymath wants to merge 1 commit into
mainfrom
fix/launcher-header-uses-project-license

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

The launcher template hard-coded # SPDX-License-Identifier: MPL-2.0 — twice — and never used app_license, which template.rs:122 computes from [project].license and then throws away. This PR makes both emitted headers (script header + the embedded deed's ;; header) use the project's licence, and removes the duplicate line.

Why — a landed regression

game-server-admin#102 (merged 2026-09-30, 6152bda) realigned that repo's launcher and replaced its AGPL-3.0-or-later header with two MPL-2.0 lines. The AGPL header was deliberate: game-server-admin#62 (309accc) set a tri-licence policy (docs/legal/LICENSE-POLICY.adoc: code → AGPL-3.0-or-later, config → MPL-2.0 carve-out). The realign could not honour it because the template never read the licence. A follow-up game-server-admin PR sets its [project].license and re-realigns from this branch.

Evidence

  • cargo check --all-targets rc=0; cargo test --workspace rc=0 (124 tests).
  • Behaviour preservation: minting the stapeln fixture config (no licence ⇒ default) before vs after differs by exactly one line — the deleted duplicate # SPDX-License-Identifier: MPL-2.0. minted-2026-09-23_stapeln-launcher-deed.sh re-minted from the emitter per its README (never hand-edited); the 09-22 fixture is untouched.
  • Mutant: restoring the literal header fails rendered_licence_is_the_projects_and_appears_once_per_header with left: [MPL-2.0 ×2] / right: [AGPL-3.0-or-later ×2]; restored tree green.

Chosen arm — override in one word if you disagree

The embedded deed block's ;; SPDX line also takes the project licence, so a launcher is one file, one licence. The alternative (deed block always MPL-2.0 as "machine-readable config", per game-server-admin's carve-out) would make every AGPL launcher dual-headed AGPL AND MPL to a REUSE reader.

Not in this PR

The open realign PRs aerie#98, nextgen-databases#107, panll#136 and boj-server-mk2#48 carry the duplicate line (all MPL repos, so no licence change). They self-heal on the next realign after this merges; not re-minting them from an unmerged generator.

🤖 Generated with Claude Code

https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK

… MPL-2.0

The launcher template carried `# SPDX-License-Identifier: MPL-2.0` as a
literal -- twice (line 2 and the header proper) -- and never read
`app_license`, which template.rs computed from `[project].license` and then
discarded. Realigning a launcher in an AGPL repo therefore silently
relicensed it: game-server-admin#102 (6152bda) replaced the launcher's
AGPL-3.0-or-later header, set deliberately in game-server-admin#62 under
that repo's docs/legal/LICENSE-POLICY.adoc, with two MPL-2.0 lines.

- The script header and the embedded deed's `;;` header both emit
  `{{ app_license }}` (default MPL-2.0 unchanged).
- The duplicate literal line is gone; the template's own licence remains in
  its Tera doc comment. The tag name is a Tera string so a licence scanner
  reading the template sees only the template's own header.
- Tests: a non-default licence must appear exactly once per header and
  directly under the shebang; the no-licence default stays MPL-2.0.
  Mutant (restore the literal) kills the first test with the expected diff.
- Fixture minted-2026-09-23 re-minted from the emitter per its README:
  the diff is exactly the one deleted duplicate line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 609a49f0-6da5-458a-9f5b-b16a9c060228

📥 Commits

Reviewing files that changed from the base of the PR and between 2cb0f24 and 1ddf146.

📒 Files selected for processing (3)
  • crates/launcher-common/src/template.rs
  • crates/launcher-common/tests/fixtures/metadata_block/minted-2026-09-23_stapeln-launcher-deed.sh
  • templates/launcher.sh.tera
💤 Files with no reviewable changes (1)
  • crates/launcher-common/tests/fixtures/metadata_block/minted-2026-09-23_stapeln-launcher-deed.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: rust-ci / Detect Cargo.toml
  • GitHub Check: hypatia / Hypatia Neurosymbolic Analysis
  • GitHub Check: CodeQL Analysis (actions, none)
  • GitHub Check: Build, count, mint, lint
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
crates/launcher-common/src/template.rs (1)

720-750: LGTM!

Also applies to: 752-763

templates/launcher.sh.tera (1)

32-32: 🔒 Security & Privacy | 🛡️ Detected with Advanced Tier

No change is needed for multiline project.license values. config.validate() calls validate_display_value("project.license", license), which rejects CR and LF control characters before rendering.

Likely an incorrect or invalid review comment.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Generated launcher scripts now show the configured licence identifier in both the main script header and the launcher deed header, rather than always showing MPL-2.0.
    • The script header appears directly beneath the shebang, and the licence identifier is shown only once in each header.
    • When no licence is configured, the script header continues to show MPL-2.0.

Walkthrough

The launcher template now uses app_license in both SPDX headers and places the shebang first. Tests cover configured licences and the MPL-2.0 fallback. A fixture no longer contains a duplicate SPDX identifier.

Changes

Launcher licence rendering

Layer / File(s) Summary
Render and verify licence headers
templates/launcher.sh.tera, crates/launcher-common/src/template.rs, crates/launcher-common/tests/fixtures/metadata_block/minted-2026-09-23_stapeln-launcher-deed.sh
The template uses app_license in both SPDX headers, with the shebang first. Tests check configured licence values, header placement, uniqueness, and the MPL-2.0 fallback. The fixture removes a duplicate SPDX identifier.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1ddf1

The generated launcher now reflects the project licence consistently, preserves the default, and removes the duplicate header. No merge-blocking issue was identified.

Architecture Summary

Architecture risk: 🔵 Low · up to 1ddf1

The change affects 2 systems.

Changed systems: crates, templates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.
  • observed — templates (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/launcher-common/src/template.rs: Added a test that renders a non-default project licence and checks that both headers use it, each appears once, and the script header follows the shebang.
  • observed — Modified behavior in crates/launcher-common/src/template.rs: Added a test that a missing project licence renders MPL-2.0 in the script header.
  • observed — Modified behavior in crates/launcher-common/tests/fixtures/metadata_block/minted-2026-09-23_stapeln-launcher-deed.sh: Removed the duplicate SPDX-License-Identifier: MPL-2.0 comment; the identifier remains on line 2.
  • observed — Modified behavior in templates/launcher.sh.tera: The leading SPDX comment was removed so the shebang is the template’s first line.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: emitting the project's licence once instead of using hard-coded MPL-2.0 headers.
Description check ✅ Passed The description is directly related to the changes. It explains the template fix, the licence behaviour, the regression, and the reported validation results.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

A rabbit checks the header line
The shebang leads, the marks align
Two licence tags now match the plan
If none is set, MPL began
I thump and hop: the tests all shine

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

hyperpolymath added a commit to hyperpolymath/game-server-admin that referenced this pull request Sep 30, 2026
…realign (#105)

## What

Restores `game-server-admin-launcher.sh`'s **AGPL-3.0-or-later** header,
which #102 (6152bda, merged 2026-09-30) replaced with two `MPL-2.0`
lines.

## Why

`docs/legal/LICENSE-POLICY.adoc` (#62, 309accc) puts code — including
`.sh` — under AGPL-3.0-or-later and keeps config under an MPL-2.0
carve-out. #102's realign used a launch-scaffolder generator that
hard-coded `MPL-2.0` and never read `[project].license`, so it
relicensed a shipped file without anyone deciding to. That generator
defect is fixed in **hyperpolymath/launch-scaffolder#64**.

## Change

- `game-server-admin.launcher.a2ml`: `[project].license =
"AGPL-3.0-or-later"` (the app's licence). The config file's own SPDX
header stays MPL-2.0 per the carve-out.
- `game-server-admin-launcher.sh`: re-realigned from
launch-scaffolder#64 at 1ddf146. The diff is the header only: one
`AGPL-3.0-or-later` script header, one matching `;;` deed header,
duplicate removed. `CONFIG_FILE` and the body are byte-identical.

`bash -n` ok; `shellcheck -S warning` clean. No CI here depends on
realign, so this can merge before or after launch-scaffolder#64. Until
#64 merges, a realign from the old generator would revert this header
again.

Not armed for automerge: armed PRs on this repo merge on the spot (#104,
#102), so this is left for your review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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