Not from the audit — surfaced while remediating #262. Filed because no code change can resolve it: the repository's own tooling contradicts itself, so it needs a configuration decision.
The conflict
GraphWriter.execute_write in engine/sync/idea_portfolio.py is a typing.Protocol method. Every possible body breaks one of three surfaces, measured on that branch:
| Body |
Scan for Contract Violations |
Lint + Type Check |
github-code-quality |
raise NotImplementedError |
❌ [STUB-001] CRITICAL, merge-blocking |
✅ |
✅ |
pass |
✅ |
❌ ruff PIE790 "Remove unnecessary pass" |
✅ |
... |
✅ |
✅ |
❌ "Statement has no effect" |
STUB-001 is r"raise\s+NotImplementedError" scoped to engine/ (tools/contract_scanner.py), so it catches the first form and not the second.
- ruff
PIE790 catches the second.
github-code-quality flags the third, and has proposed both of the other two in turn.
This has already cost a cycle
Taking the bot's first suggestion at face value turned four checks red on #262 — Scan for Contract Violations, compliance, Pre-commit Hooks and CI Gate. Reverting to ... made all four green again. A future contributor or agent reading that same bot comment will repeat this.
Why ... is the right body on the merits
GraphWriter is structural: it is never instantiated and its body never executes. IdeaPortfolioHydrator calls execute_write on the concrete object it is handed. There is no runtime path where the statement could have an effect to lack, and the repository already uses ... for every protocol method in engine/hoprag/indexer.py::GraphStore.
Suggested resolution (pick one)
- Exempt
typing.Protocol bodies in the github-code-quality configuration. Least disruptive; the other two surfaces already agree.
- Narrow
STUB-001 so raise NotImplementedError is permitted inside a Protocol class body, and standardise on it.
- Document
... as the mandated protocol body in docs/contracts/BANNED_PATTERNS.md and accept the recurring bot comment as known-noise.
An entry in .claude/rules/learnings.md would also stop agents rediscovering this; that file invites exactly this kind of note, but adding it to #262 is not appropriate while that PR is over the reviewable-size limit.
Related: #262, and the two review threads on engine/sync/idea_portfolio.py there.
Generated by Claude Code
Not from the audit — surfaced while remediating #262. Filed because no code change can resolve it: the repository's own tooling contradicts itself, so it needs a configuration decision.
The conflict
GraphWriter.execute_writeinengine/sync/idea_portfolio.pyis atyping.Protocolmethod. Every possible body breaks one of three surfaces, measured on that branch:Scan for Contract ViolationsLint + Type Checkgithub-code-qualityraise NotImplementedError[STUB-001]CRITICAL, merge-blockingpassPIE790"Remove unnecessarypass"...STUB-001isr"raise\s+NotImplementedError"scoped toengine/(tools/contract_scanner.py), so it catches the first form and not the second.PIE790catches the second.github-code-qualityflags the third, and has proposed both of the other two in turn.This has already cost a cycle
Taking the bot's first suggestion at face value turned four checks red on #262 —
Scan for Contract Violations,compliance,Pre-commit HooksandCI Gate. Reverting to...made all four green again. A future contributor or agent reading that same bot comment will repeat this.Why
...is the right body on the meritsGraphWriteris structural: it is never instantiated and its body never executes.IdeaPortfolioHydratorcallsexecute_writeon the concrete object it is handed. There is no runtime path where the statement could have an effect to lack, and the repository already uses...for every protocol method inengine/hoprag/indexer.py::GraphStore.Suggested resolution (pick one)
typing.Protocolbodies in thegithub-code-qualityconfiguration. Least disruptive; the other two surfaces already agree.STUB-001soraise NotImplementedErroris permitted inside aProtocolclass body, and standardise on it....as the mandated protocol body indocs/contracts/BANNED_PATTERNS.mdand accept the recurring bot comment as known-noise.An entry in
.claude/rules/learnings.mdwould also stop agents rediscovering this; that file invites exactly this kind of note, but adding it to #262 is not appropriate while that PR is over the reviewable-size limit.Related: #262, and the two review threads on
engine/sync/idea_portfolio.pythere.Generated by Claude Code