✨feat: include workspace_slug in dynamic context and co id - #20
Merged
Conversation
Review Summary by QodoInclude workspace_slug in dynamic choices context
WalkthroughsDescription• Add workspace_slug to dynamic choices callback context • Implement workspace_id type coercion from int to string • Update documentation and API descriptions for workspace context • Expand test coverage for new context parameter Diagramflowchart LR
A["Dynamic Choices Request"] -->|"includes workspace_slug"| B["Request Body"]
B -->|"extracted"| C["Context Dict"]
C -->|"passed to"| D["dynamic_choices_callback"]
E["workspace_id int"] -->|"coerced to str"| F["JobContext"]
File Changes1. src/supervaizer/agent.py
|
Code Review by Qodo
|
Comment on lines
+171
to
+172
| if isinstance(v, (int, float)): | ||
| return str(v) |
There was a problem hiding this comment.
1. Bool workspace_id coerced 🐞 Bug ≡ Correctness
JobContext.coerce_workspace_id treats bool as an int and converts True/False into string workspace
IDs ("True"/"False"), silently accepting invalid input. This can create jobs with incorrect
workspace_id values instead of failing validation.
Agent Prompt
## Issue description
`JobContext.coerce_workspace_id` currently coerces any `(int, float)` to `str`. Because `bool` is an `int` subclass in Python, `workspace_id=True/False` will be accepted and converted to `"True"`/`"False"`, silently producing invalid workspace identifiers.
## Issue Context
`JobContext.workspace_id` is declared as `str`, so non-string values should either be normalized safely (for numeric IDs) or rejected when clearly invalid (like booleans).
## Fix Focus Areas
- src/supervaizer/job.py[165-173]
### Suggested change
Add an explicit `bool` guard before the numeric coercion, e.g.:
- if `isinstance(v, bool)`: raise `ValueError` (or return `v` and let Pydantic reject it)
- then handle `(int, float)` coercion
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
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.
No description provided.