Skip to content

crates adapters

bondiano edited this page Nov 12, 2026 · 1 revision

External adapters

Active contributors: Vassiliy, bondiano

Purpose

sych-adapters turns external observations into sych-core contracts. It owns Git access, parsers, pinned tools, bounded execution, model transports, GitHub and notification delivery, but not the final review decision or database state. Its dependency boundary and public modules are in crates/sych-adapters/Cargo.toml and crates/sych-adapters/src/lib.rs.

Use Facts for collection/provenance behavior and Models for gateway routing and budgets. This page identifies integration and modification boundaries.

Module map

Exported area Implementation entry point Responsibility
git crates/sych-adapters/src/git/mod.rs Git, SnapshotRequest, LocalSnapshot, policy reads, fetches and side materialization from pinned objects
tools crates/sych-adapters/src/tools/mod.rs Resolve pinned platform artifacts, verify checksums and populate tool caches
semantic crates/sych-adapters/src/semantic/mod.rs LSP orchestration, isolated base/head workspaces, changed constructs, edges, diagnostics, dependency setup and cache
syntax crates/sych-adapters/src/syntax/mod.rs In-process Rust syn, TypeScript/React oxc, Go/Python tree-sitter facts
lint crates/sych-adapters/src/lint/mod.rs Pinned source linters and project-level easement architecture checks
ci crates/sych-adapters/src/ci/mod.rs Parse imported reports into normalized commit-bound CiFacts; archive reading is in its public archive module
sandbox crates/sych-adapters/src/sandbox.rs Controlled installer jobs through bwrap or pinned Docker images
execution crates/sych-adapters/src/execution.rs Allowed targeted checks on pinned head in Docker, with report import
github crates/sych-adapters/src/github/mod.rs Webhook checks, App/install credentials, normalized reads, Actions artifacts, comments, reviews and check runs
chat crates/sych-adapters/src/chat.rs Shared OpenAI-compatible chat/SSE transport
openrouter crates/sych-adapters/src/openrouter.rs OpenRouter transport with selected model and upstreams
opencode_go crates/sych-adapters/src/opencode_go.rs OpenCode Go subscription transport
pi crates/sych-adapters/src/pi.rs GLM Coding Plan through an isolated pinned Pi CLI process
siwc crates/sych-adapters/src/siwc/mod.rs Sign in with ChatGPT credentials, refresh and Responses transport
notify crates/sych-adapters/src/notify.rs Slack incoming-webhook and SMTP notification sends
slack crates/sych-adapters/src/slack.rs Incoming Slack request signature/timestamp verification

LocalSnapshot implements the core SnapshotReader in crates/sych-adapters/src/git/reader.rs. Model transports implement ModelProvider; gateway policy, attempt admission and fallback remain in crates/sych-core/src/model/contract.rs and crates/sych-core/src/model/mod.rs. Application services assemble these pieces, rather than adapters importing sych-app.

Tool and fact integrations

crates/sych-adapters/src/semantic/profiles.rs selects rust-analyzer, TypeScript’s tsc --lsp, gopls and ty profiles. crates/sych-adapters/src/semantic/mod.rs materializes the two analyzed sides separately and maps tool coordinates back to pinned references.

crates/sych-adapters/src/lint/mod.rs maps ruff, oxlint, sqruff, mago, jarl, clj-kondo, actionlint and zizmor to eligible source files. Project architecture checks live in crates/sych-adapters/src/lint/easement/mod.rs; easement and its indexer toolchain pins are in crates/sych-adapters/src/tools/indexers.json. These checks are distinct from the repository’s own style checker.

crates/sych-adapters/src/ci/mod.rs dispatches cargo JSON, JUnit, SARIF, GitLab Code Quality, coverage, Go, Terraform, Kubernetes and Sych outcome reports. Reports are data, not executable checks; their manifest and tested-commit relationship determine which source locations may be attached. See Facts for trusted versus author-claimed provenance.

Boundaries when adding an integration

  • Pinned source: use crates/sych-adapters/src/git/command.rs and the snapshot reader/materializer rather than the checked-out working tree. Git hooks, filters and textconv are not the review input path.
  • Pinned tools: update crates/sych-adapters/src/tools/pinned.json or crates/sych-adapters/src/tools/indexers.json and the corresponding resolver/profile. Downloads must match their recorded integrity; do not silently substitute a PATH version.
  • Untrusted project configuration: follow crates/sych-adapters/src/git/workspace.rs and crates/sych-adapters/src/semantic/deps.rs. The crate README documents exclusion of command-bearing Cargo/rust-analyzer configuration and rejection of path-based Rust toolchains.
  • Execution: preserve the separate controls in crates/sych-adapters/src/sandbox.rs and crates/sych-adapters/src/execution.rs. Source parsing is in-process; dependency installers and repository checks need their explicit execution boundary.
  • Model calls: return typed replies and errors to the gateway. Do not introduce transport-local fallback that bypasses the selected route, budget or ledger contract (crates/sych-core/src/model/contract.rs).
  • SCM writes: keep unknown delivery outcomes distinct from definite refusals. Durable intent and reconciliation belong to Storage and Server, not an adapter retry loop.

Library failures use typed errors and preserve causes. The application installs the tracing subscriber; prompts, raw credentials and model responses are not diagnostic log fields. See crates/sych-adapters/README.md and Security.

Key source files

File Change entry point
crates/sych-adapters/src/lib.rs Public integration modules
crates/sych-adapters/src/git/reader.rs SnapshotReader implementation and pinned search/span reads
crates/sych-adapters/src/tools/mod.rs Tool download, integrity and cache handling
crates/sych-adapters/src/semantic/profiles.rs Language-server command/profile selection
crates/sych-adapters/src/lint/easement/mod.rs Architecture analysis and pinned indexer integration
crates/sych-adapters/src/ci/mod.rs New report-format dispatch
crates/sych-adapters/src/github/mod.rs Provider capability mapping and public GitHub API
crates/sych-adapters/tests/semantic.rs Semantic adapter contracts
crates/sych-adapters/tests/easement.rs Project architecture-check contracts
crates/sych-adapters/tests/ci_reports.rs Report import contracts

Run cargo test --locked -p sych-adapters for the package tests. Real semantic smoke can download tools; crates/sych-adapters/README.md distinguishes it from fixture tests.

Scope and maintenance snapshot

Scope: tracked crates/sych-adapters/ files at revision 00dc7637f89a47ee6fd4713204f8331418428370. There are 100 files, including 89 Rust files: 73 outside tests/ and 16 integration-test/support files. 55/89 (61.8%) contain a #[test] or #[tokio::test…] attribute, counting inline tests. This test-bearing-file ratio is not line coverage; external fixtures and app integration tests are excluded.

All-history git log origin/main --format='%an' -- crates/sych-adapters yields 2 distinct nonbot author display names, deduplicated exactly without alias merging or co-author trailers. The byline shows the most recent distinct names as first names/usernames; it does not assign ownership.

Clone this wiki locally