Skip to content

Commit 4057e24

Browse files
committed
Fix agentic module syntax errors and locale-sensitive test assertion
- Fix Python 2-style except syntax in orchestrator.py, agent.py, state.py: `except X, Y:` -> `except (X, Y):` with fmt: skip to prevent ruff formatter bug from reverting the fix - Make StatsPage quality score assertion locale-tolerant (82.5 -> /82[.,]5/) https://claude.ai/code/session_01KhAhJKpEoqCzmWzcALSfW6
1 parent 33732b0 commit 4057e24

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

agentic/workflows/modules/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def parse_json(output: str, target_type: Type[T] = None) -> Any:
144144
return [target_type.model_validate(item) for item in parsed]
145145
return target_type.model_validate(parsed)
146146
return parsed
147-
except json.JSONDecodeError, ValueError:
147+
except (json.JSONDecodeError, ValueError): # fmt: skip
148148
pass
149149

150150
# Strategy 2: Strip markdown code fences
@@ -162,7 +162,7 @@ def parse_json(output: str, target_type: Type[T] = None) -> Any:
162162
return [target_type.model_validate(item) for item in parsed]
163163
return target_type.model_validate(parsed)
164164
return parsed
165-
except json.JSONDecodeError, ValueError:
165+
except (json.JSONDecodeError, ValueError): # fmt: skip
166166
pass
167167

168168
# Strategy 3: Find first JSON array or object in output
@@ -182,7 +182,7 @@ def parse_json(output: str, target_type: Type[T] = None) -> Any:
182182
return [target_type.model_validate(item) for item in parsed]
183183
return target_type.model_validate(parsed)
184184
return parsed
185-
except json.JSONDecodeError, ValueError:
185+
except (json.JSONDecodeError, ValueError): # fmt: skip
186186
continue
187187

188188
raise json.JSONDecodeError("No valid JSON found in output", output, 0)

agentic/workflows/modules/orchestrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ def extract_run_id(stdout: str) -> str | None:
4545
try:
4646
data = json.loads(stdout.strip())
4747
return data.get("run_id")
48-
except json.JSONDecodeError, ValueError:
48+
except (json.JSONDecodeError, ValueError): # fmt: skip
4949
return None

agentic/workflows/modules/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def from_stdin(cls) -> Optional["WorkflowState"]:
172172
state = cls(run_id=run_id, prompt=data.get("prompt", ""))
173173
state.data = data
174174
return state
175-
except json.JSONDecodeError, EOFError:
175+
except (json.JSONDecodeError, EOFError): # fmt: skip
176176
return None
177177

178178
def to_stdout(self) -> None:

app/src/pages/StatsPage.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ describe('StatsPage', () => {
141141
expect(screen.getByText('53')).toBeInTheDocument();
142142
// total_lines_of_code: 245600 => formatNum => "245.6K"
143143
expect(screen.getByText('245.6K')).toBeInTheDocument();
144-
// avg_quality_score: 82.5 => formatNum(82.5) => "82.5" (toLocaleString)
145-
expect(screen.getByText('82.5')).toBeInTheDocument();
144+
// avg_quality_score: 82.5 => formatNum(82.5) => locale-sensitive decimal separator
145+
expect(screen.getByText(/82[.,]5/)).toBeInTheDocument();
146146
// coverage_percent: 73 => "73%"
147147
expect(screen.getByText('73%')).toBeInTheDocument();
148148
});

0 commit comments

Comments
 (0)