Open
#217
Bug
muse push -u / --set-upstream writes to [remotes.<name>] but muse branch --json reads from [branch.<name>] — upstream is always null
0
Anchors
—
Blast radius
—
Churn 30d
0
Proposals
No description provided.
Activity1
Found while answering a question about Episode 01's
muse branch --jsonoutput — "what shouldupstreamshow after a real push?" led to this. Confirmed with a live reproduction, not a code-read guess.Repro:
Root cause — two disconnected schemas:
set_upstream()(muse/cli/config.py:1338) writes:_upstream_for()(muse/cli/commands/branch.py:196), which produces theupstreamfield inmuse branch --json, reads:These are two different top-level TOML sections (
[remotes.<name>]vs[branch.<name>]) that never overlap. Grepped the entire codebase for any writer of[branch.<name>].remote/[branch.<name>].merge— found none. The only code that touches those two keys is_load_config's parser (muse/cli/config.py:281-286), which faithfully reads them if present, but nothing ever writes them there. TheBranchMetaTypedDict docstring even documents "Fields written bymuse pushupstream tracking (preserved on read/write)" forremote/mergeunder[branch.<name>]— describing a write path that doesn't exist.Net effect:
muse branch --json'supstreamfield can never be populated through any real, currently-existing code path.-u/--set-upstreamgenuinely runs and reports success, but writes to a location nothing ever reads back for this purpose.Suggested fix: pick one schema and make both sides agree — either make
set_upstream()writeremote/mergeunder[branch.<name>](matching what_upstream_for()already expects and what theBranchMetadocstring already claims), or make_upstream_for()read from[remotes.<name>].branch(matching whatset_upstream()actually writes). The former seems more consistent with howintent/resumablealready work (per-branch metadata under[branch.<name>]), and with the existing docstring's stated intent.Deferred per usual until after the season wraps.