Legal Citation Reference Runbook
Purpose
This runbook is the operational guide for the CourtListener legal citation reference pack in Decision Gate.
Use it for:
- Deterministic offline validation in CI/dev.
- Manual opt-in live smoke validation against CourtListener.
- Production-safe security posture and token handling.
Canonical Pack
- Canonical path:
references/openapi/courtlistener-legal-citation-v1/ - Canonical OpenAPI:
references/openapi/courtlistener-legal-citation-v1/openapi.json - Pack catalog entry:
references/openapi/reference_library.json
Offline Deterministic Mode (Default)
Offline mode is the default and is required for standard CI.
Run offline legal citation suite:
dg-reason="offline-legal-citation-suite" dg-owner="dg-maintainers" dg-expires=2026-05-15
cargo test -p system-tests --features system-tests --test providers -- --exact legal_citation::legal_citation_reference_projection_first_end_to_end
Validate strict four-operation import/profile:
dg-reason="offline-strict-import-check" dg-owner="dg-maintainers" dg-expires=2026-05-15
cargo test -p system-tests --features system-tests --test providers -- --exact legal_citation::legal_citation_reference_import_strict_four_operation_profile
Validate dataset coverage contract:
dg-reason="offline-dataset-coverage-check" dg-owner="dg-maintainers" dg-expires=2026-05-15
cargo test -p system-tests --features system-tests --test providers -- --exact legal_citation::legal_citation_reference_dataset_coverage_and_semantics
Expected artifacts include:
legal_citation_report.jsontool_transcript.json- runpack export/verify outputs per case
Live Opt-In Mode (Manual)
Live mode is intentionally manual and not part of merge-gating CI.
Required env:
COURTLISTENER_LIVE=1
Optional env:
COURTLISTENER_BASE_URL(defaulthttps://www.courtlistener.com/api/rest/v4)COURTLISTENER_LIVE_CASE_LIMIT(default3)
Credential requirement:
- Store the raw API token in DG local encrypted secrets as
secret://courtlistener/api_token(no shell export required for live smoke). - Typed runtime auth applies deterministic render metadata (
prefix: "Token ") before injecting theAuthorizationheader. - DG secret store unlock is keyring-first. When keyring is unavailable/headless,
set
DECISION_GATE_SECRETS_PASSPHRASEbefore runningsecretscommands or live smoke. DECISION_GATE_SECRETS_PASSPHRASEis store unlock material, not a provider token.
Initialize local encrypted secrets and store the CourtListener token:
# If keyring is unavailable/headless:
export DECISION_GATE_SECRETS_PASSPHRASE="<strong-passphrase>"
scripts/bootstrap/dg.sh secrets init
export COURTLISTENER_API_TOKEN="<raw-api-token>"
scripts/bootstrap/dg.sh secrets put \
--tenant-id 1 \
--namespace-id 1 \
--name courtlistener/api_token \
--from-env COURTLISTENER_API_TOKEN
scripts/bootstrap/dg.sh secrets preflight \
--tenant-id 1 \
--namespace-id 1 \
--name courtlistener/api_token
Installed binary equivalent: replace scripts/bootstrap/dg.sh with
decision-gate in the commands above.
Alternative import workflow (explicit mappings only):
scripts/bootstrap/dg.sh secrets import \
--tenant-id 1 \
--namespace-id 1 \
--env-file .env \
--map COURTLISTENER_API_TOKEN=courtlistener/api_token
Run manual live smoke:
dg-reason="manual-live-citation-smoke" dg-owner="operator" dg-expires=2026-05-15
scripts/bootstrap/dg.sh live courtlistener smoke --case-limit 3
Direct test command remains available when needed:
COURTLISTENER_LIVE=1 \
COURTLISTENER_LIVE_CASE_LIMIT=3 \
cargo test -p system-tests --features system-tests --test providers -- --exact legal_citation::legal_citation_live_opt_in_smoke
This smoke validates:
- Auth header binding for
Authorizationviasecret://courtlistener/api_token. - Form-encoded body behavior for
citationLookup. - Pass/fail mix over a bounded live subset.
Live artifact:
legal_citation_live_report.json
Production Security Posture
Recommended defaults for production-like usage:
- Keep private-network access blocked (default fail-closed).
- Use explicit credential bindings (
secret://...) and avoid inline secrets in specs. - Restrict hosts via typed runtime security policy where deployment allows.
- Keep retries bounded and honor backoff/rate-limit signals.
Do not relax security settings used for local fixture stubs (allow_private_networks
for localhost test harness) in production deployments.
Token Handling and Redaction
- Do not commit tokens or secret-bearing env files.
- Store tokens in the local encrypted DG secret store (or enterprise secret manager).
- Keep CourtListener token value raw (no
Tokenprefix in storage). - Never print token values in logs or artifacts.
Runpack Interpretation
For each case, confirm:
- Decision outcome (
passorfail) matches expected gate semantics. runpack_verifyreports pass.- Evidence anchors are present and deterministic for repeated offline runs.
Fixture Refresh Procedure
Use the capture script for manual fixture updates:
Note: COURTLISTENER_API_TOKEN below is for the capture script only.
It is not the typed runtime credential path used by live smoke tests.
dg-reason="manual-fixture-refresh" dg-owner="operator" dg-expires=2026-05-15
COURTLISTENER_API_TOKEN="<raw-api-token>" \
python3 scripts/reference_packs/courtlistener_capture.py
Dry-run option:
dg-reason="manual-fixture-refresh-dryrun" dg-owner="operator" dg-expires=2026-05-15
COURTLISTENER_API_TOKEN="<raw-api-token>" \
python3 scripts/reference_packs/courtlistener_capture.py --dry-run
The script updates canonical pack fixtures and mirrors them into:
system-tests/tests/fixtures/legal_citation/examples/agentic/legal-citation-verification/