Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix: sanitize title branch name construction to match GitHub support on backend (#3079)
gbirman035a84241a66
diff --git a/js/app/packages/app/component/next-soup/actions/make-copy-branch-name-action.ts b/js/app/packages/app/component/next-soup/actions/make-copy-branch-name-action.tsindex fa8dfb1a8f..eda7855dcb 100644--- a/js/app/packages/app/component/next-soup/actions/make-copy-branch-name-action.ts+++ b/js/app/packages/app/component/next-soup/actions/make-copy-branch-name-action.ts@@ -10,7 +10,7 @@ export const makeCopyBranchNameAction = () => {const execute = async (entities: EntityData[]) => {const entity = entities[0];if (!entity || !isTaskEntity(entity)) return;- await copyBranchNameToClipboard(entity.id, entity.name);+ await copyBranchNameToClipboard(entity.id);};const executeWithSoup = async (entities: EntityData[], _soup: SoupState) => {diff --git a/js/app/packages/block-md/component/DispatchAgentMenu.tsx b/js/app/packages/block-md/component/DispatchAgentMenu.tsxindex d9c7ff278a..b5b7c7e650 100644--- a/js/app/packages/block-md/component/DispatchAgentMenu.tsx+++ b/js/app/packages/block-md/component/DispatchAgentMenu.tsx@@ -28,41 +28,21 @@ import { createCallback } from '@solid-primitives/rootless';import { openMacroMcpSetupModal } from '@app/component/macro-mcp-setup-modal/MacroMcpSetupModal';import PlugIcon from '@icon/regular/plug.svg';-const MAX_BRANCH_LENGTH = 200;const LAST_USED_KEY = 'dispatch-agent-last-used';-const slugify = (title: string): string =>- title- .toLowerCase()- .replace(/[^a-z0-9\s-]/g, '')- .replace(/\s+/g, '-')- .replace(/-+/g, '-')- .replace(/^-|-$/g, '');--async function buildBranchName(- documentId: string,- documentName: string-): Promise<{ shortId: string; branchName: string }> {- const result = await storageServiceClient.getDocumentShortId({ documentId });- const shortId = isOk(result) ? result[1] : documentId;- const slug = slugify(documentName);- const branchName = `macro-${shortId}${slug ? `-${slug}` : ''}`.slice(- 0,- MAX_BRANCH_LENGTH- );- return { shortId, branchName };-}-async function generateTaskPrompt(documentId: string,documentName: string,content: string,threads: CommentThread[]): Promise<string> {- const { shortId, branchName } = await buildBranchName(+ const result = await storageServiceClient.getDocumentBranchName({documentId,- documentName- );+ });+ if (!isOk(result)) {+ throw new Error('Failed to fetch branch name');+ }+ const { shortId, branchName } = result[1];const lines: string[] = [];diff --git a/js/app/packages/block-md/component/TopBar.tsx b/js/app/packages/block-md/component/TopBar.tsxindex 4add6c323e..83bf191d60 100644--- a/js/app/packages/block-md/component/TopBar.tsx+++ b/js/app/packages/block-md/component/TopBar.tsx@@ -109,7 +109,7 @@ export function TopBar() {);};- const copyBranchName = () => copyBranchNameToClipboard(blockId, name());+ const copyBranchName = () => copyBranchNameToClipboard(blockId);if (isTask) {let cleanupKbShortcut = () => {};diff --git a/js/app/packages/core/component/DocumentPreview.tsx b/js/app/packages/core/component/DocumentPreview.tsxindex 727cdc490e..861ad029f0 100644--- a/js/app/packages/core/component/DocumentPreview.tsx+++ b/js/app/packages/core/component/DocumentPreview.tsx@@ -550,12 +550,7 @@ export function PopupPreview(props: {};const handleCopyBranchName = () => {- const previewItem = item();- const docName =- props.documentInfo.name ||- ('name' in previewItem ? (previewItem.name as string) : '') ||- '';- copyBranchNameToClipboard(props.documentInfo.id, docName);+ copyBranchNameToClipboard(props.documentInfo.id);};const isSplitAlreadyOpen = () => {diff --git a/js/app/packages/core/util/branchName.ts b/js/app/packages/core/util/branchName.tsindex a854f2087f..8983fafaac 100644--- a/js/app/packages/core/util/branchName.ts+++ b/js/app/packages/core/util/branchName.ts@@ -3,44 +3,16 @@ import { toast } from '@core/component/Toast/Toast';import { isOk } from '@core/util/maybeResult';import { storageServiceClient } from '@service-storage/client';-const MAX_BRANCH_LENGTH = 200;--const slugify = (title: string): string =>- title- .toLowerCase()- .replace(/[^a-z0-9\s-]/g, '')- .replace(/\s+/g, '-')- .replace(/-+/g, '-')- .replace(/^-|-$/g, '');--const buildBranchName = (shortId: string, documentName: string): string => {- const suffix = `macro-${shortId}`;- const slug = slugify(documentName);- const maxSlugLength = MAX_BRANCH_LENGTH - suffix.length - 1;- let truncatedSlug = slug.slice(0, maxSlugLength);- if (truncatedSlug.length < slug.length) {- const lastBoundary = truncatedSlug.lastIndexOf('-');- if (lastBoundary > 0) {- truncatedSlug = truncatedSlug.slice(0, lastBoundary);- }- }- truncatedSlug = truncatedSlug.replace(/-+$/, '');- return truncatedSlug ? `${truncatedSlug}-${suffix}` : suffix;-};--export const copyBranchNameToClipboard = async (- documentId: string,- documentName: string-) => {- const result = await storageServiceClient.getDocumentShortId({ documentId });+export const copyBranchNameToClipboard = async (documentId: string) => {+ const result = await storageServiceClient.getDocumentBranchName({+ documentId,+ });if (!isOk(result)) {toast.failure('Failed to copy branch name');return;}- const shortId = result[1];- const branchName = buildBranchName(shortId, documentName);try {- await navigator.clipboard.writeText(branchName);+ await navigator.clipboard.writeText(result[1].branchName);analytics.track('task_copy_branch_name');toast.success('Branch name copied to clipboard');} catch {diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.tsindex ab4da0208a..f00e977f2d 100644--- a/js/app/packages/service-clients/service-storage/client.ts+++ b/js/app/packages/service-clients/service-storage/client.ts@@ -553,6 +553,28 @@ export const storageServiceClient = {);},+ async getDocumentBranchName({+ documentId,+ }: {+ documentId: string;+ }): Promise<+ MaybeResult<+ FetchWithTokenErrorCode,+ { shortId: string; branchName: string }+ >+ > {+ return mapOk(+ await dssFetch<{ shortId: string; branchName: string }>(+ `/documents/${documentId}/branch_name`,+ { method: 'GET' }+ ),+ (result) => ({+ shortId: result.shortId,+ branchName: result.branchName,+ })+ );+ },+async exportDocument({ documentId }) {return mapOk(await dssFetch<ExportDocumentResponse>(diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/branchNameResponse.ts b/js/app/packages/service-clients/service-storage/generated/schemas/branchNameResponse.tsnew file mode 100644index 0000000000..ec7840a79d--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/branchNameResponse.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Branch name response.+ */+export interface BranchNameResponse {+ /** The git branch name for the task document. */+ branchName: string;+ /** The short id of the document. */+ shortId: string;+}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex bb9959b43d..6f33d52a4d 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts@@ -78,6 +78,7 @@ export * from './basicDocumentSubTypeProperty';export * from './basicDocumentType';export * from './basicDocumentUpdatedAt';export * from './bomPart';+export * from './branchNameResponse';export * from './bulkWakeupRequest';export * from './bulkWakeupResponse';export * from './callActiveResponse';diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 645cdc6d7f..e3f0224b82 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -3180,6 +3180,24 @@ export const editDocumentResponse = zod}).describe('Edit document response.');+/**+ * Returns the short UUID and git branch name for a task document.+Returns 400 if the document is not a task.+ * @summary Handler for `GET /documents/{document_id}/branch_name`.+ */+export const getDocumentBranchNameParams = zod.object({+ document_id: zod.string().describe('Document ID'),+});++export const getDocumentBranchNameResponse = zod+ .object({+ branchName: zod+ .string()+ .describe('The git branch name for the task document.'),+ shortId: zod.string().describe('The short id of the document.'),+ })+ .describe('Branch name response.');+/*** Copies an existing document, creating a new document with the same content.Does not require re-uploading the document file.diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 3702c2cedb..73665b4a13 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -2624,6 +2624,77 @@}}},+ "/documents/{document_id}/branch_name": {+ "get": {+ "tags": ["document"],+ "summary": "Handler for `GET /documents/{document_id}/branch_name`.",+ "description": "Returns the short UUID and git branch name for a task document.\nReturns 400 if the document is not a task.",+ "operationId": "get_document_branch_name",+ "parameters": [+ {+ "name": "document_id",+ "in": "path",+ "description": "Document ID",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BranchNameResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/documents/{document_id}/copy": {"post": {"tags": ["document"],@@ -6396,6 +6467,21 @@}}},+ "BranchNameResponse": {+ "type": "object",+ "description": "Branch name response.",+ "required": ["shortId", "branchName"],+ "properties": {+ "branchName": {+ "type": "string",+ "description": "The git branch name for the task document."+ },+ "shortId": {+ "type": "string",+ "description": "The short id of the document."+ }+ }+ },"BulkWakeupRequest": {"type": "object","required": ["document_ids"],diff --git a/rust/cloud-storage/document_storage_service/src/api/swagger.rs b/rust/cloud-storage/document_storage_service/src/api/swagger.rsindex 7770de0b3c..975c307646 100644--- a/rust/cloud-storage/document_storage_service/src/api/swagger.rs+++ b/rust/cloud-storage/document_storage_service/src/api/swagger.rs@@ -69,7 +69,7 @@ use channels::inbound::axum_router::{ChannelMessageFilters,};use document_sub_type::DocumentSubType;-use documents_hex::inbound::axum_router::ShortIdResponse;+use documents_hex::inbound::axum_router::{BranchNameResponse, ShortIdResponse};use model::document::response::{CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData,DocumentResponseMetadata,@@ -153,6 +153,7 @@ use utoipa::OpenApi;documents::get_document_views::get_document_views_handler,documents::location::get_location_handler,documents_hex::inbound::axum_router::get_location_v3_handler,+ documents_hex::inbound::axum_router::get_branch_name_handler,documents_hex::inbound::axum_router::get_short_id_handler,documents::simple_save::handler,documents::initialize_user_documents::handler,@@ -420,6 +421,7 @@ use utoipa::OpenApi;CreateViewRequest,ExcludeDefaultViewRequest,+ BranchNameResponse,ShortIdResponse,// Sync servicediff --git a/rust/cloud-storage/documents/src/domain.rs b/rust/cloud-storage/documents/src/domain.rsindex a947d9653b..b5f55f4851 100644--- a/rust/cloud-storage/documents/src/domain.rs+++ b/rust/cloud-storage/documents/src/domain.rs@@ -1,5 +1,6 @@//! Domain layer: models, ports (trait interfaces), and service implementation.+pub mod branch_name;pub mod models;#[cfg(feature = "ports")]diff --git a/rust/cloud-storage/documents/src/domain/branch_name.rs b/rust/cloud-storage/documents/src/domain/branch_name.rsnew file mode 100644index 0000000000..e866804b54--- /dev/null+++ b/rust/cloud-storage/documents/src/domain/branch_name.rs@@ -0,0 +1,63 @@+//! Branch name construction for task documents.++/// Maximum allowed length of a generated branch name.+const MAX_BRANCH_LENGTH: usize = 200;++/// Convert a task title into a slug suitable for a git branch name.+pub fn slugify(name: &str) -> String {+ let mut result = String::with_capacity(name.len());+ let mut prev_hyphen = false;+ for c in name.chars() {+ let to_push = if c.is_ascii_alphabetic() {+ c.to_ascii_lowercase()+ } else if c.is_ascii_digit() || c == '-' {+ c+ } else if c.is_whitespace() {+ '-'+ } else {+ continue;+ };+ if to_push == '-' {+ if !prev_hyphen {+ result.push('-');+ prev_hyphen = true;+ }+ } else {+ result.push(to_push);+ prev_hyphen = false;+ }+ }+ result.trim_matches('-').to_string()+}++/// Build the full task branch name from the document's short id and title.+///+/// Format: `{slug}-macro-{short_id}`, capped at [`MAX_BRANCH_LENGTH`]+/// characters. If the slug must be truncated to fit, it's cut at the+/// last hyphen boundary so words aren't split mid-string.+pub fn build_task_branch_name(short_id: &str, document_name: &str) -> String {+ let suffix = format!("macro-{short_id}");+ let slug = slugify(document_name);+ let max_slug_len = MAX_BRANCH_LENGTH.saturating_sub(suffix.len() + 1);++ // slugify output is pure ASCII, so byte-indexing is safe.+ let truncated = if slug.len() > max_slug_len {+ let cut = &slug[..max_slug_len];+ match cut.rfind('-').filter(|&i| i > 0) {+ Some(boundary) => &cut[..boundary],+ None => cut,+ }+ } else {+ slug.as_str()+ };++ let truncated = truncated.trim_end_matches('-');+ if truncated.is_empty() {+ suffix+ } else {+ format!("{truncated}-{suffix}")+ }+}++#[cfg(test)]+mod test;diff --git a/rust/cloud-storage/documents/src/domain/branch_name/test.rs b/rust/cloud-storage/documents/src/domain/branch_name/test.rsnew file mode 100644index 0000000000..1f225697ff--- /dev/null+++ b/rust/cloud-storage/documents/src/domain/branch_name/test.rs@@ -0,0 +1,80 @@+use super::{build_task_branch_name, slugify};++#[test]+fn strips_brackets_and_special_chars() {+ assert_eq!(slugify("[search] fix bug"), "search-fix-bug");+}++#[test]+fn lowercases_and_replaces_spaces() {+ assert_eq!(slugify("My Cool Task"), "my-cool-task");+}++#[test]+fn collapses_consecutive_hyphens() {+ assert_eq!(slugify("foo -- bar"), "foo-bar");+}++#[test]+fn trims_leading_and_trailing_hyphens() {+ assert_eq!(slugify(" -hello world- "), "hello-world");+}++#[test]+fn keeps_digits() {+ assert_eq!(slugify("Issue 1234: do thing"), "issue-1234-do-thing");+}++#[test]+fn drops_non_ascii() {+ assert_eq!(slugify("café résumé"), "caf-rsum");+}++#[test]+fn empty_after_sanitization() {+ assert_eq!(slugify("!!!@@@"), "");+}++#[test]+fn keeps_existing_hyphens() {+ assert_eq!(slugify("foo-bar-baz"), "foo-bar-baz");+}++#[test]+fn builds_full_branch_name() {+ assert_eq!(+ build_task_branch_name("abcd1234", "[search] fix bug"),+ "search-fix-bug-macro-abcd1234"+ );+}++#[test]+fn falls_back_to_suffix_when_slug_empty() {+ assert_eq!(build_task_branch_name("abcd1234", "!!!"), "macro-abcd1234");+}++#[test]+fn caps_branch_name_at_max_length() {+ let title = "word ".repeat(60);+ let result = build_task_branch_name("abcd1234", &title);+ assert!(result.len() <= 200);+ assert!(result.ends_with("-macro-abcd1234"));+ // Truncation happens at a hyphen boundary, so no trailing partial word.+ assert!(!result.contains("-w-macro-"));+}++#[test]+fn truncates_at_hyphen_boundary() {+ // Short id "id" → suffix "macro-id" (8 chars). Available slug = 200 - 9 = 191.+ let mut slug_input = String::new();+ for _ in 0..30 {+ slug_input.push_str("longword ");+ }+ let result = build_task_branch_name("id", &slug_input);+ assert!(result.len() <= 200);+ // The slug portion should not end with a partial "longword".+ let slug_portion = result.trim_end_matches("-macro-id");+ for segment in slug_portion.split('-') {+ assert_eq!(segment, "longword", "found partial word: {segment}");+ }+}diff --git a/rust/cloud-storage/documents/src/inbound/axum_router.rs b/rust/cloud-storage/documents/src/inbound/axum_router.rsindex af4ebeeab5..8798df406e 100644--- a/rust/cloud-storage/documents/src/inbound/axum_router.rs+++ b/rust/cloud-storage/documents/src/inbound/axum_router.rs@@ -4,6 +4,7 @@//! - `POST /` — create a new document//! - `GET /{document_id}` — get document metadata//! - `GET /{document_id}/location_v3` — get document content location (presigned URL)+//! - `GET /{document_id}/branch_name` — get short ID + git branch name (when the document is a task)//! - `GET /{document_id}/short_id` — get document short ID//! - `DELETE /{document_id}` — soft-delete a document@@ -15,6 +16,7 @@ mod create_document;mod create_task;mod delete_document;mod edit_document;+mod get_branch_name;mod get_document;mod get_location;mod get_short_id;@@ -43,6 +45,7 @@ pub use create_document::*;pub use create_task::*;pub use delete_document::*;pub use edit_document::*;+pub use get_branch_name::*;pub use get_document::*;pub use get_location::*;pub use get_short_id::*;@@ -125,6 +128,10 @@ where"/{document_id}/location_v3",axum::routing::get(get_location_v3_handler::<T, Svc>),)+ .route(+ "/{document_id}/branch_name",+ axum::routing::get(get_branch_name_handler::<T, Svc>),+ ).route("/{document_id}/short_id",axum::routing::get(get_short_id_handler::<T, Svc>),diff --git a/rust/cloud-storage/documents/src/inbound/axum_router/get_branch_name.rs b/rust/cloud-storage/documents/src/inbound/axum_router/get_branch_name.rsnew file mode 100644index 0000000000..c4f7d0ff86--- /dev/null+++ b/rust/cloud-storage/documents/src/inbound/axum_router/get_branch_name.rs@@ -0,0 +1,71 @@+//! Handler for `GET /documents/{document_id}/branch_name`.++use axum::{+ Json,+ extract::{Path, State},+};+use entity_access::domain::ports::EntityAccessService;+use entity_access::inbound::axum_extractors::DocumentAccessExtractor;+use models_permissions::share_permission::access_level::ViewAccessLevel;++use super::{DocumentRouterState, Params};+use crate::domain::branch_name::build_task_branch_name;+use crate::domain::models::DocumentError;+use crate::domain::ports::DocumentService;+use document_sub_type::DocumentSubType;++/// Branch name response.+#[derive(serde::Serialize, utoipa::ToSchema)]+#[serde(rename_all = "camelCase")]+pub struct BranchNameResponse {+ /// The short id of the document.+ pub short_id: String,+ /// The git branch name for the task document.+ pub branch_name: String,+}++/// Handler for `GET /documents/{document_id}/branch_name`.+///+/// Returns the short UUID and git branch name for a task document.+/// Returns 400 if the document is not a task.+#[utoipa::path(+ tag = "document",+ get,+ path = "/documents/{document_id}/branch_name",+ operation_id = "get_document_branch_name",+ params(+ ("document_id" = String, Path, description = "Document ID")+ ),+ responses(+ (status = 200, body = BranchNameResponse),+ (status = 400, body = model_error_response::ErrorResponse),+ (status = 401, body = model_error_response::ErrorResponse),+ (status = 404, body = model_error_response::ErrorResponse),+ (status = 500, body = model_error_response::ErrorResponse),+ )+)]+#[tracing::instrument(skip(state, access), err)]+pub async fn get_branch_name_handler<T: DocumentService, Svc: EntityAccessService>(+ State(state): State<DocumentRouterState<T, Svc>>,+ access: DocumentAccessExtractor<ViewAccessLevel, Svc>,+ Path(Params { document_id }): Path<Params>,+) -> Result<Json<BranchNameResponse>, DocumentError> {+ let receipt = access.entity_access_receipt;++ let document = state.service.get_document(receipt.clone()).await?;+ let short_id = state.service.get_short_id(receipt).await?;++ match document.document_metadata.sub_type {+ Some(DocumentSubType::Task) => {+ let branch_name =+ build_task_branch_name(&short_id, &document.document_metadata.document_name);+ Ok(Json(BranchNameResponse {+ short_id,+ branch_name,+ }))+ }+ None => Err(DocumentError::BadRequest(format!(+ "document {document_id} is not a task"+ ))),+ }+}diff --git a/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rsindex 61865dd0dd..7c2f3df4ed 100644--- a/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs+++ b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs@@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize};use uuid::Uuid;use super::DocumentToolContext;+use crate::domain::branch_name::build_task_branch_name;#[derive(Debug, Serialize, JsonSchema)]#[serde(rename_all = "camelCase")]@@ -94,10 +95,10 @@ whereinternal_error: e.into(),})?;- let name = result.document_metadata.document_name.clone();- let slugified_name = name.replace(" ", "-").to_lowercase();-- Some(format!("macro-{short_id}-{slugified_name}"))+ Some(build_task_branch_name(+ &short_id,+ &result.document_metadata.document_name,+ ))}}} else {diff --git a/rust/cloud-storage/documents/src/inbound/toolset/read_metadata/test.rs b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata/test.rsnew file mode 100644index 0000000000..0daacdaf1a--- /dev/null+++ b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata/test.rs@@ -0,0 +1,41 @@+use super::slugify;++#[test]+fn strips_brackets_and_special_chars() {+ assert_eq!(slugify("[search] fix bug"), "search-fix-bug");+}++#[test]+fn lowercases_and_replaces_spaces() {+ assert_eq!(slugify("My Cool Task"), "my-cool-task");+}++#[test]+fn collapses_consecutive_hyphens() {+ assert_eq!(slugify("foo -- bar"), "foo-bar");+}++#[test]+fn trims_leading_and_trailing_hyphens() {+ assert_eq!(slugify(" -hello world- "), "hello-world");+}++#[test]+fn keeps_digits() {+ assert_eq!(slugify("Issue 1234: do thing"), "issue-1234-do-thing");+}++#[test]+fn drops_non_ascii() {+ assert_eq!(slugify("café résumé"), "caf-rsum");+}++#[test]+fn empty_after_sanitization() {+ assert_eq!(slugify("!!!@@@"), "");+}++#[test]+fn keeps_existing_hyphens() {+ assert_eq!(slugify("foo-bar-baz"), "foo-bar-baz");+}