Skip to content

Rename this server in Dagu Console from Dagu - #3202

Merged
yohamta0 merged 2 commits into
mainfrom
license-server-rename
Oct 16, 2026
Merged

yohamta0 merged 2 commits into
mainfrom
license-server-rename

Conversation

@yohamta0

@yohamta0 yohamta0 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Dagu Console showed a connected server only by the name it reports (license.server_name, else the hostname, e.g. s-macbook-pro.taild5c75a.ts.net), and changing it took a config edit, a restart, and up to an hour.

  • License page: the Server row on Plan & features gets a Rename button for a server that checks in with Dagu Console. Once renamed, it shows the name the server reports beside the new one. Saving an empty name returns to the reported name.
  • API: PUT /api/v1/license/server-name (admin only, also through remote nodes) sends the name to Dagu Console and returns the license status. It refuses names over 100 characters and licenses that never check in, and explains a refusal by Dagu Console. Each rename is audited as license_server_rename.
  • License status: serverName is now the name Dagu Console shows, read from the license token's new server_name claim; the new reportedName is the name the server reports. Without the claim (older Console), serverName stays the reported name.

Dagu Console keeps the name, so there is one source for it. Owners can also rename a server on its Settings tab in the console, and check-ins no longer overwrite a name a person gave. The console side (POST /api/v1/licenses/rename and the server_name claim) is already deployed.

Docs: dagucloud/docs#46

Testing

  • internal/license: client request/response, rename applies and saves the returned token without counting as a check-in, empty name clears, length limit counts characters, Console refusal keeps the license, 404 from an older Console, licenses that never check in.
  • internal/service/frontend/api/v1: rename through a fake Console, refusal message, unreachable Console (502), name too long, no check-in, admin-only, audit entry.
  • UI: rename flow, prefill with a given name, error keeps the form open, no rename without check-in.
  • make check, make test for the touched packages, pnpm test, pnpm typecheck, pnpm build.

Summary by cubic

Lets you rename this server in Dagu Console from the Plan & features page, so the console no longer shows only the cryptic hostname the server reports.

  • The Server row gets a Rename button for servers that check in; a renamed server shows its new name beside the reported one, and clearing the name returns to the reported one.
  • PUT /api/v1/license/server-name (admin only) sends the name to Dagu Console, refuses names over 100 characters, explains a refusal by Dagu Console, and is audited as license_server_rename.
  • License status now returns the console's name as serverName and the reported name as reportedName; without a server_name claim, serverName falls back to the reported name.

Written for commit a19bf76. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • New Features
    • Added an option to rename the server shown in license details. Names can be up to 100 characters; leaving the field empty uses the server’s reported name.
    • License details now distinguish the chosen display name from the name reported by the server.
  • Bug Fixes
    • Server-name updates now preserve the existing license check-in time.

Dagu Console showed a connected server only by the name it reports,
often a cryptic hostname, and only a config change and a restart could
change it. PUT /api/v1/license/server-name sets the name Dagu Console
shows for the server, and an empty name returns to the reported one.

The license status now reports the name Dagu Console shows, carried
in the license token, beside the name the server reports.
The Server row on Plan & features gets a Rename button for a server that
checks in with Dagu Console. It shows the name Dagu Console uses and,
once renamed, the name the server reports beside it.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f5ede6c6-5252-400d-9239-98331423f1aa
📥 Commits

Reviewing files that changed from the base of the PR and between c56a781 and a19bf76.

📒 Files selected for processing: 18
  • api/v1/api.gen.go
  • api/v1/api.yaml
  • internal/license/claims.go
  • internal/license/client.go
  • internal/license/client_test.go
  • internal/license/manager.go
  • internal/license/manager_test.go
  • internal/license/rename.go
  • internal/license/rename_test.go
  • internal/license/status.go
  • internal/license/status_test.go
  • internal/service/frontend/api/v1/license.go
  • internal/service/frontend/api/v1/license_test.go
  • ui/src/api/v1/schema.ts
  • ui/src/contexts/ConfigContext.tsx
  • ui/src/i18n/staticMessages.ts
  • ui/src/pages/license/LicenseOverview.tsx
  • ui/src/pages/license/__tests__/index.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The change adds an admin-only API and license overview controls for changing the server name shown in Dagu Console. License status now reports both the displayed name and the name reported by the server. The manager sends rename requests to Console and applies the returned license token.

Changes: License Server Rename

Layer / File(s) Summary
Server name contracts
api/v1/api.yaml, internal/license/claims.go, internal/license/status.go, internal/license/status_test.go, ui/src/api/v1/schema.ts, ui/src/contexts/ConfigContext.tsx
The API and license status distinguish the displayed server name from the reported name. The API contract defines the rename operation and its request.
Cloud rename and token update
internal/license/client.go, internal/license/client_test.go, internal/license/manager.go, internal/license/manager_test.go, internal/license/rename.go, internal/license/rename_test.go
The manager validates and sends rename requests, maps unsupported Console responses, and applies a returned token while preserving the previous check-in time. Tests cover name limits, errors, and status updates.
Frontend API and audit
internal/service/frontend/api/v1/license.go, internal/service/frontend/api/v1/license_test.go
The API checks permissions, calls the manager, maps errors, audits successful renames, and returns license status. Tests cover responses, auditing, and access control.
License overview rename controls
ui/src/pages/license/LicenseOverview.tsx, ui/src/pages/license/__tests__/index.test.tsx, ui/src/i18n/staticMessages.ts
The overview displays reported and custom names and provides rename controls when server ID data exists. Tests cover saves, failures, and licenses without check-in data. Translations are added in English, Simplified Chinese, and Japanese.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LicenseOverview
  participant RenameLicenseServer
  participant ManagerRenameServer
  participant CloudClientRename
  participant DaguConsole
  LicenseOverview->>RenameLicenseServer: PUT /license/server-name with name
  RenameLicenseServer->>ManagerRenameServer: RenameServer(name)
  ManagerRenameServer->>CloudClientRename: Rename request
  CloudClientRename->>DaguConsole: POST /api/v1/licenses/rename
  DaguConsole-->>CloudClientRename: Heartbeat response with token
  CloudClientRename-->>ManagerRenameServer: Heartbeat response
  ManagerRenameServer-->>RenameLicenseServer: Updated license state
  RenameLicenseServer-->>LicenseOverview: LicenseStatusResponse
Loading
Merge Risk: ⚪ Minimal · up to a19bf

The rename flow has no identified merge-blocking issue; complete the normal checks before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 15 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description clearly explains the server rename feature, API behavior, license-status changes, testing coverage, and documentation link. It omits the template's explicit Changes, Related Issues, an…
Title check Passed The title clearly and concisely identifies the main change: renaming a server in Dagu Console.
Full details: Description check

Explanation

The description clearly explains the server rename feature, API behavior, license-status changes, testing coverage, and documentation link. It omits the template's explicit Changes, Related Issues, and Checklist sections, but the required change details and validation information are substantially present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 15 files. (2 skipped: 1 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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

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

@yohamta0
yohamta0 merged commit 998db8e into main Oct 16, 2026
32 of 33 checks passed
@yohamta0
yohamta0 deleted the license-server-rename branch October 16, 2026 10:51
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