fix(library): exclude no_resolve notes from sync no-id count
This commit is contained in:
parent
eb6b3d25d0
commit
75db364a1d
2 changed files with 20 additions and 1 deletions
|
|
@ -62,7 +62,12 @@ export async function libraryFolderSync(spec: MediaTypeSpec, deps: LibraryEngine
|
||||||
const filename = filenameOf(note.path);
|
const filename = filenameOf(note.path);
|
||||||
if (isSkippableNote(filename, frontmatter, spec.itemType)) continue;
|
if (isSkippableNote(filename, frontmatter, spec.itemType)) continue;
|
||||||
if (!spec.hasId(frontmatter)) {
|
if (!spec.hasId(frontmatter)) {
|
||||||
|
// no_resolve opt-outs are deliberate manual notes — keep them out of the actionable no-id count
|
||||||
|
if (hasNoResolveFlag(frontmatter)) {
|
||||||
|
deps.log(`no_resolve flag set, skipping sync: ${note.path}`);
|
||||||
|
} else {
|
||||||
report.skippedNoId++;
|
report.skippedNoId++;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!opts.full && !spec.isActive(frontmatter)) {
|
if (!opts.full && !spec.isActive(frontmatter)) {
|
||||||
|
|
|
||||||
|
|
@ -439,4 +439,18 @@ describe('libraryFolderResolve: no_resolve flag', () => {
|
||||||
expect(report.skippedNoResolve).toBe(0);
|
expect(report.skippedNoResolve).toBe(0);
|
||||||
expect(report.resolved).toEqual(['A.md']);
|
expect(report.resolved).toEqual(['A.md']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('SYNC: no_resolve id-less note excluded from skippedNoId (silent log skip); plain id-less note still counted', async () => {
|
||||||
|
const { spec } = makeFakeSpec({});
|
||||||
|
const flagged = NO_ID_NOTE.replace('fake_id: ', 'fake_id: \nno_resolve: true');
|
||||||
|
const logs: string[] = [];
|
||||||
|
const { deps } = makeDeps([
|
||||||
|
{ path: 'Flagged.md', content: flagged },
|
||||||
|
{ path: 'Plain.md', content: NO_ID_NOTE },
|
||||||
|
]);
|
||||||
|
deps.log = (m: string) => logs.push(m);
|
||||||
|
const report = await libraryFolderSync(spec, deps, { full: true });
|
||||||
|
expect(report.skippedNoId).toBe(1);
|
||||||
|
expect(logs.some(l => l.includes('no_resolve flag set, skipping sync: Flagged.md'))).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue