mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 04:10:47 +02:00
fix: correct adapters against real running providers (round 2)
Ran real backends in isolated environments (real Postgres-backed gbrain, live Sourcebot v6.5.0 with anonymous access, real graphify 0.9.23). All three now index + search end-to-end. Fixes: - gbrain: RESTORE `--strategy code` in refresh — round 1 removed it on a --help misread, which silently stopped code from ever being indexed. refresh now runs the verified two-pass (`sync`, then `sync --strategy code --full`). Pinned by a new test so the regression can't return. - sourcebot: an API key is NOT required for local use — anonymous access (FORCE_ENABLE_ANONYMOUS_ACCESS=true) serves /api/search keyless (verified). Key stays optional; only the messaging changed (anonymous-access first, key as fallback) plus a note that a local repo needs remote.origin.url to index. - graphify: correct the docstring — for CODE both `graphify <dir>` and `graphify update` are AST-only (no LLM); the LLM only renames clusters and ingests non-code, which our parser ignores. No LLM mode; local=true is correct. Docs: capability matrix + "Verified against real environments" updated to record all three proven end-to-end and to correct the two first-round mistakes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
a524d860a8
commit
ab7989c6c1
@@ -46,9 +46,11 @@ export interface SourcebotOptions {
|
||||
/** Path to the server's config.json (for register_source). Defaults to SOURCEBOT_CONFIG. */
|
||||
configPath?: string;
|
||||
/**
|
||||
* API key for the Sourcebot REST API. Defaults to SOURCEBOT_API_KEY. Sourcebot
|
||||
* v5 gates `/api/search` behind auth (`Authorization: Bearer <key>`); without
|
||||
* it, `search` gets HTTP 401. Generate one in Settings -> API Keys.
|
||||
* OPTIONAL API key for the Sourcebot REST API. Defaults to SOURCEBOT_API_KEY.
|
||||
* A local instance with anonymous access enabled
|
||||
* (`FORCE_ENABLE_ANONYMOUS_ACCESS=true`) serves `/api/search` with NO key —
|
||||
* verified keyless against a real Sourcebot v6.5.0. Only set a key when your
|
||||
* instance is login-gated; it is sent as `Authorization: Bearer <key>`.
|
||||
*/
|
||||
apiKey?: string;
|
||||
/** Injectable fetch for tests. */
|
||||
@@ -93,7 +95,12 @@ export class SourcebotProvider implements CodeProvider {
|
||||
return this.capabilities.has(capability);
|
||||
}
|
||||
|
||||
/** Add the repo as a local `git` connection in Sourcebot's config.json. */
|
||||
/**
|
||||
* Add the repo as a local `git` connection in Sourcebot's config.json.
|
||||
* NOTE: Sourcebot silently SKIPS a local repo that has no `remote.origin.url`
|
||||
* (logs "Skipping <path> - remote.origin.url not found"); a freshly `git init`'d
|
||||
* repo must set an origin before it will index.
|
||||
*/
|
||||
async registerSource(repo: RepoRef, opts: OpOptions = {}): Promise<SourceStatus> {
|
||||
assertEgressConsent(this, opts); // no-op when the server is loopback (local)
|
||||
if (!this.#configPath) {
|
||||
@@ -148,7 +155,7 @@ export class SourcebotProvider implements CodeProvider {
|
||||
opts.timeout ?? DEFAULT_TIMEOUT_MS,
|
||||
);
|
||||
if (res.status === 401 || res.status === 403) {
|
||||
return { id: "*", state: "unknown", partial: true, detail: "reachable but not authenticated (set SOURCEBOT_API_KEY)" };
|
||||
return { id: "*", state: "unknown", partial: true, detail: "reachable but login-gated (enable anonymous access with FORCE_ENABLE_ANONYMOUS_ACCESS=true for local use, or set SOURCEBOT_API_KEY)" };
|
||||
}
|
||||
return { id: "*", state: res.ok ? "ready" : "unknown", partial: true, detail: `HTTP ${res.status}` };
|
||||
} catch {
|
||||
@@ -168,7 +175,7 @@ export class SourcebotProvider implements CodeProvider {
|
||||
throw new CodeProviderError("PROVIDER_UNAVAILABLE", `Sourcebot unreachable at ${this.#baseUrl}: ${(err as Error).message}`, this.id);
|
||||
}
|
||||
if (res.status === 401 || res.status === 403) {
|
||||
throw new CodeProviderError("PROVIDER_UNAVAILABLE", `Sourcebot requires authentication; set SOURCEBOT_API_KEY (HTTP ${res.status})`, this.id);
|
||||
throw new CodeProviderError("PROVIDER_UNAVAILABLE", `Sourcebot is login-gated (HTTP ${res.status}); enable anonymous access (FORCE_ENABLE_ANONYMOUS_ACCESS=true) for local use, or set SOURCEBOT_API_KEY`, this.id);
|
||||
}
|
||||
if (!res.ok) throw new CodeProviderError("PROVIDER_ERROR", `Sourcebot ${path} returned HTTP ${res.status}`, this.id);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user