Skip to content

Commit 37f3b48

Browse files
committed
fix: include deployedState in ProjectStatusResult to fix scope error
After rebasing, the dataset enrichment code referenced context.deployedState outside the withCommandRunTelemetry callback where context was defined. Rather than hoisting context outside the callback (which would lose telemetry coverage for loadStatusConfig failures), include deployedState in the ProjectStatusResult so it flows through the Result type naturally.
1 parent eb02167 commit 37f3b48

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/cli/commands/status/action.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export interface ResourceStatusEntry {
3737
export type ProjectStatusResult = Result<{
3838
targetRegion?: string;
3939
resources: ResourceStatusEntry[];
40+
deployedState: DeployedState;
4041
}> & { projectName?: string; targetName?: string; logPath?: string; resources?: ResourceStatusEntry[] };
4142

4243
export interface StatusContext {
@@ -490,6 +491,7 @@ export async function handleProjectStatus(
490491
targetName: selectedTargetName ?? '',
491492
targetRegion: targetConfig?.region,
492493
resources,
494+
deployedState,
493495
logPath: logger.getRelativeLogPath(),
494496
};
495497
}

src/cli/commands/status/command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ValidationError, serializeResult } from '../../../lib';
22
import { getErrorMessage } from '../../errors';
3-
import { withCommandRunTelemetry } from '../../telemetry/cli-command-run.js';
4-
import { FilterState, FilterType, standardize } from '../../telemetry/schemas/common-shapes.js';
53
import { getDatasetStatus } from '../../operations/dataset';
64
import type { DatasetStatusResult } from '../../operations/dataset';
5+
import { withCommandRunTelemetry } from '../../telemetry/cli-command-run.js';
6+
import { FilterState, FilterType, standardize } from '../../telemetry/schemas/common-shapes.js';
77
import { COMMAND_DESCRIPTIONS } from '../../tui/copy';
88
import { requireProject } from '../../tui/guards';
99
import type { ResourceStatusEntry } from './action';
@@ -175,7 +175,7 @@ export const registerStatus = (program: Command) => {
175175
// Fetch enriched dataset info when --type dataset is specified
176176
let datasetDetails: DatasetStatusResult[] = [];
177177
if (cliOptions.type === 'dataset' && datasets.length > 0 && result.targetRegion && result.targetName) {
178-
const deployedState = context.deployedState;
178+
const deployedState = result.deployedState;
179179
const targetResources = deployedState.targets?.[result.targetName]?.resources;
180180
const deployedDatasets = targetResources?.datasets ?? {};
181181

0 commit comments

Comments
 (0)