feat(core): validate warning for dead renames overlay entries (#19)#27
Merged
Conversation
Placeholder branch for the proposal 0002 implementation. No code yet. Refs #19
Implements proposal 0002. `validate` now emits a non-blocking
`renames.dangling` warning for each `renames:` overlay entry that renamed
no rule the active set actually materialized — mirroring `policy.dangling`
for the last org overlay without a consistency check.
"Applies to a rule" is read from provenance, not id presence: a live
`kind: rule` rename stamps `source.original_id`/`source.pack` on the
materialized rule, so the applied-rename set is recoverable as
`{(pack, original_id)}`. An entry is dead iff `(pack, from)` is absent.
Forward-looking entries (pack not yet active) are dead now and warned too,
for parity with `policy.dangling`.
`RuleDef` gains an additive `source: dict` field, populated from the rule
doc's sibling `source` block (previously discarded on load). Additive
throughout: new advisory diagnostic code, no exit-code/schema change.
Docs: cli.md diagnostic-code examples + manifest.md renames section.
Closes #19
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.
Implements proposal 0002 (accepted in #26).
validatenow surfaces deadrenames:overlay entries — the last org overlay without a consistency check (policieshaspolicy.dangling,relationshipshasrelationship.overlay_dangling). A non-blockingrenames.danglingwarning is emitted perkind: ruleentry that renamed no rule the active set actually materialized."Applies to a rule" is read from provenance, not id presence: a live rename stamps
source.original_id/source.packon the materialized rule, so the applied-rename set is recoverable as{(pack, original_id)}and an entry is dead iff(pack, from)is absent. Forward-looking entries (pack not yet active) are dead now and warned too — the deliberate parity choice withpolicy.dangling.What changed
Implementation:
RuleDefgains an additivesource: dict = {}field, populated in_ruledef_from_doc(soload_definitionsanddefinitions_from_closure, which delegates to it, both carry provenance that was previously discarded on load)validate._renames_checks(model, diags), called fromvalidate_semanticbeside_policy_checks; derives the applied-rename set from rule provenance and emitsrenames.dangling(warning) per deadkind: ruleentry, inserted in(pack, from)order (byte-stable —make_envelopesorts by(scope, path, code), identical across these, so insertion order is the tiebreak)Tests:
tests/e2e/test_rename_overlay.py): live rename → no warning; forward-looking entry → onerenames.dangling, exit 0; dead entry alongside a live one → only the dead one; two dead entries ordered by(pack, from)tests/unit/test_renames_dangling.py): applied-set derivation from provenance (renamed vs un-renamed rules; id-presence is not the test); additiveRuleDef.sourcepopulation; ordering; no-manifest no-opDocs (same PR):
docs/reference/cli.md—renames.danglingadded to the diagnostic-code examplesdocs/reference/manifest.md— a line underrenamesnoting a dead entry is warned, not enforced, viavalidateNo surface/skill change (core diagnostic only). Additive: new advisory diagnostic code, no exit-code or
schema_versionchange, no manifest-shape change. Does not move a binding decision (advisory consequence of decision 0007's overlay, as the proposal's Compatibility section records) — no decision record.Proof
Objective half — full suite green (
pytest -q): 358 passed.Session evidence — none required (proposal §Proof: this is a core diagnostic with no surface/skill change and no new judgment; the plugins already teach
validateas the repo-health verb). Real CLI drive on alean-uxrepo with a forward-looking rename of the not-yet-activeopen-agile-architecture:Non-blocking (exit 0 /
status: ok), one warning namingpack/from/to.Closes #19.