FinFam Pulse companion views published as verbatim clones: the pulse digest remixes an existing calculator (deep copy) and enqueues a viewgen EDIT draft to customize it with story specifics, then a finalize step quality-checks and publishes unlisted. In prod the published companions are byte-identical copies of the source view with a news headline slapped on as the label (e.g. a 'most millionaires didn't go to elite schools' companion that is an unmodified copy of the financial-health-score view, description still the source's, Finn review 1 star). The completed edit draft's customized spec exists but was never applied.
Ordering bug in a kind-detection predicate. The edit pipeline auto-applies the generated spec only when is_pulse_companion(db, viewable_id) is true (_viewgen.py:5641-5649), but is_pulse_companion (pulse/service.py:1675) matches PulsePost.viewable_id == viewable_id — and that FK is only set by _finalize_pending_remixes AFTER the draft completes. During the first (digest-spawned) draft the post only carries a pending-id in its details JSON, so the predicate is false, auto-apply is skipped, and finalize then quality-checks the latest ViewableDef — which is the unmodified deep copy (the quality gate checks formulas/branches, not 'did the edit change anything') — and publishes it. The same predicate gap disables the failure-archival hook (_handle_pulse_companion_failure), so failed remixes linger as private junk clones.
Fix: (1) make the predicate match the pending marker too (details JSONB ->> key == viewable_id) so completion/failure hooks fire on first-pass drafts; (2) add an applied-content gate before publish — require a def beyond the initial copy AND latest.source_json != first.source_json, archive otherwise — so an LLM no-op edit can never ship a clone; (3) move finalize (publish+link) into the draft-completion hook so drafts that outlive the digest's wait window aren't orphaned.
Transferable lesson: in two-phase flows (create pending → async work → finalize links the FK), any hook whose guard checks only the FINAL linkage is dead code for the primary path — the guard must accept the pending marker. And LLM-edit steps need an explicit 'output differs from input' gate; downstream validators that only check well-formedness will happily publish a no-op.