Let module callers pass in-memory mapping rules to Set#32
Merged
Conversation
Completes dev/PLAN.md Track A Phase A4: Set(config, mapping_rules=[...]) runs permission sync from parsed rules with no maps YAML file, so the full get -> assemble -> dry-run loop never touches disk under no_files. - In-memory rules go through the same structural validation as file-loaded rules (validate_mapping_rules), at the edge before any network or path resolution - With files enabled, the rules actually used are serialized into the run directory as the maps.yaml audit copy, keeping the audit trail faithful (a stale customer maps file is never copied) - Snapshots still gate apply: no_files + apply keeps requiring no_backup; reversibility invariant unchanged - MappingRule exported from the package for caller typing - Module-mode diagnostics: swallowed SystemExit messages now surface through the package logger so host applications can see why a run failed Tests: rules resolution/validation unit matrix; audit serializer round-trip; e2e parity (file vs in-memory vs in-memory+no_files produce identical mutations and instance state on dry-run and apply fixtures); audit-copy content equality; invalid-rules fail-fast with zero mutations; module-API falsy-result and logger-diagnostic guarantees. Verification: tests/run.py 102/102 fast, 120/120 --live against the sgdev test instance. Amp-Thread-ID: https://ampcode.com/threads/T-019eba67-c19d-7166-9690-dcb2f0eed165 Co-authored-by: Amp <amp@ampcode.com>
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.
Completes dev/PLAN.md Track A Phase A4 (the one piece deferred from #31).
What
src.Set(config, mapping_rules=[...])runs permission sync from parsed rules with no maps YAML file. Combined withGetResultdata andno_files=True, the full get -> assemble -> dry-run loop never touches disk.Guarantees
apply;no_files+applykeeps requiringno_backupSystemExitmessages now surface through the package logger so host applications can see why a run failedMappingRuleexported for caller typingTests
Verification
uv run tests/run.py- 102/102uv run tests/run.py --live- 120/120 against the sgdev test instance