Superseded by
docs/proposals/vocabulary-consolidation.md(2026-07-10).Closed record, not a backlog. Statuses below are as they stood when the program closed and are not maintained. Open work lives only in
BACKLOG.md.Historical document. Current product terminology is Vocabulary (third pillar), concept scheme, and field binding. Retired names (
ontology,KB,field mapping) appear here as program-era references only. See Canonical Terminology.
Vocabulary Implementation Plan (historical)¶
Objective¶
Implement ontology governance as a practical layer in PyCharter that:
- normalizes and validates ontology bindings in contracts,
- enforces proposal/review governance with merge gates, and
- operationalizes ontology for validation, routing, and impact analysis.
This plan is derived from:
docs/guides/ontology-governance-rfc.md
Scope Summary¶
In scope:
- Canonical contract ontology schema (
field_bindings) with backward compatibility. - Semantic health APIs and merge gate validation APIs.
- Policy-aware approvals by tier and change type.
- UI support in ontology proposal flow for ontology change governance.
- Initial ontology-driven contract checks (
coverage,references,derived_from).
Out of scope for this implementation cycle:
- Advanced graph reasoning and automated ontology inference.
- Full ontology recommender/copilot.
- Hard global enforcement on all legacy contracts from day one.
Workstreams¶
WS1: Contract Ontology Canonicalization¶
Goal: make ontology contract payload strict enough for reliable processing.
Tasks:
- Define canonical schema:
ontology.versionontology.field_bindings.{field_path}.concept_id- optional
confidence,relationships,lineage,tags - Implement strict Pydantic models in
db/schemas/data_contract.py. - Add parser normalization:
- legacy
ontology.fields-> canonicalontology.field_bindings - Add structured validation errors and migration warnings.
- Add tests:
- parse legacy and canonical
- invalid relationship type rejection
- missing
concept_idrejection
Primary files:
src/pycharter/db/schemas/data_contract.pysrc/pycharter/contract_parser/parser.pytests/test_contract_parser.pytests/wiki/test_knowledge_json_schema.py(ontology enums: ConceptType, RelationshipType)tests/wiki/test_schema_loader.py(loadsvocabulary_metaschema.yaml)
Acceptance criteria:
- Existing contracts still parse via normalization path.
- New canonical schema is validated deterministically.
- Validation error messages identify field path and fix hint.
WS2: Semantic Health Service¶
Goal: expose measurable ontology quality for each contract.
Tasks:
- Add semantic health service:
- mapping coverage (% mapped fields)
- invalid concept references
- deprecated concept usage
- invalid relationship types
- Add API endpoint:
GET /api/v1/contracts/{contract_id}/field-mapping- Add tests for service + route.
Primary files:
src/pycharter/wiki/knowledge/*(new helper/service module)src/pycharter/wiki/api/routes/v1/*src/pycharter/wiki/api/models/*
Acceptance criteria:
- Endpoint returns deterministic health payload.
- Health score works for both legacy and canonical ontology payloads.
WS3: Proposal Governance + Merge Gates¶
Goal: make ontology changes policy-driven and safely mergeable.
Tasks:
- Extend proposal model:
proposal_typerequired_approvalsgate_statusJSON- Add policy evaluator:
- derive required approvals by tier + change type
- Add proposal validation endpoint:
POST /api/v1/proposals/{id}/validate- Implement gates:
- concept existence
- relationship-type validity
- semantic coverage delta
- optional SHACL gate (feature flag)
- Block merge unless gates pass (for governed tiers).
Primary files:
src/pycharter/db/models/semantic/(proposal-related models)src/pycharter/wiki/collaboration/proposals.pysrc/pycharter/wiki/collaboration/review.pysrc/pycharter/wiki/collaboration/permissions.pysrc/pycharter/wiki/api/routes/v1/proposals.py
Acceptance criteria:
corechanges require configured approvers and passing gates.- Gate outputs are persisted and queryable.
- Failed gates provide actionable diagnostics.
WS4: Ontology UI Enhancements for Ontology Governance¶
Goal: make governance decisions visible and auditable in the UI.
Tasks:
- Proposal form adds
proposal_typeand impacted contract summary. - Proposal detail page shows:
- required approvers
- gate status (pass/fail/pending)
- impact summary (contracts/fields/concepts touched)
- Review panel shows policy progress to merge readiness.
Primary files:
src/pycharter/ui/src/app/ontology/proposals/page.tsxsrc/pycharter/ui/src/app/ontology/proposals/detail/page.tsxsrc/pycharter/ui/src/components/ontology/CreateProposalModal.tsxsrc/pycharter/ui/src/components/ontology/ReviewList.tsx
Acceptance criteria:
- User can see exactly what is blocking merge.
- Policy and gate outcomes are aligned with backend source of truth.
WS5: Ontology-Driven Contract Checks¶
Goal: turn ontology into useful validation behavior.
Tasks:
- Add optional semantic coverage threshold checks.
- Implement
referencesintegrity checks (quality checks, not DB FKs). - Implement
derived_fromlineage consistency checks. - Route incidents to concept + contract owners.
Primary files:
src/pycharter/validator/*src/pycharter/api/services/contract_service.py- metadata ownership/governance integration points
Acceptance criteria:
- Contract validation report includes ontology-derived checks.
- Failures identify impacted owners/stakeholders.
Sequencing and Milestones¶
Milestone 1 (2 weeks)¶
- WS1 complete.
- WS2 partial (service + API v1 without full scoring weights).
Deliverable:
- canonical schema + health endpoint + parser compatibility.
Milestone 2 (2 weeks)¶
- WS3 backend complete.
- WS4 partial UI integration for gate and approvals display.
Deliverable:
- governed proposal workflow with merge block behavior.
Milestone 3 (2 weeks)¶
- WS4 complete.
- WS5 baseline checks complete.
Deliverable:
- ontology-driven validation and end-to-end governance UX.
Testing Strategy¶
- Unit:
- schema normalizer
- policy evaluator
- gate engine
- Integration:
- proposal creation -> review -> validate -> merge
- contract parse -> semantic health -> validation report
- Regression:
- legacy contract parsing
- existing ontology flows without ontology changes
Migration and Backward Compatibility¶
- Accept both legacy
ontology.fieldsand canonicalfield_bindings. - Normalize at parse time; keep write-path to canonical for new saves.
- Add warnings in API responses for legacy payload usage.
- Provide migration command (future task):
- dry-run summary + optional rewrite output.
Delivery Backlog (Ticket-Ready)¶
Backend¶
- BE-ONT-001: Add canonical ontology binding models to
DataContractSchema. - BE-ONT-002: Implement parser normalizer
fields -> field_bindings. - BE-ONT-003: Build semantic health calculator service.
- BE-ONT-004: Add semantic health API route + response model.
- BE-ONT-005: Extend proposal DB model for governance metadata.
- BE-ONT-006: Implement policy evaluator by tier/change type.
- BE-ONT-007: Implement proposal gate runner endpoint.
- BE-ONT-008: Merge guard enforcement with gate + approval checks.
- BE-ONT-009: Add ontology-derived validation checks (
references,derived_from).
Frontend¶
- FE-ONT-001: Add proposal type selector in create proposal modal.
- FE-ONT-002: Add gate status panel in proposal detail.
- FE-ONT-003: Add approval requirement/progress display.
- FE-ONT-004: Add impact summary block for changed concepts/fields/contracts.
QA/DevEx¶
- QA-ONT-001: Contract fixture suite for legacy + canonical ontology payloads.
- QA-ONT-002: End-to-end test for proposal governance lifecycle.
- DX-ONT-001: Author migration guide section + API examples.
Risks and Controls¶
- Risk: concept ID inconsistency across environments.
- Control: explicit concept registry validation + seed synchronization check.
- Risk: governance friction for domain teams.
- Control: tiered policy with configurable thresholds.
- Risk: UI/backend policy mismatch.
- Control: backend-provided policy status model; UI only renders server state.
Decision Log (To Fill)¶
- Canonical field path format.
- Decision: JSONPath in v1.
- Rationale: user preference and better support for nested/array structures.
- Field-to-concept cardinality.
- Decision: many-to-many in v1.
- Concept identifier strategy.
- Decision: use an immutable
concept_key(separate from display name). - Coverage denominator.
- Decision: leaf fields only.
- Coverage enforcement behavior.
- Decision: warn-only in v1 (no hard fail).
- Approval policy for
corein v1. - Decision: any authenticated user can approve for now.
- Merge blocking scope by tier.
- Decision: block merges for
coreonly in v1;domain/freeare warn-only with audit. - Legacy payload handling (
ontology.fields). - Decision: always normalize in memory; persist canonical
field_bindingson create/update saves. - Note: no forced bulk rewrite migration for untouched historical contracts.
- SHACL gate default (off/on) for first production rollout.
- Decision: feature-flagged OFF by default in v1, report-only when enabled.
WS3 API Examples¶
Create proposal with governance metadata:
POST /api/v1/proposals/
{
"contract_id": "9fae5b8a-2a50-4f77-86fc-7f96d130c001",
"title": "Map customer fields to core identity concepts",
"author": "alice",
"proposal_type": "mapping_change",
"affected_tiers": ["core"]
}
Run proposal validation gates:
POST /api/v1/proposals/{proposal_id}/validate
{
"proposed_ontology": {
"version": "1.1.0",
"field_bindings": {
"$.customer_id": [
{"concept_id": "CustomerIdentifier"}
]
}
}
}
Semantic health by contract name/version:
Implementation Start Recommendation¶
Start with WS1 + WS2 in a single branch to establish canonical data shape and observability first. This minimizes downstream churn before governance and UI work.