Skip to content

refactor: collapse free annotation AST state#450

Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:submit/free-annotation-ast-single-field
Open

refactor: collapse free annotation AST state#450
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:submit/free-annotation-ast-single-field

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 30, 2026

Closes #449.

Summary

  • Remove the redundant ActivityAnnotations.FreeAnnotation field.
  • Use FreeAnnotations []string as the single source of truth in visitor and builder code.
  • Remove the dedup helper that existed only to reconcile both fields.
  • Add a bug-test MDL script documenting the expected free-vs-attached annotation roundtrip shape.

Validation

  • make build
  • ./bin/mxcli check mdl-examples/bug-tests/free-annotation-roundtrip.mdl
  • go test ./mdl/visitor ./mdl/executor -run 'FreeAnnotation|AnnotationsBeforePosition|AnnotationAfterPosition' -v
  • make test
  • make lint-go

Symptom: ActivityAnnotations stored both FreeAnnotation and FreeAnnotations, creating a duplicated state invariant that tests and future code could accidentally violate.

Root cause: the single-value field was kept as a convenience alias after multi-free-annotation support was added, so builder code needed a dedup helper solely to reconcile both fields.

Fix: keep only FreeAnnotations, update visitor and builder paths to pass that slice directly, and add a bug-test script documenting the expected free-annotation roundtrip shape.

Tests: ran make build, mxcli check for the new bug-test MDL file, focused visitor/executor free-annotation tests, make test, and make lint-go.
@ako ako added this to the v0.8.0 milestone Apr 30, 2026
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.

Collapse free-annotation AST state to a single slice

3 participants