fix: flat vault type resolution — remove type/ prefix from links and protected folders

- Type relationship links: [[type/essay]] → [[essay]] (matches flat vault structure)
- PROTECTED_FOLDERS / KEEP_FOLDERS: only attachments, _themes, assets
- TypeSelector navigation: type/slug → slug
- Updated all 14 affected test files
- All 612 Rust tests + 2151 frontend tests pass
This commit is contained in:
lucaronin
2026-03-16 16:17:58 +01:00
parent 3fb7cf6a56
commit a12ad57699
53 changed files with 522 additions and 346 deletions

View File

@@ -67,7 +67,7 @@ describe('useNoteListSort (via NoteList)', () => {
})
it('reads sort from type document for sectionGroup selection', () => {
const typeDoc = makeEntry({ path: '/type/note.md', title: 'Note', isA: 'Type', sort: 'title:asc' })
const typeDoc = makeEntry({ path: '/note.md', title: 'Note', isA: 'Type', sort: 'title:asc' })
const entries = [
typeDoc,
makeEntry({ path: '/c.md', title: 'Charlie', modifiedAt: 3000 }),
@@ -82,7 +82,7 @@ describe('useNoteListSort (via NoteList)', () => {
})
it('shows type title as header for sectionGroup selection', () => {
const typeDoc = makeEntry({ path: '/type/project.md', title: 'Project', isA: 'Type' })
const typeDoc = makeEntry({ path: '/project.md', title: 'Project', isA: 'Type' })
renderNoteList({ entries: [typeDoc], selection: { kind: 'sectionGroup', type: 'Project', label: 'Projects' } })
expect(screen.getByText('Project')).toBeInTheDocument()
})
@@ -91,7 +91,7 @@ describe('useNoteListSort (via NoteList)', () => {
localStorageMock.setItem('laputa-sort-preferences', JSON.stringify({ '__list__': { option: 'title', direction: 'asc' } }))
const onUpdateTypeSort = vi.fn()
const updateEntry = vi.fn()
const typeDoc = makeEntry({ path: '/type/project.md', title: 'Project', isA: 'Type', sort: null })
const typeDoc = makeEntry({ path: '/project.md', title: 'Project', isA: 'Type', sort: null })
const entries = [typeDoc, makeEntry()]
renderNoteList({
@@ -101,15 +101,15 @@ describe('useNoteListSort (via NoteList)', () => {
updateEntry,
})
expect(onUpdateTypeSort).toHaveBeenCalledWith('/type/project.md', 'sort', 'title:asc')
expect(updateEntry).toHaveBeenCalledWith('/type/project.md', { sort: 'title:asc' })
expect(onUpdateTypeSort).toHaveBeenCalledWith('/project.md', 'sort', 'title:asc')
expect(updateEntry).toHaveBeenCalledWith('/project.md', { sort: 'title:asc' })
})
it('does not migrate if type already has sort', () => {
localStorageMock.setItem('laputa-sort-preferences', JSON.stringify({ '__list__': { option: 'title', direction: 'asc' } }))
const onUpdateTypeSort = vi.fn()
const updateEntry = vi.fn()
const typeDoc = makeEntry({ path: '/type/project.md', title: 'Project', isA: 'Type', sort: 'modified:desc' })
const typeDoc = makeEntry({ path: '/project.md', title: 'Project', isA: 'Type', sort: 'modified:desc' })
const entries = [typeDoc, makeEntry()]
renderNoteList({