Skip to content

Fix bolt guide crash when using rainbow formatter#230

Open
op-ct wants to merge 2 commits intoOpenVoxProject:mainfrom
op-ct:fix/rainbow-guide-crash
Open

Fix bolt guide crash when using rainbow formatter#230
op-ct wants to merge 2 commits intoOpenVoxProject:mainfrom
op-ct:fix/rainbow-guide-crash

Conversation

@op-ct
Copy link
Copy Markdown
Contributor

@op-ct op-ct commented May 1, 2026

Short description

Fixes #229

Follows the example of the human outputter.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document and added a Signed-off-by annotation to each of my commits
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@bastelfreak bastelfreak added the bug Something isn't working label May 1, 2026
@nmburgan
Copy link
Copy Markdown
Member

nmburgan commented May 5, 2026

I'm not quite sure I understand how this was failing before...

binford2k
binford2k previously approved these changes May 5, 2026
@binford2k binford2k dismissed their stale review May 5, 2026 18:40

needs more investigation

@binford2k
Copy link
Copy Markdown
Contributor

I'm not quite sure I understand how this was failing before...

I'm not sure I understand why the variety of method signatures in https://github.com/search?q=repo%3AOpenVoxProject%2Fopenbolt%20print_topics&type=code

@op-ct
Copy link
Copy Markdown
Contributor Author

op-ct commented May 5, 2026

I'm not quite sure I understand how this was failing before...

In 759f54c, the argument passed into the outputters' print_topics methods changed from outputter.print_topics(topics) to outputter.print_topics(topics: topics). The human outputter was updated to accommodate this with a keyword arg, but the rainbow outputter wasn't―so it interprets the topics: topics keyword as a positional arg (Hash) instead of a keyword (Array). When it tries to join the supposed "Array", it fails (as seen in #229)

@op-ct
Copy link
Copy Markdown
Contributor Author

op-ct commented May 5, 2026

I'm not sure I understand why the variety of method signatures in https://github.com/search?q=repo%3AOpenVoxProject%2Fopenbolt%20print_topics&type=code

@binford2k I'm not certain of the original reasoning behind the additional **kwargs (conjecture below); I ported it to match the human outputter's signature for print_topics.

FWIW, the same commit (759f54c) updated the json outputter to accept print_topics(**kwargs) resulting in it interpreting the keyword arg as a Hash and thus outptting a semantically comprehensible topics key:

{"topics":["debugging","inventory","links","logging","module","modulepath","project","targets","transports"]}

The human outputter added a positional **kwargs in the same commit, possibly in solidarity (because I don't see any other use for it).

@binford2k
Copy link
Copy Markdown
Contributor

@op-ct that makes this method explanation quite incorrect then! This mismatch is what threw me off.

Think you could fix that comment and add a bit like "we don't need the keyword argument; it's interpreted a hash and thus this outputs semantically correct json."

@op-ct op-ct force-pushed the fix/rainbow-guide-crash branch from a8af31e to 45d66c4 Compare May 6, 2026 02:09
Signed-off-by: Chris Tessmer <chris.tessmer@onyxpoint.com>
@op-ct op-ct force-pushed the fix/rainbow-guide-crash branch 2 times, most recently from 2361093 to 5cc829c Compare May 6, 2026 02:33
Ever since commit 759f54c, the method signatures for the various format
outputters (`json`, `human`, `rainbow`) have been inconsistent.

This patch removes unused/unneccessary `**kwargs`,  standardizes
arguments as `(topics: [<Array of guide names>]`),  and updates method
documentation to reflect their actual behavior.

Signed-off-by: Chris Tessmer <chris.tessmer@onyxpoint.com>
@op-ct op-ct force-pushed the fix/rainbow-guide-crash branch from 5cc829c to 11ea72b Compare May 6, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running bolt guide with rainbow formatter causes crash

4 participants