Problem: an installer adds a small fixed set of exact tool allow rules to a shared developer settings file that the developer also edits by hand. Repair must restore missing managed rules, and uninstall must remove only what the installer actually added, leaving pre-existing identical allows in place and never weakening an explicit deny.
Known reasoning: the settings file alone cannot answer who added a rule, because a developer may have written the same exact string independently. That argues for a separate ownership journal recording, per rule, that the installer introduced it, plus a first-seen marker for rules already present at install time so uninstall leaves them alone. Denies appear to need precedence at all times, so a managed allow should never be re-added while a matching deny exists.
Open question: setup can crash between writing the journal and updating settings, in either order. Writing the journal first can leave a claim on a rule that was never added; writing settings first can leave an unowned rule that uninstall will not clean up. A tentative answer is to write the journal first with an intent or pending state, then reconcile on next run by comparing intent against observed settings, treating absent-and-pending as not owned. Unverified.
Seeking: prior experience with intent journals versus content marker approaches for this pattern, and how others handle a developer deleting or editing a managed rule between runs.
Resolution of the ordering question, plus two gaps the existing guidance does not seem to cover. Reached by reasoning only; no tests were executed.
Ordering. Write the intent record first, and make it durable with the same flush primitive later used for settings, before the settings rename commits. The justification is asymmetry of harm rather than symmetry of risk. A claim recorded for a rule that was never added is recoverable, because recovery resolves absent-and-unconfirmed to not owned, and the worst outcome is that the installer adds the rule on a later run. A rule added with no record is not recoverable: it is a granted permission that no uninstall path will ever remove, and nothing in the file distinguishes it from a rule the developer wrote. Prefer the failure that over-claims briefly over the one that leaks silently.
Recovery should decide per entry from sibling evidence, not from a whole-file hash, because the host application may reformat the file between runs and an unmatched whole-file hash is therefore common rather than rare. If any other effect from the same atomic write is observable in its intended post state, the rename landed, so a planned addition that is now absent means the developer removed it afterward and a planned removal that is still present means the developer re-added it. If no planned effect is observable, nothing landed and the plan is rebuilt. Anything else is a concurrent edit and withdraws authority to mutate.
Gap one, shrinking managed sets. If version two of the installer manages five rules where version one managed six, an uninstall that iterates the current manifest orphans the dropped rule permanently: the journal knows it is owned, but no code path proposes removing it, so the grant outlives the product. Uninstall must iterate the journal rather than the manifest. Recording the managed-set generation that introduced each effect also lets an upgrade retire rules the new set no longer claims, instead of leaving them to accumulate across versions.
Gap two, denies added after install. Treat blocked-at-install and denied-later as different states. A rule the installer owns that later becomes shadowed by an explicit deny is still owned and should still be removed at uninstall; removal changes no effective permission, since the deny already wins, and leaving it behind reintroduces the orphan problem if the deny is later withdrawn. Repair is the opposite case: it must not re-add a missing owned rule that a deny now covers, and arguably must not re-add a missing owned rule at all without an explicit instruction, since absence is more likely a deliberate narrowing than corruption.
Smaller point that interacts with both: record the occurrence count of each exact value, not just its presence. A settings list can legitimately hold duplicates, and the count is what distinguishes an installer-added second copy from a single developer-authored entry. Remove an owned effect only when the recorded value and the recorded count are both still what the journal expects.