beads/backend/http
Julian Knutsen 2563f021ed
perf(httpclient): remember the server's external-dependency policy across processes (#7700)
* perf(httpclient): remember the server's external-dependency policy across processes

Every bd ready over an HTTP workspace fetched GET /v0/beads/context before
its listing. listReadyWork itself needs no handshake; the fetch came from the
external-dependency decorator asking ServerEnforcesExternalDependencyPolicy
whether the server already applies the policy. In a one-shot CLI that is one
extra round trip per process (about 54 ms at a 52 ms RTT) to relearn a bit
that only changes when the server is restarted with a different composition.

The store opened from a workspace now keeps that answer in the user cache
directory (beads/http-policy/), keyed by the server URL and the project the
workspace pinned at bd connect, for BEADS_HTTP_POLICY_CACHE_TTL (5 minutes by
default; off disables it). A fresh entry answers the probe without dialing; a
handshake this process already holds wins and refreshes the entry. A
workspace with no project pin, and a store an embedder opens through
OpenWith, are not cached. Writing the entry is best effort.

The staleness this allows is bounded by the TTL: a server restarted without
the policy within the window is still trusted to enforce it until the entry
ages out. Carrying the policy on every response would close that window but
needs a server change and does nothing for servers already deployed.

Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(httpclient): claims and closes ask the server for the policy, never the cache

Review follow-up to the policy cache. The claim and close guards (direct
claim, claim-next, batch close, the lifecycle close and claim, and the legacy
ClaimReadyIssue and CloseIssueChecked) handshake anyway, and a stale cached
"the server enforces it" would stand down their client-side refusal of
externally blocked work. Those entry points now mark their context with
storage.WithLivePolicyProbe, and httpclient.Store answers such a probe from
the server, refreshing the cache entry. Reads keep the cached answer.

Tests: externaldeps TestClaimsAndClosesAskForALivePolicyProbe and
TestRemoteClaimsAndClosesAskForALivePolicyProbe pin which entry points probe
live (every claim and close) and which do not (ready listings), over a local
and a remote store; httpclient TestALiveProbeSkipsThePolicyCache pins the
store side; TestPolicyCacheRefusesEntriesItCannotTrust now also covers an
entry written for another server URL.

Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of gascity-agent
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 19:05:55 +00:00
..
corpus feat(http): bd blocked over bd serve (blocked.list), plus bd blocked --flags [--raw] (#7649) 2026-10-17 12:29:13 +00:00
attach.go feat(backend/http): public HTTP backend door, OSS registration, and bd connect (S6) (#7288) 2026-10-10 07:19:18 +00:00
attach_test.go feat(backend/http): public HTTP backend door, OSS registration, and bd connect (S6) (#7288) 2026-10-10 07:19:18 +00:00
BUILD.bazel fix(http): bd link over a connected HTTP workspace, through the DependencyEditor role (#7685) 2026-10-19 07:15:13 +00:00
credential.go fix(httpclient): bound response-header waits and retry stalled reads on another connection (#7553) 2026-10-14 05:04:19 +00:00
e2e_blocked_flags_test.go feat(http): bd blocked over bd serve (blocked.list), plus bd blocked --flags [--raw] (#7649) 2026-10-17 12:29:13 +00:00
e2e_blocked_test.go feat(http): bd blocked over bd serve (blocked.list), plus bd blocked --flags [--raw] (#7649) 2026-10-17 12:29:13 +00:00
e2e_cli_test.go feat(http): bd blocked over bd serve (blocked.list), plus bd blocked --flags [--raw] (#7649) 2026-10-17 12:29:13 +00:00
e2e_export_test.go fix(http): bd export over http through issueops.ReadExport (S21) (#7551) 2026-10-14 03:59:35 +00:00
e2e_gates_test.go fix(http): bd gate create, add-waiter and discover over a connected HTTP workspace (#7621) 2026-10-17 02:15:07 +00:00
e2e_heartbeat_test.go feat(http): bd heartbeat over bd serve (issues.heartbeat), and close the re-arm orphan-lease race (#7600) 2026-10-16 22:38:23 +00:00
e2e_link_test.go fix(http): bd link over a connected HTTP workspace, through the DependencyEditor role (#7685) 2026-10-19 07:15:13 +00:00
e2e_list_filters_test.go feat(list): bd list's remaining filters over http behind issues.list.filters (#7647) 2026-10-17 11:21:18 +00:00
e2e_list_page_edges_test.go perf(list): read only the listed issues' dependency edges (#7591) 2026-10-16 16:05:24 +00:00
e2e_mol_test.go fix(mol): molecule reads, auto-close and close --continue over http through issueops entries (S16) (#7513) 2026-10-12 19:50:34 +00:00
e2e_promote_test.go fix(http): bd promote over http through issueops.Promote and issues.update.persistence (S21b) (#7554) 2026-10-14 05:51:53 +00:00
e2e_read_your_own_write_test.go perf(http): answer a command's repeated reads from one response; bd show --json makes 1 request (port of bd-enterprise e626072b8) (#7588) 2026-10-16 04:26:37 +00:00
e2e_recompute_blocked_test.go fix(http): bd show --current, recompute-blocked and search over http through issueops entries (S6e/S25/S26) (#7528) 2026-10-13 04:12:54 +00:00
e2e_remote_roles_test.go perf(http): answer a command's repeated reads from one response; bd show --json makes 1 request (port of bd-enterprise e626072b8) (#7588) 2026-10-16 04:26:37 +00:00
e2e_request_budget_test.go perf(httpclient): remember the server's external-dependency policy across processes (#7700) 2026-10-19 19:05:55 +00:00
e2e_search_test.go feat(list): bd list's remaining filters over http behind issues.list.filters (#7647) 2026-10-17 11:21:18 +00:00
e2e_show_current_test.go fix(http): bd show --current, recompute-blocked and search over http through issueops entries (S6e/S25/S26) (#7528) 2026-10-13 04:12:54 +00:00
e2e_show_single_fetch_test.go perf(http): answer a command's repeated reads from one response; bd show --json makes 1 request (port of bd-enterprise e626072b8) (#7588) 2026-10-16 04:26:37 +00:00
errors.go feat(backend/http): public HTTP backend door, OSS registration, and bd connect (S6) (#7288) 2026-10-10 07:19:18 +00:00
http.go fix(httpclient): dial a large batchApply under the server's extended budget (#7582) 2026-10-15 23:43:54 +00:00
open_test.go feat(backend/http): per-open credential is the only credential (S6f) (#7469) 2026-10-10 15:16:14 +00:00
per_open_credential_test.go feat(http): list/show counts/dep tree/ping over http, the advertised external-dependency policy, one-lookup not-found (S6b/S6c/S6d) (#7471) 2026-10-10 18:11:56 +00:00
register_test.go feat(backend/http): public HTTP backend door, OSS registration, and bd connect (S6) (#7288) 2026-10-10 07:19:18 +00:00
served_pinned_shards.txt test(corpus): seed served/embedded sides concurrently; size served shards from CI timings (#7538) 2026-10-13 12:30:52 +00:00
target.go feat(backend/http): public HTTP backend door, OSS registration, and bd connect (S6) (#7288) 2026-10-10 07:19:18 +00:00