diff --git a/scripts/run-backfill.sh b/scripts/run-backfill.sh index 0271023..03ec59c 100755 --- a/scripts/run-backfill.sh +++ b/scripts/run-backfill.sh @@ -25,6 +25,7 @@ VINTAGES=( 118-82 118-158 119-73 + 119-142 ) TOTAL=${#VINTAGES[@]} @@ -49,9 +50,9 @@ for i in "${!VINTAGES[@]}"; do echo "[$n/$TOTAL] Vintage $v" echo "────────────────────────────────────────" - # Run in a separate process with generous heap (8GB) + # Run in a separate process with generous heap (default 6GB; override with BACKFILL_HEAP_MB) # The orchestrator's resume logic will skip already-committed vintages - if node --max-old-space-size=8192 "$PROJECT_ROOT/dist/index.js" backfill \ + if node --max-old-space-size=${BACKFILL_HEAP_MB:-6144} "$PROJECT_ROOT/dist/index.js" backfill \ --phase olrc --target "$TARGET" --vintages "$ACCUMULATED" 2>&1; then echo " ✓ done" else @@ -69,4 +70,4 @@ echo "Inspect with:" echo " cd $TARGET" echo " git log --oneline --decorate" echo " git tag -l" -echo " git diff annual/2013..annual/2025 --stat" +echo " git diff annual/2013..annual/2026 --stat" diff --git a/scripts/seed-all-vintages.sh b/scripts/seed-all-vintages.sh index f570b81..9f3dcad 100755 --- a/scripts/seed-all-vintages.sh +++ b/scripts/seed-all-vintages.sh @@ -25,6 +25,7 @@ VINTAGES=( 118-82 118-158 119-73 + 119-142 ) echo "=== Seeding ${#VINTAGES[@]} OLRC vintages ===" diff --git a/src/backfill/olrc-orchestrator.ts b/src/backfill/olrc-orchestrator.ts index b89ac78..c62308a 100644 --- a/src/backfill/olrc-orchestrator.ts +++ b/src/backfill/olrc-orchestrator.ts @@ -116,8 +116,10 @@ async function transformVintage( totalSections += titleIr.sections.length; totalFiles += writeResult.filesWritten; } - } catch { - // Skip titles that fail to parse — non-fatal for backfill + } catch (error) { + // Skip titles that fail to parse — non-fatal for backfill, but never silent + const message = error instanceof Error ? error.message : String(error); + process.stderr.write(`[backfill] ✗ title ${target.cacheKey} skipped (${vintage}): ${message}\n`); continue; } } diff --git a/src/backfill/olrc-planner.ts b/src/backfill/olrc-planner.ts index 645b7be..9bd24d2 100644 --- a/src/backfill/olrc-planner.ts +++ b/src/backfill/olrc-planner.ts @@ -12,8 +12,12 @@ export interface OlrcVintageEntry { } /** - * Known OLRC release points sourced from - * https://uscode.house.gov/download/priorreleasepoints.htm + * Known OLRC release points. Dates are the "current through" public-law dates + * OLRC lists for each release point (https://uscode.house.gov/priorreleasepoints.html; + * pre-119th-Congress entries verified against the archived priorreleasepoints.htm). + * + * As of November 2026 OLRC only hosts 119th-Congress release points; older ZIPs + * return 404 and must be sourced from an archive (e.g. the Wayback Machine). * * Each entry uses the actual OLRC release-point identifier (which may differ * from the public-law number the site advertises on the main download page). @@ -25,31 +29,32 @@ export interface OlrcVintageEntry { */ export const KNOWN_VINTAGES: OlrcVintageEntry[] = [ // 113th Congress (2013–2015) - { vintage: '113-21', congress: 113, lawNumber: '21', year: 2013, releaseDate: '2013-06-15', congressBoundary: false }, + { vintage: '113-21', congress: 113, lawNumber: '21', year: 2013, releaseDate: '2013-07-18', congressBoundary: false }, { vintage: '113-296', congress: 113, lawNumber: '296', year: 2014, releaseDate: '2014-12-19', congressBoundary: true }, // 114th Congress (2015–2017) - { vintage: '114-38', congress: 114, lawNumber: '38', year: 2015, releaseDate: '2015-07-30', congressBoundary: false }, - { vintage: '114-329', congress: 114, lawNumber: '329', year: 2017, releaseDate: '2017-01-03', congressBoundary: true }, + { vintage: '114-38', congress: 114, lawNumber: '38', year: 2015, releaseDate: '2015-07-28', congressBoundary: false }, + { vintage: '114-329', congress: 114, lawNumber: '329', year: 2017, releaseDate: '2017-01-06', congressBoundary: true }, // 115th Congress (2017–2019) - { vintage: '115-51', congress: 115, lawNumber: '51', year: 2017, releaseDate: '2017-08-14', congressBoundary: false }, - { vintage: '115-442', congress: 115, lawNumber: '442', year: 2019, releaseDate: '2019-01-03', congressBoundary: true }, + { vintage: '115-51', congress: 115, lawNumber: '51', year: 2017, releaseDate: '2017-08-18', congressBoundary: false }, + { vintage: '115-442', congress: 115, lawNumber: '442', year: 2019, releaseDate: '2019-01-14', congressBoundary: true }, // 116th Congress (2019–2021) - { vintage: '116-91', congress: 116, lawNumber: '91', year: 2019, releaseDate: '2019-12-20', congressBoundary: false }, - { vintage: '116-344', congress: 116, lawNumber: '344', year: 2021, releaseDate: '2021-01-03', congressBoundary: true }, + { vintage: '116-91', congress: 116, lawNumber: '91', year: 2019, releaseDate: '2019-12-19', congressBoundary: false }, + { vintage: '116-344', congress: 116, lawNumber: '344', year: 2021, releaseDate: '2021-01-13', congressBoundary: true }, // 117th Congress (2021–2023) - { vintage: '117-81', congress: 117, lawNumber: '81', year: 2021, releaseDate: '2021-11-15', congressBoundary: false }, - { vintage: '117-262', congress: 117, lawNumber: '262', year: 2022, releaseDate: '2022-12-22', congressBoundary: true }, + { vintage: '117-81', congress: 117, lawNumber: '81', year: 2021, releaseDate: '2021-12-27', congressBoundary: false }, + { vintage: '117-262', congress: 117, lawNumber: '262', year: 2022, releaseDate: '2022-12-21', congressBoundary: true }, // 118th Congress (2023–2025) - { vintage: '118-82', congress: 118, lawNumber: '82', year: 2024, releaseDate: '2024-01-29', congressBoundary: false }, - { vintage: '118-158', congress: 118, lawNumber: '158', year: 2024, releaseDate: '2024-12-23', congressBoundary: true }, + { vintage: '118-82', congress: 118, lawNumber: '82', year: 2024, releaseDate: '2024-09-20', congressBoundary: false }, + { vintage: '118-158', congress: 118, lawNumber: '158', year: 2024, releaseDate: '2024-12-21', congressBoundary: true }, // 119th Congress (2025–) - { vintage: '119-73', congress: 119, lawNumber: '73', year: 2025, releaseDate: '2025-03-14', congressBoundary: false }, + { vintage: '119-73', congress: 119, lawNumber: '73', year: 2026, releaseDate: '2026-01-23', congressBoundary: false }, + { vintage: '119-142', congress: 119, lawNumber: '142', year: 2026, releaseDate: '2026-11-10', congressBoundary: false }, ]; export interface OlrcBackfillPlan { diff --git a/src/sources/olrc.ts b/src/sources/olrc.ts index 9e21373..9ff2cd5 100644 --- a/src/sources/olrc.ts +++ b/src/sources/olrc.ts @@ -18,13 +18,14 @@ import type { } from '../utils/manifest.js'; import { logNetworkEvent } from '../utils/logger.js'; -const DOWNLOAD_TIMEOUT_MS = 500; +const DOWNLOAD_TIMEOUT_MS = 30_000; const DOWNLOAD_RETRY_COUNT = 1; const MAX_XML_ENTRY_BYTES = 64 * 1024 * 1024; const MAX_LARGE_TITLE_XML_ENTRY_BYTES = 128 * 1024 * 1024; const MAX_TOTAL_XML_BYTES = 256 * 1024 * 1024; const OLRC_HOME_URL = 'https://uscode.house.gov/'; -const OLRC_LISTING_URL = 'https://uscode.house.gov/download/download.shtml'; +// OLRC moved its download listing from /download/download.shtml to /download.html in its 2026 site redesign. +const OLRC_LISTING_URL = 'https://uscode.house.gov/download.html'; const OLRC_LEGACY_LISTING_URL = 'https://uscode.house.gov/download/annualtitlefiles.shtml'; const FIXTURE_ENV_PREFIX = 'US_CODE_TOOLS_TITLE_'; const RESERVED_EMPTY_TITLE = 53; diff --git a/tests/adversary-round5-issue5.test.ts b/tests/adversary-round5-issue5.test.ts index a43091e..ab85956 100644 --- a/tests/adversary-round5-issue5.test.ts +++ b/tests/adversary-round5-issue5.test.ts @@ -253,7 +253,7 @@ describe('adversary regressions for issue #5 — round 5', () => { }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { return makeTextResponse(listingHtml, 'text/html'); } @@ -277,9 +277,9 @@ describe('adversary regressions for issue #5 — round 5', () => { }); const nonListingUrls = requestedUrls.filter( - (url) => url !== 'https://uscode.house.gov/' && url !== 'https://uscode.house.gov/download/download.shtml', + (url) => url !== 'https://uscode.house.gov/' && url !== 'https://uscode.house.gov/download.html', ); - expect(requestedUrls).toContain('https://uscode.house.gov/download/download.shtml'); + expect(requestedUrls).toContain('https://uscode.house.gov/download.html'); expect(requestedUrls).not.toContain('https://uscode.house.gov/download/annualtitlefiles.shtml'); expect(nonListingUrls.length).toBe(53); expect(nonListingUrls.every((url) => url.includes(`/releasepoints/us/pl/${latestVintage}/`))).toBe(true); diff --git a/tests/cli/issue21-historical-olrc.test.ts b/tests/cli/issue21-historical-olrc.test.ts index f553bf3..3ac132a 100644 --- a/tests/cli/issue21-historical-olrc.test.ts +++ b/tests/cli/issue21-historical-olrc.test.ts @@ -66,7 +66,7 @@ globalThis.fetch = async (input, init) => { }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { return new Response(htmlForListing(spec.vintages), { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' }, diff --git a/tests/unit/backfill-olrc-planner.test.ts b/tests/unit/backfill-olrc-planner.test.ts index 44029d1..60ab4b2 100644 --- a/tests/unit/backfill-olrc-planner.test.ts +++ b/tests/unit/backfill-olrc-planner.test.ts @@ -5,7 +5,7 @@ describe('OLRC backfill planner', () => { it('resolves known vintages by id', () => { const entry = resolveVintageEntry('119-73'); expect(entry).toBeDefined(); - expect(entry!.year).toBe(2025); + expect(entry!.year).toBe(2026); expect(entry!.congress).toBe(119); }); @@ -23,7 +23,7 @@ describe('OLRC backfill planner', () => { it('assigns annual tags for each vintage', () => { const plan = buildOlrcBackfillPlan(['113-21', '119-73']); expect(plan.tags.get('annual/2013')).toBe('113-21'); - expect(plan.tags.get('annual/2025')).toBe('119-73'); + expect(plan.tags.get('annual/2026')).toBe('119-73'); }); it('assigns congress boundary tags', () => { diff --git a/tests/unit/sources/olrc.test.ts b/tests/unit/sources/olrc.test.ts index 6da50a5..ba5891b 100644 --- a/tests/unit/sources/olrc.test.ts +++ b/tests/unit/sources/olrc.test.ts @@ -265,7 +265,7 @@ describe('OLRC source and cache behavior', () => { } }, 45000); - it('defaults OLRC vintage discovery to download.shtml instead of probing annualtitlefiles.shtml first', async () => { + it('defaults OLRC vintage discovery to download.html instead of probing annualtitlefiles.shtml first', async () => { const modulePath = resolve(process.cwd(), 'src', 'sources', 'olrc.ts'); const mod = await safeImport(modulePath); ensureModuleLoaded(modulePath, mod); @@ -300,7 +300,7 @@ describe('OLRC source and cache behavior', () => { }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { expect(init?.headers).toBeDefined(); const headers = new Headers(init?.headers); expect(headers.get('cookie') ?? headers.get('Cookie')).toContain('JSESSIONID=current-only'); @@ -330,7 +330,7 @@ describe('OLRC source and cache behavior', () => { const result = await fetchOlrcSource({ force: false }); expect((result as any)?.ok).toBe(true); expect(requests).toContain('https://uscode.house.gov/'); - expect(requests).toContain('https://uscode.house.gov/download/download.shtml'); + expect(requests).toContain('https://uscode.house.gov/download.html'); expect(requests).toContain('https://uscode.house.gov/download/releasepoints/us/pl/119/73/xml_usc01@119-73.zip'); expect(requests).not.toContain('https://uscode.house.gov/download/annualtitlefiles.shtml'); } finally { @@ -344,7 +344,7 @@ describe('OLRC source and cache behavior', () => { } }); - it('bootstraps homepage cookies before requesting download.shtml and releasepoint ZIPs', async () => { + it('bootstraps homepage cookies before requesting download.html and releasepoint ZIPs', async () => { const modulePath = resolve(process.cwd(), 'src', 'sources', 'olrc.ts'); const mod = await safeImport(modulePath); ensureModuleLoaded(modulePath, mod); @@ -377,7 +377,7 @@ describe('OLRC source and cache behavior', () => { }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { return new Response(`
Title 1 @@ -396,7 +396,7 @@ describe('OLRC source and cache behavior', () => { const result = await fetchOlrcSource({ force: false, cacheRoot }); expect((result as any)?.ok).toBe(true); - const listing = requests.find((request) => request.url === 'https://uscode.house.gov/download/download.shtml'); + const listing = requests.find((request) => request.url === 'https://uscode.house.gov/download.html'); const zip = requests.find((request) => request.url.endsWith('xml_usc01@119-73.zip')); expect(requests[0]?.url).toBe('https://uscode.house.gov/'); @@ -408,7 +408,7 @@ describe('OLRC source and cache behavior', () => { } }); - it('retries homepage bootstrap after a transient bootstrap failure before touching download.shtml', async () => { + it('retries homepage bootstrap after a transient bootstrap failure before touching download.html', async () => { const modulePath = resolve(process.cwd(), 'src', 'sources', 'olrc.ts'); const mod = await safeImport(modulePath); ensureModuleLoaded(modulePath, mod); @@ -449,7 +449,7 @@ describe('OLRC source and cache behavior', () => { }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { expect(headers.get('cookie') ?? headers.get('Cookie')).toContain('JSESSIONID=recovered-session'); return new Response(` @@ -474,14 +474,14 @@ describe('OLRC source and cache behavior', () => { 'https://uscode.house.gov/', 'https://uscode.house.gov/', ]); - expect(requests[2]?.url).toBe('https://uscode.house.gov/download/download.shtml'); + expect(requests[2]?.url).toBe('https://uscode.house.gov/download.html'); } finally { globalThis.fetch = originalFetch; rmSync(cacheRoot, { recursive: true, force: true }); } }); - it('parses download.shtml releasepoint listings by newest numeric vintage and ignores appendix links', async () => { + it('parses download.html releasepoint listings by newest numeric vintage and ignores appendix links', async () => { const modulePath = resolve(process.cwd(), 'src', 'sources', 'olrc.ts'); const mod = await safeImport(modulePath); ensureModuleLoaded(modulePath, mod); @@ -500,7 +500,7 @@ describe('OLRC source and cache behavior', () => { return new Response('ok', { status: 200, headers: { 'Set-Cookie': 'JSESSIONID=listing-session; Path=/; HttpOnly' } }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { return new Response(` older title 1 @@ -578,7 +578,7 @@ describe('OLRC source and cache behavior', () => { return new Response('ok', { status: 200, headers: { 'Set-Cookie': 'JSESSIONID=reserved-empty; Path=/; HttpOnly' } }); } - if (url === 'https://uscode.house.gov/download/download.shtml') { + if (url === 'https://uscode.house.gov/download.html') { return new Response(` Title 1