fix(library): exclude no_resolve notes from sync no-id count

This commit is contained in:
afiqzudinhadi 2026-08-05 20:35:36 +08:00
parent eb6b3d25d0
commit 75db364a1d
2 changed files with 20 additions and 1 deletions

View file

@ -62,7 +62,12 @@ export async function libraryFolderSync(spec: MediaTypeSpec, deps: LibraryEngine
const filename = filenameOf(note.path);
if (isSkippableNote(filename, frontmatter, spec.itemType)) continue;
if (!spec.hasId(frontmatter)) {
report.skippedNoId++;
// 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++;
}
continue;
}
if (!opts.full && !spec.isActive(frontmatter)) {

View file

@ -439,4 +439,18 @@ describe('libraryFolderResolve: no_resolve flag', () => {
expect(report.skippedNoResolve).toBe(0);
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);
});
});