fix: scope correlation-chain query to the exchange's own env
Correlated exchanges always share the env of the one being viewed — using the globally-selected env from the picker was wrong if the user switched envs after opening a detail view (or arrived via permalink). Thread `environment` through: - `ExecutionStore.ExecutionRecord` gains `environment` field; the ClickHouse `executions` table already stores this, just not read back. - `ClickHouseExecutionStore.findById` SELECT adds the column; mapper populates it. - `ExecutionDetail` gains `environment`; `DetailService` passes through. - `IngestionService.toExecutionRecord` passes null — this legacy PG ingestion path isn't active when ClickHouse is enabled, and the read-side is what drives the correlation UI. - UI `ExchangeHeader` reads `detail.environment ?? storeEnv` and extends the TS type locally (schema.d.ts catches up on next regen). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,11 @@ function statusVariant(s: string): StatusVariant {
|
||||
export function ExchangeHeader({ detail, onCorrelatedSelect, onClearSelection }: ExchangeHeaderProps) {
|
||||
const navigate = useNavigate();
|
||||
const { timeRange } = useGlobalFilters();
|
||||
const environment = useEnvironmentStore((s) => s.environment);
|
||||
const storeEnv = useEnvironmentStore((s) => s.environment);
|
||||
// Prefer the exchange's own env over the selected env — correlated exchanges
|
||||
// always live in the same env as the one being viewed, and the user may have
|
||||
// switched env-picker after opening this detail.
|
||||
const environment = detail.environment ?? storeEnv;
|
||||
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null, environment);
|
||||
const chain = chainResult?.data;
|
||||
const showChain = chain && chain.length > 1;
|
||||
|
||||
Reference in New Issue
Block a user