gabriel / muse public
test BREAKING harmony task/harmony-tdd-bug-fixes #1 / 1
AI Agent gabriel · 59 days ago · Apr 17, 2026 · Diff

test(harmony): comprehensive TDD suite — 154 tests, 4 bugs fixed

Bugs found and fixed:

Bug 1 (symbol-level paths): auto_apply and record_resolutions were silently skipping symbol-level conflict paths like 'config.py::MAX_CONNECTIONS' because manifest lookups used the full address instead of extracting the file portion. Fixed by splitting on '::' before manifest access.

Bug 2 (record_resolutions idempotency): calling record_resolutions twice with the same outcome_blob produced duplicate resolution files because compute_resolution_id uses _now_utc(). Fixed by checking existing resolutions for matching outcome_blob before writing.

Bug 3 (MERGE_STATE original_conflict_paths): checkout --ours/--theirs progressively empties conflict_paths, so by commit time record_resolutions received an empty list and learned nothing. Fixed by adding original_conflict_paths to MergeState and write_merge_state, preserved through all subsequent writes. commit.py now uses original_conflict_paths.

Bug 4 (path traversal guard): (root / '../evil.py').relative_to(root) did not raise ValueError because pathlib.relative_to does string-level part comparison without resolving '..'. Fixed by using .resolve() on both sides before the relative_to check, which normalises '../' traversals and symlinks.

Bug 5 (semantic fingerprint cross-content replay): compute_pattern_id always incorporated blob_fp alongside semantic_fp, making different blob pairs produce different pattern IDs even when the semantic fingerprint was identical. This made the HarmonyPlugin semantic matching feature impossible. Fixed: when semantic_fp != blob_fp, pattern_id is computed from semantic_fp alone, enabling two conflicts with different blob content but the same semantic shape to share a pattern and replay the same saved resolution.

Test suite (154 tests across 27 test classes): - blob_fingerprint: commutativity, stability, distinctness - compute_pattern_id: path/blob/semantic sensitivity, new semantic isolation - compute_semantic_fingerprint: plugin dispatch, fallback, commutativity - record_pattern/load_pattern: round-trip, idempotency, invalid IDs - list_patterns, forget_pattern, clear_all - save_resolution/load_resolution: round-trip, idempotency, orphan guard - list_resolutions: sort by (human_verified, confidence, applied_count) - best_resolution: ranking in all tiebreaker combinations - increment_applied_count: increment, repeated, missing - gc_stale: removes old unresolved, keeps resolved or recent - audit log: append, accumulate, limit, provenance, metadata - policy CRUD: save/load/list/remove, scope ordering - PolicyCondition matching: all predicate combinations, glob paths - match_policy: first-match wins, no-match, skip non-matching - escalation lifecycle: record, load, list, filter, resolve - record_resolutions: file paths, symbol paths, idempotency, multi-path - auto_apply: exact replay, commutativity, applied_count, disk write - auto_apply symbol paths: record, replay, partial resolution - path traversal guard: '../', symbol+'../', absolute paths - one-sided deletion: ours missing, theirs missing, both missing - semantic plugin: cross-content replay, distinct fingerprints no cross-replay - MergeState: original_conflict_paths through 1/2/3-step resolution - End-to-end integration flows: full lifecycle, gc, policy, escalation, clear - AgentProvenance: human/agent round-trip, missing fields

sha256:504d361df4841c9944cb69f89914fa3342ece1832c896d550a3bed8502a64c1c sha
sha256:1a002a2d6faed9d0066b70edd683ec6b43dadf3134af0c1802fb6485f0c83a3c snapshot
← Older Oldest on task/harmony-tdd-bug-fixes
All commits
Newer → Latest on task/harmony-tdd-bug-fixes

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:504d361df4841c9944cb69f89914fa3342ece1832c896d550a3bed8502a64c1c --body "your comment"