Skip to content

fix: do not emit annotations before unsupported-action comments#307

Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:audit/describer-skip-annotations-for-unsupported
Open

fix: do not emit annotations before unsupported-action comments#307
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:audit/describer-skip-annotations-for-unsupported

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 26, 2026

Part of #332.

Fixes #306.

Summary

Unsupported microflow activities are represented as comments in DESCRIBE MICROFLOW output. This PR prevents activity annotations from being emitted before those comments, so the generated MDL remains parseable.

Root cause

The describer emitted object annotations before every formatted activity result. For unsupported activity placeholders the formatted result starts with --, leaving annotations orphaned because comments are not valid microflowStatement targets.

Fix

When a formatted statement begins with a comment marker, emit only the comment and skip emitObjectAnnotations.

Tests

Added traversal coverage for unsupported/comment activity output with preceding activity metadata.

Validation

  • make build
  • make test
  • make lint-go
  • make test-integration

Agentic Code Testing

  • No new authoring syntax.
  • Synthetic regression coverage verifies generated MDL stays parseable.

Test plan

  • Unsupported activity comments remain visible.
  • No orphan annotations are emitted before comment placeholders.

When the describer falls back to a placeholder comment for an activity it does not know how to render, preceding `@position(...)`, `@anchor(...)`, or similar annotations become orphaned on re-execution.

The grammar accepts annotations only as a prefix of a real microflow statement. A comment placeholder is intentionally not a statement target, so annotation-prefixed comments can fail to parse.

Skip object annotations when the formatted statement begins with `--`. The unsupported placeholder remains visible in describe output, but the generated MDL stays parseable.

Tests cover unsupported/comment activity output with preceding activity metadata.
@github-actions
Copy link
Copy Markdown

AI Code Review

What Looks Good

  • Targeted fix: The change precisely addresses the root cause by skipping annotation emission when the formatted statement begins with a comment marker (--), preventing orphaned annotations before unsupported activity placeholders.
  • Clear rationale: The added comment explains why annotations must be skipped for comment-formatted statements (grammar only accepts annotations as prefixes of real microflow statements, not comments).
  • Test coverage: New unit test TestTraverseFlow_UnsupportedActivitySkipsAnnotations verifies the fix by checking that no @position annotations appear before unsupported-action comments and that the comment itself is present.
  • Validation: All specified checks pass (make build, make test, make lint-go, make test-integration).
  • No syntax changes: The fix doesn't modify MDL syntax, so MDL syntax design and full-stack consistency checklists don't apply (no new grammar/AST/visitor/executor/LSP changes needed).
  • Atomic scope: PR focuses solely on fixing orphaned annotations in DESCRIBE MICROFLOW output for unsupported activities.

Recommendation

Approve the PR. The fix is minimal, well-tested, and resolves the reported issue without introducing side effects or violating project conventions. No changes are needed.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Adds an MDL script under mdl-examples/bug-tests/ documenting the
unsupported-activity comment regression and providing a positive-control
microflow that exercises annotated supported activities. Pure MDL cannot
create unsupported activities; the negative case is covered by the
existing Go test TestTraverseFlow_UnsupportedActivitySkipsAnnotations.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • Bug fix correctness: The change correctly addresses the root cause by skipping annotation emission when a statement begins with -- (comment marker), preventing orphaned annotations before unsupported activity placeholders.
  • Test coverage:
    • Adds a positive-control bug test (mdl-examples/bug-tests/306-describer-annotations-before-unsupported-comment.mdl) verifying annotations still work for supported activities while unsupported ones emit clean comments.
    • Adds a unit test (TestTraverseFlow_UnsupportedActivitySkipsAnnotations) directly validating the fix for unsupported activities.
    • Both tests are in the correct locations per checklist (bug tests in mdl-examples/bug-tests/, unit tests alongside implementation).
  • Validation: PR reports passing make build, make test, make lint-go, and make test-integration.
  • Scope: Focused exclusively on the annotation emission bug for unsupported microflow activities (no unrelated changes).
  • Code quality:
    • Minimal, localized change (4 lines added) with clear comment explaining the rationale.
    • No duplication of existing logic.
    • Maintains backward compatibility for supported activities.

Recommendation

Approve. The PR correctly fixes the bug with appropriate tests, follows contribution guidelines, and maintains all project standards. No changes needed.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

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.

DESCRIBE MICROFLOW emits orphan annotations before unsupported-action comments

2 participants