store: PR review: paper-dynasty-database#38 — offense_col default_factory fix (APPROVED)
This commit is contained in:
parent
0561445eee
commit
55925b591e
@ -0,0 +1,26 @@
|
||||
---
|
||||
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.020351+00:00"
|
||||
---
|
||||
|
||||
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
|
||||
Loading…
Reference in New Issue
Block a user