Skip to content

fix: make GraphicalDisplayRenderer subclassable - #433

Merged
forntoh merged 2 commits into
masterfrom
fix/431-432-renderer-subclass-access
Sep 28, 2026
Merged

forntoh merged 2 commits into
masterfrom
fix/431-432-renderer-subclass-access

Conversation

@forntoh

@forntoh forntoh commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes GraphicalDisplayRenderer properly subclassable by opening up the geometry helpers and active-item state that custom renderer subclasses need (reported against v5.13.0).

Changes

Verification

  • pio run -e esp32: SUCCESS (RAM 7.1%, flash 25.8%)
  • pio run -e uno: compiles; fails only the pre-existing checkprogsize size limit, byte-identical to the pre-change baseline (local harness src/main.cpp includes all dependencies)
  • Subclass compile proof: a minimal GraphicalDisplayRenderer subclass overriding drawItem and calling the newly protected members plus the new accessors compiles on both environments (proof code reverted afterward)
  • clang-format --dry-run -Werror clean; git diff --check clean

Fixes #431
Fixes #432

Summary by CodeRabbit

  • Improvements
    • Added access to the currently active menu item and a way to check whether a menu item is active.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 90bd391d-7986-442d-b41a-b27028266731

📥 Commits

Reviewing files that changed from the base of the PR and between d8d9723 and 379f699.

📒 Files selected for processing (1)
  • src/renderer/GraphicalDisplayRenderer.h
📝 Walkthrough

Walkthrough

GraphicalDisplayRenderer adds getActiveItem() and isActiveItem() as public const accessors. The latter returns true only when the active item is non-null and matches the supplied item. A protected: access label is also added.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Feature · Severity of issue fixed: Low

Merge Risk: 🔵 Low · up to d8d97

A custom item callback can remove and delete itself while the renderer still exposes it as active, allowing a subclass to access freed storage. This is a narrow extension-code risk; clear the active context before removal to address it.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d8d97

The new accessors do not change how items are selected or grant control over them. They do expose a borrowed item pointer whose validity during item removal is not guaranteed, so custom renderer code needs care when using it.

Retained concerns

  • Low · security · inferred: The new public getter can expose a borrowed active-item pointer after reentrant removal and before lifecycle cleanup. If the owner deletes that item and custom code dereferences the getter result, freed storage could be accessed; no such runtime sequence is demonstrated.
Security review details

Security Blast Radius

  • inferred — The plausible effect is confined to applications using the renderer API and custom item lifecycles; the reviewed change does not establish a cross-service or privileged sink path.

Security Findings and Attack Paths

  • inferred — A custom item callback can run while its item is active and can reach screen removal. External deletion followed by a custom renderer’s dereference of the new getter would create a potential use-after-free path, but neither that subclass behavior nor attacker control of it is established.

Trust Boundaries and Controls

  • observed — The accessors provide observation and identity comparison, not item mutation or callback registration. Active-item assignment remains on the existing renderer lifecycle path.

Hardening Proposals

  • proposed — Specify the returned pointer’s borrowed lifetime for subclass authors and consider invalidating active-item state when removal can occur during a callback.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: enabling custom GraphicalDisplayRenderer subclasses through access-level updates and new accessors.
Linked Issues check ✅ Passed The reviewed header places all seven methods named by #431 under protected: measureText, toggleIndicatorWidth, rowHeight, drawScrollBar, getMaxRows, getMaxCols, and getEffectiveCols. I…
Out of Scope Changes check ✅ Passed The reviewed changes only alter GraphicalDisplayRenderer access and add active-item accessors. These changes directly support #431 and #432. No unrelated behavior, state exposure, or feature change …
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

coderabbitai[bot]

This comment was marked as resolved.

forntoh added a commit that referenced this pull request Sep 28, 2026
## Summary

- Removes the dangling esp8266 `include` block from the Compile Examples
workflow matrix.

## Why

Since bbd2b8f ("Remove esp8266 board configuration from compile
workflow") removed the esp8266 matrix board entry, the leftover
`include` block (no `fqbn`, empty `libraries`/`sketch-paths`) has
spawned a broken esp8266 job on every workflow run — it fails with
`IndexError: list index out of range` before compiling anything (see the
failed job on #433 and #434). That commit's own verification run was
cancelled, so the breakage went unnoticed.

This completes the original removal intent and un-breaks the compile
workflow for all current and future PRs.

## Verification

- `git diff`: only the 9-line esp8266 include block removed; the four
board matrix entries (esp32, avr:uno, mkr1000, stm32) and all remaining
include blocks (AVR, ESP32, SAMD, STM32) are untouched.
- YAML validated: `yaml.safe_load` (temp venv) and independently via
ruby `YAML.load_file` — both pass.

## Notes

- If the esp8266 compile job is listed as a required status check in
branch protection, that repository setting should be updated after this
merges.
- After this merges, open PRs with a recorded failed esp8266 job (e.g.
#433) may need a branch update to re-run checks.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Automated build validation no longer includes ESP8266 board
configurations. This changes which board builds are checked
automatically; it does not describe a change to the behavior of existing
devices.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@forntoh forntoh added the bugfix I have fixed a bug label Sep 28, 2026
@forntoh
forntoh enabled auto-merge (squash) September 28, 2026 11:46
@forntoh
forntoh disabled auto-merge September 28, 2026 11:46
@forntoh
forntoh merged commit f57ac96 into master Sep 28, 2026
15 of 17 checks passed
@forntoh
forntoh deleted the fix/431-432-renderer-subclass-access branch September 28, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix I have fixed a bug

Projects

None yet

1 participant