Skip to content

Anchor model and re-anchoring algorithm #38

Description

@vdvman1

Question

What is the anchor model, and what algorithm re-anchors annotations when an article revision changes?

The hardest decision on this map. Everything about annotations depends on it.

Settled going in: a redundant selector set (structural path + text quote + character offset), tried in order, with fuzzy matching on section headings. Failures orphan to the margin, stay visible with their quoted text, and permalink to the revision they were written against. Re-anchoring runs on every article regardless of age.

Decide:

  • The stored anchor shape. Which selectors, in what form, and what each one is relative to. The structural path presumably references the section tree from the article schema — pin down exactly how (section id? index? both?), and how a range within a block is expressed.
  • Resolution order and fallback ladder. Which selector is authoritative, what each fallback costs in false-positive risk, and where the ladder stops and declares a failure.
  • Fuzzy matching parameters. For headings: how much heading-text drift is tolerated before a section is considered a different section, given article section order is very unlikely to change. For quotes: what match tolerance, and what happens on multiple candidate matches.
  • What counts as failure, and how confident a match must be before it is accepted. Getting this wrong in the permissive direction silently relocates a correction onto unrelated text — worse than orphaning it.
  • Robustness to processorVersion changes, not just content changes. If the parser changes how blocks split or how heading ids are generated, existing anchors must still resolve.
  • When re-anchoring runs — synchronously in the ingest mutation, as a follow-up action, incrementally? What happens to an annotation written against revision N while revision N+1 is being ingested?
  • Ranges spanning structure. Can an anchor cross a block or heading boundary? What happens to a selection inside a syntax-highlighted code block, where the DOM is generated by shiki rather than by Mojang?

Blocked on the anchoring prior-art research and the article schema. Use /domain-modeling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wayfinder:grillingWayfinder ticket: HITL conversation (default type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions