Commit graph hyperhive/hive-forge
Author SHA1 Message Date
damocles
bd4906ab17 hive-forge: unit-test blocking_open_count 2026-08-19 15:17:28 +02:00
damocles
a3f14f5126 hive-forge: surface issues an issue/pr blocks in list/issue/pr 2026-08-19 15:03:15 +02:00
atlas
74dfd366b4 hive-forge: pin forgejo-api to 0.11.1 so it shares the workspace reqwest
forgejo-api 0.11.0 links reqwest 0.12 while the workspace is on 0.13, and
cargo unifies features per (crate, VERSION) — not per crate. So forgejo-api's
internal client was a *second* reqwest, built with neither the workspace's TLS
features nor the system trust store, and every https call it made to a gateway
name failed `invalid peer certificate: UnknownIssuer` while a client built in
this workspace succeeded against the same host.

Pinning to 0.11.1 puts one reqwest in the tree, which is what makes the
existing "feature unification gives forgejo-api our TLS backend" comment true
rather than aspirational — the claim is a fact about the lockfile, so the pin
is load-bearing and says so.

The reqwest feature list moves with it: `rustls-native-certs` and
`webpki-roots` were 0.13.1-era names that no longer exist, and `rustls` now
carries the platform verifier (OS trust store, honours SSL_CERT_FILE). Naming
a feature that is gone is a hard resolution error rather than a silent no-op,
so the list had to change in the same commit as the pin.

Refs #3391
2026-08-19 12:30:50 +02:00
damocles
3c4ff447e3 hive-forge: issue-create refuses an empty body 2026-08-19 01:43:10 +02:00
damocles
8b83eca0c1 fix(#3435): hive-forge issue/pr show fail on forgejo's null-for-empty reactions
Forgejo returns a bare `null` body (not `[]`) for a reactions list when
nothing has reacted yet. issue_reactions/comment_reactions deserialized
straight into forgejo-api's typed Vec<Reaction>, which has no null
tolerance, so issue show / pr show / view failed on every item with zero
reactions - i.e. nearly everything.

Generalize pr_status's existing null_as_empty (same quirk, hit earlier
on combined-status statuses) into a shared helper in verbs/mod.rs, and
fetch reactions via the raw JSON path (Client::get_api_json) with a
NullableVec<T> wrapper instead of the typed client's bare Vec<Reaction>.

Also names the failing request in errors going forward, since
get_api_json's error context includes the URL - closes the gap the
issue itself flagged (the old error said what didn't parse but not
what was fetched).
2026-08-18 15:26:07 +02:00
damocles
fb9cc5635a hive-forge reaction: add --list-allowed to surface the instance's configured shortcodes 2026-08-18 13:53:27 +02:00
damocles
96a27cef3c docs: cover the reaction verb and comments --show-reactions 2026-08-18 13:53:27 +02:00
damocles
2c45a9960f hive-forge: show + post/remove emoji reactions on issues, PRs, and comments 2026-08-18 13:53:27 +02:00
damocles
a796c24037 hive-forge list: show dep-progress count for items with open dependencies 2026-08-18 12:18:57 +02:00
damocles
4f8b78a4d4 hive-forge dependency: don't drop the original errors if the verification read-back also fails 2026-08-16 18:51:46 +02:00
damocles
eefd971bd8 hive-forge dependency: surface a converged-despite-error case instead of swallowing it 2026-08-16 18:48:39 +02:00
damocles
7668454bae hive-forge: verify dependency add/remove by read-back instead of trusting HTTP status 2026-08-16 18:47:01 +02:00
damocles
bad5285f2e fix(hive-forge): populate owner/repo in dependency add/remove body 2026-08-16 14:57:17 +02:00
damocles
b7a7628845 hive-forge: point to per-line review comments instead of inlining them, fix pr reviews line numbers 2026-08-15 12:34:23 +02:00
damocles
6a95aceedb hive-forge: add dependency verb for issue/pr blocking relationships 2026-08-15 09:44:28 +02:00
damocles
b4e56b964f pr-merge: don't tell the caller to just un-draft a PR that isn't theirs 2026-08-13 15:21:12 +02:00
damocles
dd5ccb5ce7 hive-forge: don't assert 'conflicts' from a bare mergeable=false 2026-08-13 15:21:12 +02:00
damocles
6f3ac755e0 hive-forge: surface comment/issue attachments in comments/view/comment-show/issue 2026-08-11 20:31:36 +02:00
atlas
0e64f46221 fix(#3129): treat a blank head sha as unknown too, not as a real value
argus's review note: the emptiness guard was one-sided. A reviewed sha
of "" was already treated as unknown, but a head of "" was not — so a
forge returning an empty string rather than omitting the field would
make every review compare unequal and mark the whole PR stale. That is
the wrong-direction failure this function exists to prevent, and the
asymmetry contradicted its own doc comment.

Both sides now check emptiness, for the same reason: a blank string is
a value the forge sent, not a sha it has.
2026-08-09 21:52:09 +02:00
atlas
178eb13993 fix(#3129): age out a review against the PR head, not forgejo's stale bit
Forgejo's per-review `stale` flag is eventually consistent: seconds
after a push it still reports the pre-push answer, so a verdict against
the previous head reads as current in exactly the window where the CLI
gets run right after pushing.

latest_reviews now fetches the PR head once and ORs a direct comparison
of the review's own commit_id into the flag. Fixing it at construction
rather than at the call sites means superseded() is unchanged and all
three consumers are corrected together: assign-reviewer's refusal,
pr_merge's changes-requested gate, and — the one that matters most —
pr_status's readiness verdict, which could otherwise report a dead
approval as valid.

Unknowns fail toward keeping the verdict: a missing head or commit_id
degrades to today's behaviour instead of voiding every review on the PR.
2026-08-09 21:47:57 +02:00
atlas
6e64489050 fix(forge): suggest the nearest name when a filter value misses
The third bullet of the issue's ask, dropped in the first pass and caught
in review: a filter value that does not resolve is a near-miss far more
often than an invention, and an error that only lists all 18 available
names makes the reader do the diff by eye -- on the one occasion they
already know they mistyped something.

Thresholded rather than always suggesting the minimum-distance
candidate: a wrong suggestion is worse than none, because it invites a
second failed attempt at a name that was never there. The bound scales
with the needle (a third of its length, capped at 3), so a short name
does not match half the repo and a long one still tolerates a typo or
two, and an unrelated word falls back to the full list.

Tie-break is on length then alphabetical, so the suggestion does not
depend on the order the forge happened to return its labels in.
2026-08-05 22:13:45 +02:00
atlas
0aa9a854bc fix(forge): validate list's label + milestone filters, and paginate both
A filter value the forge cannot resolve is DISCARDED, not rejected, so a
typo does not narrow the result set -- it returns the unfiltered one.
That does not waste a query, it inverts the answer: "is anything open in
this milestone" comes back as every open issue and reads as yes, and a
duplicate check gets a list that never narrowed.

`list` now resolves both before querying. Labels reuse the write side's
resolver; the ids are discarded because this endpoint filters by name, so
resolution here is a spell-check rather than a lookup -- reusing it keeps
the message identical to the one the write side has always produced.
Milestones accept a title or an id and are checked against the ALL-state
set: filtering on a closed milestone is a normal query, and validating
against open-only would reject exactly the retrospective ones.

Both fetchers paginate. `repo_labels` asked for one page of 100 and
treated it as the population -- the inverse of the trailer bug, same
root: a valid label past the cut fails to resolve, and the error then
prints an "available labels" list that is itself truncated, so the
message argues for the typo.

`--assignee` / `--author` stay unvalidated on purpose: someone who has
left still legitimately appears on old issues, so a login that is not a
current member is not necessarily a typo.

Also drops the docs paragraph claiming unknown labels are silently
dropped on the write side; that has not been true since the resolver
landed.
2026-08-05 22:06:12 +02:00
atlas
8e690c0694 feat(forge): search + milestone filters, and a page trailer that can't lie
`list` already built its query with `q: None, milestones: None` — both
fields were on the request it was sending. So full-text search over
title and body is a flag, not a new verb, and a text match is only
useful composed with the other filters anyway.

The trailer was the real defect. It fired on `count == limit`, but the
forge clamps page size to its own `api.MAX_RESPONSE_ITEMS`: ask for 400,
get a full 50, and `50 != 400` kept it silent — suppressing the warning
in precisely the case where the truncation is invisible. It now reports
the real total from `X-Total-Count`, which the response header struct
already parsed and the call site discarded. The requested limit is not
clamped client-side: that ceiling is the remote's configuration, not
ours.
2026-08-05 18:45:17 +02:00
damocles
4cf647aa70 hive-forge: add --since cursor paging to comments and timeline 2026-08-03 20:50:53 +02:00
damocles
f6629f0c23 hive-forge: cap timeline --limit so truncation detection can't go blind at the page-size boundary 2026-08-03 20:50:53 +02:00
damocles
c7d0e4c317 hive-forge: smaller comments/timeline defaults, report truncation instead of hiding it 2026-08-03 20:50:53 +02:00
damocles
8db1cbd204 hive-forge: add pr edit, reusing issue edit's shared /issues endpoint 2026-08-03 01:54:28 +02:00
damocles
29a11476a4 hive-forge: show/pr show now list current dependencies 2026-08-02 12:38:07 +02:00
damocles
7bad72d354 hive-forge: hard-error unresolved --label names; render dependency timeline events 2026-08-02 12:25:12 +02:00
iris
d2dc681fcf hive-forge: attach the resolved repo to every verb's error
Wraps the whole verb dispatch in run() with .with_context(|| format!("repo {repo}"))
instead of threading context through ~34 individual verb files. A body-decode
failure surfaces from forgejo-api as a bare ReqwestError with no status code or
URL retained (no client-injection point to capture more), so without this the
error alone can't distinguish a mistyped org/repo from a transient flake — see
the recent hive-forge triage-automation thread this was filed from.

Split run()'s match into a dispatch() fn so the repo can be captured once before
dispatching and the with_context wrap applied once after, uniformly, regardless
of which verb failed.
2026-07-29 21:18:32 +02:00
damocles
4aa710bd18 hive-forge: don't re-request a review from someone who already reviewed
fixes hyperhive/hyperhive#2839. pr_assign_reviewer's own doc-comment
claimed full idempotency (already-requested = no-op), but conflated
'still pending' with 'already reviewed' - Forgejo clears a fulfilled
reviewer from requested_reviewers, so re-requesting them isn't a
no-op, it dismisses the standing review. now checks latest_reviews
for a non-superseded review from the target user first and skips
the request instead of blindly posting it.
2026-07-29 20:49:40 +02:00
damocles
ed305bbe00 hive-forge: shell out to git for origin-remote inference instead of hand-parsing config 2026-07-29 18:44:28 +02:00
damocles
f034ffb9d8 hive-forge: infer active repo from cwd's git remote, demote HIVE_FORGE_REPO 2026-07-29 18:37:37 +02:00
damocles
9b29c6a172 hive-forge: lint no-reviewer checks actual requested-reviewers, not a text mention 2026-07-27 19:07:36 +02:00
damocles
abde71b0ed hive-forge: add --label to issue-create and pr-create 2026-07-27 16:19:36 +02:00
atlas
80650041d9 fix(#2752): pr-status must not abort on a repo with no CI
On a repo with no CI configured forgejo returns the combined-status
`statuses` field as an explicit `null` rather than `[]`.
`#[serde(default)]` only covers a *missing* key — a present null still
fails to deserialize, so `pr-status` died with
`invalid type: null, expected a sequence` instead of reporting the PR.

Deserialize the field through an `Option<Vec<_>>` so both null and
absent map to an empty vec.

Closes #2752.
2026-07-27 10:11:01 +02:00
atlas
270d3aafa2 docs: declare readme = "README.md" for the last four crates
hive-c0re, hive-claude, hive-forge and hivectl each ship a README.md but
never declared it in their package manifest, so cargo/docs.rs metadata
did not pick it up. Every other workspace member already sets the field;
this closes the gap left after the README backfill.
2026-07-27 09:35:06 +02:00
damocles
d153d1d35f docs: trim readmes down, stop restating impl detail the module docs already own 2026-07-26 21:01:00 +02:00
damocles
9283a1fc81 docs: add missing readmes for hive-c0re, hive-forge, hivectl 2026-07-26 20:57:44 +02:00
atlas
37ae72c19d docs(hive-forge): add the missing # Errors section on fetch_combined_in 2026-07-26 19:48:23 +02:00
atlas
1219f31c2f fix(hive-forge): tolerate an empty CI state in pr-status + pr-merge
Forgejo reports `"state": ""` in the combined-status response for a
commit that has no CI contexts at all. The typed `forgejo-api` client
models that field as an enum with no empty variant, so deserialization
failed and both verbs died outright — on exactly the pull requests
where "no CI ran here" is the useful answer. `pr-merge` was the worse
of the two: the crash sat in its pre-merge readiness check, blocking a
merge it should have waved through.

Route both call sites through the existing raw-JSON escape hatch
(`Client::get_api_json`), which exists for this failure mode: the
crate pins one schema while the server tracks the latest release line.
A lenient local `CombinedStatus` keeps `state` a plain `String` and
the per-context statuses as opaque values, so an empty or unknown
state is reported rather than fatal. `status_state_str` and its enum
mapping go away with it.

Closes #2735
2026-07-26 19:48:23 +02:00
damocles
c0c8e2a2d6 hive-forge: add lint unlabeled --scope subcommand 2026-07-26 16:32:28 +02:00
atlas
1356a1f049 fix(#2624): make hive-forge failures unmistakable on stderr
`fn main() -> Result<()>` let anyhow's Debug impl render failures with a
bare `Error:` header. hive-forge is almost always invoked from an agent's
bash task, where the completion wake points at the task's .out file - so a
failure that only writes to .err is easy to miss entirely (mara's "had no
clue it failed" on #2624).

Wrap the dispatch in a run() and own the failure path in main():
- prefix with the binary name (`hive-forge: FAILED: ...`) so the line is
  unmistakably ours in a mixed transcript,
- render with {:#} (alternate Display), which keeps the full context chain
  inline - plain Display would have dropped every `.context()` below the
  top one,
- return ExitCode::FAILURE explicitly rather than relying on the Termination
  impl.

Half of #2624: the other half (surfacing .err in the bash-mcp completion
when a task exits non-zero) is damocles's, per the issue thread.
2026-07-26 02:44:41 +02:00
atlas
03f8bc8a6a docs(#2671): trim per-verb arg help (repo-create)
Drop the API path from --org and the "Forgejo applies it to the initial
commit" mechanics from --default-branch (kept the user-facing caveat:
only takes effect with --auto-init). Swept the remaining verbs
(attachment-get, pr-reviews, attach, repo-add-collaborator, comment,
clone, pr-cmd router, …) — already user-relevant, no changes needed.
2026-07-23 22:54:15 +02:00
atlas
311599e8f2 docs(#2671): trim per-verb arg help (diff, list, lint, pr-merge)
Continue trimming clap arg help to user-relevant info: drop the
token-bounded-paging rationale (list --page), the why-it's-required
note (lint no-reviewer), the `Forgejo Do:`/`force_merge` API internals
(pr-merge), and tighten diff --full. pr-status was already clean.
2026-07-23 22:50:55 +02:00
atlas
ef9935e3d0 docs(#2671): trim per-verb arg help (pr-create, comments, ci-log, ci-rerun)
Drop implementation detail from the clap arg help (the `<verb> --help`
surface) — which API/endpoint, page-count math, persisted-vs-streamer
log-source internals, refspec shapes — keeping only what/when-to-use for
each flag. Module `//!` docs (dev-facing, not shown by `--help`) left
intact.
2026-07-23 21:55:04 +02:00
atlas
c64136d094 docs(#2671): trim hive-forge top-level + global-option help
Drop implementation mechanics from the `--help` surface, keep only
what a user needs to run the command:

- global `-r`/`-f`/`--json`: remove token-file paths, the bash-helper
  history, and the "already-JSON verbs ignore --json" aside.
- verb `about` strings (repo-create/repo-labels/repo-search/artifact-get/
  ci-log/ci-rerun/pr-commits): drop which-API / "no REST endpoint" /
  web-route / workflow-dispatch internals and cross-refs.

Per-verb arg help (verbs/*.rs) trimmed in follow-up commits.
2026-07-23 21:52:33 +02:00
atlas
b670291347 fix(#2565): lenient notifications deserialize in hive-forge read-guard 2026-07-17 16:45:56 +02:00
atlas
e394533268 feat(#2529): bump reqwest 0.12 -> 0.13
Now that matrix-sdk 0.18 is on main, reqwest 0.13.1 is already in the
tree transitively. Point the workspace crates at it directly.

reqwest 0.13 renamed the rustls feature set:
- rustls-tls -> rustls
- rustls-tls-native-roots -> rustls-native-certs
- (webpki-roots is now a separate feature)

hive-forge keeps its dual-trust story (system/native store for the
hive CA + bundled Mozilla roots for public CAs) by enabling
rustls-native-certs + webpki-roots explicitly.

forgejo-api 0.11 resolves cleanly against reqwest 0.13 (no conflict).

rusqlite 0.40 is intentionally NOT bumped here: matrix-sdk-sqlite 0.18
still pins rusqlite 0.37, so 0.40's libsqlite3-sys 0.38 would hit the
links="sqlite3" single-owner conflict. Deferred until upstream moves.
2026-07-16 17:03:38 +02:00
damocles
31752d4089 fix(#2488): verify assignee change landed instead of trusting forge 200 2026-07-15 19:06:24 +02:00