[GH-ISSUE #5895] mari db CLI misparses row ids that start with '-' as flags (intermittent CI red + un-addressable rows) #3252

Closed
opened 2026-10-21 06:01:16 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5895

Originally assigned to: @SpicyMarinara on GitHub.

In one sentence: nanoid IDs can legally begin with -, and the mari db CLI parses such an ID as a flag — making every id-positional command (patch, get, delete…) fail with a usage error for ~1 in 64 generated rows, which also intermittently fails the open-issues regression lane in CI.

Caught in the wild

CI run 34044151642 (complete-node-regressions on an unrelated PR):

AssertionError: reparenting an entry to another lorebook must succeed:
{"ok":false,"mode":"read","command":"mari db patch lorebook_entries --EwXN_y0nAZbMu0baN4O --json {...} --apply",
 "error":"Usage: mari db patch <table> <id> (--json '<partial-row-json>' | --json-file <path>) [--apply]"}

The entry's generated id was -EwXN_y0nAZbMu0baN4O; the CLI's argv scan treated it as an option, leaving the positional <id> empty. The default nanoid alphabet includes - and _, both position-unrestricted, so roughly 1/64 of all generated ids start with -.

Impact

  • Professor Mari's direct CLI runtime hits the same wall: any store row whose id begins with - cannot be addressed positionally by mari db get/patch/delete, so a real user's unlucky row is un-patchable through the CLI until worked around.
  • The open-issues lane creates fresh rows each run, so CI eats an unrelated red roughly whenever an unlucky id lands in an id-positional call — the disruptive-flake class of #5788.

Fix directions

  • Teach the argv parser that the token in an id position is a positional even when it starts with - (e.g. only treat tokens as flags if they match known option names), and/or support the conventional -- end-of-options separator and use it wherever the engine composes CLI calls (parseDirectMariArgv/lane helpers).
  • Belt: the lane could regenerate ids that start with -, but that hides the user-facing CLI bug rather than fixing it — parser first.
Originally created by @kolacheee on GitHub (Sep 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5895 Originally assigned to: @SpicyMarinara on GitHub. **In one sentence:** nanoid IDs can legally begin with `-`, and the `mari db` CLI parses such an ID as a flag — making every id-positional command (`patch`, `get`, `delete`…) fail with a usage error for ~1 in 64 generated rows, which also intermittently fails the `open-issues` regression lane in CI. ## Caught in the wild CI run 34044151642 (`complete-node-regressions` on an unrelated PR): ``` AssertionError: reparenting an entry to another lorebook must succeed: {"ok":false,"mode":"read","command":"mari db patch lorebook_entries --EwXN_y0nAZbMu0baN4O --json {...} --apply", "error":"Usage: mari db patch <table> <id> (--json '<partial-row-json>' | --json-file <path>) [--apply]"} ``` The entry's generated id was `-EwXN_y0nAZbMu0baN4O`; the CLI's argv scan treated it as an option, leaving the positional `<id>` empty. The default nanoid alphabet includes `-` and `_`, both position-unrestricted, so roughly 1/64 of all generated ids start with `-`. ## Impact - Professor Mari's direct CLI runtime hits the same wall: any store row whose id begins with `-` cannot be addressed positionally by `mari db get/patch/delete`, so a real user's unlucky row is un-patchable through the CLI until worked around. - The `open-issues` lane creates fresh rows each run, so CI eats an unrelated red roughly whenever an unlucky id lands in an id-positional call — the disruptive-flake class of #5788. ## Fix directions - Teach the argv parser that the token in an id position is a positional even when it starts with `-` (e.g. only treat tokens as flags if they match known option names), and/or support the conventional `--` end-of-options separator and use it wherever the engine composes CLI calls (`parseDirectMariArgv`/lane helpers). - Belt: the lane could regenerate ids that start with `-`, but that hides the user-facing CLI bug rather than fixing it — parser first.
bsakaguchi 2026-10-21 06:01:16 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 7, 2026):

Owner: @SpicyMarinara; Codex is taking this in draft issue-sweep PR #5929. Existing issue-linked branches and open/draft PRs were checked before starting. I will verify the reported behavior against current staging and keep the fix and regression proof focused.

<!-- gh-comment-id:5573739468 --> @SpicyMarinara commented on GitHub (Sep 7, 2026): Owner: @SpicyMarinara; Codex is taking this in draft issue-sweep PR #5929. Existing issue-linked branches and open/draft PRs were checked before starting. I will verify the reported behavior against current staging and keep the fix and regression proof focused.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 7, 2026):

Fixed in #5929, merged into staging as 4f67630e6 after the full regression matrix and completed CodeRabbit review.

<!-- gh-comment-id:5574822553 --> @SpicyMarinara commented on GitHub (Sep 7, 2026): Fixed in #5929, merged into staging as 4f67630e6 after the full regression matrix and completed CodeRabbit review.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3252
No description provided.