Skip to content

Retry an add only on a taken name, and show the server's refusal - #249

Merged
ewowi merged 1 commit into
MoonModules:mainfrom
AnjinMeili:app-add-retry
Nov 16, 2026
Merged

ewowi merged 1 commit into
MoonModules:mainfrom
AnjinMeili:app-add-retry

Conversation

@AnjinMeili

Copy link
Copy Markdown
Contributor

PR 0 of the Pi HUB75 series agreed in the agent-to-agent thread (https://discord.com/channels/700041398778331156/1571096940576510053). It is not HUB75 work, so it goes up alone.

What changes

Adding a MoonLive script from the picker retried the name with -2 to -20 on any refusal, then alerted that twenty modules of that name already exist. A name too long, or any other refusal, looked like twenty collisions.

  • addModule reports a refusal through an optional out-parameter ({status, error}); callers that pass none behave as before.
  • addPickedType retries only on 409 (name in use). Any other refusal stops at the first attempt and shows the server's own reason.

One file, src/ui/app.js, 14 lines of code.

Tested

  • In a browser, on the desktop build: adding the script particle-fountain (17 characters, over the 15-character module name limit) shows one alert with the server's reason ("could not add particle-fountain: missing type, a name too long, or no parent_id ..."); adding voronoi twice makes voronoi-2 with no alert.
  • JS suite 397/397, desktop 3,353/3,353, the S3 firmware (esp32s3-n16r8) built.
  • check_prose fails on counts this change does not raise: EmDash and SelfReference, which main shows on this machine too (likely Vale running without its C++ and Python grammars), and two Temporal findings in lines already on main. The change's own added lines carry no finding.

How it was written

The change was written with an AI agent (Claude) from the bug found while adding the HUB75 test pattern script; I read every line, ran the browser checks myself, and the agent ran the suites and checks.

Adding a module whose name the server refuses for any reason other than a taken name now shows the server's own reason at once, instead of retrying nineteen numbered names and then reporting twenty collisions.

KPI: 256lights | Desktop:2600KB | tick:8/10/8/1/8/8/167/7/7/8us(FPS:125000/100000/125000/1000000/125000/125000/5988/142857/142857/125000) | src:397(100835) | test:295(71352) | functions-over:333
Commit: src +19/-5 lines | test +0/-0 lines | duplicated lines 3190 -> 3190 (+0)

**UI**
- `addModule` reports a refusal through an optional out-parameter (`{status, error}`); callers that pass none behave as before.
- `addModule`'s comment says when it returns null: an empty `type`, a refusal or a failed request.
- `addPickedType` retries with `-2` to `-20` only on 409 (name in use); any other refusal, such as a name too long, stops at the first attempt and shows the server's error.

**Docs/CI**
- The backlog mirror re-rendered: two of the Project's cards changed since the last render.
- check_prose fails on counts this change does not raise: EmDash 989 -> 1039 and SelfReference 14 -> 16, which upstream/main itself shows on this machine (likely Vale without its C++ and Python grammars, W101, a hypothesis), and Temporal 170 -> 171 from upstream lines (1f42852, f5868a7); this change's added lines carry no finding.
- The Reviewer step skipped: one file, 14 lines.

Tested: desktop 3,353/3,353; JS suite 397/397; the S3 firmware (esp32s3-n16r8) built; `node --check` on app.js; in a browser on the desktop build (port 8083, a scratch data folder), adding the script particle-fountain (17 characters, over the 15-character name limit) showed one alert with the server's reason, and adding voronoi twice made voronoi-2 with no alert (James).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:22
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Automated regression tests are still needed to verify retry behavior for 409 collisions, other refusals, request failures, and the twenty-collision limit.

1 open issue
What changed in this PR

This PR fixes MoonLive script creation in the picker so only name collisions trigger retries, while other failures show their reported reason.

Changes:

  • Add optional failure details to addModule without changing existing callers.
  • Retry with numbered names only for HTTP 409 responses.
  • Refresh repository health metrics and record a desktop render-loop pacing backlog item.
File Description
src/​ui/​app.js Report add failures and restrict picker retries to name collisions.
docs/​work/​backlog_mirror/​platform.md Document the desktop render-loop pacing backlog item.
docs/​work/​backlog_mirror/​cards.json Add the corresponding backlog card metadata.
docs/​reference/​metrics/​repo-health.md Refresh the generated repository health report.
docs/​reference/​metrics/​repo-health.json Update the underlying repository health measurements.

Review effort: Balanced

Comment thread src/ui/app.js
return created;
}
// Only a taken name (409) is worth retrying with a suffix: any other refusal (a name too long, an unknown type, a missing parent) fails the same way with -2, so the add stops at the first and shows the server's own reason.
if (why.status !== 409) {
@ewowi
ewowi merged commit e54825c into MoonModules:main Nov 16, 2026
23 checks passed
ewowi added a commit that referenced this pull request Nov 16, 2026
#249 (the add retry) merged after this branch was cut; its regenerated repo-health conflicted with this branch's newer KPI run, which stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants