feat(author): drop thin edition clusters from catalogue sync (#2235) - #2673
Conversation
b2072bc to
f454ab4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Heads up on a migration number collision, not a review. This PR adds a migration numbered 086, and so does #2673 or #2633, whichever this is not. Both are open and both claim it. 086 is a genuine gap on main, which goes 085 then 087, and it has never been filled by a merged commit. Three separate branches have each created their own 086 at some point, which is how the gap became attractive to all of them at once. Main tops out at 089. Current claim map across the open PRs:
Suggest renaming to 093 or above rather than reusing the gap, and picking the number by checking open PRs rather than main. The reason this keeps happening is that each branch computes "next free" against a main that excludes everyone else's in flight work. |
1854e09 to
198360b
Compare
|
My fault, and a correction to my own advice on this PR. I told four PRs that 093 was the first free number. Two of you took it, so #2673 and #2761 now both claim 093, which is the same collision I was flagging. Telling several branches one free number just moves the crash. Assigning distinct numbers instead, so nobody has to guess:
So please rename to One other thing on this PR: the body says 086 while the file says 093. Those need to agree whichever number it ends on. Note for anyone reading this later: 086 is a real gap on main, which runs 085 then 087, and it was never filled by a merged commit. The apply loop keys on the filename number rather than on "greater than last applied", so a back filled 086 does apply cleanly to existing installs. That is why #2633 can keep it. |
…e#2235) A metadata profile can now set a minimum edition count per title cluster. During author catalogue sync, works whose normalised title has fewer known editions than the floor are skipped before creation; the cluster's best-known count decides, so a title with one well-editioned work keeps its thinner siblings. Unknown is not zero: works reporting no edition count at all pass the filter, which keeps Hardcover-primary authors (whose records never carry a count) from losing their whole catalogue. Already-tracked books are maintained, not dropped, and explicit single-work adds are exempt, matching the vavallee#1612 catalogue-heuristic exemption. The skip is opt-in (profile default 0 = off) and shows up in the sync summary and the author page notice as its own line. Signed-off-by: gch ahcg <gchahcg@proton.me>
198360b to
53931a4
Compare
|
Renamed to |
vavallee
left a comment
There was a problem hiding this comment.
This is the shape we agreed on #2235, and the unknown passes rule is the part that matters most: Hardcover primary authors never carry an edition count, so a sum or zero based rule would have emptied their catalogues. I checked it's pinned by turning a missing count into a zero, and `TestFetchAuthorBooks_SkipsThinCluster` fails. Merged onto current main it builds, vets, and `db`, `models` and the catalogue sync tests pass. 094 is unique across main and every open PR.
Two small things before merge:
- Changelog fragment. Every PR needs one under `changelog.d/` (the release notes are assembled from them). Something like `changelog.d/2235-min-edition-count.md` with an `### Added` bullet. House style is no dashes in the text.
- One line in the docs about series fill. Every metadata profile filter, this one included, is skipped by the series fill path today. That's #2208 and not yours to fix, but someone who sets a floor and then fills a series will see thin works arrive and think the filter is broken. A sentence in the User Guide section you added saves that support question.
Tiny nit, take or leave: the cluster key is normalised inline in two places (building the map and reading it). They match today; a small helper would keep them from drifting.
…s fill gap (vavallee#2235) Adds the changelog fragment for the opt in minimum edition count, and a sentence in the user guide that series fill skips every metadata profile filter today, this one included (vavallee#2208). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9 Signed-off-by: vavallee <vavallee@protonmail.com>
|
Pushed two small follow ups so this can make the next release: a changelog fragment ( |
Resolves the one conflict in internal/api/authors.go: this branch adds resolveMinEditionCount and main (vavallee#2754) adds the author work language evidence fetch at the same point in runCatalogueSync. Independent, so both are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9 Signed-off-by: vavallee <vavallee@protonmail.com>
Summary
Metadata profiles gain an opt-in minimum edition count filter for author catalogue syncs: works whose title cluster reports fewer known editions than the profile's floor are skipped before they become book rows. Closes #2235.
This is the smaller, safer shape of the request from the issue thread — a per-profile number, not a global catalogue-wide policy — and it leaves the closed PR #2628's cluster-signalling approach behind.
Implementation notes
EditionCountacross the works in the cluster — one well-editioned work saves the title's thinner siblings0= filter off; the cluster map is only built when the profile sets a floor, so the default is zero-cost094_metadata_profile_min_edition_count.sqladdsmin_edition_count INTEGER NOT NULL DEFAULT 0tometadata_profiles.SkippedThinCluster+ sample, capped at 5) and surfaced as its own line in the author page's sync notice.Where it's mounted
fetchAuthorBooks(internal/api/authors.go): cluster map built in the candidate loop, filter applied in the create loop after existing-book resolution.internal/db/metadata_profiles.go,internal/models/metadata_profile.go.MetadataTab.tsx), sync notice breakdown (AuthorSyncNotice.tsx), en i18n keys (other locales fall back to en).Follow-ups (not in this PR)
Checklist
fetchAuthorBookstests (drop, opt-in default, owned-book exemption, single-work exemption) plus the twin-title fixture fix inEditAuthorModal.test.tsxdocs/User-Guide-Wiki.mdprofile-filter listTest plan
make test(full Go suite, CI gate)gofmt -l .,go vet ./...,golangci-lint v2.11.4,govulncheckmake smoke(real binary, exercises the new migration)cd web && npm run typecheck && npm run build && npm test(1002 tests) andnpm run lint(0 errors; remaining warnings pre-existing)