The three packages now live in one monorepo, so most contract drift is caught at PR time by shared tests. The mechanism documented here still applies for two cases:
- Aligning with sibling repos that vendored an earlier version of one of these packages.
- Catching unintentional schema drift inside the monorepo before it ships.
Keep shared identifiers, field names, contract versions, and handoff formats aligned across:
llm_knowledge_ingestionllm_observability_analyticsllm_dataset_foundry
…and across any external repos that still consume these packages' artifacts.
In-repo:
docs/shared-contract-summary.json— machine-readable summary of identifiers, contract versions, and handoff field requirements.scripts/validate_shared_contracts.py— validates that the summary is internally consistent and that example artifacts contain required fields.
The summary defines:
- canonical shared identifiers and their semantics
- contract version constants per package
- required producer/consumer fields per handoff
- example artifact paths used during validation
python scripts/validate_shared_contracts.pyWhen sibling repos exist on disk, pass their summaries with --peer:
python scripts/validate_shared_contracts.py \
--peer ../llm-observability-analytics/docs/shared-contract-summary.json \
--peer ../llm-dataset-foundry/docs/shared-contract-summary.json- Propose the contract change in
docs/shared-contract-summary.json. - Update the affected schema dataclasses, docs, and example artifacts in the same PR.
- Run
python scripts/validate_shared_contracts.pylocally. - Open coordinated PRs in any sibling repos.
- Update peer summaries and integration examples.
- Run cross-repo validation with
--peerbefore merging. - For breaking changes, bump the contract version constant and add migration notes to the PR description.
The llm-observability CLI also ships a diff-contracts subcommand that surfaces breaking field changes between two contract files:
python -m llm_observability_analytics.cli.main diff-contracts old.json new.json