Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cofoundy/context/agent-floor.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ CTO reacts to events, not to chatter.
- **If you rescue orphaned work, CLAIM it and tell the other side in the SAME movement — before opening the PR.** This already happened: the CTO rescued an orphan on a new branch *while* the lane, independently and correctly, opened its own — two PRs, identical tree. Both did the right thing; what was missing was a comparable identity before either PR existed. `orphan_guard.py claim --branch <b> --base origin/main --actor "$COFOUNDY_AGENT" --notify <the other lane>` → `0` claimed + announced, open your PR · `1` someone else already holds this tree, STOP · `3` claimed but the aviso FAILED, do **not** open the PR. `--notify` is mandatory because announcing is part of the act of rescuing, not a courtesy afterwards. → `skills/factory/references/site-lifecycle.md` §8.1
- **Orchestrator's half of that pair (it binds the orchestrator, not you): before merging it must affirm that the PR's `headRefOid` IS the branch's real remote head** — `gh pr view <n> --json headRefOid` compared against `git ls-remote origin refs/heads/<branch>`, not the value it read a while ago. If they differ, you pushed after it looked, and merging there is exactly what orphans your commit. If your work goes missing this way, that is an orchestrator defect — report it, don't absorb it.
- **Self-merge to the INTEGRATION branch on CI-green IF your scope is DISJOINT.** When your task touched only files YOU own per the ownership matrix (no shared files), open your MR there and set **auto-merge on CI-green** — you land your own lane, no orchestrator relay. Resolve the branch, never assume it: `git ls-remote --heads origin dev`. It is `dev` (per `handbook/governance/git-strategy.md`), **not `develop`** — this floor said `develop` until 2026-08-06 and no Cofoundy repo has ever had a branch by that name, so this rule silently pointed every lane at the gated trunk.
- **No integration branch → do NOT auto-merge. Open the MR and stop.** Landing on a gated trunk is the orchestrator's call, not yours: if that trunk requires up-to-date branches, your merge invalidates every sibling lane's PR and each one pays an update-and-rerun cycle. Say in your termination signal that the MR is open and unmerged, and why. (Measured in `inbox-ai` 2026-08-06: 12 open PRs, all based on `main`, `strict: true`, no `dev` — that pileup is this rule firing wrong.)
- **No integration branch → do NOT auto-merge. Open the MR and stop.** Landing on a gated trunk is the orchestrator's call, not yours: if that trunk requires up-to-date branches, your merge invalidates every sibling lane's PR and each one pays an update-and-rerun cycle. Say in your termination signal that the MR is open and unmerged, and why. (Measured in `tracta` 2026-08-06: 12 open PRs, all based on `main`, `strict: true`, no `dev` — that pileup is this rule firing wrong.)
- **CI is the gate — and the gate is the command's exit code.** `gh pr checks <pr>` exits non-zero while checks are still **pending**; a zero-length `statusCheckRollup` array reads as "no failures" when it means "no signal". Read `$?` of `gh` itself, never of a `tail` you piped it into, and never your own parse.
- **Shared-file edits → flag, don't auto-merge.** If you touched a SHARED surface (the api-client barrel/index, `app.module`, prisma migrations, root `package.json`, anything multiple lanes edit) label your MR `needs-coordinated-merge` and STOP — the merge-coordinator sequences those (concurrent auto-merges on a shared file collide). Better: avoid shared-file edits by design (add your own file, not a line in a shared index).
- **A numbered file is a shared surface even though it is your OWN file — never derive its number from `main`.** Bitácoras (`docs/bitacora/NNN_slug.md`) and any other `NNN_`-prefixed sequence: reading `main` for "the highest N so far" is a read-modify-write against every sibling lane still in flight, and **git will not flag it** — you each write a *different* filename, so the merge is clean and the sequence is silently broken. Measured 2026-08-08 in `inbox-ai`: five duplicated numbers across 11 merged files (one of them tripled), plus three live PRs all claiming `052` — and the fifth landed the same day the bug was filed. Which numbers exactly is recorded as data (`slots.py::BITACORA_DEBT`), never as a list in prose: a restated list goes stale on its own. Ask the allocator instead; it reserves under a lock:
- **A numbered file is a shared surface even though it is your OWN file — never derive its number from `main`.** Bitácoras (`docs/bitacora/NNN_slug.md`) and any other `NNN_`-prefixed sequence: reading `main` for "the highest N so far" is a read-modify-write against every sibling lane still in flight, and **git will not flag it** — you each write a *different* filename, so the merge is clean and the sequence is silently broken. Measured 2026-08-08 in `tracta`: five duplicated numbers across 11 merged files (one of them tripled), plus three live PRs all claiming `052` — and the fifth landed the same day the bug was filed. Which numbers exactly is recorded as data (`slots.py::BITACORA_DEBT`), never as a list in prose: a restated list goes stale on its own. Ask the allocator instead; it reserves under a lock:
```bash
python3 <orchestrator>/skills/factory/scripts/slots.py bitacora --site "$COFOUNDY_AGENT" --json
```
Expand Down
2 changes: 1 addition & 1 deletion .cofoundy/context/constraints/escalation-thresholds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ scoped_to:
worker_id: cto-d606f0

# DECISION DEL CTO 2026-09-04: NO se otorga auto_approve_main_deploy.
# Razon (finding H-5): inbox-ai (= Tracta, en produccion) consume
# Razon (finding H-5): Tracta (= Tracta, en produccion) consume
# `github:cofoundy/ui#main` SIN PIN, en 139 archivos de su frontend. Todo merge a
# main de este repo entra a su prod sin gate. El blast radius de un deploy a main
# NO es "se redeploya Storybook": es la app que se factura a S/.150-250/mes.
Expand Down
6 changes: 3 additions & 3 deletions .cofoundy/context/decisions/2026-09-04-phase-5-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ estructura del DOM y no en color. → **B-5**.
|---|---|---|---|
| **B-1** | `tasks/T-003.md` | Bloque `## Acceptance`, los tres ítems | Retitular **`## Acceptance (falsable)`** y agregar gemelo a cada uno. **#1** → añadir: *«Gemelo anti-aliasing: retener `s1 = seek(tl,t1)`, luego `seek(tl,t2)` con `t2>t1`; `s1` NO debe haber cambiado, y `s1` ≠ `s2` en un campo nombrado. Un `seek` que devuelve el Map interno vivo DEBE poner esto rojo.»* **#2** → añadir: *«Gemelo negativo: `seek` a un `t` ANTERIOR al `react` ⇒ la reacción está ausente.»* **#3** → **reemplazar el benchmark de 2 ms** por: *«Instrumentar contador de pasos de fold por `seek`; afirmar ≤ `64 + log2(n)`. Gemelo de escalado: 500 vs 5000 pasos ⇒ costo sublineal. Un fold lineal sin checkpoints DEBE ponerlo rojo.»* (El wall-clock se conserva sólo como señal informativa, nunca como criterio.) |
| **B-2** | `tasks/T-003.md` → n/a; **`tasks/T-006.md`** | `## Alcance`, la frase **«Tope de costo (A-1): si excede ~0,5 d, revertí a stub y avisá.»**; `scope.write`; `## Acceptance` #1 y #3 | (a) **Reemplazar el tope de tiempo por tope de alcance:** *«Cota dura, verificable leyendo el dato entregado: ≤6 cues por canal, ≤3 capas por cue, `wave` ∈ {sine, square, triangle, noise}. Orden de entrega OBLIGATORIO: (1) schema + `AudioSink` muteado, (2) cue packs. El "stub" es el caso degenerado de (1) con cero packs — se llega por resta, no se reconstruye. Si los packs no entran en la cota, PARÁ con (1) entregado y reportá en `.cofoundy/state/reports/skin.md`.»* (b) **Sacar `ChannelId` de T-006 y moverlo a T-005** (`adapters/**` es celda `W` de `channel`); T-006 conserva sólo el token CSS `--channel-imessage`. (c) **`--channel-imessage` + `ChannelId` son INCONDICIONALES y quedan FUERA de la cota** — son `mvp_scope.incluye` y no pueden caer como daño colateral del tope de audio. (d) **#1** → añadir: *«Gemelo positivo: con el sink DESMUTEADO, `scheduledNodes > 0` antes del seek y `=== 0` después. Un sink no-op DEBE poner esto rojo.»* (e) **#3** → reemplazar *«y suenan distinto»* por: *«los dos packs son deep-inequal como datos, y el digest del buffer PCM renderizado difiere entre canales. Gemelo positivo: el mismo pack dos veces ⇒ digest idéntico.»* |
| **B-3** | `tasks/T-007.md` | `## Acceptance` #2, la frase **«Criterio real: el fork `MobileComposer.tsx` (13 KB) de inbox-ai queda sin razón de ser.»** | Reemplazar por un instrumento en dos mitades, ambas rojas-capaces: *(i)* **Test mecánico:** simular `visualViewport` a altura de teclado (fake en jsdom o Playwright con viewport reducido) y afirmar que el bounding box del composer queda **dentro** del visual viewport; sin la resolución de `dvh`/`interactive-widget` DEBE fallar. *(ii)* **Checklist derivada del archivo real,** mismo patrón que A-4: enumerar los comportamientos de `products/cofoundy-platform/inbox-ai/frontend/src/components/conversation/MobileComposer.tsx` (verificado: 13 KB, existe) y afirmar cobertura ítem por ítem. **«Pierde su razón de ser» deja de ser prosa y pasa a ser una lista con casillas.** Esto instrumenta la `definicion_de_exito` #5. |
| **B-4** | `tasks/T-008.md` | `## Acceptance` #1 (el paréntesis) y #4 | (a) **Borrar el escape hatch** *«(o lleva adaptador documentado inline)»*. Reemplazar #1 por: *«La story de reemplazo se tipa contra la forma REAL: importar o transcribir literalmente `interface Message` de `products/cofoundy-platform/inbox-ai/frontend/src/lib/api.ts:229` (verificado) como fixture tipado; si la forma diverge, el typecheck DEBE fallar. Adaptador permitido sólo si el fixture de origen sigue siendo el tipo real.»* (b) **Cerrar la mitad huérfana de A-4:** añadir #5 → *«Calcular N y escribirlo: N = KB de `MessageBubble.tsx` + `MobileComposer.tsx` cubiertos por la story de reemplazo, registrado en `.cofoundy/state/reports/qa.md`. Sin N escrito, el criterio de éxito #4 sigue afirmándose.»* (c) **#4:** quitar de la acceptance de `qa` la anotación en `src/types/**` (celda ⛔ para las seis lanes) y reescribir: *«`COMPONENTS.md` actualizado; la deuda de los dos `Message` se **solicita** por `A` en `reports/qa.md` con el texto exacto propuesto para `src/types/message.ts:62` y `src/types/index.ts:28` — la aplica el CTO. La acceptance de qa se satisface con la solicitud, no con el write.»* |
| **B-3** | `tasks/T-007.md` | `## Acceptance` #2, la frase **«Criterio real: el fork `MobileComposer.tsx` (13 KB) de inbox-ai queda sin razón de ser.»** | Reemplazar por un instrumento en dos mitades, ambas rojas-capaces: *(i)* **Test mecánico:** simular `visualViewport` a altura de teclado (fake en jsdom o Playwright con viewport reducido) y afirmar que el bounding box del composer queda **dentro** del visual viewport; sin la resolución de `dvh`/`interactive-widget` DEBE fallar. *(ii)* **Checklist derivada del archivo real,** mismo patrón que A-4: enumerar los comportamientos de `projects/tracta/frontend/src/components/conversation/MobileComposer.tsx` (verificado: 13 KB, existe) y afirmar cobertura ítem por ítem. **«Pierde su razón de ser» deja de ser prosa y pasa a ser una lista con casillas.** Esto instrumenta la `definicion_de_exito` #5. |
| **B-4** | `tasks/T-008.md` | `## Acceptance` #1 (el paréntesis) y #4 | (a) **Borrar el escape hatch** *«(o lleva adaptador documentado inline)»*. Reemplazar #1 por: *«La story de reemplazo se tipa contra la forma REAL: importar o transcribir literalmente `interface Message` de `projects/tracta/frontend/src/lib/api.ts:229` (verificado) como fixture tipado; si la forma diverge, el typecheck DEBE fallar. Adaptador permitido sólo si el fixture de origen sigue siendo el tipo real.»* (b) **Cerrar la mitad huérfana de A-4:** añadir #5 → *«Calcular N y escribirlo: N = KB de `MessageBubble.tsx` + `MobileComposer.tsx` cubiertos por la story de reemplazo, registrado en `.cofoundy/state/reports/qa.md`. Sin N escrito, el criterio de éxito #4 sigue afirmándose.»* (c) **#4:** quitar de la acceptance de `qa` la anotación en `src/types/**` (celda ⛔ para las seis lanes) y reescribir: *«`COMPONENTS.md` actualizado; la deuda de los dos `Message` se **solicita** por `A` en `reports/qa.md` con el texto exacto propuesto para `src/types/message.ts:62` y `src/types/index.ts:28` — la aplica el CTO. La acceptance de qa se satisface con la solicitud, no con el write.»* |
| **B-5** | `tasks/T-002.md` (agrega) y `tasks/T-005.md` (refuerza) | T-002 `## Acceptance`, **ítem nuevo #6**; T-005 `## Acceptance` #3 | (a) **T-002 #6 (nuevo, ola 1):** *«Test de fixture de caps: renderizar el mismo guion con un fixture que implemente los 16 campos difiriendo de WhatsApp en `tail: last`, `receiptGlyph: single-tick`, `reactions: own-row`; el DOM debe cambiar en las tres. **Gemelo positivo:** con el fixture WhatsApp, el DOM vuelve al render de referencia. Un layout hardcodeado DEBE ponerlo rojo — en la ola 1, antes de que `capture/` congele goldens.»* (b) **T-005 #3:** el grep se conserva como red barata pero deja de ser el detector primario; añadir: *«El detector de hardcode es el test de fixture de caps de T-002 #6, extendido a los dos adapters reales. El grep no caza `switch`, `==`, lookups por clave literal, ni un render mono-canal sin ramas.»* **Esto instrumenta además la `definicion_de_exito` #2** (diferencias estructurales, no de color). |
| **B-6** | `tasks/T-002.md` | `## Acceptance`, **ítem nuevo #7** | *«El bundle construido de `element/` contiene **cero** React: afirmarlo sobre el grafo de imports del build (`react`/`react-dom` ausentes de las dependencias del bundle). Gemelo positivo: la misma sonda contra el bundle de `react/` DEBE dar positivo — un chequeo que nunca encuentra React no prueba nada.»* Instrumenta la `definicion_de_exito` #3 («las dos landings Astro lo montan sin agregar React»), que hoy no tiene ninguna sonda: `demo/index.html` abre igual aunque React venga empaquetado. |
| **B-7** | `specs/file-ownership-matrix.md` §Olas + protocolo de reportes de lane | Fila de «Reportes» de la tabla de verificación de colisión | Hacer **medible** el tripwire `budget_overrun`, hoy infireable: *(i)* cada `.cofoundy/state/reports/{lane}.md` **DEBE** abrir con el campo `wall_clock_minutes:` — un reporte sin él es reporte incompleto; *(ii)* el CTO suma el acumulado **al cierre de cada ola**; *(iii)* **disparo duro:** si el acumulado cruza **24 h** en cualquier momento, `budget_overrun` escala **de inmediato**, sin terminar la ola; *(iv)* **disparo temprano:** al cierre de la ola 3 (6 de 8 tareas), si el acumulado supera **16 h**, escalar ahí — la cola (T-007 react+mobile, T-008 stories+tests+coverage+docs) no baja plausiblemente de 8 h, y 24 − 8 = 16. La cifra es derivada, no elegida. |
Expand Down Expand Up @@ -391,7 +391,7 @@ veredicto a propósito.
«nunca absorbas en silencio un pivot de scope»); precedencia operador > config de proyecto
- `packages/ui/CLAUDE.md` — contrato `MobileBaseline`, SSOT de `COMPONENTS.md`
- **Verificado en disco, no inferido:**
`products/cofoundy-platform/inbox-ai/frontend/src/components/conversation/MobileComposer.tsx` (13 KB, existe) ·
`projects/tracta/frontend/src/components/conversation/MobileComposer.tsx` (13 KB, existe) ·
`…/frontend/src/lib/api.ts:229` (`interface Message`, la forma real para B-4) ·
`…/frontend/src/lib/messageGrouping.ts:25` (`groupKey`, el que el adapter adopta)

Expand Down
2 changes: 1 addition & 1 deletion COMPONENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Most common needs first. Story URL pattern: `https://ui.cofoundy.dev/?path=/docs
| **Docs MDX components** (allowlist for `docs-ai/content/*`) | see [Docs](#docs) (15 components) | Docs | `docs-*` |
| Slot-composable client portal page | `ClientPortalPanel` | Docs | `docs-clientportalpanel` |
| Wikilink hover preview in docs | `LinkPreviewProvider` | Docs | `docs-linkpreview` |
| Deterministic, seeded chat-conversation simulator (WhatsApp/Telegram look, byte-identical screenshots) | `ChatSim` (React), `<cf-chat-sim>` (custom element) | Chat Sim | `chatsim-channels`, `chatsim-states`, `chatsim-inboxai-replacement` |
| Deterministic, seeded chat-conversation simulator (WhatsApp/Telegram look, byte-identical screenshots) | `ChatSim` (React), `<cf-chat-sim>` (custom element) | Chat Sim | `chatsim-channels`, `chatsim-states`, `chatsim-tracta-replacement` |

---

Expand Down
2 changes: 1 addition & 1 deletion demo/chat-sim.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ var CfChatSim = (() => {
avatarSide: "inbound",
// T-028: WhatsApp Business's `interactive.type: "buttons"|"list"` — each its own native
// message type with its own chrome (reply-buttons, and a scrollable list opened via a button).
// Both supported, nothing to constrain yet (inbox-ai capabilities.py/registry.py's model).
// Both supported, nothing to constrain yet (Tracta capabilities.py/registry.py's model).
capabilities: {
buttons: null,
list: null
Expand Down
6 changes: 3 additions & 3 deletions demo/parity-t027.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
T-027 acceptance evidence page — same no-build-step contract as index.html/chrome-axis.html
(file:// only, checked-in bundle, no type="module").

Left: WhatsApp, chrome="branded" with a Fovente-red consumer token + `loop` — this is
Left: WhatsApp, chrome="branded" with a brand-red consumer token + `loop` — this is
exactly ChatDemo.astro's production case (auto-scroll via scrollId, loop, `service`
encryption-notice/stop/done), reproduced through the real engine.
Right: Telegram, chrome="fidelity", same script — the gemelo: `service` renders in both
Expand Down Expand Up @@ -105,7 +105,7 @@ <h1>T-027 — scroll(scrollId) + loop + service + receipts + chrome="branded" +
{ "k": "post", "by": "out:ai", "text": "*Resumen de la reserva*\n• Sábado 8:00pm\n• 4 personas\n• Mesa junto a la ventana", "delayMs": 400 },
{ "k": "post", "by": "in", "text": "Perfecto, confirmo", "delayMs": 1400 },
{ "k": "receipt", "id": "m2", "to": "read", "delayMs": 0 },
{ "k": "post", "by": "out:ai", "text": "Paga aquí: pagos.fovente.pe/r/8x2", "media": { "link": true }, "delayMs": 700 },
{ "k": "post", "by": "out:ai", "text": "Paga aquí: pagos.ejemplo.pe/r/8x2", "media": { "link": true }, "delayMs": 700 },
{ "k": "receipt", "id": "m5", "to": "sent", "delayMs": 400 },
{ "k": "receipt", "id": "m5", "to": "delivered", "delayMs": 500 },
{ "k": "post", "by": "system", "text": "TRACTA SE DETUVO · PAGO DECLARADO", "media": { "kind": "service", "variant": "warn" }, "delayMs": 900 },
Expand Down Expand Up @@ -138,7 +138,7 @@ <h1>T-027 — scroll(scrollId) + loop + service + receipts + chrome="branded" +
{ "k": "post", "by": "out:ai", "text": "*Resumen de la reserva*\n• Sábado 8:00pm\n• 4 personas\n• Mesa junto a la ventana", "delayMs": 900 },
{ "k": "post", "by": "in", "text": "Perfecto, confirmo", "delayMs": 1400 },
{ "k": "receipt", "id": "m2", "to": "read", "delayMs": 0 },
{ "k": "post", "by": "out:ai", "text": "Paga aquí: pagos.fovente.pe/r/8x2", "media": { "link": true }, "delayMs": 700 },
{ "k": "post", "by": "out:ai", "text": "Paga aquí: pagos.ejemplo.pe/r/8x2", "media": { "link": true }, "delayMs": 700 },
{ "k": "receipt", "id": "m5", "to": "sent", "delayMs": 400 },
{ "k": "receipt", "id": "m5", "to": "read", "delayMs": 500 },
{ "k": "post", "by": "system", "text": "TRACTA SE DETUVO · PAGO DECLARADO", "media": { "kind": "service", "variant": "warn" }, "delayMs": 900 },
Expand Down
Loading
Loading