feat(ingest): Recapture mode — re-grab post bodies/links + localize on-disk inline images (#830)
CI / frontend-build (push) Successful in 19s
CI / backend-lint-and-test (push) Successful in 44s
CI / integration (push) Successful in 3m21s
CI / lint (push) Successful in 4s

A plain backfill gates post-body capture on the seen-ledger, so a post whose
media is already on disk AND whose post key is already seen never gets its body
recaptured (operator-flagged: Industrial Lust description missing). Recovery
recaptures unconditionally but re-downloads the whole source.

New 'recapture' walk mode (4th beside tick/backfill/recovery): bypasses the
post-record gate so EVERY post's body + external links are re-captured
(detail-fetching empty bodies) WITHOUT re-downloading on-disk media; and
surfaces already-present media via a separate non-deleting relink channel so the
importer backfills ImageRecord.source_filehash for inline-image localization.

- ingest_core: recapture mode + recapture_records gate bypass + relink collect
- patreon_downloader: recapture surfaces seen-on-disk as skipped_disk(path),
  never refetches seen-missing media, still downloads genuinely-new
- importer.relink_source_filehash: NULL-only sha256 backfill, never unlinks
- download_service: mode derivation + phase-3 relink loop + lifecycle clear
- source_service/api: start_recapture + backfill_recapture field + action
- frontend: Recapture kebab action + 'Recapturing' badge across SourceActions/
  Row/Card/SubscriptionsTab + sources store
- tests across ingester/downloader/importer/source_service/api/download_service

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 20:58:40 -04:00
parent 96c29c370b
commit 65ec29ba9b
18 changed files with 467 additions and 29 deletions
@@ -21,7 +21,7 @@
<v-icon>{{ running ? 'mdi-stop' : 'mdi-magnify-scan' }}</v-icon>
<v-tooltip activator="parent" location="top">
{{ running
? (recovering ? 'Stop recovery' : 'Stop backfill')
? (recovering ? 'Stop recovery' : (recapturing ? 'Stop recapture' : 'Stop backfill'))
: 'Backfill one-time walk of the FULL post history until complete' }}
</v-tooltip>
</v-btn>
@@ -38,6 +38,17 @@
under the current similarity threshold
</v-list-item-subtitle>
</v-list-item>
<v-list-item
v-if="isPatreon && !running"
prepend-icon="mdi-text-box-search-outline"
@click="emit('recapture', source)"
>
<v-list-item-title>Recapture post text &amp; links</v-list-item-title>
<v-list-item-subtitle>
Re-grab every post's body + external links and localize inline images
already on disk without re-downloading media
</v-list-item-subtitle>
</v-list-item>
<v-divider v-if="isPatreon && !running" />
<v-list-item
base-color="error"
@@ -58,10 +69,11 @@ const props = defineProps({
source: { type: Object, required: true },
checking: { type: Boolean, default: false },
})
const emit = defineEmits(['check', 'backfill', 'recover', 'remove'])
const emit = defineEmits(['check', 'backfill', 'recover', 'recapture', 'remove'])
const running = computed(() => props.source.backfill_state === 'running')
const recovering = computed(() => !!props.source.backfill_bypass_seen)
const recapturing = computed(() => !!props.source.backfill_recapture)
const isPatreon = computed(() => props.source.platform === 'patreon')
</script>
@@ -40,7 +40,7 @@
<v-chip
v-else-if="source.backfill_state === 'running'"
size="x-small" color="info" variant="tonal" label
>{{ source.backfill_bypass_seen ? 'Recovering' : 'Backfilling'
>{{ source.backfill_bypass_seen ? 'Recovering' : (source.backfill_recapture ? 'Recapturing' : 'Backfilling')
}}{{ source.backfill_posts
? ` · ${source.backfill_posts} posts`
: (source.backfill_chunks ? ` (${source.backfill_chunks})` : '') }}</v-chip>
@@ -60,6 +60,7 @@
@check="$emit('check', $event)"
@backfill="$emit('backfill', $event)"
@recover="$emit('recover', $event)"
@recapture="$emit('recapture', $event)"
@remove="$emit('remove', $event)"
/>
</div>
@@ -79,7 +80,7 @@ const props = defineProps({
checking: { type: Boolean, default: false },
warningThreshold: { type: Number, default: 5 },
})
const emit = defineEmits(['edit', 'remove', 'toggle', 'check', 'backfill', 'recover'])
const emit = defineEmits(['edit', 'remove', 'toggle', 'check', 'backfill', 'recover', 'recapture'])
function onToggleEnabled(value) {
emit('toggle', { source: props.source, enabled: value })
@@ -51,7 +51,7 @@
<v-chip
v-else-if="source.backfill_state === 'running'"
size="x-small" color="info" variant="tonal" label
>{{ source.backfill_bypass_seen ? 'Recovering' : 'Backfilling'
>{{ source.backfill_bypass_seen ? 'Recovering' : (source.backfill_recapture ? 'Recapturing' : 'Backfilling')
}}{{ source.backfill_posts
? ` · ${source.backfill_posts} posts`
: (source.backfill_chunks ? ` (${source.backfill_chunks})` : '') }}</v-chip>
@@ -71,6 +71,7 @@
@check="$emit('check', $event)"
@backfill="$emit('backfill', $event)"
@recover="$emit('recover', $event)"
@recapture="$emit('recapture', $event)"
@remove="$emit('remove', $event)"
/>
</td>
@@ -87,7 +88,7 @@ const props = defineProps({
checking: { type: Boolean, default: false },
warningThreshold: { type: Number, default: 5 },
})
const emit = defineEmits(['edit', 'remove', 'toggle', 'check', 'backfill', 'recover'])
const emit = defineEmits(['edit', 'remove', 'toggle', 'check', 'backfill', 'recover', 'recapture'])
function onToggleEnabled(value) {
emit('toggle', { source: props.source, enabled: value })
@@ -138,7 +138,7 @@
:source="item.singleSource"
:checking="store.checkingIds.has(item.singleSource.id)"
@check="onCheck" @backfill="onBackfill"
@recover="onRecover" @remove="removeSource"
@recover="onRecover" @recapture="onRecapture" @remove="removeSource"
/>
<v-btn icon size="small" variant="text" @click.stop="openEditSource(item.singleSource)">
<v-icon>mdi-pencil</v-icon>
@@ -214,6 +214,7 @@
@check="onCheck"
@backfill="onBackfill"
@recover="onRecover"
@recapture="onRecapture"
/>
<tr v-if="item.sources.length === 0">
<td colspan="8" class="fc-subs__sources-empty">
@@ -291,6 +292,7 @@
@check="onCheck"
@backfill="onBackfill"
@recover="onRecover"
@recapture="onRecapture"
/>
<div v-if="item.sources.length === 0" class="fc-subs__sources-empty">
No sources yet. Tap + to add one.
@@ -646,6 +648,22 @@ async function onRecover(source) {
}
}
// #830: arm a recapture walk (Patreon-only) — re-grab every post's body +
// external links and localize on-disk inline images, without re-downloading
// media. Reuses the backfill lifecycle/badge; stop via the same Stop control.
async function onRecapture(source) {
try {
await store.recaptureSource(source.id, source.artist_id)
toast({ text: `Recapture started for ${source.artist_name}`, type: 'success' })
// recaptureSource patches the source in place — no full reload.
} catch (e) {
toast({
text: `Recapture start failed: ${e?.body?.detail || e?.message || e}`,
type: 'error',
})
}
}
async function checkAll(group) {
let ok = 0
let conflict = 0
+9
View File
@@ -131,6 +131,14 @@ export const useSourcesStore = defineStore('sources', () => {
_patchSource(body)
return body
}
// #830: arm a recapture walk (Patreon-only) — re-grab every post's body +
// external links and localize on-disk inline images, WITHOUT re-downloading
// media. Shares the backfill lifecycle/badge; stop via stopBackfill.
async function recaptureSource(id, artistIdHint = null) {
const body = await api.post(`/api/sources/${id}/backfill`, { body: { action: 'recapture' } })
_patchSource(body)
return body
}
// Plan #708 B4: dry-run preview — count what a backfill WOULD download
// (native platforms), without downloading. Read-only, so no cache invalidate.
@@ -167,6 +175,7 @@ export const useSourcesStore = defineStore('sources', () => {
startBackfill,
stopBackfill,
recoverSource,
recaptureSource,
previewSource,
findOrCreateArtist, autocompleteArtist,
loadScheduleStatus,