feat: scaffold outreach engine monorepo on the novelpad-desktop stack
Workspaces: config (copied), outreach-core (schema + actions/queries + hard gates), outreach-ai (Gemini client + embeddings copies, profiler and mission-fit-judge agent stubs), outreach-worker (DBOS executor with nightly ingest + hourly expiry workflows), outreach-review (RR7 review queue v0). Initial drizzle migration incl. pgvector extension. Stack contract: Yarn 4.5.0 + Turbo, Node 22.16, Drizzle 0.44.6 + pgvector, DBOS 4.17.6, @google/genai on Vertex, gemini-embedding-001 @1536, React Router v7. Files copied from novelpad-desktop carry provenance headers @ 62c56b87. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
56
packages/outreach-ai/src/agents/org-profiler/schema.test.ts
Normal file
56
packages/outreach-ai/src/agents/org-profiler/schema.test.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { OrgProfileSchema } from './schema.js';
|
||||
|
||||
const validProfile = {
|
||||
legalName: { value: 'NH Literacy Alliance', sourceUrl: 'https://nhliteracy.org', confidence: 0.95 },
|
||||
ein: { value: '02-1234567', sourceUrl: 'https://apps.irs.gov/pfft', confidence: 0.9 },
|
||||
mission: { value: 'Improve literacy outcomes for NH children.', sourceUrl: 'https://nhliteracy.org/about', confidence: 0.85 },
|
||||
programAreas: {
|
||||
value: ['youth literacy tutoring', 'family reading nights'],
|
||||
sourceUrl: 'https://nhliteracy.org/programs',
|
||||
confidence: 0.75,
|
||||
},
|
||||
geographicScope: { value: 'Hillsborough County, NH', sourceUrl: 'https://nhliteracy.org/about', confidence: 0.6 },
|
||||
annualRevenue: { value: 480_000, sourceUrl: 'https://apps.irs.gov/pfft', confidence: 0.8 },
|
||||
targetPopulations: {
|
||||
value: ['K-5 students', 'low-income families'],
|
||||
sourceUrl: 'https://nhliteracy.org/about',
|
||||
confidence: 0.55,
|
||||
},
|
||||
};
|
||||
|
||||
describe('OrgProfileSchema', () => {
|
||||
it('accepts a fully-sourced valid profile fixture', () => {
|
||||
const result = OrgProfileSchema.safeParse(validProfile);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts a null ein and a null annualRevenue (org not matched to a 990-PF filing)', () => {
|
||||
const result = OrgProfileSchema.safeParse({ ...validProfile, ein: null, annualRevenue: null });
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects an ein that does not match the ##-####### federal EIN shape', () => {
|
||||
const result = OrgProfileSchema.safeParse({
|
||||
...validProfile,
|
||||
ein: { value: 'not-an-ein', sourceUrl: null, confidence: 0.9 },
|
||||
});
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects a confidence outside the 0-1 range', () => {
|
||||
const result = OrgProfileSchema.safeParse({
|
||||
...validProfile,
|
||||
mission: { value: 'Improve literacy outcomes.', sourceUrl: null, confidence: 1.4 },
|
||||
});
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects an empty programAreas array (sourcedField requires at least one)', () => {
|
||||
const result = OrgProfileSchema.safeParse({
|
||||
...validProfile,
|
||||
programAreas: { value: [], sourceUrl: null, confidence: 0.5 },
|
||||
});
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user