updater: ownership closure for untracked changed components, keep update history - #122
Merged
Merged
Conversation
The update path calls create_documentation_metadata, which writes metadata.json from scratch, and only then appends the step summary. So update_history never held more than the last step and a chain of updates lost its history. Read the history before the rewrite and restore it in merge_into_metadata.
_read_update_history is a staticmethod and used json without an import (the only one was local to _run_incremental_update), so every --update that reached the metadata rewrite crashed with NameError.
…p 3a) The module tree tracks a minority of the code graph (svelte: 764 of 2239 components). A changed component outside it has no owner, so it never enters a leaf's Own; it only reached neighbouring leaves as CONTEXT, which does not activate. Along svelte's 20-commit chain 24 of 38 changed components were untracked and 8 of 20 update steps wrote no page, including the pinned endpoint commit (transform-client.js::client_component). Extend the owner map to a total function with the placement rules of Step 2: rule 1 same file, rule 2 same directory with one leaf, rule 3 neighbour majority at tau_nb, rule 4 the routing agent in a "place or leave" mode (no new leaves). A changed untracked component enters Own of its effective owner and activates that leaf like a tracked change; the leaf agent sees it under OWN with a "not listed by this module; assigned by rule k" note and keeps the no-op / patch / rewrite judgment. Activation only: the tree on disk is not changed and the closure is recomputed every step. What no rule places stays context. - ownership.py: close_ownership(), Adoption; route_by_rules() made public - change_report.build_reports(adopted=...): Own/Up/context consult the closure; LeafReport.adopted records id -> rule - routing.RoutingAgent: purpose="ownership" uses OWNERSHIP_ROUTING_USER_PROMPT (place | untracked), maps create -> left - record: UpdateRecord.ownership, summary n_adopted / n_adopted_by_agent - options: use_ownership_closure (default on, off at rung 1); CLI --no-ownership-closure - tests: rules 1-4, deleted untracked, unplaced, switched off, end-to-end
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.
Three updater changes, on top of #111 and #121.
Ownership closure (Step 3a)
The module tree tracks only part of the code graph (svelte: 764 of 2239 components). A changed component outside the tree has no owner, so it never activates a leaf; it only reached neighbouring leaves as context. On svelte's 20-commit chain, 24 of 38 changed components were untracked and 8 of 20 update steps wrote no page, including the final commit.
The owner map is now total, using the placement rules of Step 2:
tau_nbA placed component enters the leaf's Own set and activates that leaf like a tracked change. The leaf agent sees it under OWN with a note saying which rule assigned it, and still decides no-op / patch / rewrite. Only activation changes: the tree on disk is not modified, and the closure is recomputed every step. Components no rule places stay context.
ownership.py:close_ownership(),Adoption;route_by_rules()made publicchange_report.build_reports(adopted=...): Own/Up/context use the closure;LeafReport.adoptedrecords id -> rulerouting.RoutingAgent:purpose="ownership"prompt (place | untracked)record:UpdateRecord.ownership, summaryn_adopted/n_adopted_by_agentoptions:use_ownership_closure(on by default, off at rung 1); CLI--no-ownership-closureKeep
update_historyacross updatesThe update path rewrote
metadata.jsonfrom scratch before adding the step summary, soupdate_historyonly ever held the last step. The history is now read before the rewrite and restored.Missing
import jsonindoc_generator_read_update_historyusedjsonwithout a module-level import, so every--updatecrashed withNameErrorwhen writing metadata.Tests
204 pass with pydantic-ai 1.0.6 (as in CI) and 2.24. New tests cover rules 1-4, deleted and unplaced untracked components, the switch-off, and an end-to-end run.