43 lines
1.6 KiB
Markdown
43 lines
1.6 KiB
Markdown
---
|
|
id: 29f1641c-5539-4814-8efa-c03692025c15
|
|
type: workflow
|
|
title: "PR review: paper-dynasty-database#38 — offense_col default_factory fix (APPROVED)"
|
|
tags: [pr-reviewer, paper-dynasty-database, pydantic, python, fastapi, bug-fix]
|
|
importance: 0.4
|
|
confidence: 0.8
|
|
created: "2026-03-03T20:33:06.020351+00:00"
|
|
updated: "2026-03-03T20:33:06.424317+00:00"
|
|
relations:
|
|
- target: d36a86f0-8183-4c94-8d63-0be65d3fd63a
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.81
|
|
edge_id: 92c4541e-21a0-4898-a56d-9d6bc785aced
|
|
- target: 5ae1bf6e-1e1c-4486-8a4d-10afd9e42189
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.81
|
|
edge_id: 924f6a05-07de-4f96-af11-eea5211ef738
|
|
- target: 04e57a23-0a20-49d6-8c5a-2fa5fc4e55b5
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.8
|
|
edge_id: 82c2dfef-28b1-4e09-a5b4-94a83a4dcbd5
|
|
---
|
|
|
|
Reviewed PR #38 in cal/paper-dynasty-database.
|
|
|
|
**Verdict**: APPROVED (posted as COMMENT — Gitea blocks self-approval)
|
|
|
|
**Change**: `app/routers_v2/mlbplayers.py` line 40
|
|
- Before: `offense_col: int = random.randint(1, 3)`
|
|
- After: `offense_col: int = pydantic.Field(default_factory=lambda: random.randint(1, 3))`
|
|
|
|
**Finding**: Fix is correct. Bare `random.randint(1,3)` as a Pydantic field default is evaluated once at class definition time (module import), causing all instances to share the same value. `default_factory` defers evaluation per-instantiation.
|
|
|
|
**Notes**:
|
|
- `random` and `pydantic` already imported — no new deps
|
|
- Pydantic v1 codebase (uses `.dict()` method)
|
|
- `pydantic.Field` qualified form consistent with file style
|
|
- No security, style, or edge case issues
|