REPOSITORY CODING · MEDIUM
Implement backlinks from resolved document references
Reference classification works. Add sorted, deduplicated source lists per target, excluding unavailable and missing-anchor references.
Repository ImplementationVersion-aware citation index
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Symfony · 60 minute session
- Build a citation report from document revisions and references. A document has an id, revision, deleted flag, and unique case-sensitive anchors. Select the greatest revision per id before looking at deletion or anchors. Identical redelivery is allowed; conflicting content at the same revision is invalid.
- A reference identifies source, target and an optional fragment (empty string means the whole document). Decode valid percent escapes exactly once, preserving literal plus characters. Reject malformed escapes and invalid UTF-8. Fragment matching is case-sensitive.
- Classify references in this order: source-unavailable, target-unavailable, anchor-missing, resolved. A deleted latest document is unavailable even if an older live revision exists. Validate fragment encoding even if a document is unavailable.
- Return references sorted by id. Build backlinks only from resolved references: each target has sorted unique source ids, and targets are sorted. Several anchors from one source still create one backlink. Empty collections must remain arrays.
- This native Symfony application uses HttpFoundation, Routing, HttpKernel and controllers. CLI checks call the same indexing service. It stores no external documents and makes no network requests while indexing.