getaero-io/gtm-eng-skills / engineering/warm-intro-scoring
warm-intro-scoring
Verifiedtests/features.test.ts
View on GitHubimport {describe,it,expect} from 'bun:test';
import {buildFeatures,canonicalLinkedIn,roleFunction,isEmployee,metro,type FeatureInput,type Job} from '../plays/features';
const job=(extra:Partial<Job>={}):Job=>({companyId:'company-1',companyName:'Example Systems',position:'Software Engineer',location:'San Francisco',startDate:{year:2020,month:'January'},endDate:{text:'Present'},...extra});
const fixture=():FeatureInput=>({as_of:'2026-09-23',profiles_checked_at:'2026-08-02',requester_name:'Requester',connectors:[{id:'conn:1',first_name:'Connector',last_name:'One',linkedin_url:'https://linkedin.com/in/connector-one',source:'snapshot:connector-one',observed_at:'2026-08-02',company:'Example Systems',title:'Software Engineer',experience:[job()]}],profiles:[{id:'tgt:1',first_name:'Target',last_name:'One',linkedin_url:'https://linkedin.com/in/target-one',source:'snapshot:target-one',observed_at:'2026-08-02',company:'Example Systems',domain:'example.test',title:'Software Engineer',experience:[job()]}],targets:[{name:'Target One',linkedin_url:'https://linkedin.com/in/target-one',company:'Example Systems',domain:'example.test'}]});
describe('Source feature extraction',()=>{
it('retains source profile URLs for both people',()=>{const f=fixture(),p=buildFeatures(f).paths[0];expect(p.connector_linkedin_url).toBe("https://www.linkedin.com/in/connector-one");expect(p.target_linkedin_url).toBe("https://www.linkedin.com/in/target-one");});
it('accepts employee-sourced connectors without claiming a LinkedIn edge',()=>{const f=fixture();f.connectors[0].source='company-roster:example';const p=buildFeatures(f).paths[0];expect(p.features.relationship.value).toBe(0);expect(p.features.relationship.explanation).not.toContain('membership is known');expect(p.review_status).toBe('needs_confirmation');expect(p.features.work_overlap.value).toBeGreaterThan(0);});
it('uses canonical identity and rejects name-only resolution',()=>{expect(canonicalLinkedIn('https://www.linkedin.com/in/One/?x=2')).toBe('one');expect(canonicalLinkedIn('https://evil.test/in/One')).toBeNull();const f=fixture();f.targets[0].linkedin_url='https://linkedin.com/in/missing';const r=buildFeatures(f);expect(r.paths).toHaveLength(0);expect(r.coverage.unresolved[0].reason).toBe('missing_profile');});
it('retains ambiguous and mismatched contacts for review',()=>{const f=fixture();f.profiles.push({...f.profiles[0],id:'tgt:2'});expect(buildFeatures(f).coverage.unresolved[0].reason).toBe('ambiguous_profile');f.profiles.pop();f.targets[0].domain='another.test';expect(buildFeatures(f).coverage.unresolved[0].reason).toBe('account_domain_mismatch');});
it('explains missing and conflicting account metadata without guessing',()=>{const f=fixture();delete f.profiles[0].domain;let r=buildFeatures(f);expect(r.paths).toHaveLength(0);expect(r.coverage.unresolved[0].domain_check).toMatchObject({status:'missing_profile_domain',expected_domain:'example.test',profile_domain:null,profile_id:'tgt:1'});expect(r.coverage.unresolved[0].target.title).toBe('Software Engineer');f.profiles[0].domain='other.test';r=buildFeatures(f);expect(r.coverage.unresolved[0].domain_check.status).toBe('different_domains');expect(f.profiles[0].domain).toBe('other.test');expect(f.targets[0].title).toBeUndefined();f.targets[0].domain='';delete f.profiles[0].domain;r=buildFeatures(f);expect(r.paths).toHaveLength(0);expect(r.coverage.unresolved[0].domain_check.status).toBe('missing_target_domain');});
it('shares dated function and location without double counting',()=>{const p=buildFeatures(fixture()).paths[0];expect(p.baseline_score).toBe(80);expect(p.features.work_overlap.work_context).toEqual({company_size:null,same_function:true,same_location:true});expect(p.features.work_overlap.overlap_start).toBe('2020-01-31');expect(p.features.city_overlap.value).toBe(0);expect(p.features.role_industry.value).toBe(0);});
it('uses conservative year bounds and does not claim uncertain overlap',()=>{const f=fixture();f.connectors[0].experience=[job({startDate:{year:2020},endDate:{year:2020}})];f.profiles[0].experience=[job({startDate:{year:2020},endDate:{year:2020}})];const p=buildFeatures(f).paths[0];expect(p.features.work_overlap.value).toBe(0);expect(p.features.work_overlap.timing_status).toBe('unknown');});
it('selects strongest work context before longer weak overlap',()=>{const f=fixture();f.connectors[0].experience=[job({position:'Founder',location:'Unknown',startDate:{year:2010,month:'January'}}),job({startDate:{year:2025,month:'January'}})];const p=buildFeatures(f).paths[0];expect(p.features.work_overlap.evidence_ids).toEqual(['emp:conn:1:1','emp:tgt:1:0']);expect(p.features.work_overlap.work_context.same_function).toBe(true);});
it('awards direct investor role once and does not treat it as employee overlap',()=>{const f=fixture();f.connectors[0].experience=[job({position:'Seed Investor'})];const p=buildFeatures(f).paths[0];expect(p.baseline_score).toBe(120);expect(p.features.investor_role.value).toBe(1);expect(p.features.work_overlap.value).toBe(0);expect(p.features.city_overlap.value).toBe(0);expect(isEmployee(job({position:'Community Member'}))).toBe(false);});
it('holds unsupported investor-employer context',()=>{const f=fixture();f.connectors[0].company='Example Fund';f.connectors[0].experience=[job({companyId:'fund-id',companyName:'Example Fund',position:'Managing Director'})];f.funding_edges=[{target_domain:'example.test',investor_key:'example fund',investor_firm:'Example Fund',investor_company_id:'fund-id',source:'cached:funding',detail:'Cached funding',observed_at:'2026-08-02'}];expect(buildFeatures(f).paths[0].features.investor_portfolio.value).toBe(0);f.verified_firms=[{target_domain:'example.test',investor_key:'example fund',evidence:{id:'primary:fund',source:'https://fund.example/portfolio',detail:'Investment confirmed',observed_at:'2026-09-23'}}];expect(buildFeatures(f).paths[0].features.investor_portfolio.value).toBe(1);});
it('excludes self pairs and disallows future or conflicting observations',()=>{const f=fixture();f.connectors[0].linkedin_url=f.targets[0].linkedin_url;expect(buildFeatures(f).coverage.self_pairs_excluded).toBe(1);f.connectors[0].observed_at='2026-09-24';expect(()=>buildFeatures(f)).toThrow();});
it('uses a small-company size snapshot only for two current roles',()=>{const f=fixture();f.connectors[0].experience=[job({position:'Founder',location:'Unknown'})];f.profiles[0].experience=[job({position:'Founder',location:'Unknown'})];f.company_sizes=[{company_id:'company-1',count:50,evidence:{id:'size:1',source:'https://example.test/about',observed_at:'2026-09-23',detail:'50 employees'}}];expect(buildFeatures(f).paths[0].baseline_score).toBe(80);f.connectors[0].experience[0].endDate={year:2025,month:'January'};const p=buildFeatures(f).paths[0];expect(p.baseline_score).toBe(20);expect(p.features.work_overlap.work_context.company_size).toBeNull();});
it('keeps board and school overlap separate from employment',()=>{const f=fixture();for(const p of [f.connectors[0],f.profiles[0]]){p.experience=[job({position:'Board Member'})];p.education=[{schoolId:'school-1',schoolName:'Example College',startDate:{year:2010,month:'September'},endDate:{year:2014,month:'May'}}];}const p=buildFeatures(f).paths[0];expect(p.baseline_score).toBe(50);expect(p.features.board_overlap.value).toBe(1);expect(p.features.school_overlap.value).toBe(1);expect(p.features.work_overlap.value).toBe(0);});
it('counts shared investor context once and suppresses it for a direct investor role',()=>{const f=fixture();f.owner_portfolio=[{target_domain:'example.test',investor_name:'Example Fund',seed_evidence:[{id:'seed:1',source:'https://fund.example/requester',observed_at:'2026-09-23',detail:'Requester investment'}],portfolio_evidence:{id:'portfolio:1',source:'https://fund.example/target',observed_at:'2026-09-23',detail:'Target investment'}}];let p=buildFeatures(f).paths[0];expect(p.baseline_score).toBe(83);expect(p.features.investor_portfolio.evidence_ids).toEqual(['target-account-domain:tgt:1','seed:1','portfolio:1']);f.connectors[0].experience=[job({position:'Seed Investor'})];p=buildFeatures(f).paths[0];expect(p.baseline_score).toBe(120);expect(p.features.investor_portfolio.value).toBe(0);});
it('leaves generic executive functions and remote locations unknown',()=>{expect(roleFunction('Founder and CEO')).toBeNull();expect(metro('San Francisco, remote')).toBeNull();expect(metro('Paris')).toBeNull();});
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |