Skip to content

Infer deterministic IDs for rule modules (triggers, on_load) - #532

Draft
ccutrer with Copilot wants to merge 3 commits into
mainfrom
copilot/infer-ids-and-names-for-modules
Draft

Infer deterministic IDs for rule modules (triggers, on_load)#532
ccutrer with Copilot wants to merge 3 commits into
mainfrom
copilot/infer-ids-and-names-for-modules

Conversation

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown

Triggers and the on_load module were assigned random UUIDs, making them opaque in logs and tooling. This replaces random UUIDs with IDs derived from the rule's UID.

Changes

  • Trigger IDs: Each trigger now gets an ID of {rule_uid}:{n} where n is a 1-based sequential counter scoped to the rule. Falls back to a random UUID only when no rule UID is present in thread context (edge case).
  • on_load module ID: Uses {rule_uid}:on_load instead of a random UUID. Same fallback applies.

Example

rule id: "my_rule" do
  changed SomeSwitch   # trigger id → "my_rule:1"
  changed OtherSwitch  # trigger id → "my_rule:2"
  on_load              # on_load module id → "my_rule:on_load"
  run { nil }
end

This makes module IDs human-readable and stable across script reloads, consistent with how rule IDs are already inferred from source location.

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add ID inference for all modules including triggers and conditions Infer deterministic IDs for rule modules (triggers, on_load) Apr 8, 2026
Copilot AI requested a review from ccutrer April 8, 2026 16:44
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.

infer ids and names for all modules

2 participants