Skip to content

feat(examples): CourtListener / SEC EDGAR evidence provider plugin (bounty #1934) - #1949

Open
dankezo wants to merge 2 commits into
AI-WorkDeck:masterfrom
dankezo:bounty/1934-evidence-plugin
Open

dankezo wants to merge 2 commits into
AI-WorkDeck:masterfrom
dankezo:bounty/1934-evidence-plugin

Conversation

@dankezo

@dankezo dankezo commented Dec 5, 2026

Copy link
Copy Markdown

Closes #1934 (bounty ¥3,000).

What this adds

A new example plugin, examples/courtlistener-edgar-evidence/, implementing the public EvidenceProvider SPI (evidence.retrieve.v1) for two public US sources — following docs/EVIDENCE_CONTRACT.md and the shape of examples/hello-evidence-plugin/:

  • CourtListenerProvider (courtlistener-edgar-evidence.courtlistener) — queries that look like US citations (e.g. 410 U.S. 113) go to the citation-lookup API (an unfound citation returns nothing, never an invented case); other queries go to the opinion search API. The locator is the citation itself, source_uri opens the opinion on courtlistener.com.
  • SecEdgarProvider (courtlistener-edgar-evidence.sec-edgar) — EDGAR full-text search; the locator is the accession number + file name, source_uri is the sec.gov Archives original.

Contract discipline

  • Items without a precise locator are dropped, not decorated (contract §3/§6); as_of filters later-effective items; outages degrade to an empty list, never an exception.
  • Idempotent replay: evidence_id/content_hash derive from source content only (retrievedAt stays null), and hash changes track source changes — that is the anchor-drift signal for the Sources pane.
  • Hygiene: explicit User-Agent on every request, a built-in rate limiter (CourtListener default quota 5/min; EDGAR fair-access 10/s), zero hardcoded keys — the CourtListener token comes from the user's own COURTLISTENER_API_TOKEN env var (API v4 requires auth; without it that source degrades to empty, EDGAR unaffected), and the EDGAR User-Agent is overridable via AWD_EVIDENCE_USER_AGENT.
  • HTTP goes through an injectable HttpTransport (JDK HttpClient by default, 4s/8s timeouts, inside the host's 10s cap); JSON parsing is a small zero-dependency parser tolerant of camelCase/snake_case field drift.

Tests (offline, fixtures only)

mvn test — 14/14 pass, including:

  • Both providers green under EvidenceProviderConformanceKit (ConformanceTest).
  • Citation + search mapping, drop-without-locator, no-token → no network call, HTTP failure → empty, as_of exclusion, limit, idempotent replay, rate-limiter spacing (fake clock).
  • Fixtures in src/test/resources/fixtures/ are recorded/synthetic response shapes; no live network in CI. The EDGAR endpoint shape was verified live while writing the fixtures; CourtListener's API now requires a token, so its fixtures follow the documented v4 response shape and field handling is deliberately liberal.

Bilingual README (EN + zh-CN) covers behavior, configuration and build/install steps. SPDX headers on all sources.

CLA: happy to sign via the CLA Assistant bot on this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Withdrawn] Moved to internal backlog (#1934)

1 participant