Skip to content

fix: degrade gracefully when source confinement is unavailable; sync upstream 0.3.28 - #6

Merged
GQAdonis merged 54 commits into
mainfrom
fix/windows-source-confinement-degrade
Sep 22, 2026
Merged

GQAdonis merged 54 commits into
mainfrom
fix/windows-source-confinement-degrade

Conversation

@GQAdonis

Copy link
Copy Markdown
Owner

Summary

Brings main up to date with the Windows source-confinement fix and the upstream work merged beside it on this branch. PR #5 merged this work into docs/claude-md, not main, so none of it has reached main yet.

Fork fixes

  • fix(code-query): when source confinement is unavailable, degrade and report a diagnostic instead of aborting (0272a4a)
  • fix(output): show the source-confinement diagnostic in the agent view (f5f9b24)
  • ci: package only the crates that can be archived without a registry (92ef1a8)
  • fix(surreal): match upstream trail ranking and count degree directly; limit the colon-path store test to Unix (096623d, c5bd5b9)

Upstream merges (crabbuild/compass)

  • Compass releases 0.3.24 through 0.3.28
  • Agent-query correctness: relationship recall, relationship paths, contract parity, bounded impact traversal on direct call chains (feat: improve relationship recall and agent query contracts crabbuild/compass#325)
  • Agent-readable query views, source-proven receiver calls, typed and faster Leiden community detection, a higher limit for the authoritative history graph, and a worktree-safe graph ensure
  • The SurrealDB projection is kept through the upstream merge (220fc58)

Records

  • Review packets and session wiki for the compass-scoping-and-bounds phase

204 files changed, +20.8k / −2.5k.

Test plan

  • Start CI by hand (branch pushes run no CI): gh workflow run compass-ci.yml --repo GQAdonis/compass --ref fix/windows-source-confinement-degrade
  • cargo test --workspace --test '*' --locked
  • cargo clippy --workspace --lib --bins --locked -- -D warnings and cargo fmt --all -- --check
  • node scripts/check_viewer_assets.mjs
  • On Windows: compass query degrades with the confinement diagnostic and does not abort
  • Build with the Surreal feature and run the Surreal trail/degree tests

🤖 Generated with Claude Code

GQAdonis and others added 30 commits August 9, 2026 07:43
AGENTS.md required every compiling Cargo command to set CARGO_TARGET_DIR
beneath /Volumes/Workspace/crabbuild-target, and to stop rather than fall back
to a local target/ when that volume was absent. That path is a macOS mount
point specific to one contributor's machine, not a property of the project. On
any checkout without it, an agent or contributor following AGENTS.md correctly
concludes that no build, test, lint, or qualification step may be run at all.

Two of the references were executable, not advisory:

- scripts/qualify_compass_store_release.sh hard-failed with exit 1 unless
  /Volumes/Workspace was mounted and writable, making the compass-store
  release qualification gate unrunnable elsewhere;
- both qualification scripts defaulted CARGO_TARGET_DIR to that absolute path,
  silently writing build output outside the checkout when the variable was
  unset.

skills/compass-release/SKILL.md additionally listed the volume as a hard
compatibility requirement and gated the release procedure on
`test -d /Volumes/Workspace`.

Replace the mandate with environment-neutral guidance that keeps the useful
parts: per-checkout target directories, CARGO_TARGET_DIR not persisting between
invocations, external qualification repositories treated as read-only, and
cargo clean only with an explicit target directory.

Scripts now honor CARGO_TARGET_DIR when set and otherwise fall back to the
checkout's own target directory. Documentation uses <cargo-target-dir> and
<qualification-corpus-root> placeholders.

Introduced in dd14b3c ("docs: add AI contributor guidance").

Fixes crabbuild#211

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merge the fully gated Compass 0.3.24 release metadata and changelog.
* feat(graph): improve community detection quality

* test(graph): rebaseline topology for Leiden

* ci: install cargo-audit from its lockfile
* perf(graph): make Leiden modularity linear

* docs(graph): qualify optimized Leiden performance
* perf(graph): make Leiden faster than Louvain

* docs(graph): record Leiden performance lead

* docs(graph): reference follow-up optimization commit
Merge the clean origin/main-based 0.3.25 release metadata and changelog after the full native, code-graph, dependency, and JavaScript/VS Code matrix passed.
Integrate upstream releases 0.3.24 and 0.3.25 while retaining all fork
functionality.

Upstream additions preserved:
- Typed Leiden community detection replacing Louvain, with
  compass.community-quality/1 evidence sidecars
- Immutable-history authoritative limit raised 512 MiB -> 5 GiB
- compass ensure worktree-safe graph bootstrap
- compass review readability and strict URI node records

Fork functionality retained:
- compass-graphdb-surreal and compass-partition crates
- compass agent list|install|doctor|export|validate|mcp-config namespace
- distribution.toml native package generators
- Bounded canonical graph-size preflight (enforce_preflight_graph_size)
- COMPASS_MAX_GRAPH_BYTES override consistency
- MCP 2026-07-28 discovery contract and rmcp 3.1.4

Conflict resolutions:
- compass-history/Cargo.toml, compass-mcp/Cargo.toml: union of upstream
  0.3.25 version bumps with fork dependencies
- pipeline.rs: union of upstream Leiden imports with fork SnapshotError
  and max_canonical_graph_bytes
- artifacts.rs: upstream streamed canonical encoding supersedes the fork
  sorting fix; removed the resulting dead canonical_trusted_graph_bytes
- CHANGELOG.md: fork Unreleased entries above upstream released sections
- Bumped remaining 0.3.23 path pins to 0.3.25

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4iiLG9sYTVt8tFtZv5iwe
…merge

Upstream 0.3.24 edited the canonical umbrella SKILL.md to document the new
`compass ensure` session and worktree bootstrap. The fork's build-time guard
pins that file's SHA-256 to keep the six focused skills strictly additive, so
the merged tree failed `compass-cli`'s build script.

Only upstream modified SKILL.md; the fork has never touched it. Every other
guard invariant still holds (canonical frontmatter, all eight required core
sections, and all six focused skills), so re-pinning the digest is the correct
resolution rather than reverting upstream's guidance.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4iiLG9sYTVt8tFtZv5iwe
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4iiLG9sYTVt8tFtZv5iwe
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Brings in SurrealDB CLI/MCP wiring, standalone server support, credential
precedence, legacy query-artifact rejection, and the fork preflight size-gate
fix (16a2e20).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

# Conflicts:
#	PERFORMANCE.md
#	crates/compass-cli/Cargo.toml
#	crates/compass-cli/src/lib.rs
#	crates/compass-core/Cargo.toml
#	crates/compass-core/src/cluster_existing.rs
#	crates/compass-core/src/pipeline.rs
#	crates/compass-graphdb-surreal/Cargo.toml
#	crates/compass-query/Cargo.toml
Removes the hardcoded /Volumes/Workspace build-volume requirement from
AGENTS.md, advisor plans, and qualification scripts. Docs and scripts only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

# Conflicts:
#	AGENTS.md
#	scripts/qualify_code_graph_v1.sh
* Improve query and path result fidelity

* Bump rustls past security advisory
forhappy and others added 24 commits September 19, 2026 07:15
* fix(query): improve agent-facing graph answers

* fix(ci): allow approved clipper license version

* fix(ci): keep relevance corpus generator in sync
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Absorb upstream 0.3.26-0.3.28 (agent-readable query output, path and
callers fidelity, Rust receiver recall) while preserving this fork's
optional SurrealDB graph projection.

Merge resolution:
- Adopt upstream's compass.query/1 + agentView MCP contract in place of
  this fork's compass.code_context.v1 envelope. The four navigation tools
  no longer declare a raw output schema, matching upstream.
- Keep the fork's envelope-level max_response_bytes bound, which upstream
  does not have: the query engine bounds the semantic result, and the
  delivered envelope is bounded after the agent view is attached.
- Route the Surreal query path through the same envelope builder as the
  typed path, so both backends report one contract.
- Add QueryGraph::degree for upstream's live CompassQL degree property,
  implemented for both the in-memory graph and the Surreal projection.

Native Windows support, no WSL:
- Reject an embedded store path containing "://" instead of silently
  retargeting the store when the address is split on its scheme.
- Report restore cleanup that could not complete rather than discarding
  it. Embedded store owners are retained for the process lifetime, so
  Windows refuses the removal and used to leave a half-populated
  directory that the next attempt rejected as non-empty.
- Hash the Surreal repository root losslessly so two distinct non-UTF-8
  roots cannot collide onto one repository id.
- Qualify the SurrealDB surfaces on windows-2025 in CI; building any
  SurrealDB feature there needs CMake and NASM for the transitive
  aws-lc-sys dependency, which the default build does not pull in.

Also sync distribution.toml and the MCP discovery golden, which were
pinned at 0.3.23 against a 0.3.25 workspace before this merge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`<[Value]>::is_empty` named a type that is not in scope in this test,
so the history_cli target failed to compile.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The MCP navigation tools now return compass.mcp.tool-result/1. The
migration guide previously told clients to read structuredContent.data
under compass.code_context.v1, which no longer exists; it now maps every
field of the withdrawn envelope onto the shipped one.

Update the compatibility contract and integration guide to describe the
result/agentView/semanticResultDigest shape, the absence of an advertised
raw output schema, and the envelope-level max_response_bytes bound.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rectness

feat: improve relationship recall and agent query contracts
Two defects that only the SurrealDB feature builds exercise. The default
workspace test wave compiles no Surreal engine, so both passed a green
216-suite run before CI caught them.

Trail ranking: upstream 0.3.28 replaced the JSON engine's evidence-quality
BFS with a Dijkstra weighted by relation kind, so the two backends chose
different edges between the same node pair and the native/JSON differential
assertion failed. Port that traversal into the Surreal backend: same cost
function, admission rule, tie-breakers, and truncation semantics, using
ordered maps so no decision depends on hash iteration. `code_relation_weight`
is replicated beside the existing `evidence_quality` replica because
compass-query is only a dev-dependency here; the copy names its source of
truth.

Degree: `QueryGraph::degree` reused `cql_adjacent_at`, which resolves every
neighbor's ordinal and fails closed when one is absent, reporting "CQL
adjacency endpoint identity mismatch". That is right for traversal and wrong
for a degree, which counts incident edges whether or not the far endpoint is
retained by the current selection. Add `cql_degree_at`, which counts relation
rows under the same bound and stops before endpoint resolution.

Also drop a `://` rejection added earlier in this merge. The SDK splits an
address on its first `://`, which is always the `surrealkv://` prefix this
code builds, so a colon inside the path — including a Windows drive letter —
is already carried through as the path. The guard rejected valid paths and its
test asserted the wrong behavior; replace it with one that asserts the real
property.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The test opened a store directory named `store:colon`, which NTFS cannot
create because it reserves `:` for alternate data streams. Windows CI
reported `create_store_directory: The directory name is invalid.
(os error 267)`.

The property under test — a colon inside the path stays part of the path
rather than being read as an address scheme — is exercised on Windows by
every absolute path through its drive letter, which the other tests in
this file already cover.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…is unavailable

`open_beneath` fails closed on non-Unix targets: there is no stdlib equivalent
of component-by-component `openat` + `O_NOFOLLOW`, so rather than reopen the
canonicalize-then-open race it returns `ErrorKind::Unsupported`. That decision
is right and is unchanged here.

The defect was the call site. `add_verified_files` propagated that error with
`?`, so on Windows EVERY evidence-bearing query — explore, node, callers,
callees, impact — returned nothing at all, on both x64 and arm64. The graph
answer never depended on reading the file; only the inlined source evidence
did.

It now degrades exactly as a stale digest already does: the file is reported
with `source: None` plus a `SourceConfinementUnsupported` diagnostic naming it,
and the query succeeds. Only that one code degrades — an unsafe path or a read
failure still aborts, because those are real problems rather than an
unavailable mechanism.

The classification is extracted into `classify_open_error` so it can be tested
on every platform. The existing unit test for this path is
`#[cfg(all(test, not(unix)))]`, which is why the propagation bug survived:
nothing on Unix ever exercised the shape. The new tests run everywhere, and
reverting the classification fails them (verified by mutation).

Affects upstream too: crabbuild/compass carries the identical `?` at its
line 3397, and no issue tracks it.

Assisted-by: AGENT:claude-opus-5 [Bash,Edit,Read]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…grade

fix(code-query): degrade instead of aborting when source confinement is unavailable
`cargo package` rewrites every path dependency into a registry requirement and
resolves it against crates.io. This workspace is not published there:
`compass-graph` and `compass-files` do not exist on crates.io at all, and the
`compass-cli` / `compass-core` names there belong to unrelated projects at
unrelated versions (2.0.7, 0.1.0-alpha.1).

So the step asserted an operation this project never performs, and failed for
that reason rather than for any defect in the archives. It took the `quality`,
`dependency-policy` and `dependency-audit` jobs down with it.

No flag avoids the lookup — `--no-verify`, `--no-metadata`, `--allow-dirty` and
`--offline` were each tried and each still resolved against the index. The
requirement is structural, not a verification or a network step.

Packaging is now checked on the three crates that have no sibling path
dependencies, so they archive without a registry: compass-model, compass-files
and compass-ir. That still catches a missing file, an unpackageable path or a
broken manifest — the defects this step exists to find — on the leaves the rest
of the workspace is built from. Each was verified to package successfully
before being listed.

Restore the workspace-wide form if these crates are ever published.

Assisted-by: AGENT:claude-opus-5 [Bash,Edit,Read]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`QueryDiagnosticCode::SourceConfinementUnsupported` arrived with upstream
0.3.28 and is emitted by the query engine, but `agent_caveat` never
matched it and that match has no catch-all, so compass-output did not
compile.

Report it as a Warning rather than a Blocker: the graph answer is still
valid, only the source excerpt is missing. The wording tells an agent to
read the file directly before quoting or editing, which is the behavior
this platform limitation requires. Windows takes this path, since
race-resistant source confinement is implemented only for Unix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Absorb ten upstream commits (PR crabbuild#325): source-backed alias/import/export
usage evidence in callers/impact/affected, live CompassQL node degree,
historical reads that neutralize checkout filters, the bounded
`compass architecture` view, and the shared agent output formats.

Conflict resolution kept both sides wherever they were disjoint:

- compass-model/src/search.rs: our `searchable_node_terms`, which the
  Surreal projection depends on, alongside upstream's new
  `RELATIONSHIP_SEARCH_EDGE_KINDS`. Neither side had the other's symbol.
- compass-cli/src/install_commands.rs: our focused-skill collection
  preflight and consumer updates beside upstream's managed-skill probe
  and state-event journaling. All eight functions have live call sites.
- compass-cli/src/help.rs: upstream's newer option text in all seven
  hunks, with our `--engine ...|surreal` option re-applied to each.

One resolution takes upstream over this fork's version. Our
`RELATIONSHIP_TERM_INDEX_CAPABILITY_V2` guarded postings that are
byte-identical to the ones `_V1` guards: `af0bb1d0` added `_V2` without
removing `_V1`, `direct_call_source_identifier_postings` is unchanged
from the merge base, and the base already stored the `(source, term,
target)` evidence that commit claimed as new. Keeping `_V2` would make
this fork report incomplete relationship coverage for every
upstream-written snapshot — a false negative on complete, immutable
data — so the marker returns to `_V1` and the three remaining
references follow it. No migration is required: snapshots from any
0.3.x-lineage builder stay mutually readable. The now-false v2 claims
in CHANGELOG.md and COMPATIBILITY.md are corrected.

Re-pin the canonical skill digest; upstream documented its new
`architecture` command in SKILL.md, which the build-time guard rejects
until the digest is refreshed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR #5 makes code queries degrade instead of aborting when race-resistant
source confinement is unavailable, which is every non-Unix platform.
That is the upstream-side half of the Windows failure this branch was
already carrying a consumer arm for: `agent_caveat` now renders the
`SourceConfinementUnsupported` diagnostic as a Warning rather than a
Blocker, so the graph answer still stands while an agent is told to read
the file directly before quoting or editing it.

Auto-merged with no conflicts; `clippy --workspace -D warnings` is clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@GQAdonis
GQAdonis merged commit 33ecb36 into main Sep 22, 2026
8 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants