Skip to content

Memory update from review of PR #4#5

Open
arcanist[bot] wants to merge 2 commits into
mainfrom
memory/update-from-pr-4
Open

Memory update from review of PR #4#5
arcanist[bot] wants to merge 2 commits into
mainfrom
memory/update-from-pr-4

Conversation

@arcanist
Copy link
Copy Markdown

@arcanist arcanist Bot commented Apr 13, 2026

Memory updates from PR #4

Add: When adding a new operator using the @operator decorator, especially if the function has a suffix (e.g., _op) that differs from the intended registry name.

Type: gotcha

Memory:

When registering operators with the @operator decorator, always pass an explicit name= parameter. The decorator falls back to func.__name__ when no name is given — so a function named pack_candidates_op registers as "pack_candidates_op", not "pack_candidates". Any code that looks up operators by their intended semantic name (e.g., NoN.from_operators(["pack_candidates"])) will fail silently at lookup time rather than at definition time.

Rationale:

The agent spent significant time tracking down why NoN.from_operators(["pack_candidates", ...]) failed. The bug is non-obvious: the decorator silently uses func.__name__ as the registry key, and the metadata name field is not used. This is a genuine gotcha that a competent engineer would likely miss on first pass.

Why this is a memory (not a convention update): This is a situational pattern that helps the agent in specific contexts, not a permanent rule for all future code.

Referenced files: nons/operators/deterministic.py


Add: When designing multi-layer NoN pipelines where one operator returns a list (e.g., List[Candidate]) that feeds into a downstream single-node operator expecting the full collection.

Type: gotcha

Memory:

In Layer._prepare_inputs, list inputs are distributed 1-to-1 across nodes only when len(self.nodes) > 1. For single-node layers, any list input is always broadcast as-is. This means if an operator returns a List[T] and the next layer has exactly one node, that node receives the full list — not individual elements. Be aware of this when chaining operators that return collections through single-node layers.

Rationale:

This was a subtle bug fixed in this session: a single-node layer receiving a 1-element list from extract_winners was unwrapping it and passing a bare Candidate to majority, which expected a list. The fix (guard on len(self.nodes) > 1) is not obvious from reading the code without understanding the intent. Engineers building pipelines need to know this behavior.

Why this is a memory (not a convention update): This is a situational pattern that helps the agent in specific contexts, not a permanent rule for all future code.

Referenced files: nons/core/layer.py


Sessions: 5ea2a0a0-6590-4a63-bca5-b2ad4ad1bdbb

Merge to apply. Close to discard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants