Adopt the Pipeline: grid-driven opportunities link (v0.1.0:87)

The fundraising grid (canonical) now drives the classic opportunities
Pipeline board, instead of the board being a disconnected second data-entry
surface. An "Add to Pipeline" row action creates a durably-linked opportunity
via the new opportunities.fundraising_investor_id (migration 0005, additive +
reversible), reusing the grid's already-synced contact — retiring the
POST /api/contacts side-door — and mapping the grid lead to the opp owner.

Ownership is split so the two stay reconciled: the grid owns whether the link
exists and the seed; the board owns stage/probability/owner. The link endpoint
is idempotent (one live opp per investor; a re-link never reseeds funnel
fields). "Is in pipeline?"/"what stage?" are derived from a live opp join and
injected as read-only grid columns on read, stripped on write, so they never
persist or dirty the autosave. Remove-from-pipeline soft-deletes the opp and
leaves the grid row fully intact; deleting an investor from the grid archives
its orphaned opp.

Also fixes the standing soft-delete leak in handle_pipeline_report and the
dashboard pipeline aggregates, which counted tombstoned opportunities.

Tests: backend/test_grid_pipeline_link.py (link/idempotent/round-trip/guards/
unlink-intact/re-link/orphan/aggregates); 28/28 suite green, render-smoke green.
This commit is contained in:
Keysat
2026-06-17 23:08:36 -05:00
parent 06482247df
commit 7f9a15ebf3
10 changed files with 724 additions and 89 deletions
+25
View File
@@ -0,0 +1,25 @@
import { VersionInfo } from '@start9labs/start-sdk'
// Adopt the Pipeline — the fundraising grid (canonical) now drives the deal board.
// An "Add to Pipeline" row action creates and durably links an opportunity via the new
// opportunities.fundraising_investor_id column (backend migration 0005, additive +
// reversible — applied at app startup by core_migrations, so this StartOS migration is a
// no-op). The link reuses the grid's already-synced contact (no POST /api/contacts
// side-door) and maps the grid `lead` → owner; it is idempotent (one live opp per
// investor; a re-link never reseeds the board-owned stage/probability). Two read-only
// grid columns — Pipeline + Pipeline Stage — are derived live from the linked opp.
// "Remove from Pipeline" soft-deletes the opp (the grid row is untouched); deleting an
// investor from the grid archives its orphaned opp. Also folds in the soft-delete fix for
// the pipeline report + dashboard aggregates (archived opps are no longer counted).
export const v_0_1_0_87 = VersionInfo.of({
version: '0.1.0:87',
releaseNotes: {
en_US: [
'Adopt the Pipeline: flag an investor in the fundraising grid as a deal and it',
'creates a linked opportunity on the Pipeline board — no duplicate data entry, the',
'board owns the stage/odds, and a read-only Pipeline Stage column mirrors it back',
'into the grid. Removing from the pipeline archives the deal but leaves the grid intact.',
].join(' '),
},
migrations: { up: async () => {}, down: async () => {} },
})