fix: dora tool docstring and sort fallback #6
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/woodpecker-mcp!6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/dora-tool-nits"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix two nits from PR #5 review: module docstring missing
(N tools)suffix convention, and timestamp sort fallback using wrong type.Changes
src/woodpecker_mcp/tools/dora.py: Added(1 tool)suffix to module docstring to match convention used by all other tool modules (pipelines, repos, secrets, crons, system, queue)src/woodpecker_mcp/tools/dora.py: Changed sort fallback from0(int) to""(str) to prevent mixed-type comparison whencreated_atis missingTest Plan
Related
🤖 Generated with Claude Code
PR #6 Review
DOMAIN REVIEW
Tech stack: Python / FastAPI-MCP / Woodpecker CI API integration.
Change 1 -- Docstring
(1 tool)suffix: Verified against all other tool modules onmain:pipelines.py(6 tools)repos.py(2 tools)queue.py(1 tool)secrets.py(4) + global secret CRUD (4) = 8 toolscrons.py(5 tools)system.py(3 tools)dora.py(before)The fix correctly adds
(1 tool)to match the established convention. Correct.Change 2 -- Sort fallback
or 0toor "": This is where it gets interesting.The
created_atvalues come fromp.get("created_at")on the raw Woodpecker API response dict. The Woodpecker CI API (confirmed via thewoodpecker-sdkswagger spec in the sibling repo) returns pipeline timestamps under the field namecreated-- notcreated_at-- and the value is an integer Unix timestamp.This means:
p.get("created_at")will always returnNone(wrong key name), so the fallback fires on every entry.or 0fallback is actually type-correct for integer Unix timestamps.or ""fallback changes the sort to compare empty strings, which works (all entries sort identically), but is arguably less correct -- if the key name bug were fixed,created_atwould be anint, and""would cause aTypeErroron mixed comparison (intvsstr).In other words: this PR fixes a hypothetical type mismatch that does not exist, while leaving an actual field-name bug (
created_atvscreated) untouched. Fixing the field name would reintroduce the originalor 0as the correct fallback.BLOCKERS
None. Both changes are low-risk. The sort fallback change is technically a lateral move (neither value works correctly due to the underlying field-name issue), not a regression.
NITS
Field name bug (pre-existing, not introduced by this PR):
p.get("created_at")should bep.get("created")to match the Woodpecker API schema. This affectsdora.pylines 99-101 and also appears inpipelines.py(lines 34, 73, 270) andcrons.py(line 34). Worth a follow-up issue -- the sort fallback fix in this PR becomes moot once the field name is corrected, and the correct fallback for integer timestamps would beor 0, notor "".Sort order test gap (pre-existing):
test_recent_failures_limitedverifies the count is capped but does not assert the returned order is descending by timestamp. A one-line assertion on the first vs. lastcreated_atvalues would close this gap.SOP COMPLIANCE
fix: dora tool docstring and sort fallback)PROCESS OBSERVATIONS
The
created_atvscreatedfield name mismatch across multiple tool modules suggests integration tests against a live Woodpecker instance may not be exercising timestamp fields. The two skipped integration tests intest_dora.pywould catch this if run. Consider prioritizing a sweep of allget("created_at")/get("started_at")/get("finished_at")calls against the actual API schema -- this is a class of bug, not an isolated typo.VERDICT: APPROVED
Both changes are correct in isolation and low-risk. The docstring fix is unambiguously right. The sort fallback change is a lateral move due to the underlying field-name bug, but it does not introduce a regression. Recommend a follow-up issue for the
created_atvscreatedfield name mismatch across the codebase.