Skip to content

ariadne: load-time channel lint — fail-fast enforcement (§12, PR-C) - #465

Merged
transfix merged 1 commit into
masterfrom
design/ariadne-channel-enforcement
Sep 29, 2026
Merged

transfix merged 1 commit into
masterfrom
design/ariadne-channel-enforcement

Conversation

@transfix

Copy link
Copy Markdown
Owner

PR-C of the channel-scoping work — the load-time enforcement layer, on top of the declaration (#464) and the core resolver (#463). Fail-fast, static; the runtime policy for dynamic channel names is the final follow-up.

What lands

lint_channels() runs in load_node once the tree + all scripts are built. For each program lane (init/on_tick/on_key/on_pointer + every widget on:), it parses the script with the state_exec parser and walks the value_t AST for the string-literal first arg of (msg-send|msg-recv|msg-pending …) — the static channel references — then validates each:

  • a plain name must be a declared channel; a /-ref must be a declared global; a #-runtime channel (tick/key/pointer) is never linted
  • undeclared → a hard load error (strict, the default), a warning (warn), or skipped (off) per lint.channels; warn/off emit a one-time "relaxed" notice unless lint.quiet
  • gated on the document declaring a channels: block (no block ⇒ no enforcement — existing docs keep working)

Guarded by CVC_STATE_EXEC (no parser / no program lanes without it) — a no-op otherwise. Only static (literal) refs are visible at load; dynamic (msg-recv (expr)) names are the runtime policy's job.

Tests

8 AriadneChannelLint tests: strict-fails, declared-passes, warn-warns-not-fails, off-skips, global-needs-declared-global (positive + negative), #-exempt, no-block-no-enforcement, init-script-linted. Full loader suite green (159), no regressions.

Follow-up — final PR (runtime policy B)

A channel policy (declared set + globals + strict/quiet) on each action/resident ictx, checked in resolve_channel to catch dynamic channel names the static lint can't see — the completeness backstop. Plus a consolidated roadmap §12 write-up of the whole channel-scoping model (#463 core → #464 declaration → this lint → runtime policy).

…hannels (§12, PR-C)

The load-time half of channel enforcement (the runtime policy for dynamic
channel names is a follow-up). Gated on the document declaring a channels:
block; strictness from the lint: block (default strict).

- lint_channels() runs after the tree + scripts are built: it parses each
  program lane (init/on_tick/on_key/on_pointer + every widget on:) with the
  state_exec parser and walks the value_t AST for the string-literal first arg
  of (msg-send|msg-recv|msg-pending ...) — the STATIC channel references. Each
  is validated against the declared channels (a '/'-ref against the declared
  globals; a '#'-runtime channel is never linted). Undeclared -> a hard load
  error (strict), a warning (warn), or skipped (off) per lint.channels; warn/off
  emit a one-time "relaxed" notice unless lint.quiet. Dynamic (non-literal)
  refs are the runtime policy's job.
- Guarded by CVC_STATE_EXEC (the parser is unavailable, and there are no program
  lanes to lint, without it) — a no-op otherwise.
- 8 AriadneChannelLint tests (strict-fails, declared-passes, warn, off, global
  needs-declared-global, '#'-exempt, no-block-no-enforcement, init-script-
  linted). Full loader suite green (159), no regressions.

Follow-up (final PR): the runtime policy (B) — a channel policy on each action/
resident ictx (declared set + globals + strict/quiet), checked in resolve_channel
to catch DYNAMIC channel names the static lint can't see; + a roadmap §12 write-up.
@transfix
transfix force-pushed the design/ariadne-channel-enforcement branch from 6ebca47 to be24b56 Compare September 29, 2026 03:20
@transfix
transfix merged commit 870c9ed into master Sep 29, 2026
13 checks passed
@transfix
transfix deleted the design/ariadne-channel-enforcement branch October 29, 2026 20:51
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