Skip to content

Commit 167f0d8

Browse files
MaxGhenisclaude
andcommitted
fix: remove debug console.log statements from adapters
Remove debug logging statements that were accidentally left in: - conversionHelpers.ts: 12 console.log statements and unused isProxy helper - SimulationAdapter.ts: 4 console.log statements - HouseholdAdapter.ts: 2 console.warn statements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 872e197 commit 167f0d8

File tree

3 files changed

+8
-54
lines changed

3 files changed

+8
-54
lines changed

app/src/adapters/HouseholdAdapter.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ export class HouseholdAdapter {
8585
// Convert snake_case to camelCase for internal representation
8686
const camelKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
8787
householdData[camelKey] = value as any;
88-
} catch (error) {
89-
// If entity not found in metadata, still include it but log warning
90-
console.warn(`Entity "${key}" not found in metadata, including anyway`);
88+
} catch {
89+
// If entity not found in metadata, still include it
9190
const camelKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
9291
householdData[camelKey] = value as any;
9392
}
@@ -125,7 +124,6 @@ export class HouseholdAdapter {
125124
} else {
126125
// If not found in metadata, try snake_case conversion
127126
const snakeKey = key.replace(/([A-Z])/g, '_$1').toLowerCase();
128-
console.warn(`Entity "${key}" not found in metadata, using snake_case "${snakeKey}"`);
129127
household_json[snakeKey] = value as any;
130128
}
131129
}

app/src/adapters/SimulationAdapter.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ export class SimulationAdapter {
1919
* Converts SimulationMetadata from API GET response to Simulation type
2020
*/
2121
static fromMetadata(metadata: SimulationMetadata): Simulation {
22-
console.log('[SimulationAdapter.fromMetadata] RAW API METADATA:', {
23-
id: metadata.id,
24-
status: metadata.status,
25-
hasOutput: !!metadata.output,
26-
outputType: typeof metadata.output,
27-
metadataKeys: Object.keys(metadata),
28-
});
29-
3022
if (!metadata.population_id) {
3123
throw new Error('Simulation metadata missing population_id');
3224
}
@@ -45,13 +37,7 @@ export class SimulationAdapter {
4537
if (metadata.output && typeof metadata.output === 'string') {
4638
try {
4739
parsedOutput = JSON.parse(metadata.output);
48-
console.log('[SimulationAdapter.fromMetadata] Parsed stringified output:', {
49-
originalType: 'string',
50-
parsedType: typeof parsedOutput,
51-
parsedKeys: parsedOutput ? Object.keys(parsedOutput) : [],
52-
});
53-
} catch (error) {
54-
console.error('[SimulationAdapter.fromMetadata] Failed to parse output:', error);
40+
} catch {
5541
// Keep original value if parsing fails
5642
parsedOutput = metadata.output;
5743
}
@@ -70,14 +56,6 @@ export class SimulationAdapter {
7056
status: metadata.status,
7157
};
7258

73-
console.log('[SimulationAdapter.fromMetadata] TRANSFORMED SIMULATION:', {
74-
id: simulation.id,
75-
status: simulation.status,
76-
hasOutput: !!simulation.output,
77-
outputType: typeof simulation.output,
78-
simulationKeys: Object.keys(simulation),
79-
});
80-
8159
return simulation;
8260
}
8361

app/src/adapters/conversionHelpers.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import { PolicyMetadataParams, PolicyMetadataParamValues } from '@/types/metadat
33
import { Parameter } from '@/types/subIngredients/parameter';
44
import { ValueInterval } from '@/types/subIngredients/valueInterval';
55

6-
// Helper to detect Immer Proxy objects
7-
function isProxy(obj: any): boolean {
8-
return obj != null && typeof obj === 'object' && obj.constructor?.name === 'DraftObject';
9-
}
10-
116
/**
127
* Converts PolicyMetadataParamValues (with "startDate.endDate" keys) into ValueInterval array
138
* Copied from src/libs/policyParameterTransform.ts
@@ -51,32 +46,15 @@ export function convertPolicyJsonToParameters(policyJson: PolicyMetadataParams):
5146
* Converts Parameter[] to PolicyMetadataParams format for API payloads
5247
*/
5348
export function convertParametersToPolicyJson(parameters: Parameter[]): PolicyMetadataParams {
54-
console.log('[ADAPTER] convertParametersToPolicyJson - START');
55-
console.log('[ADAPTER] parameters:', parameters);
56-
5749
const data: PolicyMetadataParams = {};
5850

59-
parameters.forEach((param, paramIndex) => {
60-
console.log(`[ADAPTER] Processing parameter ${paramIndex}:`, param);
61-
console.log(`[ADAPTER] param is Proxy?`, isProxy(param));
62-
console.log(`[ADAPTER] param.values:`, param.values);
63-
console.log(`[ADAPTER] param.values is Array?`, Array.isArray(param.values));
64-
65-
if (param.values && param.values.length > 0) {
66-
console.log(`[ADAPTER] First value:`, param.values[0]);
67-
console.log(`[ADAPTER] First value is Proxy?`, isProxy(param.values[0]));
68-
}
69-
70-
data[param.name] = param.values.reduce((acc, cur, valueIndex) => {
71-
console.log(`[ADAPTER] Processing value ${valueIndex}:`, cur);
72-
console.log(`[ADAPTER] cur is Proxy?`, isProxy(cur));
73-
return { ...acc, [`${cur.startDate}.${cur.endDate}`]: cur.value };
74-
}, {});
51+
parameters.forEach((param) => {
52+
data[param.name] = param.values.reduce(
53+
(acc, cur) => ({ ...acc, [`${cur.startDate}.${cur.endDate}`]: cur.value }),
54+
{}
55+
);
7556
});
7657

77-
console.log('[ADAPTER] convertParametersToPolicyJson - END');
78-
console.log('[ADAPTER] Final data:', data);
79-
8058
return data;
8159
}
8260

0 commit comments

Comments
 (0)