mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 09:29:38 +02:00
Use HashSet for gateway term service sets
This commit is contained in:
parent
0862250dab
commit
3a256096f8
2 changed files with 22 additions and 8 deletions
|
|
@ -420,6 +420,19 @@ Notes:
|
||||||
- `bun run --cwd ts/packages/client test -- src/__tests__/rpc-timeout.test.ts`
|
- `bun run --cwd ts/packages/client test -- src/__tests__/rpc-timeout.test.ts`
|
||||||
- `cd ts && bun run check:tsgo`
|
- `cd ts && bun run check:tsgo`
|
||||||
|
|
||||||
|
### 2026-06-04: Gateway Term Service HashSet Slice
|
||||||
|
|
||||||
|
- Status: migrated and package-verified.
|
||||||
|
- Completed:
|
||||||
|
- `ts/packages/flow/src/gateway/dispatch/serialize.ts` now uses
|
||||||
|
`effect/HashSet` for static term-bearing request/response service
|
||||||
|
membership instead of native `Set`.
|
||||||
|
- Request and response translators preserve the same deep client/internal
|
||||||
|
term conversion behavior via `HashSet.has` membership checks.
|
||||||
|
- Verification:
|
||||||
|
- `bun run --cwd ts/packages/flow test -- src/__tests__/gateway-dispatcher.test.ts`
|
||||||
|
- `cd ts && bun run check:tsgo`
|
||||||
|
|
||||||
### 2026-06-02: RAG And Agent Requestor Bridge Slice
|
### 2026-06-02: RAG And Agent Requestor Bridge Slice
|
||||||
|
|
||||||
- Status: migrated, root-verified, committed, and pushed.
|
- Status: migrated, root-verified, committed, and pushed.
|
||||||
|
|
@ -1862,7 +1875,8 @@ Notes:
|
||||||
- Qdrant graph/doc known-collection caches now use
|
- Qdrant graph/doc known-collection caches now use
|
||||||
`MutableHashSet<string>`. Short-lived local traversal sets remain no-ops.
|
`MutableHashSet<string>`. Short-lived local traversal sets remain no-ops.
|
||||||
- Gateway dispatcher static service registries, streaming membership, and
|
- Gateway dispatcher static service registries, streaming membership, and
|
||||||
scoped requestor cache now use Effect `HashMap`/`HashSet`.
|
scoped requestor cache now use Effect `HashMap`/`HashSet`; gateway
|
||||||
|
term-bearing service membership sets now use Effect `HashSet` too.
|
||||||
- FlowManager `() => Effect.gen(...)` factories are normalized to
|
- FlowManager `() => Effect.gen(...)` factories are normalized to
|
||||||
`Effect.fn` / `Effect.fnUntraced`. Sibling service factories still need a
|
`Effect.fn` / `Effect.fnUntraced`. Sibling service factories still need a
|
||||||
focused scan before treating them as valid migration targets.
|
focused scan before treating them as valid migration targets.
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import {
|
||||||
type Term,
|
type Term,
|
||||||
type Triple,
|
type Triple,
|
||||||
} from "@trustgraph/base";
|
} from "@trustgraph/base";
|
||||||
import { Effect, Match } from "effect";
|
import { Effect, HashSet, Match } from "effect";
|
||||||
import * as O from "effect/Option";
|
import * as O from "effect/Option";
|
||||||
import * as S from "effect/Schema";
|
import * as S from "effect/Schema";
|
||||||
|
|
||||||
|
|
@ -251,23 +251,23 @@ function deepInternalToClient(value: unknown): unknown {
|
||||||
* Services whose requests contain Term/Triple fields that need translation.
|
* Services whose requests contain Term/Triple fields that need translation.
|
||||||
* All other services pass through without term translation.
|
* All other services pass through without term translation.
|
||||||
*/
|
*/
|
||||||
const TERM_BEARING_REQUEST_SERVICES = new Set([
|
const TERM_BEARING_REQUEST_SERVICES = HashSet.make(
|
||||||
"triples",
|
"triples",
|
||||||
"knowledge",
|
"knowledge",
|
||||||
"librarian",
|
"librarian",
|
||||||
]);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Services whose responses contain Term/Triple fields that need translation.
|
* Services whose responses contain Term/Triple fields that need translation.
|
||||||
*/
|
*/
|
||||||
const TERM_BEARING_RESPONSE_SERVICES = new Set([
|
const TERM_BEARING_RESPONSE_SERVICES = HashSet.make(
|
||||||
"triples",
|
"triples",
|
||||||
"graph-embeddings",
|
"graph-embeddings",
|
||||||
"knowledge",
|
"knowledge",
|
||||||
"librarian",
|
"librarian",
|
||||||
"graph-rag",
|
"graph-rag",
|
||||||
"agent",
|
"agent",
|
||||||
]);
|
);
|
||||||
|
|
||||||
// ---------- Top-level request / response translators ----------
|
// ---------- Top-level request / response translators ----------
|
||||||
|
|
||||||
|
|
@ -280,7 +280,7 @@ const TERM_BEARING_RESPONSE_SERVICES = new Set([
|
||||||
* scalar fields (query strings, limits, etc.).
|
* scalar fields (query strings, limits, etc.).
|
||||||
*/
|
*/
|
||||||
export function translateRequest(service: string, body: unknown): unknown {
|
export function translateRequest(service: string, body: unknown): unknown {
|
||||||
if (TERM_BEARING_REQUEST_SERVICES.has(service)) {
|
if (HashSet.has(TERM_BEARING_REQUEST_SERVICES, service)) {
|
||||||
return deepClientToInternal(body);
|
return deepClientToInternal(body);
|
||||||
}
|
}
|
||||||
return body;
|
return body;
|
||||||
|
|
@ -309,7 +309,7 @@ export const translateRequestEffect = (
|
||||||
* All other services pass through unchanged.
|
* All other services pass through unchanged.
|
||||||
*/
|
*/
|
||||||
export function translateResponse(service: string, response: unknown): unknown {
|
export function translateResponse(service: string, response: unknown): unknown {
|
||||||
if (TERM_BEARING_RESPONSE_SERVICES.has(service)) {
|
if (HashSet.has(TERM_BEARING_RESPONSE_SERVICES, service)) {
|
||||||
return deepInternalToClient(response);
|
return deepInternalToClient(response);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue