fix(regeneration): profile-aware kind selection for post-merge and proposed-change regeneration
Merged
PO
4mo ago+224+224+012345678901234567890123456789-33-33-01234567890123456789
Summary
Regeneration selection now widens a diff's changed kinds to include the node kind behind each changed profile, resolved from the branch's live schema. A change touching only a profile selects every generator and artifact whose query reads the profiled node kind — on both the post-merge selective regeneration and the proposed-change refresh.
What changed
- New
SchemaProfileExpander(core/regeneration/profiles.py): given a branch and a set of changed kinds, adds the profiled node kind for every changed profile kind, using the schema's profile→node relationship. A kind that names no profile passes through. TheSchemaManageris a constructor dependency (resolved toregistry.schemaat the wiring sites), so the component no longer reaches into the global registry. - Wired into both selection paths through one component: injected as the merge planner's
kinds_expander, which runs it in the planner's shared plan step so both the initial plan and the cascade reselection widen alike; constructed at the proposed-change flow level for the generator and artifact loops. The proposed-change generator loop, which selected on rawquery_modelsmembership, now runs through the same widened kinds. reads_kindmoved topredicates.py: with profile handling now living in the expander, it reduces tokind in query_models, so the name-stripping heuristic (kind.replace("Profile", "", 1)) is removed and the predicate lives besidequery_changed/definition_changedas a free function overRegenerationDefinition— off the definition models, which stay plain data holders.
The widening only ever adds kinds, so the no-under-execution guarantee is preserved.
Tests
- unit:
SchemaProfileExpanderagainst an injected in-memory schema branch that generates profiles - unit: gate widening selects both a generator and an artifact for a profiled kind
- unit: the planner passes the expanded kinds to every selector
- unit:
reads_kindmatches only a kind the definition's query reads - component:
run_generatorsdispatches every generator reading a profiled kind on a profile-only change
Notes
- Resolves https://opsmill.atlassian.net/browse/IFC-2907 in full — both items the ticket tracks: the fragile profile heuristic, and profile handling applied to artifacts but not generators.
- Rebased onto
pmi-20260727-refactor-selectors, which is now participant/planner based; the profile-kind widening integrates into the planner's shared plan step, and the tests moved to the participant wiring. Review feedback addressed:SchemaProfileExpandertakes an injectedSchemaManager(no global registry), andreads_kindmoved off the definition models intopredicates.py.
🤖 Generated with Claude Code