-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Make workspace branch names more human-friendly by using a structured, readable format that includes timestamp, user identity, and short workspace ID.
Desired format
<YYYY-MM-DD H:i:s>-usermailATdomainDOTtld-SHORTWORKSPACEID
Components:
- Date/time:
YYYY-MM-DD H:i:s(e.g.2025-02-05 14:30:22) — when the branch was created - User:
usermailATdomainDOTtld— commit author email with@→ATand.→DOTso the branch name is filesystem/URL-safe and readable (e.g.manuelATkiesslingDOTnet) - Short workspace ID: first 8 characters of the workspace UUID (same as today) for uniqueness and traceability
Example: 2025-02-05 14:30:22-manuelATkiesslingDOTnet-a1b2c3d4
Current behavior
- Branch names are generated in
WorkspaceSetupService::generateBranchName()(seesrc/WorkspaceMgmt/Domain/Service/WorkspaceSetupService.php). - Current format:
ws-<shortId>-<timestamp>with timestampYmd-His(e.g.ws-a1b2c3d4-20250205-143022). - User email is not available in the setup flow today; it is only used later for commits and PR body (e.g. in
WorkspaceGitService,WorkspaceMgmtFacade::commitAndPush/ensurePullRequest).
Implementation notes
-
Pass user email into setup
dispatchSetupIfNeededis called fromChatBasedContentEditorController::startConversation(), where the current user (and thusAccountInfoDto/ email) is available.- Extend the chain so that when a user triggers setup, their email is passed through:
- Optional:
WorkspaceMgmtFacadeInterface::dispatchSetupIfNeeded(string $projectId, ?string $userEmail = null)and pass$accountInfo->emailfrom the controller. SetupWorkspaceMessagewould need to carry an optional?string $userEmail = null.WorkspaceSetupService::setup()/performSetup()would need to receive (or resolve) user email and pass it togenerateBranchName().
- Optional:
-
Branch name generator
- Change
generateBranchName(string $workspaceId)to something likegenerateBranchName(string $workspaceId, ?string $userEmail = null). - Build the three segments:
- Timestamp:
DateAndTimeService::getDateTimeImmutable()->format('Y-m-d H:i:s')(note: spaces and colons are valid in Git branch names; if any tooling disallows them, considerY-m-d_H-i-sor similar). - Sanitized email: replace
@→AT,.→DOT(and optionally normalize to lowercase for consistency). - Short workspace ID:
mb_substr($workspaceId, 0, 8)(existing behavior).
- Timestamp:
- When
$userEmailis null (e.g. setup triggered from a path that has no user, or legacy callers), fall back to the current format or a placeholder (e.g.unknownATuserDOTlocalor keepws-<shortId>-<timestamp>for backward compatibility).
- Change
-
Git branch name constraints
- Git allows spaces and colons in branch names; some CI/URL tools may not. If we need to avoid them, use e.g.
Y-m-d_H-i-sinstead ofY-m-d H:i:s.
- Git allows spaces and colons in branch names; some CI/URL tools may not. If we need to avoid them, use e.g.
-
Database / storage
Workspace.branchNameis already stored (length 255). The new format is similar in length; verify max length for the chosen timestamp and email sanitization (e.g. long emails with manyDOTsegments).
-
Tests
- Unit tests for the new branch name formatter (timestamp format, email sanitization, short ID, null email fallback).
- Adjust any existing tests that assert on the current
ws-...format.
-
Docs
- Update
docs/plans/project-workspace-conversation-workflow-high-level.md(and any other docs that describe branch naming) to the new format.
- Update
Acceptance criteria
- New branches use the format
<YYYY-MM-DD H:i:s>-usermailATdomainDOTtld-SHORTWORKSPACEIDwhen user email is available. - When user email is not available, behavior is defined (fallback format) and documented.
- Existing workspaces (already have a branch name) are unchanged; only new setups use the new format.
- Branch names remain valid for Git and for GitHub (URLs, PRs, CI).
- Unit tests cover the new formatter and fallback.
References
- Current branch name generation:
sitebuilder-webapp/src/WorkspaceMgmt/Domain/Service/WorkspaceSetupService.php(generateBranchName) - Setup trigger:
WorkspaceMgmtFacade::dispatchSetupIfNeeded←ChatBasedContentEditorController::startConversation(has$accountInfo->email) - Message:
SetupWorkspaceMessage(currently onlyworkspaceId)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
In progress