Artifact Compatibility Policy
This policy defines how artifact schemas evolve and how producers and consumers must behave for backward compatibility.
Semver behavior
| Bump | Meaning | Consumer impact |
|---|---|---|
| MAJOR | Breaking data schema changes (field removed, type changed, structure changed) | Consumers must be updated to handle the new schema |
| MINOR | Additive compatible fields (new optional fields, new categories) | Consumers may ignore unknown fields; safe to upgrade |
| PATCH | Docs, bugfix semantics, no structural break | No consumer impact |
Producer rules
- Validate output against schema before write. Use
validateArtifactEnvelopebeforewriteArtifactin strict mode. - Include freshness inputs so consumers can detect staleness (e.g.
sourceHash,snapshotHash). - Document confidence limits where relevant (e.g. "DB unreachable — disk-only analysis").
- Never remove or change types of existing fields in a PATCH or MINOR. Use a new MAJOR for breaking changes.
Consumer rules
- Read exact compatible major when possible. If you need
migration.analysis1.x, accept any 1.y.z. - Tolerate unknown fields — additive minor changes must not break consumers.
- Degrade gracefully when artifact is missing, invalid, or stale:
- Show a warning (e.g. "Run migration-audit to refresh")
- Provide a fallback path (e.g. live computation) when feasible
- Do not crash or block the user without a clear recovery path
- Prefer strict major matching — do not assume 2.x is compatible with 1.x.
Deprecation process
- Announce deprecation in release notes and schema docs.
- Publish new major artifact schema with migration notes.
- Block incompatible consumers in CI/integration tests.
- Remove deprecated major after documented cutover release (e.g. 2 releases later).
- Update the artifact registry with deprecation status.
Contributor checklist
When adding or modifying artifacts:
- [ ] Schema changes follow semver (MAJOR for breaking, MINOR for additive).
- [ ] Producer validates output before write.
- [ ] Consumer degrades gracefully when artifact missing/invalid/stale.
- [ ] Artifact ID is registered in the registry.
- [ ] Contract tests exist for producer and consumer.
- [ ] Migration notes documented for any breaking change.