fix: track collection membership provenance#2616
Conversation
|
I gave this a quick test with my simple ruleset, and it looks correct. will test with my complicated ruleset and give the code a proper onceover (eventually) edit: complicated ruleset technically works, but because of the bug with media item resolution in main, it won't fill any show related collections |
Ok, so it works - it's just that your bug is stopping it from working - but it would work on a system without your specific bug? |
|
It should work, yes. My bug is already in main, so this shouldn't make anything worse Mind you, I haven't reviewed the actual code |
Please do a real code review. Would help a lot! This will be in 3.5.0 anyway, so no rush. :) |
|
Will do (eventually, probably not tonight) Will test with my advanced rules this evening Tho (as soon as my libraries are done refreshing metadata) |
fed35fc to
0d78268
Compare
Any update here? Looking to merge to development this weekend. |
|
I believe I tested it But I'll want to run a second test since I don't remember the result etc properly... |
|
And I got through some of the code review, just got stuck on other things like sleep ;) |
|
seems to be an issue on latest version it worked before tho, so maybe a bad merge. I've tested with multiple manual collections. it seems to be specifically a problem with manual collections EDIT: checked out oldest commit and it seems I was wrong. it fails on that too.... Dug further into this; it seems to be a bug on main. somewhere between current main and 40 commits back |
|
this is a combination of both the fixes I did for collections being deleted, and what happens here. |
…-membership-provenance # Conflicts: # apps/server/src/modules/api/plex-api/plex-api.service.ts
Summary
Fixes #2611 by tracking rule-owned and manual collection membership separately. When multiple rules target the same manual media server collection, each Maintainerr collection now keeps its own rule-owned membership while still showing genuinely shared manual items.
Root cause
The old model stored a single
isManualflag perCollectionMediarow. During media server sync, items discovered in a shared server collection but not tracked locally were imported as manual, even when they actually belonged to another rule targeting the same media server collection. That erased provenance and caused unrelated items to appear permanently pinned as manual.What this changes
isManualflag with two independent fields:includedByRulemanualMembershipSource(legacy,local,shared)rule,manual,all) so rule execution and media server sync only clear the intended membership.Backward compatibility
isManualremains a derived field via entity hooks, so existing read paths continue to behave correctly while the new provenance fields drive collection membership behavior. The migration backfillsincludedByRuleandmanualMembershipSourcefrom existing rows and remains reversible.Validation
yarn format:changedyarn check-typesyarn lint(4 existing UI warnings only)yarn testyarn build