Skip to content

[decision] comptime-folded asserts: how the test report should account for checks that verify at compile time #12751

Closed as not planned

Description

@gHashTag

Boundary

This decides the T730 test-report ACCOUNTING for comptime-folded asserts only. In scope: how t27c test-report reports a test whose asserts all folded at comptime (today: Some(0) + the VACUOUS label), and whether the language gains a runtime-forcing assert form. Out of scope: the counting mechanism itself (#5980 records it -- __t27_tally works as designed), the wasm floor-13 landing (#12711/#12748, done), and any change to what assert means in running code.

Evidence (probes on t27c 0.5.2, recorded on #5980): a module-const array index folds at comptime -- pub const V: [2]u32 = [55, 14]; assert(V[1] == 14) passes with 0 runtime asserts and is labeled VACUOUS, while the same assert over a local array executes 1 runtime assert. The plain zig is correct and would fail loudly if the constant changed; the runtime counter just cannot see a comptime check.

User scenarios

  1. An epic-progress card wants to pin constants in its own data (assert(DATE[1] == 20261027)). Today the author writes accessor functions that force a runtime read -- a workaround pattern that exists in at least one landed spec and is undocumented.
  2. A spec author writes a const-checking test directly, sees PASS with the VACUOUS flag, and reads it as 'my test certified nothing' -- when it actually verified at compile time.
  3. A reviewer reads a test report with vacuous passes and cannot tell 'trivial backend' from 'compile-time verified' from 'author forgot the body'.

Requirements

Any chosen path must keep T730's honest accounting (a pass never claims more verification than executed) and must not inflate runtime-assert counts with comptime-only checks. The options:

  • (a) report state: test-report gains COMPTIME-VERIFIED as a distinct outcome for a passing test whose asserts all folded (the tally site already knows foldedness); the VACUOUS label then means only 'truly trivial'. Smallest: test_report.rs + report format + the COUNTER shim stays.
  • (b) language form: a runtime-forcing assert (or an attribute) that inhibits comptime folding, so const-data checks count as runtime asserts. Larger: touches the emit on every backend.
  • (c) documented idiom: keep the behavior, document the accessor pattern as the idiom for runtime checks over const data, and teach VACUOUS readers to check for comptime folding. Smallest of all, but every future author re-discovers the fold.

Success criteria

Recommendation: (a) first (it unblocks scenario 2 immediately and makes 3 legible), (c) shipped alongside as documentation, (b) deferred until a real workload needs runtime checks over const data. Refs: #5980 (the five-probe investigation), #12714 (the accessor workaround shipped in a landed spec), #12719 (the epic card that hit this).

Activity

  1. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 26, 2026
  2. github-actions commented on Oct 26, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  3. added 11 commits that reference this issue on Oct 27, 2026
    410d456
    b24e556
    f43efa7
    c55983b
    81870e1
    43307ee
    37ca933
    720ae32
    33b4021
    263f4a5
    1a8da6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions