fix: proposal from/to_snapshot_id held commit IDs, not snapshot IDs
Found while reviewing MP #9 against musehub#144: fromSnapshotId in the proposal API response is actually a commit ID -- confirmed by #0049's own docstring ('captures the HEAD commit ID of each branch') despite naming the columns from_snapshot_id/to_snapshot_id. musehub_proposals.create_proposal has always populated them from branch.head_commit_id. This is also why proposal_detail.html's 'from'/'to' anchor links to /commits/{id} worked at all -- they were unknowingly relying on the bug.
Fix: add from_commit_id/to_commit_id (holding what from/to_snapshot_id always actually held), and correct from_snapshot_id/to_snapshot_id to hold the real Snapshot (manifest) ID looked up from the anchor commit. Migration 0075 backfills the new columns from the existing (mislabeled) ones, then corrects the snapshot columns in place via a join against musehub_commits -- existing rows whose commit no longer resolves get a null snapshot_id rather than a stale commit ID masquerading as one.
Updated proposal_detail.html's anchor links to use from/to_commit_id (the correct field now that from/to_snapshot_id hold real snapshot IDs). ui_proposals.py's own from_snapshot_id/to_snapshot_id are unrelated local variables computed live from branch heads -- confirmed unaffected, left as-is. docs_muse_wire.html's from/to_snapshot_id + from/to_commit_id already correctly documents the unrelated MPatch format, which was already using this exact from/to_X_id + commit_id pairing convention correctly -- good precedent for this fix's naming.
Rewrote tests/test_proposal_snapshot_anchors.py: renamed assertions to fromCommitId/toCommitId matching corrected semantics, added coverage for the new snapshot lookup (both the real-commit hit case and the fixture-commit-doesn't-resolve miss case). 69 tests across proposals and snapshot-anchors pass with zero regressions.
Semantic Changes
35 symbols
0 comments
muse hub commit comment sha256:8d9ff9953480a93c194c2c4dba18752f490344ba971a98d03c6250db172bebc3 --body "your comment"
No comments yet. Be the first to start the discussion.