Skip to content

fix(core): remove regular-file permalink lookup - #1191

Merged
phernandez merged 1 commit into
mainfrom
codex/nonmarkdown-permalink-invariant
Aug 5, 2026
Merged

fix(core): remove regular-file permalink lookup#1191
phernandez merged 1 commit into
mainfrom
codex/nonmarkdown-permalink-invariant

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

Remove the discarded permalink lookup from regular-file indexing and make the existing non-Markdown identity contract explicit.

Non-Markdown resources continue to be addressed by their stable external_id and project-relative file_path. They continue to persist with permalink=None.

Fixes #1182.

Problem

BatchIndexer._upsert_regular_file() called EntityService.resolve_permalink() when creating a PDF, image, or other non-Markdown entity, then discarded the returned value and created the entity without a permalink.

That call was dead work, but it also obscured an important domain invariant: permalinks are semantic addresses for Markdown notes because they can round-trip through frontmatter. A generated database-only permalink for arbitrary resource bytes would introduce a second identity that the source cannot represent.

Implementation

  • Remove the unused resolve_permalink() call from the regular-file creation path.
  • Document that non-Markdown entities always have permalink=None.
  • Document the intended identities:
    • external_id is the stable API identity.
    • file_path locates the resource in project storage.
  • Strengthen the existing batch-indexer regression so PDF and image indexing:
    • fails immediately if permalink resolution is attempted;
    • asserts both entities persist with no permalink.

Scope

This is contract cleanup only. It does not:

  • add or backfill non-Markdown permalinks;
  • change routing, search, relation resolution, or wikilinks;
  • change regular-file move/update/delete behavior;
  • change Markdown permalink behavior.

Verification

  • uv run pytest -q --no-cov tests/indexing/test_batch_indexer.py::test_batch_indexer_indexes_non_markdown_files tests/index/test_local_project_index.py::test_local_project_index_indexes_regular_files tests/index/test_local_project_index.py::test_local_project_index_updates_regular_file_checksum tests/index/test_local_project_index.py::test_local_project_index_moves_and_deletes_regular_file_entities tests/index/test_local_project_index.py::test_local_project_index_resolves_regular_file_relations tests/index/test_local_watch_regular_file_parity.py
    • 8 passed
  • just fast-check
    • Ruff check/fix passed
    • Ruff formatting passed
    • ty type checking passed
  • git diff --check
    • passed

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez merged commit 4020413 into main Aug 5, 2026
25 checks passed
@phernandez
phernandez deleted the codex/nonmarkdown-permalink-invariant branch August 5, 2026 02:25
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.

Remove the dead resolve_permalink() call for regular files, and document the no-permalink invariant

1 participant