Repository navigation
fix: track tasks with fields py-tes doesn't know - #412
Merged
Merged
Conversation
py-tes raises on keys that its models don't know, also in nested objects, so that tasks of backends that add such fields (e.g., `author` of TESP) stayed `UNKNOWN`. Drop these keys before `unmarshal`. The fake TES backend of the smoke test now serves such a field. Closes #409 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check that the map of nested models is complete against py-tes's type hints, test values that are no objects and that the input isn't changed, and log ignored fields at debug level. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR makes task tracking tolerant of backend-specific fields by recursively removing fields unknown to py-tes before unmarshalling, while preserving free-form maps and supported task data; it adds unit and smoke coverage and documents the behavior. Sequence diagram for filtering backend-specific task fieldssequenceDiagram
participant Backend
participant TesClient
participant known_fields
participant py_tes
participant ProTESClient
ProTESClient->>TesClient: get_task(task_id, view)
TesClient->>Backend: GET task
Backend-->>TesClient: Task JSON with backend fields
TesClient->>known_fields: known_fields(body)
known_fields->>known_fields: Recursively filter nested models
known_fields-->>TesClient: Supported fields and free-form maps
TesClient->>py_tes: unmarshal(filtered body, tes.Task)
py_tes-->>TesClient: tes.Task
TesClient-->>ProTESClient: Task without unknown fields
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #412 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 2500 2518 +18
=========================================
+ Hits 2500 2518 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
November 4, 2026 04:59
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pro_tes/ga4gh/tes/backends.py" line_range="579-580" />
<code_context>
+ The value, without the unknown fields; not changed in place.
+ """
+ if isinstance(value, list):
+ return [known_fields(item, model) for item in value]
+ if not isinstance(value, dict):
+ return value
+ fields = signature(model).parameters
</code_context>
<issue_to_address>
**Nested arrays stall task polling**
When a configured or discovered TES backend returns a task containing deeply nested arrays, such as in `inputs`, `known_fields` recursively processes every nested list without checking its expected model shape, so a backend response containing sufficiently deep arrays raises `RecursionError` before unmarshalling. The poll handlers treat this as a failed poll and retry, leaving affected tasks untracked to completion and repeatedly consuming poll attempts.
Reject unexpected list shapes or impose a recursion-depth limit before descending into list values.
</issue_to_address>Linked issues
#409 fix: track tasks with fields py-tes doesn't know · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Drop fields unknown to py-tes recursively from task objects, including inputs, outputs, resources, executors, task logs, executor logs, and output file logs. | ✅ Met | known_fields filters each model and recurses through the mapped nested models before unmarshal in TesClient.get_task. |
| 2 | Add a regression test with extra fields at each level. | ✅ Met | The tests cover unknown fields on the task and its nested objects, including executor logs and output file logs. |
| 3 | Add a non-standard author field to the smoke-test backend and check that the task is tracked to its final state. |
✅ Met | The TES 1.1 fake backend serves author; the smoke test waits for COMPLETE and verifies that author is not exposed by proTES. |
| 4 | Add documentation. | ✅ Met | docs/tes-versions.md documents how fields added by TES instances are handled. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: pro_tes/ga4gh/tes/backends.py:580
Lists of lists aren't valid in tasks, and deep ones would raise a `RecursionError`: keep them for py-tes to reject. Co-Authored-By: Claude Opus 5.5 <[email protected]>
uniqueg
added a commit
that referenced
this pull request
Nov 4, 2026
Brings in the review fixes #410, #412, #417, #419, #420, #421. The only conflict is in the module docstring of `pro_tes/ga4gh/tes/backends.py`: keeps this branch's removal of the FOCA 0.19 caveat about redirects, and the sentence of #419 about tasks in the view `FULL`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #409.
known_fieldsdrops the keys that py-tes's models don't know, recursively, beforeunmarshalinTesClient.get_task. Tasks of backends that add fields (TESP:author) are now tracked to their final state, with their logs and outputs. Free-form maps (tags,metadata,env,backend_parameters) are kept.tests/smoke/fake_tes.pyservesauthor(except as TES 1.0), so the smoke test covers it.docs/tes-versions.md: new section on fields that TES instances add.Verification
pytest tests/ga4gh/tes/test_backends.py tests/tasks: passed, including new tests with extra fields at all levels, camel case, values that are no objects, and a check of the map of nested models against py-tes's type hints. Without the filter, py-tes raisesUnmarshalErroronauthor(checked directly).pre-commit runon the changed files: passed.Declined review findings
🤖 Generated with Claude Code
Summary by Sourcery
Support TES backends that add fields beyond the specification while preserving normal task tracking and client responses.
Bug Fixes:
Enhancements:
Documentation:
Tests: