Add AI instructions#1430
Conversation
| Look for prior art in `zwave_js_server/model/` before inventing. Examples reviewers have flagged: | ||
|
|
||
| - `from_dict` classmethod parses server payload: `def from_dict(cls, data: <Type>DataType) -> Self`. Returns `Self`, not the explicit class. | ||
| - Rename unused parameters to `_param` (e.g. `event` in event handlers). |
There was a problem hiding this comment.
I don't understand this. We don't have any parameters called _param.
There was a problem hiding this comment.
The auto-generated instructions specifially mentioned _event but I wanted to keep it more generic. If it only ever comes up in event handlers, I can go back to being more specific.
There was a problem hiding this comment.
I don't like this. We should keep the interface parameters always named the same. I suggest we remove this instruction and adjust the parameter names instead.
|
|
||
| Look for prior art in `zwave_js_server/model/` before inventing. Examples reviewers have flagged: | ||
|
|
||
| - `from_dict` classmethod parses server payload: `def from_dict(cls, data: <Type>DataType) -> Self`. Returns `Self`, not the explicit class. |
There was a problem hiding this comment.
This is just best practice Python type annotation using modern Python.
There was a problem hiding this comment.
Right, but you flagged it during your most recent review. Opus 4.7 didn't follow best practices, so I think it needs a nudge in the right direction.
There was a problem hiding this comment.
Yes. Would it work to tell it to follow the latest type annotation best practices (proposed in PEPs) of the minimum supported version of the library?
typing.Self was added in Python 3.11. We support Python 3.12+.
There was a problem hiding this comment.
@abmantis do you have any experience with this approach?
There was a problem hiding this comment.
Its hard to say. Since its already "old" (3.11) it may work, but it is probably going to be flaky/inconsistent since its very broad.
As a side note: don't we have mypy/pyright/ruff/... rules we can use for these?
There was a problem hiding this comment.
don't we have mypy/pyright/ruff/... rules we can use for these?
That would probably be the more reliable option.
These have been compiled from recent review comments.