diff --git a/.arcanist/memories/364cb094.md b/.arcanist/memories/364cb094.md new file mode 100644 index 0000000..eae4ab8 --- /dev/null +++ b/.arcanist/memories/364cb094.md @@ -0,0 +1,11 @@ +--- +id: mem-364cb094 +type: gotcha +context_hint: Operators or transforms that cache results and process dataclass objects +referenced_files: + - nons/operators/deterministic.py +source_pr_url: https://github.com/shreypjain/non/pull/16 +source_session_id: 9db00177-844e-4c98-8cbd-e0c7354f9f04 +--- + +When modifying dataclass objects inside operator `transform()` methods (or any caching pipeline), never mutate fields in-place — use `dataclasses.replace()` to create a new instance. In-place mutation changes the object's hash, corrupting cache keys and causing unbounded cache growth. diff --git a/.arcanist/memories/394fab9e.md b/.arcanist/memories/394fab9e.md new file mode 100644 index 0000000..3edaab0 --- /dev/null +++ b/.arcanist/memories/394fab9e.md @@ -0,0 +1,11 @@ +--- +id: mem-394fab9e +type: gotcha +context_hint: Checking Optional fields on Pydantic models using hasattr +referenced_files: + - nons/core/agents/agent.py +source_pr_url: https://github.com/shreypjain/non/pull/16 +source_session_id: 9db00177-844e-4c98-8cbd-e0c7354f9f04 +--- + +When checking if a Pydantic BaseModel field is set/truthy, never use `hasattr()` — all declared fields always have the attribute. Use an explicit `is not None` check (or `is not None` + not-empty) instead. E.g., `decision.params if decision.params is not None else {}`.