Skip to content

fix(synapse): unify unresolved embed macro replacement semantics #66

Description

@MarcoPorcellato

Bug Description

SYNAPSE embed expansion treats unresolved targets inconsistently:

Macro type Missing target behavior
{{embed [[Page]]}} Replaced with empty string (macro swallowed)
{{embed ((uuid))}} Left unchanged in output

Downstream RAG sees silent content loss in one case and raw Logseq macros in the other.

Clean Architecture lens

Aspect Assessment
Ring Interface Adapter (synapse.py)
SOLID Liskov / consistency — same conceptual operation (embed resolve) should share failure semantics
Uncle Bob Clean Code: symmetric error paths; pick one policy and document it

Steps to Reproduce

# Missing page
"- {{embed [[NoSuchPage]]}}\n"''

# Missing block uuid
"- {{embed ((00000000-0000-0000-0000-000000000000))}}\n"'{{embed ((...))}}'

Expected Behavior

Documented, symmetric policy, e.g.:

  • Always strip macro and insert "", or
  • Always leave a visible sentinel like [unresolved embed]

Suggested fix

  • Align block + page branches in _expand_macros_and_embeds_impl
  • Add parametrized tests in tests/test_synapse.py
  • Note behavior in docs/ARCHITECTURE.md SYNAPSE section

Context

Local code study wave 10 runtime probe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention or skill is welcome

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions