fix(library): first-pass enrich gate skips post-resolve skeletons
isActive() for book/game/comic only checked for a resolved id, so a note that had run resolve() but never a real sync() (no read_status/ play_status/status field yet) was treated as static and never enriched on subsequent runs. Now also requires the status-analog field canonical render always writes; missing it means sync() hasn't actually produced output yet.
This commit is contained in:
parent
6225231d67
commit
1d5537742f
6 changed files with 41 additions and 11 deletions
|
|
@ -194,6 +194,12 @@ describe('bookSpec.isActive', () => {
|
|||
test('olid set + Unread -> static', () => {
|
||||
expect(bookSpec.isActive({ olid: 'OL1168083W', read_status: 'Unread' })).toBe(false);
|
||||
});
|
||||
test('olid set, read_status missing (post-resolve skeleton) -> active (C1)', () => {
|
||||
expect(bookSpec.isActive({ olid: 'OL1168083W' })).toBe(true);
|
||||
});
|
||||
test('canonical enriched note (olid + read_status both present) -> static', () => {
|
||||
expect(bookSpec.isActive({ olid: 'OL1168083W', read_status: 'Unread' })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
function ctxFor(fm: Record<string, string>, body = '## My Notes\n\n'): LibraryNoteCtx {
|
||||
|
|
|
|||
|
|
@ -235,6 +235,12 @@ describe('comicSpec.isActive', () => {
|
|||
test('status Ended + read_status Unread -> static', () => {
|
||||
expect(comicSpec.isActive({ comicvine_id: '195824', status: 'Ended', read_status: 'Unread' })).toBe(false);
|
||||
});
|
||||
test('comicvine_id set, status missing (post-resolve skeleton) -> active (C1)', () => {
|
||||
expect(comicSpec.isActive({ comicvine_id: '195824' })).toBe(true);
|
||||
});
|
||||
test('canonical enriched note (status Ended, not Ongoing) -> static', () => {
|
||||
expect(comicSpec.isActive({ comicvine_id: '195824', status: 'Ended', read_status: 'Read' })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('comicSpec.resolve', () => {
|
||||
|
|
|
|||
|
|
@ -266,13 +266,22 @@ describe('gameSpec.isActive', () => {
|
|||
test('both ids empty -> active (needs first pass)', () => {
|
||||
expect(gameSpec.isActive({})).toBe(true);
|
||||
});
|
||||
test('steam_appid set -> static', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100' })).toBe(false);
|
||||
test('steam_appid set + play_status set -> static', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100', play_status: 'Unplayed' })).toBe(false);
|
||||
});
|
||||
test('rawg_id set -> static', () => {
|
||||
expect(gameSpec.isActive({ rawg_id: '4200' })).toBe(false);
|
||||
test('rawg_id set + play_status set -> static', () => {
|
||||
expect(gameSpec.isActive({ rawg_id: '4200', play_status: 'Unplayed' })).toBe(false);
|
||||
});
|
||||
test('both set -> static, regardless of play_status', () => {
|
||||
test('both ids set -> static, regardless of play_status', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100', rawg_id: '4200', play_status: 'Played' })).toBe(false);
|
||||
});
|
||||
test('id set, play_status missing (post-resolve skeleton) -> active (C1)', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100' })).toBe(true);
|
||||
});
|
||||
test('both ids set, play_status missing (post-resolve skeleton) -> active (C1)', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100', rawg_id: '4200' })).toBe(true);
|
||||
});
|
||||
test('canonical enriched note -> static', () => {
|
||||
expect(gameSpec.isActive({ steam_appid: '792100', rawg_id: '4200', play_status: 'Played' })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue