Skip to content

Add AbsValue, Modulus, and Power math components#29

Open
gerardl wants to merge 2 commits intobbartling:developfrom
gerardl:feature/add-absvalue-modulus-power
Open

Add AbsValue, Modulus, and Power math components#29
gerardl wants to merge 2 commits intobbartling:developfrom
gerardl:feature/add-absvalue-modulus-power

Conversation

@gerardl
Copy link
Copy Markdown

@gerardl gerardl commented Mar 26, 2026

Hello, very cool project! I've been working with Niagara a lot lately and was hoping something like this existed. I'm happy to build out more of the kitControl components but just did a few to make sure that was okay with you. I can also start adding tests if that would be helpful.

Summary by CodeRabbit

  • New Features

    • Three new math operators added: Absolute Value, Modulus, and Power — now available for use and constructible via the builder API.
  • Documentation

    • README and implementation checklist updated to mark these operators as supported and to document their builder entries.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 609f0fe6-647c-47f7-a3a2-0183c6fc019b

📥 Commits

Reviewing files that changed from the base of the PR and between bfe768c and 279f0f2.

📒 Files selected for processing (1)
  • README.md

📝 Walkthrough

Walkthrough

Added three kitControl Math components (AbsValue, Modulus, Power): updated README checklist, added BogFolderBuilder methods (add_abs_value, add_modulus, add_power) that delegate to _add_component, and extended component model maps for output types and slot interfaces.

Changes

Cohort / File(s) Summary
Documentation
README.md
Marked Modulus, Power, and AbsValue as completed and added API entries for add_abs_value(name: str), add_modulus(name: str), and add_power(name: str) in the BogFolderBuilder methods table.
Builder Methods
src/bog_builder/builder.py
Added public wrapper methods BogFolderBuilder.add_abs_value, add_modulus, and add_power (accept name: str, optional `properties: dict
Component Models
src/bog_builder/models.py
Extended COMPONENT_OUTPUT_TYPE with kitControl:AbsValue, kitControl:Modulus, kitControl:PowerStatusNumeric; extended COMPONENT_SLOT_MAP to declare inputs/outputs: AbsValue inputs ["inA"], outputs ["out"]; Modulus and Power inputs ["inA","inB"], outputs ["out"].

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped along the code today,
Three numbers joined the play,
Abs, Modulus, Power — neat and spry,
Builder bones that help them fly,
Checklist checked, a happy sigh.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding three math components (AbsValue, Modulus, and Power) to the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/bog_builder/models.py (1)

171-173: Make new math input slot types explicit in SLOT_TYPE_MAPPING.

Right now these inputs rely on fallback typing. Defining them explicitly keeps the type system deterministic and self-documenting.

♻️ Suggested update
 SLOT_TYPE_MAPPING = {
+    ("kitControl:AbsValue", "inA"): "StatusNumeric",
+    ("kitControl:Modulus", "inA"): "StatusNumeric",
+    ("kitControl:Modulus", "inB"): "StatusNumeric",
+    ("kitControl:Power", "inA"): "StatusNumeric",
+    ("kitControl:Power", "inB"): "StatusNumeric",
     ("kitControl:MultiVibrator", "period"): "RelTime",
     ...
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/bog_builder/models.py` around lines 171 - 173, SLOT_TYPE_MAPPING
currently lacks explicit entries for the new math node input slots (e.g.,
"kitControl:AbsValue" inputs "inA"; "kitControl:Modulus" inputs "inA","inB";
"kitControl:Power" inputs "inA","inB"), causing them to fall back to implicit
typing; update SLOT_TYPE_MAPPING to add explicit slot type mappings for these
nodes (map each "inA" and "inB" to the appropriate numeric slot type used
elsewhere in SLOT_TYPE_MAPPING) so the type system is deterministic and
self-documenting, referencing the node keys "kitControl:AbsValue",
"kitControl:Modulus", and "kitControl:Power" when adding the entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 531-533: The API reference table in README is missing entries for
the newly implemented math wrappers; update the methods table to include
add_abs_value, add_modulus, and add_power (matching the checklist just above) by
adding rows describing each method name, signature, brief description, and any
relevant params/return types so the README’s method table and checklist are
consistent; locate the methods table near the current math section and insert
the three entries with identical formatting to existing rows for other math
wrappers.

---

Nitpick comments:
In `@src/bog_builder/models.py`:
- Around line 171-173: SLOT_TYPE_MAPPING currently lacks explicit entries for
the new math node input slots (e.g., "kitControl:AbsValue" inputs "inA";
"kitControl:Modulus" inputs "inA","inB"; "kitControl:Power" inputs "inA","inB"),
causing them to fall back to implicit typing; update SLOT_TYPE_MAPPING to add
explicit slot type mappings for these nodes (map each "inA" and "inB" to the
appropriate numeric slot type used elsewhere in SLOT_TYPE_MAPPING) so the type
system is deterministic and self-documenting, referencing the node keys
"kitControl:AbsValue", "kitControl:Modulus", and "kitControl:Power" when adding
the entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c938cd6-9f53-4fe3-87a1-93c703f11900

📥 Commits

Reviewing files that changed from the base of the PR and between 0248d94 and bfe768c.

📒 Files selected for processing (3)
  • README.md
  • src/bog_builder/builder.py
  • src/bog_builder/models.py

Comment thread README.md
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.

1 participant