WHAT IT IS
Buying signals for a security reseller, drawn from free public sources.
SecuritySalesHub is pre-sales signal intelligence for an independent seller of security products, meaning a value-added reseller or managed service provider that carries several vendors' lines and sells into regulated US industries. It watches free public sources for events such as a breach report or an enforcement action, flags when an account has become more likely to buy, and attaches the evidence trail, a draft opening message and a suggested play, the sales approach that fits the event. Between August 30 and September 2 it gained seller-scoped row-level security, database rules that stop one seller's account from changing another seller's rows or the shared pipeline.
WHAT CHANGED
Seven listed sources had no code, and three had code that never ran.
On September 5 a commit titled Clean source policy inventory disabled seven rows in the source-policy table, the list of public sources the product is meant to fetch, because no Edge Function stood behind them. An Edge Function is a small program hosted on Supabase, the database platform the product is built on, and each one fetches a source. The seven covered energy data, power-grid reliability, industrial control system advisories, environmental and pipeline-safety enforcement, and bank regulators. On September 8 another commit scheduled three sources whose fetching code already existed but which no scheduled job had ever run: two security news sites and the insurance commissioners' national association. On that date six of the seven disabled rows were still off.
CONTROL
CI fails any run in which a test was skipped.
From August 15 the full test chain ran in CI, the automated checks run on every change, on a GitHub runner, a fresh machine GitHub provides for each run, which the AI coding agents doing the build do not control. The same commit made CI fail whenever a test was skipped, because a test runner reports success when a test skips itself. A Deno test of the code that stores raw events (Deno is the runtime Edge Functions use) skipped itself whenever its service settings were missing from the environment, so a passing result could mean it never ran.
LESSONS
Two patterns from this build.
- Make every enabled config row prove there is code behind it. The cleanup's check looks in the non-test source files for each enabled source's Edge Function and fails the build when one is missing. It ignores test files, so a fixture, the sample data a test runs on, cannot make a source look built, and a second test fails when a scheduled job points at an undeployed function.
- When one rule is written in two places, add a test that compares the copies. The order for picking capability categories, the types of security product an event points to, lives in the Deno code that stores a recommendation and in the web app's Node code that reads it. A sync test compares the two texts, and its header notes that both sides' tests would pass while the copies disagreed.
PROJECT DESIGN
How it works.
How data moves
Key modules
Ingestion layer
15+ Deno Edge Functions (mostly one per public source) on pg_cron, inheriting a shared runner with idempotent dedupe via ON CONFLICT DO NOTHING, TTL skip, cursor-resumable pagination, and per-source error containment.
Entity resolver
Deterministic resolution by CIK, ticker, LEI, and Wikidata QID; difflib fuzzy fallback for names. An ambiguous CIK (two watchlist rows sharing one CIK) routes to the operator review queue, never auto-fires a signal.
Multi-vendor catalog + seller filter
61 products across 47 vendors in CSV seeds; a per-vendor carried/not-carried preference layer enforces the seller's line card without touching recommendation logic. 35 vendors marked carried; 12 excluded for direct-only motion or partner-agreement conflicts.
Two-hop recommendation engine
Event-type-to-capability-category mapping in a CSV; capability-to-product mapping via the seeded products table filtered by seller preferences. No product name hardcoded in any classifier or scoring function.
SQL scoring function
Decay formula (base_strength × 0.5^(age_days/half_life) × account_fit × scope_fit) lives in SQL migrations, starting with 0008; no TypeScript reimplementation. Industry and subsector weights are keyed rows in scoring_weights.csv.
Stack inference (infer-stack)
Reads each watchlist entity's EDGAR 10-K Item 1C cybersecurity filing to infer incumbent vendor stack using word-boundary regex — incumbent context for the recommendation engine, zero paid data sources.
Config seeds
23 seed files (as of 2026-09-08) seeded via scripts/seed-loader.mjs. Products, capability categories, scoring weights, watchlist entities, and vendor preferences are admin-editable without a code deploy.
SECURITY & OPERATIONS
Security and operations.
- Row-level security on all write paths (migration 0010_rls.sql); the anonymous role can SELECT only the four card-path tables — signals, watchlist_entities, signal_evidence, recommendation_snapshots.
- Seven written trust invariants, some of them locked in the schema by CHECK constraints, append-only triggers and a products table with no price column, and tested against a live local database. The seven: no price in the DOM, nothing surfaces unsourced, unconfirmed_early_warning cards never customer-facing, recommendation snapshots append-only, no paid or LLM call on any read path, market position shown only with a named analyst source and verified date.
- Service-role leak scan (scripts/check-service-role-leak.mjs) and a generated-types content-hash sentinel run on every CI pass alongside TypeScript and Deno typechecks.
- No paid data sources: the source policies are all free, read-only public APIs and pages with verified terms of service. The only recurring cost is a capped Claude API audit judge — a scheduled Edge Function, never in the read path.
BUILDER NOTES
Builder notes.
- The plan orchestrator (tools/orchestrator/ — a custom SQLite-backed conductor, not shipped as part of the product) managed the work as chunks: chunk lifecycle, gate verdicts, seam locks, and reconcile passes. A sprint with parallel tracks needs a conductor.
- Cross-runtime parity between Next.js (Node) and Supabase Edge Functions (Deno) was enforced mainly by shared types — a content-hash sentinel on generated Supabase TypeScript types fails CI on any drift, after normalizing Windows CRLF line endings (commits 84ee93d and 666a725). Shared import paths are a runtime error; shared types across a CI boundary are not.
- On 2026-08-21 commit f22c5047 corrected 21 market-position rows (16 niche to unranked, 5 unranked rows with the wrong source) under a rule that niche needs a Gartner, Forrester or IDC ranking source. The market-position honesty gate (R4.10) is a marketPosition.ts runtime check — not documentation.
WRITING
Field notes from this work.
No public field notes for this project yet.
Full build narrative
A multi-industry, multi-vendor pre-sales signal intelligence platform — a restack of the Python/SQLite GridSignals prototype into Next.js 14 + Supabase. Monitors free public sources (SEC EDGAR, CISA KEV, HHS OCR breach portal, NERC/FERC pages, and others) to detect buying signals for 61 security products across 47 vendors, covering energy, financial services, healthcare, and cross-industry regulated entities. The core architectural additions over GridSignals: industry-keyed scoring weights, a two-hop event→capability→product reasoning chain in config-as-data CSVs, watchlist entity resolution by regulatory identifier (CIK/ticker/LEI/Wikidata QID), and trust invariants, some enforced in the schema by CHECK constraints, append-only triggers and a products table with no price column, and tested against a live local database. Tests run across two runtimes (Vitest + Deno). 984 commits · 219 PRs · 25 active days to date.
Built as an explicit generalization of GridSignals — a Python/SQLite/Streamlit prototype that covered only energy and a single vendor set. Every architectural decision was a deliberate generalization: industry-keyed scoring weights instead of a flat model, a CSV-seeded capability category layer between events and products instead of hardcoded mappings, and a seller-preference filter that enforces the vendor line card without touching classifier or scoring logic. The plan orchestrator — a custom SQLite-backed conductor at tools/orchestrator/ — managed the work as chunks through chunk lifecycle, gate verdicts, and seam locks. Cross-runtime discipline between Next.js (Node) and Supabase Edge Functions (Deno) was enforced by a generated-types hash sentinel that fails CI on any type drift, after normalizing Windows CRLF line endings.