feat(mapping): add PGE loop for entity/relationship mapping#84
Open
FiifiB wants to merge 2 commits into
Open
Conversation
Introduce agent_mapping_pge — a Planner→Generator→Evaluator mapping engine —
additively. Plans a source-model, generates entity + relationship SQL per
ontology item, and gates each with a deterministic evaluator + a semantic
critic. Coverage is engine-enforced from the ontology (abstract-superclass
UNION derivation + synthetic-endpoint fallback so one failed hub can't drop
all relationships).
Additive: agent_auto_assignment is retained and still reachable via
AgentClient.run_auto_assignment; a new AgentClient.run_mapping_pge gateway
exposes the PGE engine, so an orchestrator can choose between them. Upstream
features preserved (ToolContext.warehouse_id, Mapping._canonicalize_imported_uris).
- NEW agent_mapping_pge package + tools/{planner,evaluation}.py
- context.py: +source_model/+semantic_eval_report fields (warehouse_id kept)
- Mapping.py: run PGE + accumulate source_model/evaluations/run_log;
save_mappings_to_session gains 3 optional params (legacy path unaffected)
- Tests: 90 in tests/agents/agent_mapping_pge; 208 across units/{agents,mapping}
Co-authored-by: Isaac
|
Fiifi Botchway seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Satisfy the AI-feature lifecycle gate for the new agent: documented contract (purpose, tool surface, eval dimensions, failure modes) + a 20-example baseline eval dataset spanning single-source, multi-source cross-trust reconciliation, and degenerate inputs. Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
agent_mapping_pge, a Planner→Generator→Evaluator (PGE) enginefor entity/relationship mapping, as an additive alternative to the existing
single-agent
agent_auto_assignment. The PGE engine plans a source-model,generates entity and relationship SQL per ontology item, and gates each with a
deterministic evaluator plus an independent semantic critic — replacing the
"implementer marks its own homework" pattern with separation of creator and critic.
This is the second of two independent PGE PRs (ontology generation;
entity/relationship mapping) and is self-contained.
Why additive (both engines retained)
agent_auto_assignmentis kept and still reachable viaAgentClient.run_auto_assignment. A newAgentClient.run_mapping_pgegatewayexposes the PGE engine. This lets a downstream orchestrator choose which engine
to run based on source/ontology complexity (a follow-up change).
What changed
agents/agent_mapping_pge/— Planner (planner.py), generators(
generators/{entity,relationship}.py), evaluator(
evaluator/{deterministic,critic,report}.py), engine orchestrator(
engine.py),contracts.py, andcoverage.py.skip[]is advisory and never removes an item.a single failed hub entity can't cascade to drop all relationships.
ThreadPoolwalk with monotonic progress.agents/tools/{planner,evaluation}.py— planner/evaluation terminaltools (
submit_source_model,submit_evaluation,normalized_value_overlap).agents/tools/context.py— addssource_model+semantic_eval_report(forward-ref typed);
warehouse_idand all existing fields preserved.back/objects/mapping/Mapping.py— runs the PGE engine in the auto-assignflow and accumulates PGE extras (
source_model,mapping_evaluations,mapping_run_log);save_mappings_to_sessiongains three optional params(default
None, so the legacy path is unaffected). The upstream_canonicalize_imported_urishelper is preserved.Testing
uv run pytest tests/agents/agent_mapping_pge -q→ 90 passed.uv run pytest tests/units/agents tests/units/mapping -q→ 208 passed.This pull request and its description were written by Isaac.