Skip to content

Stable element IDs - #50

Merged
shunichironomura merged 1 commit into
mainfrom
element-ids
Feb 12, 2026
Merged

Stable element IDs#50
shunichironomura merged 1 commit into
mainfrom
element-ids

Conversation

@shunichironomura

@shunichironomura shunichironomura commented Feb 12, 2026

Copy link
Copy Markdown
Member

Problem

procnote identified elements by their content text — steps by heading, checkboxes by (step_heading, text), inputs by (step_heading, label). Any edit to element text in a template would break event tracking across the entire execution lifecycle.

Solution

Assign stable, opaque IDs to every interactive element at execution start time. IDs are logged in StepAdded events (not derived at replay time), ensuring event logs remain replayable regardless of future changes to ID generation logic.

ID scheme

  • Steps: "step-{i}" (0-based index in template)
  • Checkboxes: "step-{i}/cb-{j}" (0-based index among checkboxes in the step)
  • Inputs: use existing id from template YAML
  • Dynamic steps (added at runtime): "dyn-step-{uuid8}"

Changes

Core domain (crates/procnote-core/):

  • Added id: Option<String> to Step and StepContent::Checkbox
  • Added id: String to StepState; ExecutionState.steps HashMap keyed by step ID instead of heading
  • start() generates deterministic IDs and populates them on StepAdded events
  • All events switched from text-based to ID-based references:
    • step_headingstep_id
    • textcheckbox_id
    • labelinput_id
    • after_stepafter_step_id
  • All transition methods (start_step, toggle_checkbox, record_input, etc.) accept IDs

Tauri shell (src-tauri/):

  • ExecutionAction enum uses ID-based fields
  • record_action() dispatches by ID
  • summarize() builds timestamp maps by ID
  • DTOs include ID fields: StepSummary.id, StepContentSummary::Checkbox.id, EventHistoryEntry.step_id/element_id

Frontend (src/):

  • All components dispatch actions with IDs instead of text
  • CheckboxItem: toggle passes checkbox_id
  • InputField: record passes definition.id
  • StepCard: all actions use stepSummary.id
  • AddStepDialog: generates dynamic step IDs via crypto.randomUUID(), "Insert After" dropdown uses step IDs
  • Page component: revertible events map keyed by step_id

Verification

  • cargo test --workspace: 71 tests pass (62 core + 9 Tauri)
  • cargo clippy --workspace: no warnings
  • npx svelte-check: 0 errors, 0 warnings

Breaking change

This is a breaking change to the event log format. Existing events.jsonl files are not compatible. This is acceptable since procnote is not yet published.

@shunichironomura
shunichironomura merged commit 00787df into main Feb 12, 2026
11 checks passed
@shunichironomura
shunichironomura deleted the element-ids branch February 12, 2026 10:20
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