Keep a remote listing and an office listing two roles in the per-place fold, since the kept role takes a copy's places and not its remote and the fetch gate then rejected the one behind the other

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-10-05 10:16:37 +02:00
1 parent 8f774b5147
commit b4774f1da9
3 files changed
+31 -7

No files matched your search

+4 -3
View File
@@ -548,7 +548,8 @@ def rebuild_dupes(conn: sqlite3.Connection) -> DupeCounts:
A copy the host published for another place (`dupes.Folded.placed`)
leaves its places on the kept role as `role_places` rows with the copy's
link, see `_sync_copy_places`."""
link, see `_sync_copy_places`. Its remote stays its own, which is why a
remote listing is never folded into an office one (`dupes.fold`)."""
# Migration 18 runs this on a file that has no `teaser` and no
# `role_places` yet: there it groups as before and folds no places.
current = any(r[1] == "teaser" for r in conn.execute("PRAGMA table_info(roles)"))
@@ -556,7 +557,7 @@ def rebuild_dupes(conn: sqlite3.Connection) -> DupeCounts:
rows = conn.execute(
f"""SELECT uid, company_key, title_key, country, place, {_HOST} AS host,
description != '' AS described, posted_at,
SUBSTR({text}, 1, {dupes.TEXT_CHARS}), original_url
SUBSTR({text}, 1, {dupes.TEXT_CHARS}), original_url, remote = 'remote'
FROM roles
WHERE closed_at IS NULL AND company_key != ''
AND (company_key, title_key) IN (
@@ -567,7 +568,7 @@ def rebuild_dupes(conn: sqlite3.Connection) -> DupeCounts:
folded = made(
dupes.Copy(uid=r[0], company_key=r[1], title_key=r[2], country=r[3], place=r[4],
host=r[5], has_description=bool(r[6]), posted_at=r[7] or None,
text=r[8] or "", url=r[9] or "")
text=r[8] or "", url=r[9] or "", remote=bool(r[10]))
for r in rows)
new = folded.dup_of
old: dict[str, str | None] = dict.fromkeys(new)