|
| 1 | +// Fixture data for the corpora-curator gallery. |
| 2 | +// |
| 3 | +// WHY THIS FILE HAS A `seed()` AT ALL — and what it is telling you. |
| 4 | +// |
| 5 | +// Every component in this member reads the `curation` runes singleton rather |
| 6 | +// than taking props. That is the house convention (Per-App-Workspace-Conventions: |
| 7 | +// single source of truth, components read derived getters and call actions), and |
| 8 | +// it is a perfectly good convention for an app. It is a bad one for a component |
| 9 | +// LIBRARY: a component whose inputs are ambient cannot be rendered in a state |
| 10 | +// its author did not anticipate, which means it cannot be reviewed in one. |
| 11 | +// |
| 12 | +// Rather than refactor five components to make the gallery look tidy, the |
| 13 | +// gallery seeds the singleton and says so — every fixture that needs `seed()` |
| 14 | +// shows an "Ambient dependency" note on its Usage tab. That is the honest |
| 15 | +// reading: these components ARE isolatable, but only by staging the world |
| 16 | +// around them, and the cost of each new state is a hand-written world. |
| 17 | +// |
| 18 | +// The prop-driven entries in this catalog (the pattern recipes) need none of |
| 19 | +// this. That contrast is the argument for pushing presentational leaves — |
| 20 | +// rows, chips, fields — down to props, and it is visible here rather than |
| 21 | +// asserted in a document. |
| 22 | + |
| 23 | +import { curation } from '../curation.svelte'; |
| 24 | +import type { Source, Strategy } from '../types'; |
| 25 | + |
| 26 | +export const TAG_VOCAB = [ |
| 27 | + 'Workforce-Development', |
| 28 | + 'Work-Based-Learning', |
| 29 | + 'Employer-Partnerships', |
| 30 | + 'Apprenticeship', |
| 31 | + 'Credential-Attainment', |
| 32 | + 'Rural-Access', |
| 33 | + 'HNWI', |
| 34 | +]; |
| 35 | + |
| 36 | +export const STRATEGIES: Strategy[] = [ |
| 37 | + { |
| 38 | + slug: 'turning-jobs-into-degrees', |
| 39 | + type: 'strategy', |
| 40 | + client_slugs: ['reach-edu'], |
| 41 | + title: 'Turning Jobs Into Degrees', |
| 42 | + tags: ['Work-Based-Learning', 'Credential-Attainment'], |
| 43 | + }, |
| 44 | + { |
| 45 | + slug: 'rural-income-mobility', |
| 46 | + type: 'strategy', |
| 47 | + client_slugs: ['reach-edu'], |
| 48 | + title: 'Rural Income Mobility', |
| 49 | + tags: ['Rural-Access'], |
| 50 | + }, |
| 51 | + { |
| 52 | + slug: 'employer-of-record-models', |
| 53 | + type: 'strategy', |
| 54 | + client_slugs: ['reach-edu'], |
| 55 | + title: 'Employer-of-Record Models', |
| 56 | + tags: [], |
| 57 | + }, |
| 58 | +]; |
| 59 | + |
| 60 | +export const SOURCES: Source[] = [ |
| 61 | + { |
| 62 | + source_uuid: 'src-0001', |
| 63 | + url: 'https://www.brookings.edu/articles/the-degree-is-not-the-job/', |
| 64 | + normalized_url: 'brookings.edu/articles/the-degree-is-not-the-job', |
| 65 | + title: 'The degree is not the job', |
| 66 | + authors: ['Anthony P. Carnevale', 'Nicole Smith'], |
| 67 | + publisher: 'Brookings', |
| 68 | + published_date: '2025-11-04', |
| 69 | + tags: ['Work-Based-Learning', 'Credential-Attainment'], |
| 70 | + status: 'fetched', |
| 71 | + content_pulled: true, |
| 72 | + source_slug: 'the-degree-is-not-the-job', |
| 73 | + }, |
| 74 | + { |
| 75 | + source_uuid: 'src-0002', |
| 76 | + url: 'https://example.org/reports/apprenticeship-at-scale-2026.pdf', |
| 77 | + title: 'Apprenticeship at Scale 2026', |
| 78 | + publisher: 'National Skills Coalition', |
| 79 | + published_date: '2026-02-18', |
| 80 | + tags: ['Apprenticeship', 'Employer-Partnerships'], |
| 81 | + status: 'fetched', |
| 82 | + content_pulled: true, |
| 83 | + source_slug: 'apprenticeship-at-scale-2026', |
| 84 | + binary_filename: 'apprenticeship-at-scale-2026.pdf', |
| 85 | + binary_bytes: 4_182_301, |
| 86 | + }, |
| 87 | + { |
| 88 | + // The row that exists to be the ugly one: no title, no publisher, a URL |
| 89 | + // long enough to test truncation, and a failed fetch. A gallery whose |
| 90 | + // fixtures are all well-formed is a gallery that has never seen the |
| 91 | + // product. |
| 92 | + source_uuid: 'src-0003', |
| 93 | + url: 'https://www.dol.gov/agencies/eta/apprenticeship/policy/registered-apprenticeship-national-guidelines-standards-of-apprenticeship-2026-revision', |
| 94 | + tags: [], |
| 95 | + status: 'metadata-only', |
| 96 | + verdict_error: true, |
| 97 | + }, |
| 98 | + { |
| 99 | + source_uuid: 'src-0004', |
| 100 | + url: 'https://www.rand.org/pubs/research_reports/RRA2214-1.html', |
| 101 | + title: 'Rural Postsecondary Access and the Income Ladder', |
| 102 | + publisher: 'RAND', |
| 103 | + published_date: '2026-01-09', |
| 104 | + tags: ['Rural-Access'], |
| 105 | + status: 'metadata-only', |
| 106 | + }, |
| 107 | +]; |
| 108 | + |
| 109 | +type CurationPatch = Partial<{ |
| 110 | + connection: 'idle' | 'connecting' | 'open' | 'closed' | 'error' | 'auth_required'; |
| 111 | + lastError: string | null; |
| 112 | + clientSlug: string | null; |
| 113 | + domainType: string; |
| 114 | + strategies: Strategy[]; |
| 115 | + activeSlug: string | null; |
| 116 | + sources: Source[]; |
| 117 | + focusIdx: number; |
| 118 | + listFilter: string; |
| 119 | + tagVocab: string[]; |
| 120 | + saveStatus: string; |
| 121 | +}>; |
| 122 | + |
| 123 | +/** |
| 124 | + * Stage the world, then apply the fixture's deltas. |
| 125 | + * |
| 126 | + * Always writes EVERY field, never just the ones a fixture cares about — |
| 127 | + * otherwise the previous fixture's state leaks into the next one and a |
| 128 | + * specimen quietly renders something nobody declared. |
| 129 | + */ |
| 130 | +export function seed(patch: CurationPatch = {}): void { |
| 131 | + const base: Required<CurationPatch> = { |
| 132 | + connection: 'open', |
| 133 | + lastError: null, |
| 134 | + clientSlug: 'reach-edu', |
| 135 | + domainType: 'strategy', |
| 136 | + strategies: STRATEGIES, |
| 137 | + activeSlug: 'turning-jobs-into-degrees', |
| 138 | + sources: SOURCES, |
| 139 | + focusIdx: 0, |
| 140 | + listFilter: '', |
| 141 | + tagVocab: TAG_VOCAB, |
| 142 | + saveStatus: '', |
| 143 | + }; |
| 144 | + Object.assign(curation, base, patch); |
| 145 | +} |
0 commit comments