OXYGENHUB

Roadmap: phase D done 4213c41dfc64

Author
Andy McCall @andymccall <[email protected]>
When
· 2026-09-27 18:55 UTC
Signature
✔ signed by Andy McCall
Hash
4213c41dfc6400877b9428dfcc63b936c1cd044f8ab27a71fa1409f39ff54da7
Depends on
5b9c6ad45f6e 982864068a59 b0e64e81e4fb be0161a88dd7 d82e44097323 fce44ae9ad29
Depended on by
b582948f1912 3e5772ccf9da 1df1d57a919c
In bookmarks
agents-in-readme bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
In tags
v0.1.0 v0.10.0 v0.11.0 v0.2.0 v0.3.0 v0.3.1 v0.4.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
Edits
27 atoms, 0 tree operations, 5 files

Browse the tree at this change

modified crates/oxy-core/src/protocol.rs +4 −1
…
318 unchanged lines
319 319
        }
320 320
        Err(ureq::Error::Status(code, r)) => {
321 321
            let text = r.into_string().unwrap_or_default();
322 -
            Err(RepoError::Msg(format!("{url}: HTTP {code}: {}", text.trim())))
322 +
            Err(RepoError::Msg(format!(
323 +
                "{url}: HTTP {code}: {}",
324 +
                text.trim()
325 +
            )))
323 326
        }
324 327
        Err(e) => Err(RepoError::Msg(format!("{url}: {e}"))),
325 328
    }
…
675 unchanged lines
modified crates/oxy-core/src/repo/sync.rs +8 −2
…
739 unchanged lines
740 740
        for r in seals {
741 741
            let attest = self.store.get_attest(r)?;
742 742
            let sigs = self.store.signatures(r)?;
743 -
            bundle.attests.push(crate::protocol::SignedAttest { attest, sigs });
743 +
            bundle
744 +
                .attests
745 +
                .push(crate::protocol::SignedAttest { attest, sigs });
744 746
        }
745 747
        let results = remote.push(bundle, vec![], None, vec![])?;
746 748
        if let Some(r) = results.iter().find(|r| !r.ok) {
…
5 unchanged lines
752 754
    /// The remote whose URL starts with `base` (a hub), if configured.
753 755
    pub fn remote_for_url(&self, base: &str) -> Option<String> {
754 756
        let base = base.trim_end_matches('/');
755 -
        self.config.remotes.iter().find(|(_, url)| url.trim_end_matches('/') == base).map(|(name, _)| name.clone())
757 +
        self.config
758 +
            .remotes
759 +
            .iter()
760 +
            .find(|(_, url)| url.trim_end_matches('/') == base)
761 +
            .map(|(name, _)| name.clone())
756 762
    }
757 763
758 764
    /// Open a remote by name or, failing that, by URL with the default
…
720 unchanged lines
modified docs/roadmap.md +2 −1
…
45 unchanged lines
46 46
## Progress
47 47
48 48
- 2026-09-27: roadmap written; phase A done the same day (challenge signatures, push report, `Send` states with the hub's cache, shared lanes and `log_window`).
49 -
- 2026-09-27: phase B (hub 0.2, accounts and access) done and deployed; phase C, the review checkpoint, is Andy's to commission; phase D can start on the oxy side (`oxy seal --proposal`, `oxy proposal`) meanwhile.
49 +
- 2026-09-27: phase B (hub 0.2, accounts and access) done and deployed; phase C, the review checkpoint, is Andy's to commission.
50 +
- 2026-09-27: phase D done ahead of the review at Andy's request (`oxy seal --proposal`, `oxy proposal show|land`, seal-only pushes; hub 0.3 proposals and review). Review findings will be folded into D's code as plan items.
modified src/cli/mod.rs +5 −1
…
801 unchanged lines
802 802
            },
803 803
            PolicyCmd::Sign { proposal, out } => identity::policy_sign(&proposal, out),
804 804
        },
805 -
        Cmd::Seal { changes, proposal: Some(url), json } if changes.is_empty() => proposal::seal(&url, json),
805 +
        Cmd::Seal {
806 +
            changes,
807 +
            proposal: Some(url),
808 +
            json,
809 +
        } if changes.is_empty() => proposal::seal(&url, json),
806 810
        Cmd::Seal { changes, json, .. } => identity::seal(&changes, json),
807 811
        Cmd::Proposal { cmd } => match cmd {
808 812
            ProposalCmd::Show { url, json } => proposal::show(&url, json),
…
6 unchanged lines
modified src/cli/proposal.rs +114 −21
…
17 unchanged lines
18 18
        let (owner, name) = (parts.next().unwrap_or(""), parts.next().unwrap_or(""));
19 19
        return Ok((url.to_string(), format!("{base}/{owner}/{name}")));
20 20
    }
21 -
    let (repo_url, number) = url.rsplit_once("/proposal/").ok_or_else(|| anyhow!("{url} is not a proposal URL (…/OWNER/NAME/proposal/N)"))?;
22 -
    let (base, slug) = repo_url.rsplit_once('/').and_then(|(b, n)| b.rsplit_once('/').map(|(bb, o)| (bb, format!("{o}/{n}")))).ok_or_else(|| anyhow!("{url} is not a proposal URL"))?;
23 -
    Ok((format!("{base}/api/v1/repos/{slug}/proposals/{number}"), repo_url.to_string()))
21 +
    let (repo_url, number) = url
22 +
        .rsplit_once("/proposal/")
23 +
        .ok_or_else(|| anyhow!("{url} is not a proposal URL (…/OWNER/NAME/proposal/N)"))?;
24 +
    let (base, slug) = repo_url
25 +
        .rsplit_once('/')
26 +
        .and_then(|(b, n)| b.rsplit_once('/').map(|(bb, o)| (bb, format!("{o}/{n}"))))
27 +
        .ok_or_else(|| anyhow!("{url} is not a proposal URL"))?;
28 +
    Ok((
29 +
        format!("{base}/api/v1/repos/{slug}/proposals/{number}"),
30 +
        repo_url.to_string(),
31 +
    ))
24 32
}
25 33
26 34
pub fn fetch(repo: &Repo, url: &str) -> Result<(Value, String)> {
…
5 unchanged lines
32 40
}
33 41
34 42
fn hashes(v: &Value, key: &str) -> Vec<ChangeHash> {
35 -
    v.get(key).and_then(Value::as_array).map(|a| a.iter().filter_map(|x| x.as_str().and_then(ChangeHash::from_hex)).collect()).unwrap_or_default()
43 +
    v.get(key)
44 +
        .and_then(Value::as_array)
45 +
        .map(|a| {
46 +
            a.iter()
47 +
                .filter_map(|x| x.as_str().and_then(ChangeHash::from_hex))
48 +
                .collect()
49 +
        })
50 +
        .unwrap_or_default()
36 51
}
37 52
38 53
fn change_hashes(v: &Value) -> Vec<ChangeHash> {
39 -
    v.get("changes").and_then(Value::as_array).map(|a| a.iter().filter_map(|c| c.get("hash").and_then(Value::as_str).and_then(ChangeHash::from_hex)).collect()).unwrap_or_default()
54 +
    v.get("changes")
55 +
        .and_then(Value::as_array)
56 +
        .map(|a| {
57 +
            a.iter()
58 +
                .filter_map(|c| {
59 +
                    c.get("hash")
60 +
                        .and_then(Value::as_str)
61 +
                        .and_then(ChangeHash::from_hex)
62 +
                })
63 +
                .collect()
64 +
        })
65 +
        .unwrap_or_default()
40 66
}
41 67
42 68
fn text<'a>(v: &'a Value, key: &str) -> &'a str {
…
7 unchanged lines
50 76
        println!("{v}");
51 77
        return Ok(0);
52 78
    }
53 -
    println!("{} #{} {}", ui::done("Proposal"), v.get("number").and_then(Value::as_i64).unwrap_or(0), ui::bookmark(text(&v, "title")));
79 +
    println!(
80 +
        "{} #{} {}",
81 +
        ui::done("Proposal"),
82 +
        v.get("number").and_then(Value::as_i64).unwrap_or(0),
83 +
        ui::bookmark(text(&v, "title"))
84 +
    );
54 85
    println!("{}", ui::kv("state", text(&v, "state")));
55 86
    println!("{}", ui::kv("target", ui::bookmark(text(&v, "target"))));
56 87
    println!("{}", ui::kv("author", ui::author(text(&v, "author"))));
57 -
    let changes = v.get("changes").and_then(Value::as_array).cloned().unwrap_or_default();
88 +
    let changes = v
89 +
        .get("changes")
90 +
        .and_then(Value::as_array)
91 +
        .cloned()
92 +
        .unwrap_or_default();
58 93
    println!("{}", ui::kv("changes", changes.len().to_string()));
59 94
    for c in &changes {
60 -
        println!("  {} {}", ui::hash(&text(c, "hash")[..12.min(text(c, "hash").len())]), text(c, "message").lines().next().unwrap_or(""));
95 +
        println!(
96 +
            "  {} {}",
97 +
            ui::hash(&text(c, "hash")[..12.min(text(c, "hash").len())]),
98 +
            text(c, "message").lines().next().unwrap_or("")
99 +
        );
61 100
    }
62 -
    if v.get("conflicted").and_then(Value::as_bool).unwrap_or(false) {
101 +
    if v.get("conflicted")
102 +
        .and_then(Value::as_bool)
103 +
        .unwrap_or(false)
104 +
    {
63 105
        println!("{}", ui::warn("landing would carry conflicts"));
64 106
    }
65 107
    if let Some(blockers) = v.get("blockers").and_then(Value::as_array) {
…
1 unchanged lines
67 109
            println!("  {} {}", ui::warn("blocked:"), b.as_str().unwrap_or(""));
68 110
        }
69 111
    }
70 -
    let approvals = v.get("approvals").and_then(Value::as_array).cloned().unwrap_or_default();
112 +
    let approvals = v
113 +
        .get("approvals")
114 +
        .and_then(Value::as_array)
115 +
        .cloned()
116 +
        .unwrap_or_default();
71 117
    for a in &approvals {
72 -
        let mark = if a.get("sealed").and_then(Value::as_bool).unwrap_or(false) { ui::done("approved") } else { ui::warn("pending seal") };
118 +
        let mark = if a.get("sealed").and_then(Value::as_bool).unwrap_or(false) {
119 +
            ui::done("approved")
120 +
        } else {
121 +
            ui::warn("pending seal")
122 +
        };
73 123
        println!("  {mark} {}", text(a, "account"));
74 124
    }
75 125
    Ok(0)
…
13 unchanged lines
89 139
    for chunk in hashes.chunks(oxy_core::attest::MAX_SEAL_HASHES) {
90 140
        refs.push(repo.seal(chunk)?);
91 141
    }
92 -
    let remote = repo.remote_for_url(&repo_url).ok_or_else(|| anyhow!("no remote is configured for {repo_url}; add one with `oxy remote add`"))?;
142 +
    let remote = repo.remote_for_url(&repo_url).ok_or_else(|| {
143 +
        anyhow!("no remote is configured for {repo_url}; add one with `oxy remote add`")
144 +
    })?;
93 145
    repo.push_seals(&remote, &refs)?;
94 146
    if as_json {
95 -
        let list: Vec<String> = hashes.iter().map(|h| format!("\"{}\"", h.to_hex())).collect();
147 +
        let list: Vec<String> = hashes
148 +
            .iter()
149 +
            .map(|h| format!("\"{}\"", h.to_hex()))
150 +
            .collect();
96 151
        println!("{{\"sealed\":[{}],\"pushed\":true}}", list.join(","));
97 152
    } else {
98 -
        println!("{} {} change{} of the proposal and pushed the seal to {remote}", ui::done("Sealed"), hashes.len(), if hashes.len() == 1 { "" } else { "s" });
153 +
        println!(
154 +
            "{} {} change{} of the proposal and pushed the seal to {remote}",
155 +
            ui::done("Sealed"),
156 +
            hashes.len(),
157 +
            if hashes.len() == 1 { "" } else { "s" }
158 +
        );
99 159
    }
100 160
    Ok(0)
101 161
}
102 162
103 163
/// Fetch the proposal's changes (and anything they need) from the hub
104 164
/// into the local store.
105 -
fn ensure_changes(repo: &Repo, repo_url: &str, want: &[ChangeHash], _changes: &[ChangeHash]) -> Result<()> {
106 -
    let missing: Vec<ChangeHash> = want.iter().copied().filter(|h| !repo.store().has(h)).collect();
165 +
fn ensure_changes(
166 +
    repo: &Repo,
167 +
    repo_url: &str,
168 +
    want: &[ChangeHash],
169 +
    _changes: &[ChangeHash],
170 +
) -> Result<()> {
171 +
    let missing: Vec<ChangeHash> = want
172 +
        .iter()
173 +
        .copied()
174 +
        .filter(|h| !repo.store().has(h))
175 +
        .collect();
107 176
    if missing.is_empty() {
108 177
        return Ok(());
109 178
    }
…
17 unchanged lines
127 196
        anyhow::bail!("the proposal is {state}, not open (use --force to land anyway)");
128 197
    }
129 198
    if !v.get("landable").and_then(Value::as_bool).unwrap_or(false) && !force {
130 -
        let blockers: Vec<String> = v.get("blockers").and_then(Value::as_array).map(|a| a.iter().filter_map(|b| b.as_str().map(String::from)).collect()).unwrap_or_default();
131 -
        anyhow::bail!("the hub says the proposal cannot land yet: {} (use --force to land anyway)", blockers.join("; "));
199 +
        let blockers: Vec<String> = v
200 +
            .get("blockers")
201 +
            .and_then(Value::as_array)
202 +
            .map(|a| {
203 +
                a.iter()
204 +
                    .filter_map(|b| b.as_str().map(String::from))
205 +
                    .collect()
206 +
            })
207 +
            .unwrap_or_default();
208 +
        anyhow::bail!(
209 +
            "the hub says the proposal cannot land yet: {} (use --force to land anyway)",
210 +
            blockers.join("; ")
211 +
        );
132 212
    }
133 213
    let target = text(&v, "target").to_string();
134 214
    let heads = hashes(&v, "projected_heads");
…
1 unchanged lines
136 216
        anyhow::bail!("the hub has not computed the projected state yet; try again shortly");
137 217
    }
138 218
    ensure_changes(&repo, &repo_url, &heads, &change_hashes(&v))?;
139 -
    let remote = repo.remote_for_url(&repo_url).ok_or_else(|| anyhow!("no remote is configured for {repo_url}; add one with `oxy remote add`"))?;
219 +
    let remote = repo.remote_for_url(&repo_url).ok_or_else(|| {
220 +
        anyhow!("no remote is configured for {repo_url}; add one with `oxy remote add`")
221 +
    })?;
140 222
    // Bring the target bookmark up to date first, so the push is a fast-forward.
141 223
    repo.fetch(&remote)?;
142 224
    repo.bookmark_set(&target, &heads)?;
143 225
    let results = repo.push_bookmark(&remote, &target, false)?;
144 226
    for r in &results {
145 227
        if r.ok {
146 -
            println!("{} {}/{} - landed proposal", ui::done("Pushed"), remote, r.name);
228 +
            println!(
229 +
                "{} {}/{} - landed proposal",
230 +
                ui::done("Pushed"),
231 +
                remote,
232 +
                r.name
233 +
            );
147 234
        } else {
148 -
            println!("{} {}/{} - {}", ui::warn("Rejected"), remote, r.name, r.reason);
235 +
            println!(
236 +
                "{} {}/{} - {}",
237 +
                ui::warn("Rejected"),
238 +
                remote,
239 +
                r.name,
240 +
                r.reason
241 +
            );
149 242
        }
150 243
    }
151 244
    Ok(if results.iter().all(|r| r.ok) { 0 } else { 1 })
…
1 unchanged lines