feat(execute): tip when mac-telnet runs with no credentials (JG-24)#47
Conversation
mac-telnet logs in with RouterOS credentials over MTWEI (MD5 is refused by current RouterOS), so an empty login is rejected only at connect time. execute now surfaces that up front: when the resolved transport is mac-telnet and no username/password is resolved from any source, the envelope carries a `tip/mac-telnet-no-credentials` pointer (advice, not an error — the call is still attempted), on both the success and resolved-error paths. The MTWEI-vs-MD5 auth default is already correct and guarded (`offerMtwei` defaults true; `test/unit/mac-telnet.test.ts`), so JG-24's "don't invert the auth default" half needs no change — only the missing tip. Promotes the `tip()` builder + `TIPS_BASE_URL` from devices.ts to `core/envelope.ts` (`buildTip`, where the `Tip` type lives) so execute and devices share one definition. Hermetic unit tests pin the fire/no-fire matrix (mac-telnet + no creds fires; password, username-only, or an IP transport do not). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 23 minutes and 22 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adds an advisory “tips” signal to the execute result envelope when a resolved mac-telnet run has no resolved username and no resolved password, and centralizes tip construction so tip URLs are generated consistently across commands.
Changes:
- Add
resolvedExecuteTips()and wire it into both execute success and error envelopes. - Promote the tip builder + base URL into
src/core/envelope.tsand reuse it fromdevices. - Add unit tests for the mac-telnet no-credentials tip logic and document the new tip in
commands/execute/README.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/unit/execute.test.ts | Adds hermetic tests for the new mac-telnet “no credentials” tip logic. |
| src/execute.ts | Computes and attaches execute tips based on the resolved request (mac-telnet + no creds). |
| src/devices.ts | Switches existing device tips to use the shared buildTip() helper. |
| src/core/envelope.ts | Introduces TIPS_BASE_URL and buildTip() for consistent tip URL generation. |
| commands/execute/README.md | Documents when and why tip/mac-telnet-no-credentials is emitted. |
| expect(tips.map((t) => t.code)).toContain("tip/mac-telnet-no-credentials"); | ||
| expect(tips[0]?.detailsUrl).toContain( | ||
| "/tips/tip/mac-telnet-no-credentials", | ||
| ); | ||
| expect(tips[0]?.fix).toContain("MTWEI"); |
What
When
executeresolves to mac-telnet with no username or password from any source, the envelope now carries atip/mac-telnet-no-credentialspointer. mac-telnet logs in with RouterOS credentials over MTWEI (MD5 is refused by current RouterOS), so an empty login is rejected only at connect time — this surfaces it up front. It's a tip, not an error (the constitution's "no username set" advice channel); the call is still attempted.The two halves of JG-24
offerMtweidefaults totrue(MTWEI offered first, MD5 only as fallback) andtest/unit/mac-telnet.test.tsexercises the default. No change needed.How
resolvedExecuteTips(resolved)fires the tip whenvia === "mac-telnet"and no username and no password were resolved (the true "no auth options" case — a username-only or password-present resolution does not fire). Wired into both the success and resolved-error envelope builders (previously hard-codedtips: []).tip()builder +TIPS_BASE_URLfromdevices.tstocore/envelope.ts(buildTip, alongside theTiptype);devices.tsnow imports it. No behavior change to the existing device tips.Tests / verification
test/unit/execute.test.ts— hermetic fire/no-fire matrix (mac-telnet+no-creds fires; password, username-only, and IP transports do not; details URL + MTWEI mention checked).buildTip.bun run lint✅ ·bun run lint:ci✅ ·bun run test(704 pass) ✅ ·bun run build✅Additive advisory metadata — the mac-telnet run path is unchanged, so no CHR run is required. MATRIX unchanged.
🤖 Generated with Claude Code