Skip to content

fix: three CLI bugs causing post failures and account suspensions#3

Open
Ryan-Haines wants to merge 2 commits intoMartian-Engineering:masterfrom
Ryan-Haines:fix/cli-bugs
Open

fix: three CLI bugs causing post failures and account suspensions#3
Ryan-Haines wants to merge 2 commits intoMartian-Engineering:masterfrom
Ryan-Haines:fix/cli-bugs

Conversation

@Ryan-Haines
Copy link

What broke

Three bugs in the CLI were stacking on top of each other:

1. Post creation sends wrong field name (submoltsubmolt_name)

File: src/commands/posts.ts line 201
Bug: mb post sent { submolt: "..." } in the request body, but the API expects submolt_name. Result: every post silently failed.

2. Verify command hit wrong endpoint (/posts/{id}/verify/verify)

Bug: Verification challenges need POST /verify with a verification_code param. There was no verify command on master at all — and the version that existed elsewhere was hitting a non-existent /posts/{id}/verify route (404).
Result: every verification attempt failed, and 10 failures triggers an automatic 24-hour account suspension.

3. Verify answer sent as Number instead of String

Bug: The answer field was coerced with Number() but the API expects a string. Even if the endpoint was correct, verification would 400.

The compounding effect

Every comment posted generated a verification challenge → every verification hit a 404 → after 10 "failed challenges" the account got auto-suspended for 24 hours. The more active the CLI was, the faster the suspension.

What this PR changes

  • src/commands/posts.tssubmoltsubmolt_name in POST body (1-line fix)
  • src/commands/verify.ts — New verify command using correct POST /verify endpoint with verification_code param and String(answer) coercion
  • src/mb.ts — Register the new verify command

How to validate

# 1. Check post creation sends correct field
mb post --submolt test --title "test" --dry-run --json
# Verify the request body contains "submolt_name", not "submolt"

# 2. Check verify hits correct endpoint
mb verify --code "moltbook_verify_abc123" --answer "42" --dry-run --json
# Verify it targets POST /verify (not /posts/{id}/verify)
# Verify answer is a string "42" not number 42

# 3. Integration test (once un-suspended)
mb post --submolt general --title "test post"
# Should succeed instead of silently failing

Ryan Mac Mini added 2 commits February 19, 2026 23:44
Adds a 'verify' command that POSTs to /api/v1/verify with
{ verification_code, answer } (answer coerced to string).

Includes rate limiting, audit logging, dry-run support, and
error messaging warning about the 10-failure suspension threshold.

Closes #1
The API expects submolt_name but the CLI was sending submolt.
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.

1 participant