T-148: edits made in the worktree

This commit is contained in:
Studio 2026-12-01 23:24:23 -05:00
parent 8f9e9ac196
commit 4f0d16de5a
3 changed files with 7 additions and 6 deletions

View file

@ -131,7 +131,7 @@ Exported from `@stock-bot/research` and `@stock-bot/research/market-data-store-r
- **`createRoutedMarketDataStore({ daily, intraday })`** — Composes a full daily `MarketDataStore` (e.g. `createDuckDbMarketDataStore`) with an intraday `bars` reader (`Pick<MarketDataStore, 'bars'>`, e.g. `createQuestDbIntradayBarsReader`).
- `bars(q)` with `timeframe: '1m'` delegates directly to `intraday.bars(q)` (preserving lazy iteration, receiver, query identity, and error propagation). Note that `createQuestDbIntradayBarsReader` supports split-unadjusted raw (`adjustment: 'raw'`) `1m` bars.
- `bars(q)` with any other timeframe (`'1d'`, `'5m'`, `'1h'`, or malformed inputs) and all other `MarketDataStore` methods (`crossSection`, `fundamentalsAsOf`, `events`, `shortsAsOf`, `macroAsOf`, `fx`, `universe`) delegate directly to `daily`.
- **Shared Vault fence requirement:** The router adds no Vault logic of its own; each delegate enforces its own fence. Always construct `daily`, `intraday`, and any MCP tool (`createQueryDataTool` / `createResearchCopilotMcpServer`) with the exact same `vaultCutoffTs` and `vaultOperatorAuthorized`:
- **Shared Vault fence requirement:** The router adds no Vault logic of its own; each delegate enforces its own fence. Always construct `daily` and `intraday` with the exact same `vaultCutoffTs` and `vaultOperatorAuthorized`, and pass that same `vaultCutoffTs` to `createQueryDataTool` (which is always Vault-fenced and accepts only `{ vaultCutoffTs }`):
```ts
const vaultCutoffTs = Date.UTC(2025, 6, 1, 0, 0, 0, 0);
@ -151,7 +151,7 @@ const intraday = createQuestDbIntradayBarsReader({
const store = createRoutedMarketDataStore({ daily, intraday });
const queryDataTool = createQueryDataTool({
store,
vaultContext: { vaultCutoffTs, vaultOperatorAuthorized },
vaultContext: { vaultCutoffTs },
});
```

View file

@ -13,8 +13,9 @@
* enforce its own Vault holdout fence and point-in-time predicates.
* - Callers MUST construct both `daily` and `intraday` with the exact same
* `vaultCutoffTs` and `vaultOperatorAuthorized` values (and pass the same
* `vaultCutoffTs` to MCP tools such as `createQueryDataTool`) so the holdout
* boundary is identical across timeframes.
* `vaultCutoffTs` to MCP tools such as `createQueryDataTool`, which is
* always Vault-fenced) so the holdout boundary is identical across
* timeframes.
* - The QuestDB intraday reader (`createQuestDbIntradayBarsReader`) supports
* split-unadjusted `adjustment: 'raw'` `1m` bars; non-`'raw'` `1m` requests
* and unsupported timeframes (`'5m'`, `'1h'`) are handled by the respective
@ -100,9 +101,10 @@ function isIntraday1mBarsQuery(q: unknown): boolean {
* vaultOperatorAuthorized,
* });
* const store = createRoutedMarketDataStore({ daily, intraday });
* // `createQueryDataTool` is always Vault-fenced and accepts only `vaultCutoffTs`.
* const queryDataTool = createQueryDataTool({
* store,
* vaultContext: { vaultCutoffTs, vaultOperatorAuthorized },
* vaultContext: { vaultCutoffTs },
* });
* ```
*/

View file

@ -985,7 +985,6 @@ describe('createRoutedMarketDataStore', () => {
store: routedStore,
vaultContext: {
vaultCutoffTs: VAULT_CUTOFF_TS,
vaultOperatorAuthorized: false,
},
}),
],