Skip to content

getaero-io/gtm-eng-skills / engineering/warm-intro-scoring

warm-intro-scoring

Verified

FileKindSize
.gitignoreother121 B
GUIDE.mdmarkdown4.7 KB
LICENSEother1.1 KB
README.mdmarkdown8.0 KB
SKILL.mdskill md327 B
TESTING.mdmarkdown8.9 KB
UPSTREAM.mdmarkdown1.3 KB
assets/company-research.play.tsscript1021 B
assets/customer-db.sqlother2.7 KB
assets/evaluation-example.jsonconfig4.6 KB
assets/example.jsonconfig6.9 KB
assets/portfolio-focus.weights.jsonconfig32 B
assets/review.htmlother7.4 KB
assets/tuning-example.jsonconfig1.2 KB
assets/tuning.htmlother30.1 KB
check_all.pyscript1.4 KB
package-manifest.jsonconfig9.8 KB
plays/README.mdmarkdown18.2 KB
plays/check-report.pyscript1.8 KB
plays/check_all.pyscript1.6 KB
plays/check_parity.pyscript6.0 KB
plays/collect.play.tsscript4.0 KB
plays/collection.tsscript1.9 KB
plays/core.tsscript44.2 KB
plays/evaluation-contract.mdmarkdown3.4 KB
plays/evaluation.tsscript13.8 KB
plays/features.play.tsscript4.7 KB
plays/features.tsscript22.6 KB
plays/generatedtemplate.tsscript38.1 KB
plays/guardrails.tsscript948 B
plays/legacy.tsscript9.7 KB
plays/merge-payloads.pyscript8.6 KB
plays/parity-driver.tsscript995 B
plays/parity-evaluation.pyscript8.5 KB
plays/parity-reports.pyscript2.3 KB
plays/prepare-inputs.pyscript6.5 KB
plays/quality.tsscript3.8 KB
plays/read-sources.play.tsscript3.4 KB
plays/report-cli.tsscript590 B
plays/report.play.tsscript2.9 KB
plays/report.tsscript3.1 KB
plays/reports.tsscript5.7 KB
plays/research.play.tsscript1.6 KB
plays/review-uncertainty.play.tsscript5.5 KB
plays/score.play.tsscript2.3 KB
plays/snapshots.play.tsscript4.2 KB
plays/strict-json.tsscript1.8 KB
plays/sync-template.pyscript849 B
plays/uncertainty.tsscript4.9 KB
plays/validation.play.tsscript3.6 KB
references/adversarial-review.mdmarkdown7.0 KB
references/batch-collection.mdmarkdown5.1 KB
references/company-network.mdmarkdown5.8 KB
references/competitive-review.mdmarkdown8.8 KB
references/evaluation.mdmarkdown8.5 KB
references/evaluator-validation.mdmarkdown3.4 KB
references/evaluator.mdmarkdown7.9 KB
references/external-data.mdmarkdown4.0 KB
references/factor-test-matrix.mdmarkdown4.6 KB
references/factors.mdmarkdown6.1 KB
references/intro-drafts.mdmarkdown1.6 KB
references/pipeline.mdmarkdown7.6 KB
references/readable-output.mdmarkdown5.4 KB
references/research-brief.mdmarkdown2.4 KB
references/sources.mdmarkdown7.5 KB
references/tuning.mdmarkdown14.6 KB
scripts/audit_history.pyscript5.1 KB
scripts/check.pyscript5.1 KB
scripts/compare_versions.pyscript1.9 KB
scripts/evaluate.pyscript22.5 KB
scripts/package-skill.pyscript1.9 KB
scripts/portfolio.pyscript3.7 KB
scripts/quality.pyscript5.3 KB
scripts/recipe-demo.tsscript2.6 KB
scripts/render.pyscript1.6 KB
scripts/score.pyscript9.6 KB
scripts/temporal.pyscript2.2 KB
scripts/test_ask_handoff.pyscript2.1 KB
scripts/test_audit_history.pyscript2.7 KB
scripts/test_handoff_evaluate.pyscript9.1 KB
scripts/test_portfolio.pyscript3.6 KB
scripts/test_quality.pyscript3.1 KB
scripts/test_temporal.pyscript1.3 KB
scripts/test_tuning.pyscript14.1 KB
scripts/test_tuning_browser.cjsscript7.7 KB
scripts/test_version_parity.pyscript1.0 KB
scripts/tuning.pyscript10.9 KB
tests/adversarial.test.tsscript8.2 KB
tests/browser_e2e.cjsscript1.9 KB
tests/cloud_e2e.pyscript6.9 KB
tests/e2e-fixture.jsonconfig3.6 KB
tests/feature_parity.pyscript2.4 KB
tests/features.test.tsscript8.3 KB
tests/test_prepare_inputs.pyscript8.6 KB
tests/uncertainty.test.tsscript2.5 KB
vendor-manifest.jsonconfig748 B

scripts/test_tuning.py

View on GitHub
import copy
import json
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
import tuning

ROOT = Path(__file__).resolve().parents[1]

def path(id='a', value=0):
    return dict(id=id, target_id='t', target_name='Target', connector_id=id,
                connector_name=id, baseline_score=10, review_status='needs_confirmation',
                features={'investor_portfolio': dict(value=value, evidence_ids=['e1'] if value else [],
                          explanation='Documented portfolio connection', timing_status='not_applicable')})

class TuningTests(unittest.TestCase):
    def test_profile_links_survive_scoring_and_reject_unsafe_urls(self):
        row=path(); row['target_linkedin_url']='https://www.linkedin.com/in/target-example'; row['connector_linkedin_url']='https://linkedin.com/in/connector-example'
        data={'as_of':'2026-09-23','paths':[row]}
        self.assertEqual(tuning.rank(data)[0]['target_linkedin_url'],row['target_linkedin_url'])
        for url in ['javascript:alert(1)','https://linkedin.com.evil.test/in/x','https://linkedin.com/company/x']:
            row['target_linkedin_url']=url
            with self.assertRaises(ValueError): tuning.rank(data)

    def test_historical_input_without_cutoff_is_rejected(self):
        with self.assertRaisesRegex(ValueError, 'as_of must be a full YYYY-MM-DD date'):
            tuning.rank({'paths': [path()]})

    def test_large_artifact_preserves_all_candidates_and_feature_evidence(self):
        data = {'as_of': '2026-09-23', 'paths': [path(str(i), i % 2) for i in range(5001)]}
        html = tuning.render(data)
        payload = json.loads(html.split('<script type="application/json" id="data">', 1)[1].split('</script>', 1)[0])
        self.assertEqual(len(payload['paths']), 5001)
        self.assertLess(len(payload['feature_catalog']), 20)
        for row in payload['paths']:
            restored = {k: payload['feature_catalog'][v] for k, v in row['features'].items()}
            self.assertEqual(restored['investor_portfolio']['value'], int(row['id']) % 2)
            self.assertEqual(restored['investor_portfolio']['evidence_ids'], ['e1'] if int(row['id']) % 2 else [])
            self.assertEqual(row['review_status'], 'needs_confirmation')

    def test_portfolio_can_be_prioritized_without_clearing_hold(self):
        a=path('a',1); b=path('b'); b['features']['direct_intro']=dict(value=1,evidence_ids=['intro'],explanation='Recorded intro',timing_status='not_applicable')
        data={'as_of':'2026-09-23','paths':[a,b]}; original=copy.deepcopy(data)
        self.assertEqual(tuning.rank(data)[0]['id'],'b')
        ranked=tuning.rank(data,{'investor_portfolio':300})
        self.assertEqual(ranked[0]['id'],'a')
        self.assertEqual(ranked[0]['review_status'],'needs_confirmation')
        self.assertFalse(ranked[0]['ready_for_human_review'])
        self.assertEqual(data,original)
    def test_bad_weights(self):
        for weights in ({'nope':1},{'appearance':-1},{'appearance':float('nan')},{'appearance':float('inf')},{'appearance':True}):
            with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[path()]},weights)
    def test_missing_features_are_unknown_zero(self):
        row=tuning.rank({'as_of':'2026-09-23','paths':[path()]})[0]
        self.assertEqual(row['features']['school_overlap']['timing_status'],'unknown')
        self.assertEqual(row['features']['school_overlap']['value'],0)
    def test_positive_requires_citation_and_timed_overlap(self):
        for key in ('work_overlap','school_overlap','board_overlap'):
            p=path(); p['features'][key]=dict(value=1,evidence_ids=['e'],explanation='Shared tenure',timing_status='verified_overlap')
            with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
            p['features'][key].update(overlap_start='2020-01-01',overlap_end='2021-01-01')
            self.assertGreater(tuning.rank({'as_of':'2026-09-23','paths':[p]})[0]['tuned_score'],0)
            p['features'][key]['timing_status']='unknown'
            with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
        p=path('a',1);p['features']['investor_portfolio']['evidence_ids']=[]
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
    def test_invalid_feature_and_dates(self):
        for value in (-1,1.01,float('nan'),True):
            p=path('a',value)
            with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
        p=path();p['features']['unknown_key']={}
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
        p=path();p['features']['work_overlap']=dict(value=1,evidence_ids=['e'],explanation='tenure',timing_status='verified_overlap',overlap_start='2021',overlap_end='2022')
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
    def test_no_status_promoted_and_duplicate_rejected(self):
        for status in ('blocked_declined','needs_confirmation','ready_for_human_review'):
            p=path('a',1);p['review_status']=status
            row=tuning.rank({'as_of':'2026-09-23','paths':[p]},{'investor_portfolio':500})[0]
            self.assertEqual(row['ready_for_human_review'],status=='ready_for_human_review')
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[path(),path()]})
    def test_cutoff_is_required_exact_and_preserved(self):
        for cutoff in (None, '2026', '20260923', '2026-02-30', 2026):
            data={'paths':[path()]}
            if cutoff is not None: data['as_of']=cutoff
            with self.assertRaises(ValueError): tuning.rank(data)
        html=tuning.render({'as_of':'2026-09-23','paths':[path()]})
        self.assertIn('"as_of": "2026-09-23"',html)
    def test_overlap_cannot_extend_after_cutoff(self):
        for key in ('work_overlap','school_overlap','board_overlap'):
            p=path();p['features'][key]=dict(value=1,evidence_ids=['e'],explanation='tenure',timing_status='verified_overlap',overlap_start='2020-01-01',overlap_end='2026-09-24')
            with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
            p['features'][key]['overlap_end']='2026-09-23'
            self.assertGreater(tuning.rank({'as_of':'2026-09-23','paths':[p]})[0]['tuned_score'],0)
    def test_self_pair_duplicate_pair_and_unknown_status_rejected(self):
        p=path();p['connector_id']=p['target_id']
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
        a=path();b=copy.deepcopy(a);b['id']='distinct-path-id'
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[a,b]})
        p=path();p['review_status']='unknown'
        with self.assertRaises(ValueError): tuning.rank({'as_of':'2026-09-23','paths':[p]})
    def test_safe_render_and_private_cli(self):
        p=path();p['connector_name']='</script><img src=x onerror=alert(1)>'
        html=tuning.render({'as_of':'2026-09-23','paths':[p]})
        self.assertNotIn(p['connector_name'],html)
        self.assertIn('\\u003c/script',html)
        with tempfile.TemporaryDirectory() as tmp:
            source=Path(tmp)/'input.json'; dest=Path(tmp)/'review.html'
            source.write_text(json.dumps({'as_of':'2026-09-23','paths':[p]}))
            subprocess.run([sys.executable,str(ROOT/'scripts/tuning.py'),str(source),'--output',str(dest)],check=True,capture_output=True)
            self.assertEqual(dest.stat().st_mode & 0o777,0o600)
            self.assertNotEqual(subprocess.run([sys.executable,str(ROOT/'scripts/tuning.py'),str(source),'--output',str(dest)],capture_output=True).returncode,0)

    def test_context_does_not_change_scores_or_holds(self):
        base = {'as_of':'2026-09-23', 'paths':[path('a', 1)]}
        enriched = copy.deepcopy(base)
        enriched['paths'][0].update(target_company='Example', target_title='Engineer', requester_name='Owner')
        enriched['evidence'] = [dict(id='e1',source='https://example.com',detail='Documented holding',observed_at='2026-09-23')]
        enriched['target_research'] = {'t':[dict(label='Funding', detail='Public funding report', source_url='https://example.com', observed_at='2026-09-23', provider='Example')]}
        self.assertEqual(tuning.rank(base)[0]['tuned_score'],tuning.rank(enriched)[0]['tuned_score'])
        self.assertEqual(tuning.rank(enriched)[0]['review_status'],'needs_confirmation')
        html=tuning.render(enriched)
        self.assertIn('Documented holding', html)
        self.assertIn('Public funding report',html)
        enriched['evidence'].append(enriched['evidence'][0])
        with self.assertRaises(ValueError): tuning.render(enriched)

    def test_context_is_escaped_and_malformed_context_is_rejected(self):
        data={'as_of':'2026-09-23', 'paths':[path('a',1)]}
        attack='</script><script>alert(1)</script>'
        data['requester_name']=attack
        data['evidence']=[dict(id='e1',source='javascript:alert(1)',detail=attack,observed_at='2026-09-23')]
        self.assertNotIn(attack,tuning.render(data))
        data['target_research']={'t':'invalid'}
        with self.assertRaises(ValueError): tuning.render(data)
        del data['target_research']
        data['paths'][0]['target_company'] = {'bad':'shape'}
        with self.assertRaises(ValueError): tuning.render(data)

    def test_present_registry_requires_all_positive_references(self):
        data={'as_of':'2026-09-23','paths':[path('a',1)],'evidence':[]}
        with self.assertRaisesRegex(ValueError,'missing evidence'): tuning.render(data)
        data['evidence']=[dict(id='e1',source='https://example.com',detail='Company link',observed_at='2026-09-23')]
        tuning.render(data)
        data['paths'][0]['features']['investor_portfolio']['evidence_ids'].append('missing')
        with self.assertRaisesRegex(ValueError,'missing evidence'): tuning.render(data)
        del data['evidence']
        tuning.render(data)  # Backward-compatible IDs-only input has no registry to resolve.

    def test_source_dates_are_full_dates_at_or_before_cutoff(self):
        data={'as_of':'2026-09-23','paths':[path('a',1)]}
        for observed in ('2026','2026-09-24','2026-02-30'):
            data['evidence']=[dict(id='e1',source='https://example.com',detail='Company link',observed_at=observed)]
            with self.assertRaises(ValueError): tuning.render(data)
        data['evidence'][0]['observed_at']='2026-09-23'
        for observed in ('2026','2026-09-24','2026-02-30'):
            data['target_research']={'t':[dict(label='Fact',detail='Context',source_url='https://example.com',observed_at=observed,provider='Example')]}
            with self.assertRaises(ValueError): tuning.render(data)

    def test_fallbacks_add_points_without_claiming_a_relationship(self):
        p=path()
        p['features'].update(
            city_overlap=dict(value=1,evidence_ids=['city'],explanation='Same work city during the stated period.',timing_status='verified_overlap',overlap_start='2022-01-01',overlap_end='2023-01-01'),
            industry_match=dict(value=1,evidence_ids=['industry'],explanation='Both companies serve the same industry.',timing_status='not_applicable'),
            community_match=dict(value=1,evidence_ids=['community'],explanation='Both list the same professional group.',timing_status='not_applicable'))
        data={'as_of':'2026-09-23','paths':[p]}
        row=tuning.rank(data)[0]
        self.assertEqual(row['tuned_score'],22)
        self.assertEqual(row['review_status'],'needs_confirmation')
        self.assertFalse(row['ready_for_human_review'])
        self.assertEqual(tuning.rank(data,{'city_overlap':0})[0]['tuned_score'],12)
        p['features']['city_overlap']['timing_status']='unknown'
        with self.assertRaises(ValueError): tuning.rank(data)

    def test_direct_investor_role_ranks_above_work_and_community(self):
        investor=path('investor')
        investor['features']['investor_role']=dict(value=1,evidence_ids=['role','target'],explanation='Investor in the target company during target tenure.',timing_status='verified_overlap',overlap_start='2024-01-01',overlap_end='2025-01-01')
        worker=path('worker')
        worker['features']['work_overlap']=dict(value=1,evidence_ids=['work'],explanation='Shared employer.',timing_status='verified_overlap',overlap_start='2024-01-01',overlap_end='2025-01-01')
        worker['features']['community_match']=dict(value=1,evidence_ids=['group'],explanation='Shared professional group.',timing_status='not_applicable')
        data={'as_of':'2026-09-23','paths':[worker,investor]}
        rows=tuning.rank(data)
        self.assertEqual([(r['id'],r['tuned_score']) for r in rows],[('investor',120),('worker',82)])
        self.assertTrue(all(r['review_status']=='needs_confirmation' for r in rows))
        self.assertEqual(rows[0]['features']['work_overlap']['value'],0)
        investor['features']['investor_role']['timing_status']='unknown'
        with self.assertRaises(ValueError):tuning.rank(data)

    def test_large_company_overlap_requires_same_role_context(self):
        def result(size, function, location):
            p=path()
            p['features']['work_overlap']=dict(value=1,evidence_ids=['jobs'],explanation='Dated jobs at one company.',timing_status='verified_overlap',overlap_start='2020-01-01',overlap_end='2021-01-01',work_context=dict(company_size=size,same_function=function,same_location=location))
            # Other jobs or current titles must not inflate historical overlap.
            p['features']['role_industry']=dict(value=1,evidence_ids=['current'],explanation='Same current function.',timing_status='not_applicable')
            return tuning.normalize({'as_of':'2026-09-23','paths':[p]})[0]['features']['work_overlap']['value']*80
        self.assertEqual(result(1000,False,False),20)
        self.assertEqual(result(1000,False,True),40)
        self.assertEqual(result(1000,True,False),50)
        self.assertEqual(result(1000,True,True),80)
        self.assertEqual(result(999,False,False),80)
        self.assertEqual(result(None,None,None),20)
        for size in (True,-1,0,1.5):
            with self.assertRaises(ValueError):result(size,False,False)
        with self.assertRaises(ValueError):result(1000,'yes',True)
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall