Skip to content

Conversation

@strawmelonjuice
Copy link
Collaborator

@strawmelonjuice strawmelonjuice commented Nov 27, 2025

Summary by CodeRabbit

  • Documentation

    • Added README files for the client and server describing package roles and directing users to GitHub releases for installation and usage.
  • Chores

    • Pinned a client dependency to a specific release and updated the server package declaration to match.
    • Reworked the release workflow into a multi-step publish process with explicit sequencing, logging and robust error handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

Adds README files for client and server packages, pins the bungibindies dependency to version 1.2.0-rc, updates the server manifest to reference cynthia_websites_mini_client at 1.2.0-rc, and replaces the single-step release script with a multi-stage mise/tasks/new-release process that publishes client then server with temporary toml edits and explicit error handling and logging.

Changes

Cohort / File(s) Summary
Documentation
cynthia_websites_mini_client/README.md, cynthia_websites_mini_server/README.md
Adds README files describing the client/server package layout and pointing users to the GitHub Releases page for installation/usage.
Dependency Management
cynthia_websites_mini_server/gleam.toml, cynthia_websites_mini_server/manifest.toml
Pins bungibindies in gleam.toml to version 1.2.0-rc (replacing a git-based reference) and updates manifest.toml to bump the exported cynthia_websites_mini_client version from 1.1.6 to 1.2.0-rc.
Release Orchestration
mise/tasks/new-release
Reworks the release flow into a multi-stage process: push commits, publish client (gleam publish), temporarily update server gleam.toml to reference the published client version, publish server, revert gleam.toml, then push the tag; adds detailed logging and immediate abort on failures, and preserves no-commit/no-push controls.

Sequence Diagram(s)

sequenceDiagram
    actor Maintainer
    participant Script as mise/tasks/new-release
    participant Git as Git
    participant ClientPub as Client (gleam publish)
    participant Toml as server/gleam.toml
    participant ServerPub as Server (gleam publish)

    Maintainer->>Script: Run new-release
    Script->>Git: Push commits
    alt push fails
        Git-->>Script: error
        Script->>Maintainer: abort with error
    end

    rect rgb(220,235,255)
    Note over Script,ClientPub: Publish client package first
    Script->>ClientPub: gleam publish (client)
    alt client publish fails
        ClientPub-->>Script: error
        Script->>Maintainer: abort with error
    end
    end

    Script->>Toml: Modify dependency (path → version) (temporary)
    Script->>ServerPub: gleam publish (server)
    alt server publish fails
        ServerPub-->>Script: error
        Script->>Toml: attempt revert
        Script->>Maintainer: abort with error
    end

    Script->>Toml: Revert dependency to path
    Script->>Git: Push tag
    Script->>Maintainer: complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review focus:
    • mise/tasks/new-release multi-step control flow, subprocess invocation, stderr propagation and exit-on-failure behaviour.
    • Correctness and atomicity of the temporary gleam.toml modification and reliable restore in all failure paths.
    • Consistency between gleam.toml dependency pin and manifest.toml client version bump.

Possibly related PRs

Poem

🐰
I hopped through tomls, pins and prose,
Published client where the new version glows,
Tweaked the server, then made it right,
Commits and tags tucked snug at night,
A tiny hop — release takes flight ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'feat: Publish to hex.pm' accurately reflects the main changes: updates to the release workflow, version bumps, and READMEs enabling Gleam package publishing to Hex.pm.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gleam-publish

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
mise/tasks/new-release (1)

184-186: Consider using the already-imported join from 'path' instead of a custom implementation.

The join function from the path module is already imported at line 115. The custom pathJoin using URL manipulation is unnecessary complexity.

-    const pathJoin = (a, b) => new URL(b, new URL('file://' + (a.endsWith('/') ? a : a + '/'))).pathname;
-    const clientDir = pathJoin(config_root, "cynthia_websites_mini_client");
-    const serverDir = pathJoin(config_root, "cynthia_websites_mini_server");
+    const clientDir = join(config_root, "cynthia_websites_mini_client");
+    const serverDir = join(config_root, "cynthia_websites_mini_server");
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0f0c9e and 556be3a.

📒 Files selected for processing (4)
  • cynthia_websites_mini_client/README.md (1 hunks)
  • cynthia_websites_mini_server/README.md (1 hunks)
  • cynthia_websites_mini_server/gleam.toml (1 hunks)
  • mise/tasks/new-release (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-07-10T13:40:49.897Z
Learnt from: strawmelonjuice
Repo: CynthiaWebsiteEngine/Mini PR: 33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.897Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.

Applied to files:

  • cynthia_websites_mini_server/README.md
  • cynthia_websites_mini_client/README.md
📚 Learning: 2025-07-11T23:05:46.554Z
Learnt from: strawmelonjuice
Repo: CynthiaWebsiteEngine/Mini PR: 39
File: cynthia_websites_mini_server/test/cynthia_websites_mini_server_test.gleam:2-3
Timestamp: 2025-07-11T23:05:46.554Z
Learning: In the CynthiaWebsiteEngine/Mini project, Mise build tasks handle compilation order and codegen, ensuring proper dependency resolution even when server tests import from the client package.

Applied to files:

  • cynthia_websites_mini_server/README.md
  • cynthia_websites_mini_client/README.md
🔇 Additional comments (3)
cynthia_websites_mini_client/README.md (1)

1-5: LGTM!

The README provides a clear, concise description of the package structure and directs users appropriately to the releases page for installation guidance.

cynthia_websites_mini_server/gleam.toml (1)

27-27: LGTM!

Pinning bungibindies to a versioned dependency rather than a git reference is appropriate for the release workflow.

mise/tasks/new-release (1)

227-235: Uncommitted changes may remain after tag push.

After reverting the server's gleam.toml back to the path dependency (line 230), this change is not committed. If the script completes successfully, the working directory will have uncommitted modifications to gleam.toml. Consider whether this is intentional or if the revert should be committed (or the modification should happen in a way that doesn't affect the working tree).

Comment on lines 216 to 225
const serverPublish = Bun.spawnSync(["gleam", "publish"], { cwd: serverDir });
if (serverPublish.exitCode !== 0) {
console.error("Failed to publish server package via Gleam.");
if (serverPublish.stderr) {
console.error(serverPublish.stderr.toString());
}
// Attempt to revert the gleam.toml if modified
try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }
process.exit(1);
}
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 27, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Add --yes flag here as well, and improve error handling on revert.

Same issue as the client publish — needs --yes to avoid hanging. Additionally, the silent catch {} on line 223 swallows any error details if the revert fails, making debugging difficult.

-    const serverPublish = Bun.spawnSync(["gleam", "publish"], { cwd: serverDir });
+    const serverPublish = Bun.spawnSync(["gleam", "publish", "--yes"], { cwd: serverDir });
     if (serverPublish.exitCode !== 0) {
         console.error("Failed to publish server package via Gleam.");
         if (serverPublish.stderr) {
             console.error(serverPublish.stderr.toString());
         }
         // Attempt to revert the gleam.toml if modified
-        try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }
+        try { 
+            await Bun.write(serverTomlPath, serverTomlOrig); 
+        } catch (revertErr) {
+            console.error("Additionally failed to revert server gleam.toml:", revertErr);
+        }
         process.exit(1);
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const serverPublish = Bun.spawnSync(["gleam", "publish"], { cwd: serverDir });
if (serverPublish.exitCode !== 0) {
console.error("Failed to publish server package via Gleam.");
if (serverPublish.stderr) {
console.error(serverPublish.stderr.toString());
}
// Attempt to revert the gleam.toml if modified
try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }
process.exit(1);
}
const serverPublish = Bun.spawnSync(["gleam", "publish", "--yes"], { cwd: serverDir });
if (serverPublish.exitCode !== 0) {
console.error("Failed to publish server package via Gleam.");
if (serverPublish.stderr) {
console.error(serverPublish.stderr.toString());
}
// Attempt to revert the gleam.toml if modified
try {
await Bun.write(serverTomlPath, serverTomlOrig);
} catch (revertErr) {
console.error("Additionally failed to revert server gleam.toml:", revertErr);
}
process.exit(1);
}
🤖 Prompt for AI Agents
In mise/tasks/new-release around lines 216 to 225, the Gleam publish call needs
the non-interactive flag and the revert catch must not silently swallow errors:
change the spawn to include the "--yes" arg (e.g. ["gleam","publish","--yes"])
so it won’t hang, and replace the empty catch around the
Bun.write(serverTomlPath, serverTomlOrig) with error handling that logs the
failure (include the caught error message and stack) and exits with a non-zero
code or rethrows so a failed revert is visible for debugging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be fixed!

Copy link
Contributor

Choose a reason for hiding this comment

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

@strawmelonjuice Thanks for adding the -y flag! 👍 That will prevent the command from hanging.

However, I notice the error handling improvement for the revert operation hasn't been applied yet. On line 227, the catch block is still empty:

try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }

This silently swallows any errors that occur during the revert, making it difficult to debug if something goes wrong. Could you update it to log the error details? For example:

try { 
    await Bun.write(serverTomlPath, serverTomlOrig); 
} catch (revertErr) {
    console.error("Additionally failed to revert server gleam.toml:", revertErr);
}

This way, if the revert fails after a publish error, you'll have visibility into what went wrong.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
mise/tasks/new-release (1)

168-246: Success message does not reflect --no-commit / --no-push behaviour

When --no-push or --no-commit are set, the block that pushes, publishes, and pushes the tag is skipped, but the final log line still says:

Successfully bumped version from ... and created a new release!

In those cases no release has actually been created (and for --no-commit there may not even be a commit/tag), which can mislead both humans and automation.

Consider tracking whether the publish+tag path actually ran and adjusting the final message accordingly, for example:

-let noPush = args.includes("--no-push");
+let noPush = args.includes("--no-push");
+let didPublish = false;
 ...
-if (noPush) {
+if (noPush) {
     console.log("Skipping push to remote repository as --no-push flag is set.");
 }
 else if (!noCommit) {
@@
-    const pushTag = Bun.spawnSync(["git", "push", "origin", `v${newVersion}`], { cwd: config_root });
+    const pushTag = Bun.spawnSync(["git", "push", "origin", `v${newVersion}`], { cwd: config_root });
@@
-        process.exit(1);
-    }
-}
-console.log(`Successfully bumped version from ${currentVersion} to ${newVersion} and created a new release!`);
+        process.exit(1);
+    }
+    didPublish = true;
+}
+if (didPublish) {
+    console.log(`Successfully bumped version from ${currentVersion} to ${newVersion} and created a new release!`);
+} else {
+    console.log(`Successfully bumped version from ${currentVersion} to ${newVersion}. No push/publish was performed because of the flags in use.`);
+}

This keeps the message accurate in all flag combinations.

♻️ Duplicate comments (1)
mise/tasks/new-release (1)

221-223: Do not silently swallow errors when reverting server’s gleam.toml on failure

On server publish failure you attempt to revert gleam.toml, but any error in the revert is ignored:

// Attempt to revert the gleam.toml if modified
try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }

If the revert fails (permissions, disk full, etc.), the script exits with an error but you lose the crucial signal that the file is now left in a modified, inconsistent state, making debugging and cleanup harder.

You already log and exit on revert failure in the successful-publish path a few lines below; mirroring that pattern here would make failures much more observable:

-        // Attempt to revert the gleam.toml if modified
-        try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }
+        // Attempt to revert the gleam.toml if modified
+        try {
+            await Bun.write(serverTomlPath, serverTomlOrig);
+        } catch (revertErr) {
+            console.error("Additionally failed to revert server gleam.toml:", revertErr);
+        }

This retains the original exit behaviour but surfaces the revert problem in logs.

🧹 Nitpick comments (2)
mise/tasks/new-release (2)

27-37: “Up to date with remote” check is ineffective as written

git rev-parse --abbrev-ref @ returns the same branch name as HEAD, so branch and remote will always be equal and this check never detects being behind or ahead of the upstream. To actually compare with the tracking branch you probably want @{u} or a different mechanism (for example, checking git status --porcelain=v2 --branch for ahead/behind markers) before allowing a release.


49-104: Tighten version argument handling and relative bump behaviour

Two small edge cases here:

  1. set without an explicit version (new-release set) silently defaults to 0.0.0 via versionValue = args[1] || "0.0.0", which is surprising and potentially dangerous. It would be safer to require an explicit version for set and error out if args[1] is missing.

  2. The relative bump shorthand +x.x.x assumes currentVersion.split('.') yields plain numbers. If currentVersion ever includes a pre-release suffix (for example 1.2.3-rc.1), Number will produce NaN and you will hit the “Resulting version is not valid semver” path even though a sensible bump could be computed. If you plan to use +x.x.x when on pre-release versions, consider parsing currentVersion via semver.parse and deriving major/minor/patch from that rather than splitting the raw string.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 556be3a and cb7b4c7.

📒 Files selected for processing (2)
  • cynthia_websites_mini_server/manifest.toml (1 hunks)
  • mise/tasks/new-release (2 hunks)
🔇 Additional comments (1)
cynthia_websites_mini_server/manifest.toml (1)

10-10: Client manifest version bump looks fine; keep it in sync with Gleam output

The updated cynthia_websites_mini_client version to 1.2.0-rc under source = "local" is consistent with the staged publish flow. Just make sure this file gets regenerated by Gleam (e.g. via gleam deps / build) as part of your normal workflow so it does not drift from the tool’s canonical output.

@strawmelonjuice strawmelonjuice changed the title WIP: Gleam publish feat: Publish to hex.pm Nov 27, 2025
@strawmelonjuice strawmelonjuice merged commit 0c5a657 into main Nov 27, 2025
9 checks passed
@strawmelonjuice strawmelonjuice deleted the gleam-publish branch November 27, 2025 11:46
@coderabbitai coderabbitai bot mentioned this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants