Skip to content

fix: persist Auto Acknowledge pattern testing text#1881

Merged
Yeraze merged 1 commit into
mainfrom
fix/persist-auto-ack-test-messages
Feb 13, 2026
Merged

fix: persist Auto Acknowledge pattern testing text#1881
Yeraze merged 1 commit into
mainfrom
fix/persist-auto-ack-test-messages

Conversation

@Yeraze

@Yeraze Yeraze commented Feb 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds autoAckTestMessages as a persisted setting so the "Pattern Testing" textarea in Auto Acknowledge survives page reloads and triggers the SaveBar on edit
  • Follows the exact same pattern as every other autoAck* setting (UIContext state → App.tsx load → component prop → save POST → server whitelist)
  • No migration needed — settings use the existing key-value table

Closes #1879

Test plan

  • Navigate to Automation → Auto Acknowledge
  • Edit the "Pattern Testing" textarea — SaveBar should appear
  • Save → reload → the edited text persists
  • Dismiss (reset) restores to the previously saved value (or default if never saved)

🤖 Generated with Claude Code

)

The "Pattern Testing" textarea was purely local state with a hardcoded
default, so edits were lost on page reload and never triggered the
SaveBar. Add autoAckTestMessages as a persisted setting following the
same pattern as all other autoAck* settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown

Claude finished @Yeraze's task —— View job


Code Review Complete ✅

Reviewing PR #1881 for code quality, best practices, potential bugs, performance, security, and test coverage.

Todo List

  • Read and analyze changed files
  • Review implementation against existing autoAck* patterns
  • Check code quality and best practices
  • Identify potential bugs or issues
  • Assess performance considerations
  • Review security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Review Feedback

Overall Assessment: ✅ APPROVED

The implementation correctly follows the established pattern for persisted autoAck* settings. The code quality is good and the changes are minimal and focused.

Code Quality & Best Practices

  • Pattern Consistency: Perfect adherence to the existing autoAck* pattern:
    1. ✅ Added autoAckTestMessages to UIContext state (UIContext.tsx:70-71,198,324-325)
    2. ✅ Added to server whitelist (server.ts:4840)
    3. ✅ Added loading logic in App.tsx (App.tsx:986-988)
    4. ✅ Connected props to component (App.tsx:4541,4559)
  • State Management: Follows React best practices with proper useState initialization and useEffect dependencies
  • Save Integration: Correctly integrated with SaveBar system using existing useSaveBar hook
  • Default Value Handling: Consistent fallback to hardcoded default when no saved value exists

No Bugs Identified

  • Default Handling: Properly handles undefined testMessagesProp with sensible fallback in multiple locations (AutoAcknowledgeSection.tsx:117,147,169)
  • Change Detection: Correctly included in change detection logic (AutoAcknowledgeSection.tsx:147)
  • Reset Functionality: Properly included in resetChanges callback (AutoAcknowledgeSection.tsx:169)
  • Save Payload: Correctly added to POST request body (AutoAcknowledgeSection.tsx:273)
  • Parent Callback: Properly calls parent onTestMessagesChange after successful save (AutoAcknowledgeSection.tsx:302)

Performance Considerations

  • Minimal Impact: Only adds one string field to existing state and API operations
  • Efficient Updates: Uses existing patterns that are already optimized
  • No Unnecessary Re-renders: Proper dependency arrays in useEffect hooks

Security Review

  • Input Validation: The field accepts arbitrary text which is appropriate for a test pattern field
  • Server Whitelist: Correctly added to the server-side validation whitelist (server.ts:4840)
  • No Security Concerns: Field is used only for local pattern testing, not for actual message processing

Test Coverage Assessment

  • Existing Pattern: Other autoAck* settings have test coverage in AutoAcknowledgeSection.test.tsx
  • Low Risk: This follows the exact same pattern as existing tested functionality
  • Recommendation: No additional tests required as this mirrors existing well-tested patterns

📋 Minor Observations

  1. Consistent Defaults: The hardcoded default 'test\nTest message\nping\nPING\nHello world\nTESTING 123' is used in 3 places - this is acceptable for this use case
  2. Migration: As noted in PR description, no database migration is needed since settings use the existing key-value table

Architecture Compliance

Follows MeshMonitor's established patterns:

  • ✅ Frontend state → App.tsx loading → component props → save POST → server whitelist
  • ✅ Proper async database operation patterns
  • ✅ Consistent with existing AutoAck* settings implementation

Recommendation: MERGE - This is a clean, focused implementation that correctly implements the requested persistence functionality while following all established patterns.


Job run

@Yeraze Yeraze merged commit 5da43b6 into main Feb 13, 2026
11 checks passed
@Yeraze Yeraze deleted the fix/persist-auto-ack-test-messages branch February 13, 2026 15:03
@Yeraze Yeraze mentioned this pull request Feb 13, 2026
3 tasks
dpaschal pushed a commit to dpaschal/meshcore-monitor that referenced this pull request Mar 17, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Yeraze added a commit that referenced this pull request Jun 23, 2026
…) (#3679)

* feat(meshcore): region discovery from nearby repeaters — phase 3 (#3667)

Completes #3667: discover the regions/scopes served by nearby repeaters so users
can pick a valid scope instead of guessing.

Mechanism (firmware docs/payloads.md): a "regions request" is an ANON_REQ
sub-type 0x01 sent to a repeater (CMD_SEND_ANON_REQ = 57); the repeater replies
via PUSH_CODE_BINARY_RESPONSE (0x8C) with clock(4 LE) + a NUL-terminated,
comma-separated ASCII list of region names ('*' = legacy null region). meshcore.js
(ours and upstream) doesn't expose CMD 57, but it DOES parse the 0x8C reply, so we
build the raw frame and match the reply by tag in the native backend — no fork change.

- Native backend: `request_regions` bridge command — builds [57][pubkey:32][0x01]
  [0x00], awaits Sent(tag)+BinaryResponse(0x8C), parses clock + region names.
- Manager: `discoverRegions()` — queries each repeater/room-server contact
  sequentially (tag-correlation requires it), de-dupes, drops the '*' wildcard,
  skips non-responders. Zero-hop/direct request → no scope assertion needed.
- Route: POST /api/sources/:id/meshcore/regions/discover.
- UI: "Discover regions from repeaters" button in the default-scope section;
  discovered regions render as chips that fill the scope field on click.
- Tests: native-backend frame layout + reply parsing (clock/NUL/CSV); manager
  dedupe/sort, '*' filtering, non-repeater skip, non-responder tolerance.

Coverage depends on repeaters in the contact list — the UI hints to run
"Discover Repeaters" first (mirrors the official app; see upstream #1881).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4

* fix(meshcore): address phase 3 review — tag race, permission, logging (#3667)

Address Claude review feedback on PR #3679:
- Harden request_regions reply matching: only accept a BinaryResponse once the
  Sent ack has set our tag (tag===null no longer resolves on a stray reply).
- /regions/discover now requires 'nodes' 'write' (it transmits radio frames),
  matching POST /discover instead of the weaker 'read'.
- discoverRegions logs at debug when a repeater returns an error response (not
  just on throw).
- UI: cross-disable the node-discovery and region-discovery buttons so
  overlapping radio requests can't be triggered; clear the suggestion chips
  once a scope is saved.
- Test: discoverRegions returns empty (and queries nothing) on a non-companion
  device.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

[BUG] editing Auto Acknowledge Pattern Testing list doesn't give a save option

1 participant