feat: an open grouping — a later drop joins its post (milestone 388 step E3)
CI / extension-version (push) Successful in 3s
CI / lint (push) Successful in 3s
Build images / sign-extension (push) Successful in 4s
Build images / build-agent (push) Successful in 7s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Successful in 31s
Build images / build-web (push) Successful in 1m6s
Build images / smoke-web (push) Skipped
Build images / build-ml (push) Successful in 1m59s
Build images / promote (push) Skipped
CI / integration (push) Failing after 2m7s
CI / extension-version (push) Successful in 3s
CI / lint (push) Successful in 3s
Build images / sign-extension (push) Successful in 4s
Build images / build-agent (push) Successful in 7s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Successful in 31s
Build images / build-web (push) Successful in 1m6s
Build images / smoke-web (push) Skipped
Build images / build-ml (push) Successful in 1m59s
Build images / promote (push) Skipped
CI / integration (push) Failing after 2m7s
A synthetic post is no longer sealed at creation. A creator who adds two more variants the next day extends the existing post, its body grows with the new messages, and no rival post appears. That is what makes chat capture read as content trickling in rather than as a stream of separate arrivals. The sweep now runs two passes per source and the ORDER is load-bearing: offer new messages to still-open groups BEFORE founding new ones, because whichever runs first claims a message. E3's three named problems, each answered rather than discovered later: **Bridging.** A candidate near two groups joins NEITHER. Nearest-wins would silently make an arbitrary choice between two posts the operator may already have seen; merging them is worse still, because a merge rewrites history and anything pointing at the absorbed post dangles. Leaving it to found its own group is the recoverable failure. AMBIGUITY_MARGIN is a module constant and deliberately not a setting — it is not a quality dial anyone would tune toward a better feed, and exposing it would invite turning it to zero, which is exactly the silent arbitrary choice it prevents. **Re-surfacing without thrashing.** A grouping has two dates, and which one orders the feed is a real decision, so the feed orders by neither directly. Ordering by when the drop STARTED buries a group that grows a week later under a week of other posts — defeating the point of keeping it open. Ordering by every growth lets a group gaining one image a day live permanently at the top, so chat out-competes authored posts for the front page — the opposite of "post pacing stays front and centre". Instead `resurfaced_at` moves only when growth clears BOTH a minimum-images bar and a cooldown, so a drip-feed updates in place and a genuine second wave resurfaces exactly once. It is NULL on every ordinary post, so the sort key COALESCEs through it without moving anything that is not a grouping. **Reopening forever.** Groups close after a quiet period — artists reuse characters for years, and a group left open indefinitely will eventually absorb something it shouldn't. Openness is DERIVED, not stored: a group is open if it grew (or started) within the window. Lowering the setting closes old groups and raising it reopens them, with nothing to repair either way; a stored closed_at would have needed a sweep to set it and a repair path to ever change the policy. Rule 89 is satisfied structurally rather than by a parallel mechanism: celery_signals writes a TaskRun for every task, which already supplies duration, the 5-minute stalled-run recovery, and retention pruning. What this step owed on top of that was a wall-clock limit (present) and idempotence — re-running the joiner adds nothing, asserted directly rather than left to the unique (image, post) constraint to catch. Two bugs fixed in the writing, one of which my own test would have hit: * `assign_to_group` sorted bare (distance, Post) tuples, which falls through to comparing Posts when two distances tie — and a perfectly symmetric bridge, the exact case the function exists for, would have raised TypeError instead of declining to choose. Now keyed on the distance alone. * The cursor was still built from `post_date or downloaded_at` while the ORDER BY had gained `resurfaced_at`. Two expressions that disagree at a page boundary don't error, they silently skip or repeat rows; both sites now go through one `_post_sort_value`, and a test pages through one row at a time to prove the walk matches the whole list. Image linking is now one shared helper rather than written twice, because creation and joining would otherwise be free to drift on exactly the detail (which post owns the image) that makes a grouping reversible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LNXXULQDjVZmbuNa2G9mD9
This commit is contained in:
@@ -27,6 +27,12 @@
|
||||
<span v-if="totalImages" class="fc-post-card__meta">
|
||||
· {{ totalImages }} image{{ totalImages === 1 ? '' : 's' }}
|
||||
</span>
|
||||
<!-- Only on a grouping that has actually grown. An ordinary post can
|
||||
never show this, and a grouping that has not grown says nothing —
|
||||
an "updated" label that is always present teaches you to ignore it. -->
|
||||
<span v-if="grewAt" class="fc-post-card__meta fc-post-card__grew">
|
||||
· updated {{ grewRelative }}
|
||||
</span>
|
||||
<v-spacer />
|
||||
<PostSeriesMenu :post="post" />
|
||||
<v-btn
|
||||
@@ -221,16 +227,25 @@ const moreCount = computed(() => {
|
||||
const railCols = computed(() => rail.value.length + (moreCount.value > 0 ? 1 : 0))
|
||||
|
||||
const sortDateIso = computed(() => props.post.post_date || props.post.downloaded_at)
|
||||
|
||||
// #388 E3. A grouping stays OPEN, so its own date and its latest activity are
|
||||
// different facts. The card keeps showing when the drop STARTED — that is the
|
||||
// post's identity — and reports growth separately, because "this post is from
|
||||
// Tuesday but gained images this morning" is the whole signal that chat
|
||||
// content is trickling in.
|
||||
const grewAt = computed(() => (synthesized.value ? props.post.last_grew_at : null))
|
||||
const grewRelative = computed(() => (grewAt.value ? relativeFrom(grewAt.value) : ''))
|
||||
const absoluteDate = computed(() => new Date(sortDateIso.value).toLocaleString())
|
||||
const relativeDate = computed(() => {
|
||||
const then = new Date(sortDateIso.value).getTime()
|
||||
function relativeFrom (iso) {
|
||||
const then = new Date(iso).getTime()
|
||||
const diff = (Date.now() - then) / 1000
|
||||
if (diff < 60) return `${Math.floor(diff)}s ago`
|
||||
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`
|
||||
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`
|
||||
if (diff < 86400 * 30) return `${Math.floor(diff / 86400)}d ago`
|
||||
return new Date(sortDateIso.value).toLocaleDateString()
|
||||
})
|
||||
return new Date(iso).toLocaleDateString()
|
||||
}
|
||||
const relativeDate = computed(() => relativeFrom(sortDateIso.value))
|
||||
|
||||
// --- images → post-scoped modal ---------------------------------------
|
||||
async function fullImageIds () {
|
||||
@@ -375,6 +390,10 @@ function formatBytes (n) {
|
||||
.fc-post-card__synthetic {
|
||||
color: rgb(var(--v-theme-on-surface-variant));
|
||||
}
|
||||
|
||||
/* Growth is news, so it gets the accent the rest of the meta line doesn't —
|
||||
but it is still the meta line, not a badge competing with the artwork. */
|
||||
.fc-post-card__grew { color: rgb(var(--v-theme-accent)); }
|
||||
.fc-post-card__date,
|
||||
.fc-post-card__meta { white-space: nowrap; }
|
||||
|
||||
|
||||
@@ -48,6 +48,54 @@
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- E3: a grouping stays open, and these decide for how long and how
|
||||
loudly it announces that it grew. -->
|
||||
<div class="text-caption fc-muted mt-4 mb-2">
|
||||
A grouped post stays <strong>open</strong>: variants the creator adds
|
||||
later join the existing post instead of starting a new one, and its
|
||||
text grows with them.
|
||||
</div>
|
||||
<v-row>
|
||||
<v-col cols="12" sm="4">
|
||||
<SettingNumberField
|
||||
v-model="local.discord_group_close_after_hours"
|
||||
label="Stays open for (hours)" :min="1" :step="24"
|
||||
density="comfortable" max-width="none"
|
||||
:disabled="!local.discord_grouping_enabled" @change="onSave"
|
||||
/>
|
||||
<div class="text-caption fc-muted mt-1">
|
||||
How long after its last addition a post still accepts new variants.
|
||||
Not the drop window above — that cuts one session into drops; this
|
||||
decides how late a follow-up can still join. Too long and the same
|
||||
character coming round again months later gets absorbed by mistake.
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="4">
|
||||
<SettingNumberField
|
||||
v-model="local.discord_group_resurface_min_images"
|
||||
label="New images before it resurfaces" :min="1" :step="1"
|
||||
density="comfortable" max-width="none"
|
||||
:disabled="!local.discord_grouping_enabled" @change="onSave"
|
||||
/>
|
||||
<div class="text-caption fc-muted mt-1">
|
||||
Growth smaller than this updates the post where it sits instead of
|
||||
moving it back to the top of the feed.
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="4">
|
||||
<SettingNumberField
|
||||
v-model="local.discord_group_resurface_cooldown_hours"
|
||||
label="Resurface at most every (hours)" :min="0" :step="1"
|
||||
density="comfortable" max-width="none"
|
||||
:disabled="!local.discord_grouping_enabled" @change="onSave"
|
||||
/>
|
||||
<div class="text-caption fc-muted mt-1">
|
||||
Together with the count above, this is what stops a post that gains
|
||||
an image a day from living permanently at the top of the feed.
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-else><v-skeleton-loader type="paragraph" /></div>
|
||||
</MaintenanceTile>
|
||||
@@ -77,6 +125,10 @@ function onSave() {
|
||||
discord_grouping_enabled: Boolean(local.discord_grouping_enabled),
|
||||
discord_group_max_distance: Number(local.discord_group_max_distance),
|
||||
discord_group_window_minutes: Number(local.discord_group_window_minutes),
|
||||
discord_group_close_after_hours: Number(local.discord_group_close_after_hours),
|
||||
discord_group_resurface_min_images: Number(local.discord_group_resurface_min_images),
|
||||
discord_group_resurface_cooldown_hours:
|
||||
Number(local.discord_group_resurface_cooldown_hours),
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -84,6 +84,36 @@ describe('PostCard', () => {
|
||||
expect(w.find('.fc-post-card__synthetic').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('reports growth separately from the post date', () => {
|
||||
// The drop's own date is its identity; growth is news about it. "From
|
||||
// Tuesday, gained images this morning" is the trickling-in signal, and
|
||||
// collapsing the two would erase it.
|
||||
const w = mountComponent(PostCard, {
|
||||
props: {
|
||||
post: { ...SYNTH, last_grew_at: new Date(Date.now() - 3600e3).toISOString() },
|
||||
},
|
||||
pinia: freshPinia(),
|
||||
})
|
||||
expect(w.text()).toContain('updated 1h ago')
|
||||
})
|
||||
|
||||
it('says nothing about growth on a grouping that has not grown', () => {
|
||||
// An "updated" label that is always there teaches you to ignore it.
|
||||
const w = mountComponent(PostCard, {
|
||||
props: { post: { ...SYNTH, last_grew_at: null } },
|
||||
pinia: freshPinia(),
|
||||
})
|
||||
expect(w.text()).not.toContain('updated')
|
||||
})
|
||||
|
||||
it('never claims an ordinary post grew, even if the field leaks in', () => {
|
||||
const w = mountComponent(PostCard, {
|
||||
props: { post: { ...BASE, last_grew_at: new Date().toISOString() } },
|
||||
pinia: freshPinia(),
|
||||
})
|
||||
expect(w.text()).not.toContain('updated')
|
||||
})
|
||||
|
||||
it('singularises a one-message drop', () => {
|
||||
const w = mountComponent(PostCard, {
|
||||
props: { post: { ...SYNTH, synthesis: { message_count: 1 } } },
|
||||
|
||||
Reference in New Issue
Block a user