Stable element IDs - #50
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
StepAddedevents (not derived at replay time), ensuring event logs remain replayable regardless of future changes to ID generation logic.ID scheme
"step-{i}"(0-based index in template)"step-{i}/cb-{j}"(0-based index among checkboxes in the step)idfrom template YAML"dyn-step-{uuid8}"Changes
Core domain (
crates/procnote-core/):id: Option<String>toStepandStepContent::Checkboxid: StringtoStepState;ExecutionState.stepsHashMap keyed by step ID instead of headingstart()generates deterministic IDs and populates them onStepAddedeventsstep_heading→step_idtext→checkbox_idlabel→input_idafter_step→after_step_idstart_step,toggle_checkbox,record_input, etc.) accept IDsTauri shell (
src-tauri/):ExecutionActionenum uses ID-based fieldsrecord_action()dispatches by IDsummarize()builds timestamp maps by IDStepSummary.id,StepContentSummary::Checkbox.id,EventHistoryEntry.step_id/element_idFrontend (
src/):CheckboxItem: toggle passescheckbox_idInputField: record passesdefinition.idStepCard: all actions usestepSummary.idAddStepDialog: generates dynamic step IDs viacrypto.randomUUID(), "Insert After" dropdown uses step IDsstep_idVerification
cargo test --workspace: 71 tests pass (62 core + 9 Tauri)cargo clippy --workspace: no warningsnpx svelte-check: 0 errors, 0 warningsBreaking change
This is a breaking change to the event log format. Existing
events.jsonlfiles are not compatible. This is acceptable since procnote is not yet published.