Skip to content

fix(CODEWIKI-002): CU-86akn96pk 2 review findings in models.py - #93

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/codewiki-002-39874f88-90e36f49
Draft

flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/codewiki-002-39874f88-90e36f49

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Closes 2 review findings in codewiki/src/fe/models.py.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟡 70 medium JobStatus, CacheEntry dataclasses lack to_dict/from_dict methods codewiki/src/fe/models.py:32
2 🟡 70 medium CacheEntry dataclass lacks to_dict/from_dict; serialization duplicated in CacheManager codewiki/src/fe/models.py:48

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 90e36f49-f8c5-4b9a-a9b0-2d911418acb4

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akn96pk CodeWiki review findings sweep (9 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

2 finding(s) fixed in this draft — 2 explained inline on the diff.

Comment thread codewiki/src/fe/models.py
Comment on lines 44 to 85
main_model: Optional[str] = None
commit_id: Optional[str] = None

def to_dict(self) -> Dict[str, Any]:
"""Serialize this JobStatus to a plain dict."""
return {
"job_id": self.job_id,
"repo_url": self.repo_url,
"status": self.status,
"created_at": self.created_at.isoformat() if self.created_at else None,
"started_at": self.started_at.isoformat() if self.started_at else None,
"completed_at": self.completed_at.isoformat() if self.completed_at else None,
"error_message": self.error_message,
"progress": self.progress,
"docs_path": self.docs_path,
"main_model": self.main_model,
"commit_id": self.commit_id,
}

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "JobStatus":
"""Deserialize a JobStatus from a plain dict."""
created_at = data.get("created_at")
started_at = data.get("started_at")
completed_at = data.get("completed_at")
return cls(
job_id=data["job_id"],
repo_url=data["repo_url"],
status=data["status"],
created_at=datetime.fromisoformat(created_at) if isinstance(created_at, str) else created_at,
started_at=datetime.fromisoformat(started_at) if isinstance(started_at, str) else started_at,
completed_at=datetime.fromisoformat(completed_at) if isinstance(completed_at, str) else completed_at,
error_message=data.get("error_message"),
progress=data.get("progress", ""),
docs_path=data.get("docs_path"),
main_model=data.get("main_model"),
commit_id=data.get("commit_id"),
)


@dataclass
class CacheEntry:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 JobStatus, CacheEntry dataclasses lack to_dict/from_dict methods

Added to_dict/from_dict methods to the JobStatus dataclass (codewiki/src/fe/models.py, lines within the JobStatus class). to_dict explicitly maps all fields to a plain dict (converting datetimes to ISO strings), and from_dict reconstructs a JobStatus from a dict (parsing ISO datetime strings back). This is a self-contained addition to models.py; cache_manager.py was not modified (out of scope for this file-only fix), so the reviewer should follow up there to replace the hand-rolled logic with calls to these new methods.

🤖 Prompt for AI agents
In codewiki/src/fe/models.py around line 32, review and complete this code-review fix: JobStatus, CacheEntry dataclasses lack to_dict/from_dict methods.
What the draft fix changed: Added `to_dict`/`from_dict` methods to the `JobStatus` dataclass (codewiki/src/fe/models.py, lines within the `JobStatus` class). `to_dict` explicitly maps all fields to a plain dict (converting datetimes to ISO strings), and `from_dict` reconstructs a `JobStatus` from a dict (parsing ISO datetime strings back). This is a self-contained addition to models.py; cache_manager.py was not modified (out of scope for this file-only fix), so the reviewer should follow up there to replace the hand-rolled logic with calls to these new methods.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 70 medium — react 👍/👎 to teach the reviewer

Comment thread codewiki/src/fe/models.py
)


@dataclass

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 CacheEntry dataclass lacks to_dict/from_dict; serialization duplicated in CacheManager

Added to_dict/from_dict methods to the CacheEntry dataclass (codewiki/src/fe/models.py, lines within the CacheEntry class), explicitly handling the five named fields (repo_url, repo_url_hash, docs_path, created_at, last_accessed) including datetime ISO conversion. As with JobStatus, cache_manager.py's load_cache_index/save_cache_index were not touched since only models.py was in scope; a complete fix requires updating cache_manager.py to call CacheEntry.to_dict()/CacheEntry.from_dict() instead of manual dict construction.

🤖 Prompt for AI agents
In codewiki/src/fe/models.py around line 48, review and complete this code-review fix: CacheEntry dataclass lacks to_dict/from_dict; serialization duplicated in CacheManager.
What the draft fix changed: Added `to_dict`/`from_dict` methods to the `CacheEntry` dataclass (codewiki/src/fe/models.py, lines within the `CacheEntry` class), explicitly handling the five named fields (`repo_url`, `repo_url_hash`, `docs_path`, `created_at`, `last_accessed`) including datetime ISO conversion. As with JobStatus, cache_manager.py's load_cache_index/save_cache_index were not touched since only models.py was in scope; a complete fix requires updating cache_manager.py to call `CacheEntry.to_dict()`/`CacheEntry.from_dict()` instead of manual dict construction.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 70 medium — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(CODEWIKI-002): 2 review findings in models.py fix(CODEWIKI-002): CU-86akn96pk 2 review findings in models.py Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants