chore: auto-commit (57 archivos)

- frontend/functions/core/format_datetime_short.md
- frontend/functions/core/format_datetime_short.test.ts
- frontend/functions/core/format_datetime_short.ts
- frontend/functions/core/format_duration.md
- frontend/functions/core/format_duration.test.ts
- frontend/functions/core/format_duration.ts
- frontend/functions/core/month_grid.md
- frontend/functions/core/month_grid.test.ts
- frontend/functions/core/month_grid.ts
- frontend/functions/core/string_hash_palette.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 03:41:58 +02:00
parent 4d5a5bd3ea
commit 8618aa1be3
58 changed files with 2923 additions and 0 deletions
@@ -0,0 +1,49 @@
---
name: http_session_cookie_clear
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func SessionCookieClear(w http.ResponseWriter, name string)"
description: "Invalida la cookie de sesion en el browser fijando MaxAge=-1. Path='/', HttpOnly=true, SameSite=Lax. No retorna error porque http.SetCookie no falla en runtime."
tags: [http, session, cookie, auth, logout, response]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: ["net/http"]
params:
- name: w
desc: "ResponseWriter donde se escribe el header Set-Cookie"
- name: name
desc: "nombre de la cookie a invalidar (debe coincidir con el nombre usado al crearla)"
output: "escribe el header Set-Cookie con MaxAge=-1 en w; sin valor de retorno"
tested: true
tests:
- "cookie clear setea MaxAge negativo"
- "cookie clear valor es vacio"
- "header Set-Cookie contiene HttpOnly y SameSite=Lax"
test_file_path: "functions/infra/http_session_cookie_clear_test.go"
file_path: "functions/infra/http_session_cookie_clear.go"
---
## Ejemplo
```go
func handleLogout(db *DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
token := infra.SessionTokenExtract(r, "my_session")
if token != "" {
_ = infra.SessionDelete(db.conn, token)
}
infra.SessionCookieClear(w, "my_session")
w.WriteHeader(http.StatusNoContent)
}
}
```
## Notas
Extraido de apps/kanban/backend/auth.go. MaxAge=-1 hace que el browser elimine la cookie inmediatamente independientemente de la fecha Expires original. La funcion no retorna error porque `http.SetCookie` escribe directamente en los headers y nunca falla. Complemento de `http_session_cookie_set_go_infra`.