Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .arcanist/memories/364cb094.md
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions .arcanist/memories/394fab9e.md
Original file line number Diff line number Diff line change
@@ -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 {}`.