Repository navigation
Description
Context
The #696 package ruling (docs/decisions/index-query-api.md:80-92) makes @schlessera/brain an optional peer of ui-server that is used through the supported @schlessera/brain/queries entry. The edge table says it is resolved lazily "for the graph view and index-derived voice vocabulary only" (tests/allowed-edges.ts:112-115). That path checks the manifest and a version range before use (CORE_QUERIES_RANGE = ">=0.40.0 <1.0.0", packages/ui-server/src/core-queries.ts:40).
ui-server also does a bare await import("@schlessera/brain/internal") at five sites, for initContext, openDatabase, prepareIngest, indexAll, updateDocument, relevanceOnArchive and pruneScratch:
packages/ui-server/src/brain/application.ts:142,:151(inProcessPlanner) and:274(the application route)packages/ui-server/src/brain/maintenance-entry.ts:45packages/ui-server/src/brain/mask-application.ts:160
Core's ./internal entry carries "no compatibility guarantee, and consumers must use the same lockstep version" (packages/core/src/internal.ts:1-7). Nothing checks the version on this path, and the peer range is "@schlessera/brain": "*" (packages/ui-server/package.json, peerDependencies). A host that installs a different core release gets an unchecked internal API at capture, edit or index time, and fails there instead of at boot.
The #1345 ruling recorded on #1400 also lists the product groups that may share ./internal: "core with geo and render-template; ui-react, ui-sdk, ui-kit and ui-server". ui-server → core crosses two groups, so these imports are outside that rule as well. #1400's gate covers only module-* and ui-backend-*, and #1398 covers only pi.
Core is also loaded two more ways: coreReader checks the manifest name but not the version (packages/ui-server/src/storage/process.ts:8-14), and packages/ui-server/src/brain/maintenance-entry.ts:42 imports ./storage directly. The four loading styles make it hard to say which core versions a server release actually supports.
git grep -n '@schlessera/brain/internal"' packages/ui-server/src
jq .peerDependencies packages/ui-server/package.jsonDecision (maintainer, 2026-10-22)
Option A selected: ui-server consumes supported core operations through one manifest-and-version-range-checked resolver. Preserve core as a lazily resolved optional peer. Existing internal-sharing product groups remain unchanged; no exception allowing ui-server to depend on core internals or exact-lockstep-only peer policy is selected.
Scope
- Replace the five direct core internal imports with the narrow supported core operations they actually need, using existing public entries where suitable and adding a supported concrete operation entry where necessary. Do not publish the entire internal barrel. Exact operation/type signatures are implementation design within this bounded behavior-preserving migration.
- Put all ui-server core loading paths (
./queries, the replacement for./internal,./storage, andcoreReader) through one resolver that verifies the package manifest identity, compatible version range and required supported entry before any operation runs. Keep lazy loading and existing graceful missing-peer behavior. - Derive and document accepted version ranges from the actual APIs each path requires and verified release availability. The old queries-only minimum must not authorize a release missing newly required operations. No arbitrary version floor or unverified compatibility claim.
- Update
tests/allowed-edges.ts,docs/decisions/index-query-api.md, relevant public API documentation and api-reports so they describe every supported core entry the server uses. Record this ruling durably during implementation. - Keep application, mask, maintenance, capture, edit and indexing behavior unchanged apart from clear early compatibility refusal on the selected path.
Out of scope
- Pi's core internal imports (backends: the pi backend still reads the brain through core's internal entry #1398).
- The extension-package lint gate (ci: extension packages may import only public entry points #1400).
- Removing other unused
./internalentries (packages: delete internal entry points that no other package uses #1401). - Changing what the application, mask or maintenance paths do.
Acceptance criteria
- Option A is recorded on this issue and incorporated into
docs/decisions/index-query-api.mdduring implementation. - No ui-server source imports
@schlessera/brain/internal; every core loading path goes through the single resolver and consumes supported entries. - A ui-server test that installs a core manifest outside the accepted version, through the resolver's test seam, gets a clear refusal on the capture/index path before any core function runs, and fails before the change.
- Tests cover missing peer, wrong package identity, incompatible version and missing required entry without running a core operation, plus supported-version capture/index/query/storage paths. A missing optional peer retains the existing graceful behavior; no eager mandatory core dependency is introduced.
- The
tests/allowed-edges.tscomment for@schlessera/brain-ui-servernames every core entry the server loads. - Record an intended failing-first compatibility test and a restored mutation removing the resolver check on an actual operation path; audit all sibling core loads before completion.
Verification
bun run test packages/ui-server tests/dependency-edges.test.ts
bun run typecheckContract impact
Selected A: any new supported core operation/entry or reachable public type is an additive package-API change, requiring a CONTRACT: commit, same-commit contract/API-report updates and an appropriate changeset. Preserve existing public signatures and optional-peer behavior; no breaking export change is approved. Load the release skill before changing package contents/dependencies during implementation.
Found by a repository review on 2026-10-22.
2026-10-22 triage at main ca8842828ed8634a84c4e8aa4a88e487238721b4: refreshed verified current-source pointers by their named anchors. Scope, recorded decisions and remaining prerequisites are unchanged; source inspection supplies no new runtime or epic-completion evidence.
Decision processing — 2026-10-22
The earlier recommendation is now approved as option A. The current brief specifies supported operations, one lazy optional-peer resolver, API-derived compatibility ranges and causal compatibility tests. Remove needs: decision, add agent-ready and contract, and preserve existing priority, milestone, assignment and parent. No implementation, package modification or new runtime qualification is claimed.
Activity
schlessera commentedon Oct 21, 2026
2026-10-22 triage at main
ca8842828ed8634a84c4e8aa4a88e487238721b4: refreshed verified current-source pointers by their named anchors. Scope, recorded decisions and remaining prerequisites are unchanged; source inspection supplies no new runtime or epic-completion evidence. Added a separate unapproved recommendation and tradeoffs to the current decision brief; no ruling or implementation is inferred.schlessera commentedon Oct 22, 2026
Decision (maintainer, 2026-10-22): Option A.
Use supported core APIs with manifest/version-range validation through one resolver for every ui-server core load. Preserve lazy optional-peer behavior and existing product-group boundaries; no core-internal-sharing exception or exact-lockstep-only policy is selected. Publish only the narrow missing operations where necessary, with compatible-version evidence and normal contract/API-report/changeset review.
The body now contains the bounded migration and compatibility proof criteria. Remove
needs: decision, addagent-readyandcontract; preserve existing ownership/release metadata. No implementation or verification pass is claimed.