Skip to content

feat(meshcore): compact {ROUTE} auto-ack variable by dropping arrow spaces (#3776)#3779

Merged
Yeraze merged 1 commit into
mainfrom
feat/3776-route-no-spaces
Jun 26, 2026
Merged

feat(meshcore): compact {ROUTE} auto-ack variable by dropping arrow spaces (#3776)#3779
Yeraze merged 1 commit into
mainfrom
feat/3776-route-no-spaces

Conversation

@Yeraze

@Yeraze Yeraze commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #3776.

MeshCore channel messages are length-limited (~120 chars when a scope is present), and shorter messages transmit more reliably while costing less airtime. The {ROUTE} template variable used in Auto Acknowledge / auto-reply messages expanded the relay-hash hop chain with spaces around every arrow. This removes the surrounding spaces so the route stays readable but more compact, saving 2 bytes per hop.

Before / After

Before:  43ad → b8bf → 6abc → a5f2
After:   43ad→b8bf→6abc→a5f2

Change

  • src/server/meshcoreManager.ts — in replaceAutoAckTokens, the hop join changed from .join(' → ') to .join('→') (same glyph, no surrounding spaces). Comment updated to document the airtime rationale.
  • The direct (0 hops) and (unknown) fallbacks are unchanged.

Tests

  • New src/server/meshcoreManager.autoAckRoute.test.ts asserts:
    • hops join with a bare arrow and no surrounding spaces (guards against the old ever returning)
    • hop tokens are trimmed and empties dropped before joining
    • a single hop renders with no arrow
    • direct fallback when route is empty and hops === 0
    • fallback when route and hop count are unknown
  • Related suites green: meshcoreManager.scope.test.ts, meshcoreNativeBackend.otaPacket.test.ts, new suite — 56 tests, 0 failures.

Display/formatting change only; no system-test label.

🤖 Generated with Claude Code

…paces (#3776)

MeshCore channel messages are length-limited (~120 chars with a scope) and
shorter messages transmit more reliably and cost less airtime. The {ROUTE}
auto-acknowledge / auto-reply template variable previously expanded the hop
chain with spaces around each arrow ("43ad → b8bf → 6abc → a5f2"). This drops
the surrounding spaces so it renders as "43ad→b8bf→6abc→a5f2", saving 2 bytes
per hop while staying readable.

Adds meshcoreManager.autoAckRoute.test.ts covering the bare-arrow join, token
trimming, single-hop, "direct" (0 hops), and "—" (unknown) fallbacks.

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

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

Claude finished @Yeraze's task —— View job


PR Review: feat(meshcore): compact {ROUTE} auto-ack variable (#3776)

  • Read changed files
  • Review code quality and best practices
  • Check test coverage
  • Assess security and performance
  • Post final review

Summary

This is a clean, well-scoped change. The core modification (dropping spaces around in the route join) is minimal and correct, and the test suite is thorough for what it covers.


Code Quality

meshcoreManager.ts (lines 5212–5223)

The implementation is clean. The updated comment accurately documents the rationale and references the issue number, which is good practice.

One minor observation: the hardcoded version string on line 5241 (replace(/\{VERSION\}/g, '4.8.0')) is unrelated to this PR, but it's a pre-existing issue worth flagging — it'll silently serve stale version info as the codebase advances. Not a blocker, but worth a follow-up.


Test Coverage

meshcoreManager.autoAckRoute.test.ts

The test file is well-structured and covers the key cases:

  • ✅ Multi-hop route with bare arrow (guards against regression to )
  • ✅ Trimming and filtering of malformed/empty tokens
  • ✅ Single-hop (no arrow rendered)
  • direct fallback (0 hops, no route)
  • fallback (unknown route + unknown hops)

One gap worth noting: There is no test for the case where route is a non-null but effectively empty string after filtering (e.g., route = "," or route = " , " with hops !== 0). The current code:

if (route && route.length > 0) {
  routeStr = route
    .split(',')
    .map(h => h.trim())
    .filter(Boolean)
    .join('→');

If route = "," and hops = 2, the filter(Boolean) drops all tokens, resulting in routeStr = "" (empty string). The fallback branches are skipped since route was truthy. This means {ROUTE} would expand to an empty string rather than . This is a pre-existing edge case, but the new test file is a good place to cover it if you want to harden this path.


Security & Performance

No concerns. This is a display/formatting change with no I/O, no user-facing attack surface beyond a 2-byte airtime savings, and no performance implications.


Overall

Approved direction — the change is correct, minimal, and well-tested for the happy path and the main edge cases. The empty-token-after-filter edge case is worth a follow-up test but is not a blocker for this PR.

@Yeraze Yeraze merged commit 24d86fe into main Jun 26, 2026
19 checks passed
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.

[FEAT] Shorten {ROUTE}, in Auto Acknowledge by removing blanks

1 participant