Repository navigation
fix(clickup-app): safely coerce assignee IDs, timestamp due dates, and priority in create_task - #13921
fix(clickup-app): safely coerce assignee IDs, timestamp due dates, and priority in create_task#13921Ivansky1 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Addressed feedback from static review in commit 759496d:
|
|
Thanks @Ivansky1 - verified this end to end. Notes per file: plugins/omi-clickup-app/clickup_client.py
plugins/omi-clickup-app/test_clickup_client.py
.github/checks-manifest.yaml
No CI check runs are visible on the PR yet, so worth a glance at the manifest lane before merge - otherwise this looks merge-ready to me. Leaving final sign-off to a human maintainer. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Real bug confirmed not fixed on main (plugins/omi-clickup-app/clickup_client.py still does int(user_id) for user_id in assignees raw, aborting task creation on non-numeric assignee IDs). Root cause stated, 14 tests added covering assignees/timestamps/priority coercion, scoped diff. Merging: CI has no failing required checks, not a draft, no abuse signals.
…d priority in create_task ClickUp's create_task previously used a naive list comprehension [int(user_id) for user_id in assignees if user_id] without error handling. When passed non-numeric names, None, string 'None', or whitespace tokens, it raised an unhandled ValueError that aborted task creation entirely. In addition, numeric Unix timestamps passed to due_date crashed with TypeError or ValueError due to unconditional 'T' in due_date string testing. This change: 1. Adds a resilient ClickUpClient._coerce_assignee_ids helper extracting positive integer IDs, skipping invalid/non-numeric tokens and booleans without throwing, and deduplicating unique IDs. 2. Gracefully continues task creation even if assignees cannot be resolved rather than failing the whole task. 3. Supports millisecond Unix timestamps (int, float, numeric string) alongside ISO date strings. 4. Coerces and validates priority to ClickUp's 1-4 scale. 5. Adds full unit test coverage in test_clickup_client.py and registers clickup-client-tests in checks-manifest.yaml.
…ority, and add failure tests 1. Prevented silent truncation of fractional priorities (e.g. 4.9 -> 4) and boolean types by explicitly requiring integer types before validation. 2. Preserved exact instant and timezone offsets for ISO due dates with UTC 'Z' or offset annotations (+HH:MM), only localizing naive datetimes. 3. Added comprehensive failure path test coverage in test_clickup_client.py covering non-200 API responses, unparseable due dates, and fractional/boolean priorities.
759496d to
acdc6e6
Compare
|
Note for maintainers / bounty payout: Please ensure all bounty rewards for this PR are routed to my verified EVM / Base wallet: 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0. Thank you! |
|
Payout information update:
Thank you! |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Rebase check first: I diffed all three PR files between the commit @kodjima33 reviewed and this head. The ClickUp changes are identical; the only additional deltas (the data= OAuth token exchange and log redaction to exception class names) came from main's side of the rebase, not this branch. The reviewed substance is unchanged.
Notes per file on this head:
plugins/omi-clickup-app/clickup_client.py
_coerce_assignee_idsfixes the original crash correctly: theisinstance(item, (dict, list, set, bool))guard runs before any numeric coercion so booleans can't pass as 0/1,"None"/"NONE"sentinels are filtered case-insensitively, only positive IDs survive, and dedup keeps first-seen order.create_tasknow creates the task without assignees instead of aborting onint(user_id)with a non-numeric token.- The priority gate rejects booleans, fractional floats, and non-integer strings, and omits out-of-range values (ClickUp's documented 1-4 scale) instead of crashing.
- Due-date handling now accepts int/float/digit-string millisecond timestamps directly, and normalizes a trailing
Zto+00:00beforefromisoformat, so offset-aware ISO strings keep their exact instant - previouslypytz.localizeraised on already-aware datetimes and those due dates were silently dropped.
plugins/omi-clickup-app/test_clickup_client.py
- Ran the suite on this head: 17/17 pass. The failure-path tests (all-invalid assignees -> task still created without
assignees; unparseable due dates -> graceful omission; non-200 responses ->success: False) are exactly the coverage this fix needs.
.github/checks-manifest.yaml
clickup-client-testsis registered as a proper new entry underchecks:with both lanes and correct triggers - schema and placement match the neighboring entries.
One blocking item, and it's metadata rather than code: PR Metadata Preflight fails on failure-class-protocol because both commit subjects start with fix:, which requires a Failure-Class: declaration in the PR body. Adding exactly one of the accepted forms on its own line - e.g. Failure-Class: new, or an existing class from .github/failure-classes/ if one fits - should turn it green (re-run the job if the body edit doesn't retrigger it).
Nice work keeping the fix scoped; once the declaration is in, this is ready from my side.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Correction to my previous review — the Failure-Class: new line I asked for was my error, and here is the working version. I read the checker (scripts/failure-class) end to end: for a PR that adds no new class definition, new is invalid — it requires exactly one added .github/failure-classes/FC-<slug>.json file in the commit range. That is why PR Metadata Preflight still failed on the 19:02Z run after your body edit. You followed the instruction exactly; the instruction was wrong.
Two verified ways to turn it green:
- Quickest — replace the declaration line in the PR body with:
Failure-Class: none
The validator acceptsnoneunconditionally. I checked the existing ~300 class definitions and none matches this failure mode closely enough to point you at, sononeis the honest minimal declaration here. - If you want the class registered — keep
Failure-Class: newand add exactly one definition file, e.g..github/failure-classes/FC-unvalidated-external-id-crashes-operation.json, containingschema_version: 1, anidmatching the filename, non-emptyviolated_contractandcanonical_prevention,evidence_prs: [](explicitly allowed — this PR is the evidence), andstatus: "open". No other definition files may be touched in the same PR.
If the body edit alone doesn't retrigger the job, re-run PR Metadata Preflight manually.
The code itself is unchanged since my last pass on this head, so the per-file assessment stands:
plugins/omi-clickup-app/clickup_client.py—_coerce_assignee_idstype-guards(dict, list, set, bool)before any numeric coercion, filters"None"/"NONE"sentinels case-insensitively, and keeps only positive, order-preserved deduped IDs; the due-date path accepts millisecond timestamps directly and normalizes a trailingZto+00:00so offset-aware ISO strings keep their exact instant; the priority gate rejects booleans and fractional floats and omits out-of-range values on ClickUp's 1–4 scale.plugins/omi-clickup-app/test_clickup_client.py— 17/17 when I ran the suite on this head; the failure-path tests (all-invalid assignees → task still created withoutassignees; unparseable due date → graceful omission; non-200 →success: False) are exactly the coverage this fix needed..github/checks-manifest.yaml— theclickup-client-testsentry sits correctly underchecks:with the right triggers and lanes.
@kodjima33 gave maintainer sign-off on the pre-rebase commit and I verified all three files' ClickUp substance is identical after the rebase, so once the declaration is fixed this is ready from my side for a maintainer merge.
by AI on behalf of David
|
Closing because this is already on main (ClickUp task priority, assignee, and due-date coercion). The keep is #14268. This head does not add a unique production file. |
|
Hey @Ivansky1 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
In
plugins/omi-clickup-app/clickup_client.py:task_data["assignees"] = [int(user_id) for user_id in assignees if user_id]. Ifassigneescontained non-numeric strings (e.g. member names,"None", or whitespace tokens when name matching fails),int(user_id)raised an unhandledValueErrorwhich aborted the entire task creation call. The user's task was never created on ClickUp.due_date: Optional due date in ISO format or Unix timestamp (milliseconds). However, passing a numeric millisecond timestamp (integer, float, or digits string) crashed on'T' in due_date(TypeError: argument of type 'int' is not iterable) ordatetime.fromisoformat(ValueError).test_clickup_client.pycovering valid/invalid assignees, timestamp and ISO due dates, priority coercion, and API failure paths. Registeredclickup-client-testsin.github/checks-manifest.yaml.Testing
python -m unittest plugins/omi-clickup-app/test_clickup_client.py: All 14 tests pass in 0.02s.python -m unittest plugins/omi-clickup-app/test_settings_page.py: All 2 tests pass.git diff --check origin/main: 0 whitespace or formatting warnings.Failure-Class: new
Bounty Payout Destination (EVM / Base USDC):
0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0cc @josancamon19 @kodjima33