Skip to content

[Codegen#52] Generated Rust license follows the consumer: user choice, then repo license, else none #52

Description

@kreneskyp

Problem

The generator always stamps // SPDX-License-Identifier: MIT OR Apache-2.0 on emitted Rust (NFR-002). That code lands in someone else's codebase, so its license is theirs to decide, not ours.

Required behavior (owner decision 2026-09-15)

The SPDX identity of generated source is resolved in this order:

  1. User's explicit choice: a generator option (e.g. license: <SPDX expression>) is stamped verbatim.
  2. Repository license: if no option is given, use the consuming repository's declared license (e.g. the target crate's Cargo.toml license, or the workspace package.license).
  3. Nothing: if neither is stated, emit no SPDX header. The file then falls under the repo's own terms, or is closed / all rights reserved if the repo has none. No license means private.

The generator must never stamp a license the user or repo didn't state. That includes our AGPL, and it includes a permissive default.

Scope

  • Emitter SPDX sites: src/bound_strategy/generation.rs, src/bound_strategy/population.rs, src/harness.rs, src/kani.rs, src/oracle.rs, src/strategy.rs
  • Schemas generated-rust-kani-v1, generated-rust-kani-v2, generated-rust-oracle-v1: the required ^// SPDX-License-Identifier: MIT OR Apache-2\\.0\\n pattern must allow any valid SPDX expression or no header. This is a schema change, so decide whether it needs a new schema version.
  • The provenance/identity envelope should record which source the license came from (option, repo, or none).
  • Spec: rewrite NFR-002 (the "dual-licence" requirement and AC-2), interface-001-codegen-api.md licensing line, and add TCs for each of the 3 resolution branches.
  • Tests and examples: tests/oracle_generation.rs, examples/generation_conformance.rs (the 3 "dual-license" checks), the tests/fixtures/generated_boolean_oracle.golden golden, and assurance/change-assurance.json.
  • README license note.
  • quire-contract-ir spec/program/PGM-01-governance.md:83 ("Generated source defaults to MIT OR Apache-2.0") needs the matching policy change.

Acceptance

  • An explicit option produces exactly that SPDX line.
  • No option in a repo with a declared license produces that repo's license.
  • No option and no repo license produces no SPDX line.
  • An invalid SPDX expression in the option is rejected with a file:line-bearing error.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SXCEodZi7YFYHt43Dm5PVw

Activity

  1. kreneskyp commented on Sep 15, 2026

    @kreneskyp
    ContributorAuthor

    Scope note (owner, 2026-09-15): the target isn't necessarily Rust. Our own consumers will all be Rust, but the license resolution must be target-language-agnostic.

    • Repo license detection must not assume Cargo.toml. Read the manifest for the target ecosystem (Cargo.toml license/workspace.package.license, package.json license, pyproject.toml project.license, etc.). Where no manifest field exists, fall back to the SPDX identity of a root LICENSE file only if it can be identified unambiguously. Otherwise treat the repo as having no license, which means no header.
    • Header syntax is per target language. The SPDX line uses that language's comment form (//, #, /* */, <!-- -->, and so on). The resolution logic stays separate from the emitter's comment rendering, so a new backend only supplies the comment style.
    • Schemas and the provenance envelope should record the resolved SPDX expression and its source (option, repo, none) independent of language, not as a Rust-comment regex.
    • Tests: the 3 resolution branches are tested once at the resolver level, plus a rendering test for each supported backend. Only Rust exists today.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01SXCEodZi7YFYHt43Dm5PVw

  2. changed the title [-]Generated Rust license follows the consumer: user choice, then repo license, else none[/-] [+][Codegen#52] Generated Rust license follows the consumer: user choice, then repo license, else none[/+] on Sep 19, 2026
  3. added and removed on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions