Compare commits
5
Commits
c44ecfc14b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b528c7be1a | ||
|
|
99f8581cc8 | ||
|
|
42927b9858 | ||
|
|
338dc20126 | ||
|
|
6880b74b60 |
No files matched your search
@@ -24,6 +24,10 @@ A mobile-first invitation app with animated golden bokeh particles, an RSVP form
|
|||||||
- [Infrastructure Specification](specs/infra.md)
|
- [Infrastructure Specification](specs/infra.md)
|
||||||
- [Roadmap](ROADMAP.md)
|
- [Roadmap](ROADMAP.md)
|
||||||
|
|
||||||
|
## Experiments
|
||||||
|
|
||||||
|
- [SSO Graphify Benchmark](experiments/bdinvite-sso-graphify-benchmark/README.md) — Retrospective and archived evidence from an 8-checkpoint agent implementation benchmark.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[Unlicense](UNLICENSE) — public domain.
|
[Unlicense](UNLICENSE) — public domain.
|
||||||
@@ -13,11 +13,13 @@ from ..schemas import (
|
|||||||
GenerateMapPreviewResponse,
|
GenerateMapPreviewResponse,
|
||||||
InvitationConfigResponse,
|
InvitationConfigResponse,
|
||||||
InvitationConfigUpdate,
|
InvitationConfigUpdate,
|
||||||
|
RSVPAdminItem,
|
||||||
RSVPListResponse,
|
RSVPListResponse,
|
||||||
|
RSVPUpdate,
|
||||||
)
|
)
|
||||||
from ..services.config import get_config, seed_default_config, update_config
|
from ..services.config import get_config, seed_default_config, update_config
|
||||||
from ..services.map_preview import generate_map_preview_image, resolve_google_maps_coordinates
|
from ..services.map_preview import generate_map_preview_image, resolve_google_maps_coordinates
|
||||||
from ..services.rsvp import get_rsvps
|
from ..services.rsvp import delete_rsvp, get_rsvps, update_rsvp
|
||||||
|
|
||||||
router = APIRouter(tags=["Admin"])
|
router = APIRouter(tags=["Admin"])
|
||||||
|
|
||||||
@@ -82,6 +84,67 @@ def list_rsvps(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete(
|
||||||
|
"/rsvps/{rsvp_id}",
|
||||||
|
status_code=status.HTTP_204_NO_CONTENT,
|
||||||
|
summary="Eliminar confirmación de asistencia",
|
||||||
|
description="Elimina permanentemente un registro de RSVP por su identificador.",
|
||||||
|
responses={
|
||||||
|
204: {"description": "Registro eliminado con éxito."},
|
||||||
|
404: {"description": "Registro no encontrado."},
|
||||||
|
**ADMIN_401,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
def delete_rsvp_endpoint(
|
||||||
|
rsvp_id: int,
|
||||||
|
admin: AdminDep,
|
||||||
|
db: DbDep,
|
||||||
|
):
|
||||||
|
deleted = delete_rsvp(db, rsvp_id)
|
||||||
|
if not deleted:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
detail=f"No se encontró el registro con ID {rsvp_id}",
|
||||||
|
)
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch(
|
||||||
|
"/rsvps/{rsvp_id}",
|
||||||
|
response_model=RSVPAdminItem,
|
||||||
|
summary="Editar una confirmación de asistencia",
|
||||||
|
description="Actualiza el nombre, teléfono o correo de un asistente confirmado.",
|
||||||
|
responses={
|
||||||
|
200: {"model": RSVPAdminItem, "description": "Registro actualizado exitosamente."},
|
||||||
|
400: {"description": "Error de validación en los campos proporcionados."},
|
||||||
|
404: {"description": "Registro no encontrado."},
|
||||||
|
409: {"description": "El número de teléfono ya está registrado por otro asistente."},
|
||||||
|
**ADMIN_401,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
def update_rsvp_endpoint(
|
||||||
|
rsvp_id: int,
|
||||||
|
payload: RSVPUpdate,
|
||||||
|
admin: AdminDep,
|
||||||
|
db: DbDep,
|
||||||
|
):
|
||||||
|
status_res, updated = update_rsvp(db, rsvp_id, payload)
|
||||||
|
|
||||||
|
if status_res == "NOT_FOUND":
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
detail=f"No se encontró el registro con ID {rsvp_id}",
|
||||||
|
)
|
||||||
|
if status_res == "DUPLICATE":
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_409_CONFLICT,
|
||||||
|
detail="El número de teléfono ya está registrado para otro asistente.",
|
||||||
|
)
|
||||||
|
assert updated is not None
|
||||||
|
return updated
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/export",
|
"/export",
|
||||||
summary="Exportar confirmaciones en formato CSV",
|
summary="Exportar confirmaciones en formato CSV",
|
||||||
@@ -108,7 +171,10 @@ def export_rsvps_csv(
|
|||||||
writer.writerow(["name", "phone", "email", "created_at"])
|
writer.writerow(["name", "phone", "email", "created_at"])
|
||||||
|
|
||||||
for item in rsvps:
|
for item in rsvps:
|
||||||
created_iso = item.created_at.isoformat() if item.created_at else ""
|
created_iso = ""
|
||||||
|
if item.created_at:
|
||||||
|
dt = item.created_at if item.created_at.tzinfo else item.created_at.replace(tzinfo=UTC)
|
||||||
|
created_iso = dt.isoformat()
|
||||||
writer.writerow([item.name, item.phone, item.email or "", created_iso])
|
writer.writerow([item.name, item.phone, item.email or "", created_iso])
|
||||||
|
|
||||||
csv_content = output.getvalue()
|
csv_content = output.getvalue()
|
||||||
|
|||||||
+97
-2
@@ -1,9 +1,28 @@
|
|||||||
import re
|
import re
|
||||||
from datetime import date, datetime
|
from datetime import UTC, date, datetime
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
from pydantic import BaseModel, ConfigDict, Field, field_serializer, field_validator
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_phone(raw: str) -> str:
|
||||||
|
"""Normalize Colombian mobile numbers.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
1. Strip all non-digit characters.
|
||||||
|
2. If starts with '57' and has 12 digits, strip '57'.
|
||||||
|
3. Must be exactly 10 digits and start with '3'.
|
||||||
|
"""
|
||||||
|
digits = re.sub(r"\D", "", raw)
|
||||||
|
if digits.startswith("57") and len(digits) == 12:
|
||||||
|
digits = digits[2:]
|
||||||
|
|
||||||
|
if len(digits) != 10 or not digits.startswith("3"):
|
||||||
|
raise ValueError("Formato de teléfono inválido")
|
||||||
|
|
||||||
|
return digits
|
||||||
|
|
||||||
|
|
||||||
class RSVPCreate(BaseModel):
|
class RSVPCreate(BaseModel):
|
||||||
@@ -36,6 +55,11 @@ class RSVPCreate(BaseModel):
|
|||||||
raise ValueError("El nombre no puede estar vacío.")
|
raise ValueError("El nombre no puede estar vacío.")
|
||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
|
@field_validator("phone")
|
||||||
|
@classmethod
|
||||||
|
def validate_phone(cls, v: str) -> str:
|
||||||
|
return normalize_phone(v)
|
||||||
|
|
||||||
@field_validator("email")
|
@field_validator("email")
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_email(cls, v: str | None) -> str | None:
|
def validate_email(cls, v: str | None) -> str | None:
|
||||||
@@ -50,6 +74,61 @@ class RSVPCreate(BaseModel):
|
|||||||
return cleaned.lower()
|
return cleaned.lower()
|
||||||
|
|
||||||
|
|
||||||
|
class RSVPUpdate(BaseModel):
|
||||||
|
name: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
min_length=1,
|
||||||
|
max_length=100,
|
||||||
|
description="Nombre completo del invitado",
|
||||||
|
examples=["Andrés García"],
|
||||||
|
)
|
||||||
|
phone: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
min_length=1,
|
||||||
|
max_length=50,
|
||||||
|
description="Número móvil en formato colombiano (10 dígitos, con o sin prefijo +57)",
|
||||||
|
examples=["+57 300 123 4567"],
|
||||||
|
)
|
||||||
|
email: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
max_length=255,
|
||||||
|
description="Correo electrónico opcional para confirmación y recordatorios",
|
||||||
|
examples=["andres@example.com"],
|
||||||
|
)
|
||||||
|
|
||||||
|
@field_validator("name")
|
||||||
|
@classmethod
|
||||||
|
def normalize_name(cls, v: str | None) -> str | None:
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
cleaned = " ".join(v.strip().split())
|
||||||
|
if not cleaned:
|
||||||
|
raise ValueError("El nombre no puede estar vacío.")
|
||||||
|
return cleaned
|
||||||
|
|
||||||
|
@field_validator("phone")
|
||||||
|
@classmethod
|
||||||
|
def validate_phone(cls, v: str | None) -> str | None:
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
return normalize_phone(v)
|
||||||
|
|
||||||
|
@field_validator("email")
|
||||||
|
@classmethod
|
||||||
|
def validate_email(cls, v: str | None) -> str | None:
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
cleaned = v.strip()
|
||||||
|
if not cleaned:
|
||||||
|
return None
|
||||||
|
email_regex = r"^[^@\s]+@[^@\s]+\.[^@\s]+$"
|
||||||
|
if not re.match(email_regex, cleaned):
|
||||||
|
raise ValueError("Formato de correo electrónico inválido")
|
||||||
|
return cleaned.lower()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RSVPSuccessResponse(BaseModel):
|
class RSVPSuccessResponse(BaseModel):
|
||||||
result: Literal["SUCCESS"] = Field(
|
result: Literal["SUCCESS"] = Field(
|
||||||
default="SUCCESS",
|
default="SUCCESS",
|
||||||
@@ -97,6 +176,13 @@ class RSVPAdminItem(BaseModel):
|
|||||||
|
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
|
@field_serializer("created_at")
|
||||||
|
def serialize_created_at(self, dt: datetime) -> str:
|
||||||
|
if dt.tzinfo is None:
|
||||||
|
dt = dt.replace(tzinfo=UTC)
|
||||||
|
return dt.isoformat()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RSVPListResponse(BaseModel):
|
class RSVPListResponse(BaseModel):
|
||||||
count: int = Field(..., description="Cantidad total de confirmaciones encontradas", examples=[37])
|
count: int = Field(..., description="Cantidad total de confirmaciones encontradas", examples=[37])
|
||||||
@@ -295,6 +381,15 @@ class InvitationConfigResponse(InvitationConfigBase):
|
|||||||
|
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
|
@field_serializer("updated_at")
|
||||||
|
def serialize_updated_at(self, dt: datetime | None) -> str | None:
|
||||||
|
if dt is None:
|
||||||
|
return None
|
||||||
|
if dt.tzinfo is None:
|
||||||
|
dt = dt.replace(tzinfo=UTC)
|
||||||
|
return dt.isoformat()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GenerateMapPreviewRequest(BaseModel):
|
class GenerateMapPreviewRequest(BaseModel):
|
||||||
map_url: str | None = Field(
|
map_url: str | None = Field(
|
||||||
|
|||||||
@@ -1,29 +1,9 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
from sqlalchemy import or_, select
|
from sqlalchemy import or_, select
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from ..models import RSVP
|
from ..models import RSVP
|
||||||
from ..schemas import RSVPCreate
|
from ..schemas import RSVPCreate, RSVPUpdate, normalize_phone
|
||||||
|
|
||||||
|
|
||||||
def normalize_phone(raw: str) -> str:
|
|
||||||
"""Normalize Colombian mobile numbers.
|
|
||||||
|
|
||||||
Rules:
|
|
||||||
1. Strip all non-digit characters.
|
|
||||||
2. If starts with '57' and has 12 digits, strip '57'.
|
|
||||||
3. Must be exactly 10 digits and start with '3'.
|
|
||||||
"""
|
|
||||||
digits = re.sub(r"\D", "", raw)
|
|
||||||
if digits.startswith("57") and len(digits) == 12:
|
|
||||||
digits = digits[2:]
|
|
||||||
|
|
||||||
if len(digits) != 10 or not digits.startswith("3"):
|
|
||||||
raise ValueError("Formato de teléfono inválido")
|
|
||||||
|
|
||||||
return digits
|
|
||||||
|
|
||||||
|
|
||||||
def create_rsvp(db: Session, rsvp_in: RSVPCreate) -> tuple[str, RSVP | None]:
|
def create_rsvp(db: Session, rsvp_in: RSVPCreate) -> tuple[str, RSVP | None]:
|
||||||
@@ -81,3 +61,57 @@ def get_rsvp_count(db: Session) -> int:
|
|||||||
"""Get total count of RSVPs."""
|
"""Get total count of RSVPs."""
|
||||||
query = select(RSVP)
|
query = select(RSVP)
|
||||||
return len(list(db.execute(query).scalars().all()))
|
return len(list(db.execute(query).scalars().all()))
|
||||||
|
|
||||||
|
|
||||||
|
def delete_rsvp(db: Session, rsvp_id: int) -> bool:
|
||||||
|
"""Delete an RSVP record by its ID. Returns True if deleted, False if not found."""
|
||||||
|
rsvp = db.execute(select(RSVP).where(RSVP.id == rsvp_id)).scalar_one_or_none()
|
||||||
|
if not rsvp:
|
||||||
|
return False
|
||||||
|
db.delete(rsvp)
|
||||||
|
db.commit()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def update_rsvp(
|
||||||
|
db: Session,
|
||||||
|
rsvp_id: int,
|
||||||
|
update_in: RSVPUpdate,
|
||||||
|
) -> tuple[str, RSVP | None]:
|
||||||
|
"""Update an RSVP record using validated RSVPUpdate schema.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
("SUCCESS", rsvp)
|
||||||
|
("NOT_FOUND", None)
|
||||||
|
("DUPLICATE", None)
|
||||||
|
"""
|
||||||
|
rsvp = db.execute(select(RSVP).where(RSVP.id == rsvp_id)).scalar_one_or_none()
|
||||||
|
if not rsvp:
|
||||||
|
return "NOT_FOUND", None
|
||||||
|
|
||||||
|
if update_in.phone is not None:
|
||||||
|
existing = db.execute(
|
||||||
|
select(RSVP).where(RSVP.phone == update_in.phone, RSVP.id != rsvp_id)
|
||||||
|
).scalar_one_or_none()
|
||||||
|
if existing:
|
||||||
|
return "DUPLICATE", None
|
||||||
|
rsvp.phone = update_in.phone
|
||||||
|
|
||||||
|
if update_in.name is not None:
|
||||||
|
rsvp.name = update_in.name
|
||||||
|
|
||||||
|
if update_in.email is not None:
|
||||||
|
rsvp.email = update_in.email
|
||||||
|
|
||||||
|
try:
|
||||||
|
db.commit()
|
||||||
|
db.refresh(rsvp)
|
||||||
|
return "SUCCESS", rsvp
|
||||||
|
except IntegrityError:
|
||||||
|
db.rollback()
|
||||||
|
return "DUPLICATE", None
|
||||||
|
except Exception:
|
||||||
|
db.rollback()
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
@@ -68,3 +68,94 @@ def test_admin_export_csv(client):
|
|||||||
lines = content.strip().split("\r\n") if "\r\n" in content else content.strip().split("\n")
|
lines = content.strip().split("\r\n") if "\r\n" in content else content.strip().split("\n")
|
||||||
assert lines[0] == "name,phone,email,created_at"
|
assert lines[0] == "name,phone,email,created_at"
|
||||||
assert "Sofia Vergara,3019998877,sofia@hollywood.com" in lines[1]
|
assert "Sofia Vergara,3019998877,sofia@hollywood.com" in lines[1]
|
||||||
|
|
||||||
|
|
||||||
|
def test_admin_delete_rsvp(client):
|
||||||
|
headers = {"Remote-User": "kiskaadee"}
|
||||||
|
|
||||||
|
# Unauthorized without header
|
||||||
|
res_unauth = client.delete("/birthday/api/admin/rsvps/1")
|
||||||
|
assert res_unauth.status_code == 401
|
||||||
|
|
||||||
|
# 404 for non-existent RSVP
|
||||||
|
res_404 = client.delete("/birthday/api/admin/rsvps/9999", headers=headers)
|
||||||
|
assert res_404.status_code == 404
|
||||||
|
|
||||||
|
# Create an RSVP
|
||||||
|
client.post(
|
||||||
|
"/birthday/api/rsvp",
|
||||||
|
json={"name": "Lucas Silva", "phone": "300 444 5566", "email": "lucas@test.com"},
|
||||||
|
)
|
||||||
|
list_res = client.get("/birthday/api/admin/rsvps", headers=headers)
|
||||||
|
assert list_res.status_code == 200
|
||||||
|
rsvps = list_res.json()["rsvps"]
|
||||||
|
assert len(rsvps) == 1
|
||||||
|
rsvp_id = rsvps[0]["id"]
|
||||||
|
|
||||||
|
# Delete successfully
|
||||||
|
del_res = client.delete(f"/birthday/api/admin/rsvps/{rsvp_id}", headers=headers)
|
||||||
|
assert del_res.status_code == 204
|
||||||
|
|
||||||
|
# Confirm deletion
|
||||||
|
list_after = client.get("/birthday/api/admin/rsvps", headers=headers)
|
||||||
|
assert list_after.json()["count"] == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_admin_update_rsvp(client):
|
||||||
|
headers = {"Remote-User": "kiskaadee"}
|
||||||
|
|
||||||
|
# Unauthorized without header
|
||||||
|
res_unauth = client.patch("/birthday/api/admin/rsvps/1", json={"name": "New Name"})
|
||||||
|
assert res_unauth.status_code == 401
|
||||||
|
|
||||||
|
# 404 for non-existent RSVP
|
||||||
|
res_404 = client.patch(
|
||||||
|
"/birthday/api/admin/rsvps/9999",
|
||||||
|
json={"name": "New Name"},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
assert res_404.status_code == 404
|
||||||
|
|
||||||
|
# Create two RSVPs
|
||||||
|
client.post(
|
||||||
|
"/birthday/api/rsvp",
|
||||||
|
json={"name": "Person One", "phone": "300 111 2222", "email": "one@test.com"},
|
||||||
|
)
|
||||||
|
client.post(
|
||||||
|
"/birthday/api/rsvp",
|
||||||
|
json={"name": "Person Two", "phone": "300 333 4444", "email": "two@test.com"},
|
||||||
|
)
|
||||||
|
|
||||||
|
list_res = client.get("/birthday/api/admin/rsvps", headers=headers)
|
||||||
|
rsvps = list_res.json()["rsvps"]
|
||||||
|
id_one = next(r["id"] for r in rsvps if r["name"] == "Person One")
|
||||||
|
id_two = next(r["id"] for r in rsvps if r["name"] == "Person Two")
|
||||||
|
|
||||||
|
# Update Person One with valid new name and phone
|
||||||
|
patch_res = client.patch(
|
||||||
|
f"/birthday/api/admin/rsvps/{id_one}",
|
||||||
|
json={"name": "Person One Updated", "phone": "+57 300 999 8888", "email": "newone@test.com"},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
assert patch_res.status_code == 200
|
||||||
|
updated_data = patch_res.json()
|
||||||
|
assert updated_data["name"] == "Person One Updated"
|
||||||
|
assert updated_data["phone"] == "3009998888"
|
||||||
|
assert updated_data["email"] == "newone@test.com"
|
||||||
|
|
||||||
|
# Attempt to update Person One's phone to Person Two's phone -> 409
|
||||||
|
dup_res = client.patch(
|
||||||
|
f"/birthday/api/admin/rsvps/{id_one}",
|
||||||
|
json={"phone": "300 333 4444"},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
assert dup_res.status_code == 409
|
||||||
|
|
||||||
|
# Validation error for invalid phone
|
||||||
|
val_res = client.patch(
|
||||||
|
f"/birthday/api/admin/rsvps/{id_one}",
|
||||||
|
json={"phone": "12345"},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
assert val_res.status_code in (400, 422)
|
||||||
|
|
||||||
Generated
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
version = 1
|
version = 1
|
||||||
revision = 3
|
revision = 5
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
resolution-markers = [
|
resolution-markers = [
|
||||||
"python_full_version >= '3.14'",
|
"python_full_version >= '3.14'",
|
||||||
@@ -90,11 +90,11 @@ dev = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "certifi"
|
name = "certifi"
|
||||||
version = "2026.7.22"
|
version = "2026.10.23"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112, upload-time = "2026-07-22T03:35:12.644Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/fd/11/b524cbd9bbdaca58608e4cf4053fd463417549e1959fa8d3aa18319f9555/certifi-2026.10.23.tar.gz", hash = "sha256:a9895e6e2758b371e0545e321a3a8fd1fcfd9829ada8824a936dfb16aaaf36cd", size = 136225, upload-time = "2026-10-23T11:36:16.478Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983, upload-time = "2026-07-22T03:35:11.276Z" },
|
{ url = "https://files.pythonhosted.org/packages/32/d1/a3652fe2c19134d0d15922177821d863cbd7e842d53a21bbe7e8e3a1b5ac/certifi-2026.10.23-py3-none-any.whl", hash = "sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1", size = 135082, upload-time = "2026-10-23T11:36:14.763Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# BDInvite Graphify-assisted SSO benchmark: retrospective
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
This experiment compared two agents implementing application-level OpenID Connect single sign-on in BDInvite. The control arm used the standard repository toolchain; the Graphify arm had Graphify available for repository exploration. The plan also specified eight implementation checkpoints, a disposable OIDC fixture, external verification, and collection of token estimates and tool-use telemetry.
|
||||||
|
|
||||||
|
## Outcome
|
||||||
|
|
||||||
|
The saved telemetry contains records for CP1 through CP8 for both arms. Every record is marked `PASS`. At CP8, both records report 25 baseline tests passing, zero failed verifications, the `Remote-User` static check passing, and a successful Docker build. The stored data therefore does not support describing the implementation experiment as a failure.
|
||||||
|
|
||||||
|
The token estimates do not show lower usage in the Graphify arm. Summing the per-checkpoint `total_tokens_est` values gives:
|
||||||
|
|
||||||
|
| Arm | Estimated tokens | Checkpoint records |
|
||||||
|
| --- | ---: | ---: |
|
||||||
|
| Control | 19,907,364 | 8 |
|
||||||
|
| Graphify | 22,923,088 | 8 |
|
||||||
|
|
||||||
|
The Graphify sum is approximately 15.1% higher. This is a descriptive comparison of the stored estimates, not a reliable measurement of actual model token usage or proof that Graphify caused the difference.
|
||||||
|
|
||||||
|
## Measurement limitations
|
||||||
|
|
||||||
|
The records identify the estimation method as `character_density_approximation`, with a ratio of 3.8. These are not direct token counts from the model provider. The experiment did not capture enough authoritative usage data to make a strong claim about Graphify's effect on token consumption. Treat the percentages as exploratory only.
|
||||||
|
|
||||||
|
The frozen plan describes a broader agent-assisted SSO implementation benchmark, even though token efficiency is one of the interests. The result set is also a single paired run with one control worktree and one Graphify worktree. It cannot separate the effect of Graphify from run-to-run variation, prompt/context differences, or other agent behavior.
|
||||||
|
|
||||||
|
## What is still useful
|
||||||
|
|
||||||
|
- The frozen plan records the intended checkpoints, security requirements, and evaluation protocol.
|
||||||
|
- The fixture and evaluator source show how the work was set up and verified.
|
||||||
|
- The checkpoint JSON files preserve implementation outcomes, tool-call telemetry, commits, and estimated usage.
|
||||||
|
- The outcome suggests a useful follow-up: rerun with provider-reported token counts, repeated trials, and a clearly specified primary metric before drawing conclusions about efficiency.
|
||||||
|
|
||||||
|
## Preserved artifacts
|
||||||
|
|
||||||
|
The accompanying directories retain the frozen specification, manifest, evaluator, disposable OIDC fixture, and raw control/Graphify result records. The `control/` and `graphify/` worktrees are intentionally not part of this archive; they remain separate implementation branches (`control/feat/sso-auth` and `graphify/feat/sso-auth`).
|
||||||
|
|
||||||
|
| Artifact | Path in archive | Description & handling |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Benchmark specification | `specification/bdinvite_sso_benchmark_plan.md` | Frozen experimental protocol and checkpoint criteria (hash verified against manifest). |
|
||||||
|
| Experiment manifest | `manifest.json` | Recorded hashes, baseline commit, fixture config, and worktree metadata. |
|
||||||
|
| Gatekeeper & Evaluator | `evaluator/` (`gatekeeper.py`, `static_checks.py`, `telemetry.py`) | Evaluator support code and gatekeeper script used during the experiment. |
|
||||||
|
| Disposable OIDC Fixture | `fixture/` (`config.json`, `docker-compose.yml`, `start.sh`, `stop.sh`, `README.md`) | Disposable mock OAuth2 test fixture configuration and run scripts. |
|
||||||
|
| Raw checkpoint telemetry | `results/control/*.json`, `results/graphify/*.json` | Raw evidence records for checkpoints CP1 through CP8 for both arms. |
|
||||||
|
|
||||||
|
## Machine-specific paths and archival integrity
|
||||||
|
|
||||||
|
Certain preserved files contain absolute paths tied to the host environment where the benchmark ran:
|
||||||
|
- `manifest.json` references local filesystem paths for `canonical_brain_plan` and `source_repository`.
|
||||||
|
- `evaluator/gatekeeper.py` hardcodes an absolute path to a local commit ledger (`/home/kiskaadee/Brain/00-inbox/commit-log.csv`).
|
||||||
|
|
||||||
|
These files are preserved without modification to maintain the historical integrity of the experimental record. Any portability improvements or harness generalization should be handled as an explicit separate follow-up rather than altering frozen experiment artifacts.
|
||||||
@@ -0,0 +1,499 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Unified External Evaluator & Benchmark Gatekeeper.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python evaluator/gatekeeper.py freeze-check
|
||||||
|
python evaluator/gatekeeper.py baseline --worktree <path>
|
||||||
|
python evaluator/gatekeeper.py verify --checkpoint CP1 --worktree <path> --agent control
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.table import Table
|
||||||
|
|
||||||
|
# Add parent directory to sys.path
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
|
from evaluator.static_checks import (
|
||||||
|
check_application_domain_imports,
|
||||||
|
check_auth_port_abstraction,
|
||||||
|
check_remote_user_purged,
|
||||||
|
)
|
||||||
|
from evaluator.telemetry import log_checkpoint_telemetry
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
BENCHMARK_ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
RESULTS_DIR = BENCHMARK_ROOT / "results"
|
||||||
|
MANIFEST_PATH = BENCHMARK_ROOT / "manifest.json"
|
||||||
|
SPECIFICATION_PATH = BENCHMARK_ROOT / "specification" / "bdinvite_sso_benchmark_plan.md"
|
||||||
|
FIXTURE_DIR = BENCHMARK_ROOT / "fixture"
|
||||||
|
EVALUATOR_DIR = BENCHMARK_ROOT / "evaluator"
|
||||||
|
COMMIT_LEDGER_PATH = Path("/home/kiskaadee/Brain/00-inbox/commit-log.csv")
|
||||||
|
|
||||||
|
|
||||||
|
def run_command(cmd: List[str], cwd: Path) -> subprocess.CompletedProcess:
|
||||||
|
"""Run a shell command and return CompletedProcess."""
|
||||||
|
return subprocess.run(
|
||||||
|
cmd,
|
||||||
|
cwd=cwd,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def compute_sha256(file_path: Path) -> str:
|
||||||
|
"""Compute SHA-256 hash of a file."""
|
||||||
|
h = hashlib.sha256()
|
||||||
|
with open(file_path, "rb") as f:
|
||||||
|
while chunk := f.read(65536):
|
||||||
|
h.update(chunk)
|
||||||
|
return h.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def verify_baseline_tests(worktree: Path) -> Tuple[bool, int, int, str]:
|
||||||
|
"""Run the original 25 backend regression tests in the target worktree."""
|
||||||
|
backend_dir = worktree / "backend"
|
||||||
|
if not backend_dir.exists():
|
||||||
|
return False, 0, 0, f"Backend directory {backend_dir} does not exist."
|
||||||
|
|
||||||
|
baseline_files = [
|
||||||
|
"tests/test_admin.py",
|
||||||
|
"tests/test_config.py",
|
||||||
|
"tests/test_map_preview.py",
|
||||||
|
"tests/test_rsvp.py",
|
||||||
|
]
|
||||||
|
res = run_command(["uv", "run", "pytest"] + baseline_files, cwd=backend_dir)
|
||||||
|
import re
|
||||||
|
m = re.search(r"(\d+) passed", res.stdout)
|
||||||
|
passed_count = int(m.group(1)) if m else 0
|
||||||
|
passed = res.returncode == 0 and passed_count >= 25 and "failed" not in res.stdout
|
||||||
|
output = res.stdout + "\n" + res.stderr
|
||||||
|
return passed, passed_count if passed else 0, 25, output
|
||||||
|
|
||||||
|
|
||||||
|
def check_git_contamination(worktree: Path) -> Tuple[bool, List[str]]:
|
||||||
|
"""Verify that graphify-out or temporary artifacts are not tracked or committed."""
|
||||||
|
violations = []
|
||||||
|
# Check untracked / staged
|
||||||
|
res = run_command(["git", "status", "--porcelain"], cwd=worktree)
|
||||||
|
for line in res.stdout.splitlines():
|
||||||
|
if "graphify-out" in line:
|
||||||
|
violations.append(f"Untracked/Staged graphify-out in git status: {line}")
|
||||||
|
|
||||||
|
# Check commit log for graphify-out leaks
|
||||||
|
log_res = run_command(
|
||||||
|
["git", "log", "--name-only", "--pretty=format:%H", "42927b9..HEAD"],
|
||||||
|
cwd=worktree,
|
||||||
|
)
|
||||||
|
for line in log_res.stdout.splitlines():
|
||||||
|
if "graphify-out" in line:
|
||||||
|
violations.append(f"Committed graphify-out file found in git history: {line}")
|
||||||
|
|
||||||
|
return len(violations) == 0, violations
|
||||||
|
|
||||||
|
|
||||||
|
def check_commit_delegation(worktree: Path, baseline_sha: str = "42927b9") -> Tuple[bool, List[str], bool]:
|
||||||
|
"""Inspect commits created on top of baseline, verifying they are recorded in commit-log.csv."""
|
||||||
|
res = run_command(
|
||||||
|
["git", "rev-list", f"{baseline_sha}..HEAD"],
|
||||||
|
cwd=worktree,
|
||||||
|
)
|
||||||
|
commit_shas = [c.strip() for c in res.stdout.splitlines() if c.strip()]
|
||||||
|
if not commit_shas:
|
||||||
|
return True, [], False
|
||||||
|
|
||||||
|
# Check commit ledger if exists
|
||||||
|
ledger_content = COMMIT_LEDGER_PATH.read_text(encoding="utf-8") if COMMIT_LEDGER_PATH.exists() else ""
|
||||||
|
all_logged = True
|
||||||
|
for sha in commit_shas:
|
||||||
|
if sha not in ledger_content:
|
||||||
|
all_logged = False
|
||||||
|
break
|
||||||
|
|
||||||
|
return True, commit_shas, all_logged
|
||||||
|
|
||||||
|
|
||||||
|
def verify_freeze() -> bool:
|
||||||
|
"""Perform comprehensive Pre-Experiment Freeze Gate verification."""
|
||||||
|
console.print("\n[bold cyan]════════════════════════════════════════════════════════════[/bold cyan]")
|
||||||
|
console.print("[bold cyan] PRE-EXPERIMENT FREEZE GATE VERIFICATION (CP0) [/bold cyan]")
|
||||||
|
console.print("[bold cyan]════════════════════════════════════════════════════════════[/bold cyan]\n")
|
||||||
|
|
||||||
|
overall_pass = True
|
||||||
|
|
||||||
|
# 1. SPECIFICATION
|
||||||
|
if not SPECIFICATION_PATH.exists():
|
||||||
|
console.print(" [red]SPECIFICATION: FAIL (File not found)[/red]")
|
||||||
|
overall_pass = False
|
||||||
|
else:
|
||||||
|
spec_hash = compute_sha256(SPECIFICATION_PATH)
|
||||||
|
manifest_data = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
|
||||||
|
expected_hash = manifest_data.get("specification", {}).get("sha256")
|
||||||
|
if spec_hash == expected_hash:
|
||||||
|
console.print(f" [green]SPECIFICATION: PASS[/green] (SHA-256: [dim]{spec_hash[:12]}...[/dim])")
|
||||||
|
else:
|
||||||
|
console.print(f" [red]SPECIFICATION: FAIL (Hash mismatch: {spec_hash} != {expected_hash})[/red]")
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
# 2. MANIFEST
|
||||||
|
if MANIFEST_PATH.exists():
|
||||||
|
console.print(" [green]MANIFEST: PASS[/green]")
|
||||||
|
else:
|
||||||
|
console.print(" [red]MANIFEST: FAIL (manifest.json missing)[/red]")
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
# 3. FIXTURE (Test container lifecycle & discovery)
|
||||||
|
fixture_ok = True
|
||||||
|
start_script = FIXTURE_DIR / "start.sh"
|
||||||
|
stop_script = FIXTURE_DIR / "stop.sh"
|
||||||
|
if not (start_script.exists() and stop_script.exists()):
|
||||||
|
console.print(" [red]FIXTURE: FAIL (start.sh or stop.sh missing)[/red]")
|
||||||
|
fixture_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
else:
|
||||||
|
# Test starting fixture
|
||||||
|
start_res = run_command([str(start_script)], cwd=FIXTURE_DIR)
|
||||||
|
if start_res.returncode != 0:
|
||||||
|
console.print(f" [red]FIXTURE: FAIL (Start failed: {start_res.stderr})[/red]")
|
||||||
|
fixture_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
else:
|
||||||
|
# Query discovery
|
||||||
|
try:
|
||||||
|
r = httpx.get("http://localhost:8088/default/.well-known/openid-configuration", timeout=5.0)
|
||||||
|
disc = r.json()
|
||||||
|
assert disc.get("issuer") == "http://localhost:8088/default"
|
||||||
|
assert "authorization_endpoint" in disc
|
||||||
|
assert "token_endpoint" in disc
|
||||||
|
assert "jwks_uri" in disc
|
||||||
|
except Exception as e:
|
||||||
|
console.print(f" [red]FIXTURE: FAIL (Discovery validation error: {e})[/red]")
|
||||||
|
fixture_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
# Stop fixture
|
||||||
|
stop_res = run_command([str(stop_script)], cwd=FIXTURE_DIR)
|
||||||
|
if stop_res.returncode != 0:
|
||||||
|
console.print(f" [red]FIXTURE: FAIL (Stop failed: {stop_res.stderr})[/red]")
|
||||||
|
fixture_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
if fixture_ok:
|
||||||
|
console.print(" [green]FIXTURE: PASS[/green] (OIDC container discovery & lifecycle verified)")
|
||||||
|
|
||||||
|
# 4. EVALUATOR (Environment & Browser)
|
||||||
|
eval_ok = True
|
||||||
|
venv_py = EVALUATOR_DIR / ".venv" / "bin" / "python"
|
||||||
|
if not venv_py.exists():
|
||||||
|
console.print(" [red]EVALUATOR: FAIL (Virtualenv missing at evaluator/.venv)[/red]")
|
||||||
|
eval_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
else:
|
||||||
|
# Check required imports
|
||||||
|
check_code = "import pytest, httpx, cryptography, jwt, playwright; print('OK')"
|
||||||
|
res = run_command([str(venv_py), "-c", check_code], cwd=EVALUATOR_DIR)
|
||||||
|
if res.returncode != 0 or "OK" not in res.stdout:
|
||||||
|
console.print(f" [red]EVALUATOR: FAIL (Required dependencies missing: {res.stderr})[/red]")
|
||||||
|
eval_ok = False
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
if eval_ok:
|
||||||
|
console.print(" [green]EVALUATOR: PASS[/green] (Python 3.13 venv, test runners, Chromium ready)")
|
||||||
|
|
||||||
|
# 5. CONTROL BASELINE
|
||||||
|
control_path = BENCHMARK_ROOT / "control"
|
||||||
|
ctrl_ok, ctrl_passed, ctrl_total, ctrl_err = verify_baseline_tests(control_path)
|
||||||
|
if ctrl_ok:
|
||||||
|
console.print(f" [green]CONTROL BASELINE: PASS[/green] ({ctrl_passed}/{ctrl_total} tests passing, commit: [dim]42927b9[/dim])")
|
||||||
|
else:
|
||||||
|
console.print(f" [red]CONTROL BASELINE: FAIL ({ctrl_passed}/{ctrl_total} tests passing: {ctrl_err})[/red]")
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
# 6. GRAPHIFY BASELINE
|
||||||
|
graphify_path = BENCHMARK_ROOT / "graphify"
|
||||||
|
graph_ok, graph_passed, graph_total, graph_err = verify_baseline_tests(graphify_path)
|
||||||
|
graph_json = graphify_path / "graphify-out" / "graph.json"
|
||||||
|
if graph_ok and graph_json.exists():
|
||||||
|
console.print(f" [green]GRAPHIFY BASELINE: PASS[/green] ({graph_passed}/{graph_total} tests passing, graph.json seeded)")
|
||||||
|
else:
|
||||||
|
console.print(f" [red]GRAPHIFY BASELINE: FAIL (Tests: {graph_passed}/{graph_total}, graph.json exists: {graph_json.exists()})[/red]")
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
# 7. GIT CONTAMINATION BARRIER
|
||||||
|
ctrl_clean, ctrl_contam = check_git_contamination(control_path)
|
||||||
|
graph_clean, graph_contam = check_git_contamination(graphify_path)
|
||||||
|
if ctrl_clean and graph_clean:
|
||||||
|
console.print(" [green]GIT CONTAMINATION BARRIER: PASS[/green] (graphify-out excluded from commits & tree)")
|
||||||
|
else:
|
||||||
|
console.print(" [red]GIT CONTAMINATION BARRIER: FAIL[/red]")
|
||||||
|
for c in ctrl_contam + graph_contam:
|
||||||
|
console.print(f" - {c}")
|
||||||
|
overall_pass = False
|
||||||
|
|
||||||
|
console.print("\n[bold cyan]────────────────────────────────────────────────────────────[/bold cyan]")
|
||||||
|
if overall_pass:
|
||||||
|
console.print("[bold green] RESULT: EXPERIMENT: READY[/bold green]")
|
||||||
|
console.print("[bold cyan]────────────────────────────────────────────────────────────[/bold cyan]\n")
|
||||||
|
else:
|
||||||
|
console.print("[bold red] RESULT: EXPERIMENT: BLOCKED (Resolve failures before CP1)[/bold red]")
|
||||||
|
console.print("[bold cyan]────────────────────────────────────────────────────────────[/bold cyan]\n")
|
||||||
|
|
||||||
|
return overall_pass
|
||||||
|
|
||||||
|
|
||||||
|
def verify_checkpoint(checkpoint: str, worktree: Path, agent: str) -> bool:
|
||||||
|
"""Execute gatekeeper checks for the requested checkpoint."""
|
||||||
|
started_at = datetime.now(timezone.utc)
|
||||||
|
console.print(
|
||||||
|
f"[bold blue]Evaluating {checkpoint} on {agent} ({worktree.name})...[/bold blue]"
|
||||||
|
)
|
||||||
|
|
||||||
|
verification_data: Dict[str, Any] = {
|
||||||
|
"checkpoint_tests": {"passed": 0, "total": 0},
|
||||||
|
"cumulative_regression_tests": {"passed": 0, "total": 25},
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"details": [],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Baseline tests must always pass
|
||||||
|
base_ok, base_passed, base_total, base_out = verify_baseline_tests(worktree)
|
||||||
|
verification_data["cumulative_regression_tests"]["passed"] = base_passed
|
||||||
|
if not base_ok:
|
||||||
|
console.print("[red]❌ Baseline regression tests failed![/red]")
|
||||||
|
console.print(base_out)
|
||||||
|
verification_data["failed_verifications_count"] += 1
|
||||||
|
ended_at = datetime.now(timezone.utc)
|
||||||
|
log_checkpoint_telemetry(
|
||||||
|
RESULTS_DIR,
|
||||||
|
agent,
|
||||||
|
checkpoint,
|
||||||
|
started_at,
|
||||||
|
ended_at,
|
||||||
|
status="FAIL",
|
||||||
|
outcome_reason="baseline_regression_failure",
|
||||||
|
verification_data=verification_data,
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
|
console.print("[green]✔ Baseline regression tests passed (25/25).[/green]")
|
||||||
|
|
||||||
|
# Step 2: Git contamination check
|
||||||
|
clean_tree, contam_violations = check_git_contamination(worktree)
|
||||||
|
if not clean_tree:
|
||||||
|
console.print("[red]❌ Git contamination violation: graphify-out found in history or staged:[/red]")
|
||||||
|
for cv in contam_violations:
|
||||||
|
console.print(f" - {cv}")
|
||||||
|
ended_at = datetime.now(timezone.utc)
|
||||||
|
log_checkpoint_telemetry(
|
||||||
|
RESULTS_DIR,
|
||||||
|
agent,
|
||||||
|
checkpoint,
|
||||||
|
started_at,
|
||||||
|
ended_at,
|
||||||
|
status="FAIL",
|
||||||
|
outcome_reason="git_contamination_detected",
|
||||||
|
verification_data=verification_data,
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Step 3: Git delegation observability check
|
||||||
|
has_commits, commit_shas, all_logged = check_commit_delegation(worktree)
|
||||||
|
|
||||||
|
passed = False
|
||||||
|
outcome_reason = "none"
|
||||||
|
|
||||||
|
if checkpoint == "CP1":
|
||||||
|
# CP1: AuthPort & Identity abstraction, application domain imports isolation
|
||||||
|
has_abstractions, notes = check_auth_port_abstraction(worktree)
|
||||||
|
import_violations = check_application_domain_imports(worktree)
|
||||||
|
|
||||||
|
for n in notes:
|
||||||
|
console.print(f" [cyan]ℹ {n}[/cyan]")
|
||||||
|
|
||||||
|
if not has_abstractions:
|
||||||
|
console.print(
|
||||||
|
"[red]❌ AuthPort interface or Identity model not found in backend/app/.[/red]"
|
||||||
|
)
|
||||||
|
verification_data["failed_verifications_count"] += 1
|
||||||
|
outcome_reason = "missing_abstractions"
|
||||||
|
elif import_violations:
|
||||||
|
console.print(
|
||||||
|
"[red]❌ Application domain directly imports auth/crypto libraries:[/red]"
|
||||||
|
)
|
||||||
|
for v in import_violations:
|
||||||
|
console.print(f" - {v}")
|
||||||
|
verification_data["failed_verifications_count"] += 1
|
||||||
|
outcome_reason = "domain_import_violations"
|
||||||
|
else:
|
||||||
|
# Run any tests added for CP1
|
||||||
|
res = run_command(["uv", "run", "pytest"], cwd=worktree / "backend")
|
||||||
|
if res.returncode == 0:
|
||||||
|
console.print(
|
||||||
|
"[green]✔ CP1 AuthPort contract & isolation verified successfully![/green]"
|
||||||
|
)
|
||||||
|
passed = True
|
||||||
|
verification_data["checkpoint_tests"]["passed"] = 1
|
||||||
|
verification_data["checkpoint_tests"]["total"] = 1
|
||||||
|
else:
|
||||||
|
console.print("[red]❌ Worktree pytest suite failed:[/red]")
|
||||||
|
console.print(res.stdout + res.stderr)
|
||||||
|
verification_data["failed_verifications_count"] += 1
|
||||||
|
outcome_reason = "test_suite_failure"
|
||||||
|
|
||||||
|
elif checkpoint == "CP6":
|
||||||
|
# CP6: Negative Barrier - Remote-User header MUST be rejected with 401
|
||||||
|
res = run_command(
|
||||||
|
[
|
||||||
|
"uv",
|
||||||
|
"run",
|
||||||
|
"python",
|
||||||
|
"-c",
|
||||||
|
"""
|
||||||
|
from fastapi.testclient import TestClient
|
||||||
|
from app.main import app
|
||||||
|
client = TestClient(app)
|
||||||
|
res = client.get('/birthday/api/admin/rsvps', headers={'Remote-User': 'kiskaadee'})
|
||||||
|
assert res.status_code == 401, f'Expected 401, got {res.status_code}'
|
||||||
|
print('CRITICAL NEGATIVE GATE PASSED: Remote-User without session rejected with 401')
|
||||||
|
""",
|
||||||
|
],
|
||||||
|
cwd=worktree / "backend",
|
||||||
|
)
|
||||||
|
if res.returncode == 0:
|
||||||
|
console.print(f"[green]✔ {res.stdout.strip()}[/green]")
|
||||||
|
passed = True
|
||||||
|
else:
|
||||||
|
console.print("[red]❌ Critical negative gate failed:[/red]")
|
||||||
|
console.print(res.stdout + res.stderr)
|
||||||
|
outcome_reason = "negative_barrier_failure"
|
||||||
|
|
||||||
|
elif checkpoint == "CP8":
|
||||||
|
# CP8: Purge verification: zero occurrences of Remote-User in runtime
|
||||||
|
ru_violations = check_remote_user_purged(worktree)
|
||||||
|
if ru_violations:
|
||||||
|
console.print(
|
||||||
|
f"[red]❌ Found {len(ru_violations)} runtime references to Remote-User:[/red]"
|
||||||
|
)
|
||||||
|
for v in ru_violations:
|
||||||
|
console.print(f" - {v}")
|
||||||
|
outcome_reason = "remote_user_leak_detected"
|
||||||
|
else:
|
||||||
|
console.print(
|
||||||
|
"[green]✔ Static check passed: Zero runtime occurrences of Remote-User.[/green]"
|
||||||
|
)
|
||||||
|
passed = True
|
||||||
|
else:
|
||||||
|
# Generic checkpoint test execution via worktree pytest
|
||||||
|
res = run_command(["uv", "run", "pytest"], cwd=worktree / "backend")
|
||||||
|
if res.returncode == 0:
|
||||||
|
console.print(
|
||||||
|
f"[green]✔ {checkpoint} test suite passed in worktree.[/green]"
|
||||||
|
)
|
||||||
|
passed = True
|
||||||
|
else:
|
||||||
|
console.print(f"[red]❌ {checkpoint} test suite failed in worktree:[/red]")
|
||||||
|
console.print(res.stdout + res.stderr)
|
||||||
|
outcome_reason = "test_suite_failure"
|
||||||
|
|
||||||
|
ended_at = datetime.now(timezone.utc)
|
||||||
|
status_str = "PASS" if passed else "FAIL"
|
||||||
|
|
||||||
|
# Git commit telemetry
|
||||||
|
git_telemetry = {
|
||||||
|
"commits_created": len(commit_shas),
|
||||||
|
"commit_shas": commit_shas,
|
||||||
|
"checkpoint_commit_sha": commit_shas[0] if commit_shas else "",
|
||||||
|
"commit_delegate_logged": all_logged,
|
||||||
|
}
|
||||||
|
|
||||||
|
log_checkpoint_telemetry(
|
||||||
|
RESULTS_DIR,
|
||||||
|
agent,
|
||||||
|
checkpoint,
|
||||||
|
started_at,
|
||||||
|
ended_at,
|
||||||
|
status=status_str,
|
||||||
|
outcome_reason=outcome_reason,
|
||||||
|
verification_data=verification_data,
|
||||||
|
git_data=git_telemetry,
|
||||||
|
)
|
||||||
|
|
||||||
|
if passed:
|
||||||
|
console.print(
|
||||||
|
f"[bold green]🚀 Checkpoint {checkpoint} PASSED for {agent}![/bold green]"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
console.print(
|
||||||
|
f"[bold red]⛔ Checkpoint {checkpoint} FAILED for {agent}. Agent must iterate within this checkpoint.[/bold red]"
|
||||||
|
)
|
||||||
|
|
||||||
|
return passed
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="BDInvite SSO Benchmark Gatekeeper")
|
||||||
|
subparsers = parser.add_subparsers(dest="command")
|
||||||
|
|
||||||
|
# Freeze-check command
|
||||||
|
subparsers.add_parser("freeze-check")
|
||||||
|
|
||||||
|
# Baseline command
|
||||||
|
base_parser = subparsers.add_parser("baseline")
|
||||||
|
base_parser.add_argument(
|
||||||
|
"--worktree", type=Path, required=True, help="Path to worktree"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Verify command
|
||||||
|
verify_parser = subparsers.add_parser("verify")
|
||||||
|
verify_parser.add_argument(
|
||||||
|
"--checkpoint",
|
||||||
|
type=str,
|
||||||
|
required=True,
|
||||||
|
choices=[f"CP{i}" for i in range(1, 9)],
|
||||||
|
)
|
||||||
|
verify_parser.add_argument(
|
||||||
|
"--worktree", type=Path, required=True, help="Path to worktree"
|
||||||
|
)
|
||||||
|
verify_parser.add_argument(
|
||||||
|
"--agent",
|
||||||
|
type=str,
|
||||||
|
required=True,
|
||||||
|
choices=["control", "graphify"],
|
||||||
|
help="Agent name",
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.command == "freeze-check":
|
||||||
|
ok = verify_freeze()
|
||||||
|
sys.exit(0 if ok else 1)
|
||||||
|
|
||||||
|
elif args.command == "baseline":
|
||||||
|
ok, passed, total, out = verify_baseline_tests(args.worktree)
|
||||||
|
if ok:
|
||||||
|
console.print(f"[green]✔ Baseline passed: {passed}/{total}[/green]")
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
console.print(f"[red]❌ Baseline failed:\n{out}[/red]")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
elif args.command == "verify":
|
||||||
|
ok = verify_checkpoint(args.checkpoint, args.worktree, args.agent)
|
||||||
|
sys.exit(0 if ok else 1)
|
||||||
|
|
||||||
|
else:
|
||||||
|
parser.print_help()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
"""Static architectural assertion checks for BDInvite SSO Benchmark."""
|
||||||
|
|
||||||
|
import ast
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
|
|
||||||
|
def check_remote_user_purged(worktree_path: Path) -> List[str]:
|
||||||
|
"""Verify that runtime code contains zero occurrences of Remote-User header checks."""
|
||||||
|
violations = []
|
||||||
|
target_dirs = [
|
||||||
|
worktree_path / "backend" / "app",
|
||||||
|
worktree_path / "frontend" / "src",
|
||||||
|
]
|
||||||
|
pattern = re.compile(r"remote[-_]user", re.IGNORECASE)
|
||||||
|
|
||||||
|
for target_dir in target_dirs:
|
||||||
|
if not target_dir.exists():
|
||||||
|
continue
|
||||||
|
for file_path in target_dir.rglob("*"):
|
||||||
|
if not file_path.is_file() or file_path.suffix not in {
|
||||||
|
".py",
|
||||||
|
".ts",
|
||||||
|
".tsx",
|
||||||
|
".js",
|
||||||
|
".jsx",
|
||||||
|
}:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
content = file_path.read_text(encoding="utf-8")
|
||||||
|
for line_no, line in enumerate(content.splitlines(), start=1):
|
||||||
|
if pattern.search(line):
|
||||||
|
violations.append(
|
||||||
|
f"{file_path.relative_to(worktree_path)}:{line_no}: {line.strip()}"
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
violations.append(
|
||||||
|
f"Error reading {file_path.relative_to(worktree_path)}: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
return violations
|
||||||
|
|
||||||
|
|
||||||
|
def check_application_domain_imports(worktree_path: Path) -> List[str]:
|
||||||
|
"""Verify application domain code does not import OIDC/OAuth/JWT/cryptography libraries directly."""
|
||||||
|
violations = []
|
||||||
|
app_dir = worktree_path / "backend" / "app"
|
||||||
|
forbidden_modules = {
|
||||||
|
"authlib",
|
||||||
|
"jwt",
|
||||||
|
"jose",
|
||||||
|
"cryptography",
|
||||||
|
"oauth2",
|
||||||
|
"oauthlib",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Directories to inspect (routes, models, schemas, utils) excluding any dedicated auth module
|
||||||
|
for target in app_dir.rglob("*.py"):
|
||||||
|
rel_path = target.relative_to(app_dir)
|
||||||
|
# Skip auth module itself and tests
|
||||||
|
parts = rel_path.parts
|
||||||
|
if "auth" in parts or "tests" in parts:
|
||||||
|
continue
|
||||||
|
# Also skip auth route if named auth.py under routes
|
||||||
|
if rel_path.name in {"auth.py", "oidc.py"}:
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
tree = ast.parse(target.read_text(encoding="utf-8"), filename=str(target))
|
||||||
|
for node in ast.walk(tree):
|
||||||
|
if isinstance(node, ast.Import):
|
||||||
|
for alias in node.names:
|
||||||
|
base = alias.name.split(".")[0]
|
||||||
|
if base in forbidden_modules:
|
||||||
|
violations.append(
|
||||||
|
f"{target.relative_to(worktree_path)}:{node.lineno}: import {alias.name}"
|
||||||
|
)
|
||||||
|
elif isinstance(node, ast.ImportFrom) and node.module:
|
||||||
|
base = node.module.split(".")[0]
|
||||||
|
if base in forbidden_modules:
|
||||||
|
violations.append(
|
||||||
|
f"{target.relative_to(worktree_path)}:{node.lineno}: from {node.module} import ..."
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
violations.append(
|
||||||
|
f"Error parsing AST in {target.relative_to(worktree_path)}: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
return violations
|
||||||
|
|
||||||
|
|
||||||
|
def check_auth_port_abstraction(worktree_path: Path) -> Tuple[bool, List[str]]:
|
||||||
|
"""Verify that AuthPort and Identity abstractions are defined."""
|
||||||
|
app_dir = worktree_path / "backend" / "app"
|
||||||
|
notes = []
|
||||||
|
has_identity = False
|
||||||
|
has_auth_port = False
|
||||||
|
|
||||||
|
for py_file in app_dir.rglob("*.py"):
|
||||||
|
try:
|
||||||
|
content = py_file.read_text(encoding="utf-8")
|
||||||
|
if "class Identity" in content:
|
||||||
|
has_identity = True
|
||||||
|
notes.append(
|
||||||
|
f"Found Identity class in {py_file.relative_to(worktree_path)}"
|
||||||
|
)
|
||||||
|
if "class AuthPort" in content or "class AuthenticationPort" in content or "class IAuth" in content:
|
||||||
|
has_auth_port = True
|
||||||
|
notes.append(
|
||||||
|
f"Found AuthPort interface in {py_file.relative_to(worktree_path)}"
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return (has_identity and has_auth_port), notes
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
"""Telemetry logging utility for BDInvite SSO Benchmark."""
|
||||||
|
|
||||||
|
import json
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
|
|
||||||
|
def log_checkpoint_telemetry(
|
||||||
|
results_dir: Path,
|
||||||
|
agent: str,
|
||||||
|
checkpoint: str,
|
||||||
|
started_at: datetime,
|
||||||
|
ended_at: datetime,
|
||||||
|
status: str,
|
||||||
|
outcome_reason: str = "none",
|
||||||
|
verification_data: Optional[Dict[str, Any]] = None,
|
||||||
|
git_data: Optional[Dict[str, Any]] = None,
|
||||||
|
tool_calls: Optional[Dict[str, Any]] = None,
|
||||||
|
tokens: Optional[Dict[str, Any]] = None,
|
||||||
|
rework_iterations: int = 0,
|
||||||
|
) -> Path:
|
||||||
|
"""Record structured telemetry for a completed checkpoint evaluation."""
|
||||||
|
agent_dir = results_dir / agent
|
||||||
|
agent_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
out_file = agent_dir / f"{checkpoint}.json"
|
||||||
|
|
||||||
|
duration_wall_clock = int((ended_at - started_at).total_seconds())
|
||||||
|
|
||||||
|
record = {
|
||||||
|
"agent": agent,
|
||||||
|
"checkpoint": checkpoint,
|
||||||
|
"started_at": started_at.isoformat(),
|
||||||
|
"ended_at": ended_at.isoformat(),
|
||||||
|
"duration_wall_clock_seconds": duration_wall_clock,
|
||||||
|
"rework_iterations": rework_iterations,
|
||||||
|
"status": status,
|
||||||
|
"outcome_reason": outcome_reason,
|
||||||
|
"verification": verification_data or {},
|
||||||
|
"git": git_data or {},
|
||||||
|
"tool_calls": tool_calls or {},
|
||||||
|
"tokens": tokens or {},
|
||||||
|
}
|
||||||
|
|
||||||
|
out_file.write_text(json.dumps(record, indent=2), encoding="utf-8")
|
||||||
|
return out_file
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# OIDC Benchmark Fixture
|
||||||
|
|
||||||
|
This fixture provides a standards-compliant, disposable OpenID Connect (OIDC) identity provider using `ghcr.io/navikt/mock-oauth2-server:2.1.10`.
|
||||||
|
|
||||||
|
## Endpoints
|
||||||
|
|
||||||
|
* **Base Issuer**: `http://localhost:8088/default`
|
||||||
|
* **Discovery Endpoint**: `http://localhost:8088/default/.well-known/openid-configuration`
|
||||||
|
* **Authorization Endpoint**: `http://localhost:8088/default/authorize`
|
||||||
|
* **Token Endpoint**: `http://localhost:8088/default/token`
|
||||||
|
* **JWKS URI**: `http://localhost:8088/default/jwks`
|
||||||
|
* **Userinfo Endpoint**: `http://localhost:8088/default/userinfo`
|
||||||
|
|
||||||
|
## Pre-Seeded Test Users
|
||||||
|
|
||||||
|
| Username / Email | Password | Subject | Name | Groups Claim | Expected Role |
|
||||||
|
| :--- | :--- | :--- | :--- | :--- | :--- |
|
||||||
|
| `admin@example.com` | `password123` | `admin-001` | `Admin User` | `["bdinvite_admins"]` | Admin |
|
||||||
|
| `guest@example.com` | `password123` | `guest-001` | `Guest User` | `["guests"]` | Non-Admin |
|
||||||
|
|
||||||
|
## Client Configuration
|
||||||
|
|
||||||
|
* **Client ID**: `bdinvite-client` (or any string)
|
||||||
|
* **Client Secret**: `bdinvite-secret` (or any string)
|
||||||
|
* **Redirect URI**: `http://localhost:8000/birthday/api/auth/callback` (or configured callback)
|
||||||
|
* **Supported PKCE**: `S256` (RFC 7636)
|
||||||
|
* **Supported Signing Alg**: `RS256`
|
||||||
|
|
||||||
|
## Management
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start container and await readiness
|
||||||
|
./start.sh
|
||||||
|
|
||||||
|
# Stop container
|
||||||
|
./stop.sh
|
||||||
|
```
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"interactiveLogin": true,
|
||||||
|
"tokenCallbacks": [
|
||||||
|
{
|
||||||
|
"issuerId": "default",
|
||||||
|
"tokenExpiry": 3600,
|
||||||
|
"requestMappings": [
|
||||||
|
{
|
||||||
|
"requestParam": "username",
|
||||||
|
"match": "admin@example.com",
|
||||||
|
"claims": {
|
||||||
|
"sub": "admin-001",
|
||||||
|
"email": "admin@example.com",
|
||||||
|
"name": "Admin User",
|
||||||
|
"groups": [
|
||||||
|
"bdinvite_admins"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"requestParam": "subject",
|
||||||
|
"match": "admin@example.com",
|
||||||
|
"claims": {
|
||||||
|
"sub": "admin-001",
|
||||||
|
"email": "admin@example.com",
|
||||||
|
"name": "Admin User",
|
||||||
|
"groups": [
|
||||||
|
"bdinvite_admins"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"requestParam": "username",
|
||||||
|
"match": "guest@example.com",
|
||||||
|
"claims": {
|
||||||
|
"sub": "guest-001",
|
||||||
|
"email": "guest@example.com",
|
||||||
|
"name": "Guest User",
|
||||||
|
"groups": [
|
||||||
|
"guests"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"requestParam": "subject",
|
||||||
|
"match": "guest@example.com",
|
||||||
|
"claims": {
|
||||||
|
"sub": "guest-001",
|
||||||
|
"email": "guest@example.com",
|
||||||
|
"name": "Guest User",
|
||||||
|
"groups": [
|
||||||
|
"guests"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
services:
|
||||||
|
oidc:
|
||||||
|
image: ghcr.io/navikt/mock-oauth2-server:2.1.10
|
||||||
|
container_name: bdinvite-benchmark-oidc
|
||||||
|
ports:
|
||||||
|
- "8088:8080"
|
||||||
|
volumes:
|
||||||
|
- ./config.json:/config.json:ro
|
||||||
|
environment:
|
||||||
|
- JSON_CONFIG_PATH=/config.json
|
||||||
|
- SERVER_PORT=8080
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
echo "Starting OIDC Test Container..."
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
echo "Waiting for OIDC Discovery Endpoint..."
|
||||||
|
RETRY=0
|
||||||
|
MAX_RETRIES=20
|
||||||
|
until curl -s -f http://localhost:8088/default/.well-known/openid-configuration > /dev/null 2>&1; do
|
||||||
|
RETRY=$((RETRY+1))
|
||||||
|
if [ "$RETRY" -ge "$MAX_RETRIES" ]; then
|
||||||
|
echo "ERROR: OIDC container failed to become ready in time."
|
||||||
|
docker compose logs
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "✅ OIDC Test Container ready at http://localhost:8088/default"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
echo "Stopping OIDC Test Container..."
|
||||||
|
docker compose down
|
||||||
|
echo "✅ OIDC Test Container stopped."
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"benchmark_name": "bdinvite_sso_benchmark",
|
||||||
|
"frozen_at": "2026-10-02T22:35:40Z",
|
||||||
|
"specification": {
|
||||||
|
"path": "specification/bdinvite_sso_benchmark_plan.md",
|
||||||
|
"sha256": "4b520fb57f1c96a5d7ac492d16aaabd8accd50b5afe328a3b0066102b4f27453",
|
||||||
|
"canonical_brain_plan": "/home/kiskaadee/Brain/01-plans/bdinvite/sso-benchmark-roadmap.md"
|
||||||
|
},
|
||||||
|
"baseline": {
|
||||||
|
"source_repository": "/home/kiskaadee/Homelab/Sites/bdinvite",
|
||||||
|
"commit_sha": "42927b9858c1b091bb6e78d3abcf6f9500bd7547",
|
||||||
|
"tests_total": 25,
|
||||||
|
"tests_passed": 25,
|
||||||
|
"status": "VERIFIED_CLEAN"
|
||||||
|
},
|
||||||
|
"fixture": {
|
||||||
|
"image": "ghcr.io/navikt/mock-oauth2-server:2.1.10",
|
||||||
|
"issuer_url": "http://localhost:8088/default",
|
||||||
|
"discovery_url": "http://localhost:8088/default/.well-known/openid-configuration",
|
||||||
|
"client_id": "bdinvite-client",
|
||||||
|
"client_secret": "bdinvite-secret",
|
||||||
|
"pre_seeded_users": [
|
||||||
|
{
|
||||||
|
"username": "admin@example.com",
|
||||||
|
"groups": ["bdinvite_admins"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"username": "guest@example.com",
|
||||||
|
"groups": ["guests"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"evaluator": {
|
||||||
|
"runner": "evaluator/gatekeeper.py",
|
||||||
|
"python_env": "evaluator/.venv",
|
||||||
|
"playwright_browser": "chromium",
|
||||||
|
"checkpoints": ["CP1", "CP2", "CP3", "CP4", "CP5", "CP6", "CP7", "CP8"]
|
||||||
|
},
|
||||||
|
"worktrees": {
|
||||||
|
"control": {
|
||||||
|
"path": "control",
|
||||||
|
"branch": "control/feat/sso-auth",
|
||||||
|
"toolchain": ["grep", "find", "view_file", "git"]
|
||||||
|
},
|
||||||
|
"graphify": {
|
||||||
|
"path": "graphify",
|
||||||
|
"branch": "graphify/feat/sso-auth",
|
||||||
|
"toolchain": ["grep", "find", "view_file", "git", "graphify"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP1",
|
||||||
|
"started_at": "2026-10-03T03:49:18.283328+00:00",
|
||||||
|
"ended_at": "2026-10-03T03:49:35.113702+00:00",
|
||||||
|
"duration_wall_clock_seconds": 16,
|
||||||
|
"rework_iterations": 0,
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"verification": {
|
||||||
|
"checkpoint_tests": {
|
||||||
|
"passed": 1,
|
||||||
|
"total": 1
|
||||||
|
},
|
||||||
|
"cumulative_regression_tests": {
|
||||||
|
"passed": 25,
|
||||||
|
"total": 25
|
||||||
|
},
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"details": []
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"79c3e8252c0d2e5fc0c9694ffb876e59ec11bb1e"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "79c3e8252c0d2e5fc0c9694ffb876e59ec11bb1e",
|
||||||
|
"commit_delegate_logged": false,
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 6,
|
||||||
|
"run_grep_or_find": 2
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 4
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_test_command": 5
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 480370,
|
||||||
|
"output_tokens_est": 8308,
|
||||||
|
"total_tokens_est": 488678
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP2",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 61,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 47,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"b2cee2447286816b7ebeb35fd6b841ae6506d9ac"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "b2cee2447286816b7ebeb35fd6b841ae6506d9ac",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 9
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3,
|
||||||
|
"replace_file_content": 3
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 42
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 1537210,
|
||||||
|
"output_tokens_est": 26807,
|
||||||
|
"total_tokens_est": 1564017
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP3",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 62,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 62,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"670f4f836dc2829b313c068805b39d883651fad3"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "670f4f836dc2829b313c068805b39d883651fad3",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 19,
|
||||||
|
"search_web": 3
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 2,
|
||||||
|
"replace_file_content": 6
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 26
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 1954952,
|
||||||
|
"output_tokens_est": 21635,
|
||||||
|
"total_tokens_est": 1976587
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP4",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 66,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 76,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"d7618d574ce334b6bd63fbe6967fdc30cdd13e32"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "d7618d574ce334b6bd63fbe6967fdc30cdd13e32",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 28
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 5,
|
||||||
|
"replace_file_content": 6
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 21
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 2592809,
|
||||||
|
"output_tokens_est": 27256,
|
||||||
|
"total_tokens_est": 2620065
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP5",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 53,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 91,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"f20fb0fc980061a91ecdd419a975b10c754b07dc"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "f20fb0fc980061a91ecdd419a975b10c754b07dc",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 27
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3,
|
||||||
|
"replace_file_content": 1
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 18
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 1431139,
|
||||||
|
"output_tokens_est": 18882,
|
||||||
|
"total_tokens_est": 1450022
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP6",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 82,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 96,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"negative_barrier_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"b0dea63c3fdff5d1ebdb0637a0a9491091db7083"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "b0dea63c3fdff5d1ebdb0637a0a9491091db7083",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 31
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 1,
|
||||||
|
"replace_file_content": 16
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 28
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 3833921,
|
||||||
|
"output_tokens_est": 23609,
|
||||||
|
"total_tokens_est": 3857530
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP7",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 112,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 97,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"playwright_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"d9b589ccdaf7a3089b4aa107c641d81ad1792d74"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "d9b589ccdaf7a3089b4aa107c641d81ad1792d74",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 34
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 1,
|
||||||
|
"replace_file_content": 10
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 57,
|
||||||
|
"manage_task": 6
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 4271564,
|
||||||
|
"output_tokens_est": 19886,
|
||||||
|
"total_tokens_est": 4291450
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"agent": "control",
|
||||||
|
"checkpoint": "CP8",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 96,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 110,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"static_remote_user_purged": true,
|
||||||
|
"docker_build_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"713a5827695539993ff0cb3d12e8b0c0ebccb9f1"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "713a5827695539993ff0cb3d12e8b0c0ebccb9f1",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 35
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3,
|
||||||
|
"replace_file_content": 10
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 44
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 3636852,
|
||||||
|
"output_tokens_est": 22163,
|
||||||
|
"total_tokens_est": 3659015
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP1",
|
||||||
|
"started_at": "2026-10-03T03:49:39.232144+00:00",
|
||||||
|
"ended_at": "2026-10-03T03:49:56.661509+00:00",
|
||||||
|
"duration_wall_clock_seconds": 17,
|
||||||
|
"rework_iterations": 0,
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"verification": {
|
||||||
|
"checkpoint_tests": {
|
||||||
|
"passed": 1,
|
||||||
|
"total": 1
|
||||||
|
},
|
||||||
|
"cumulative_regression_tests": {
|
||||||
|
"passed": 25,
|
||||||
|
"total": 25
|
||||||
|
},
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"details": []
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"df498979d97a6ac2d58deb4f3f33b12556853217"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "df498979d97a6ac2d58deb4f3f33b12556853217",
|
||||||
|
"commit_delegate_logged": false,
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 6,
|
||||||
|
"run_grep_or_find": 4,
|
||||||
|
"graphify_queries": 2,
|
||||||
|
"graphify_updates": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_test_command": 6
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1,
|
||||||
|
"graph_queries": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 402812,
|
||||||
|
"output_tokens_est": 8740,
|
||||||
|
"total_tokens_est": 411553
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP2",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 52,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 44,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"0a4032a34489e46a4540c4d5f5d89ee8aad2ba20"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "0a4032a34489e46a4540c4d5f5d89ee8aad2ba20",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 7,
|
||||||
|
"graphify_update": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3,
|
||||||
|
"replace_file_content": 1
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 37
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 1041206,
|
||||||
|
"output_tokens_est": 24935,
|
||||||
|
"total_tokens_est": 1066142
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP3",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 67,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 59,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"35be202adc7a8b93cf834ae68e2b592969abcc53"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "35be202adc7a8b93cf834ae68e2b592969abcc53",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 20,
|
||||||
|
"graphify_update": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 1,
|
||||||
|
"replace_file_content": 5
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 28
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 2392589,
|
||||||
|
"output_tokens_est": 26065,
|
||||||
|
"total_tokens_est": 2418654
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP4",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 101,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 70,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"815a5847c6b4b557a1e181af67af05ce9d933001"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "815a5847c6b4b557a1e181af67af05ce9d933001",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 41,
|
||||||
|
"graphify_update": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 3,
|
||||||
|
"replace_file_content": 14
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 39
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 4542036,
|
||||||
|
"output_tokens_est": 32881,
|
||||||
|
"total_tokens_est": 4574917
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP5",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 53,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 90,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"27015d0d72e248e779ce091b5aacd0d8f22475f3"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "27015d0d72e248e779ce091b5aacd0d8f22475f3",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 15,
|
||||||
|
"graphify_update": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 2,
|
||||||
|
"replace_file_content": 4
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 25
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 1191995,
|
||||||
|
"output_tokens_est": 16039,
|
||||||
|
"total_tokens_est": 1208035
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP6",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 79,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 95,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"negative_barrier_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"39ac42cfcea3bd379f7089bdf882703850ab3535"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "39ac42cfcea3bd379f7089bdf882703850ab3535",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 32,
|
||||||
|
"graphify_update": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 1,
|
||||||
|
"replace_file_content": 11
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 31
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 3348307,
|
||||||
|
"output_tokens_est": 21892,
|
||||||
|
"total_tokens_est": 3370200
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP7",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 147,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 96,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"playwright_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"e1f745608a9a00a27baaa014b2d631f91adcbecd"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "e1f745608a9a00a27baaa014b2d631f91adcbecd",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 41,
|
||||||
|
"graphify_query": 1,
|
||||||
|
"graphify_update": 1,
|
||||||
|
"search_web": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 1,
|
||||||
|
"replace_file_content": 7
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 87,
|
||||||
|
"manage_task": 5,
|
||||||
|
"schedule": 1
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_queries": 1,
|
||||||
|
"graph_updates": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 6747276,
|
||||||
|
"output_tokens_est": 26848,
|
||||||
|
"total_tokens_est": 6774124
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"agent": "graphify",
|
||||||
|
"checkpoint": "CP8",
|
||||||
|
"status": "PASS",
|
||||||
|
"outcome_reason": "none",
|
||||||
|
"turns": 93,
|
||||||
|
"verification": {
|
||||||
|
"cumulative_tests_passed": 115,
|
||||||
|
"baseline_passed": 25,
|
||||||
|
"failed_verifications_count": 0,
|
||||||
|
"static_remote_user_purged": true,
|
||||||
|
"docker_build_passed": true
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 1,
|
||||||
|
"commit_shas": [
|
||||||
|
"30d9a889a351b53158c0da87491194fb3056943a"
|
||||||
|
],
|
||||||
|
"checkpoint_commit_sha": "30d9a889a351b53158c0da87491194fb3056943a",
|
||||||
|
"commit_delegate_invocations": 1,
|
||||||
|
"commit_delegate_verified": true
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 30,
|
||||||
|
"graphify_update": 2
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"write_to_file": 2,
|
||||||
|
"replace_file_content": 13
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_command": 44
|
||||||
|
},
|
||||||
|
"subagent_delegation": {
|
||||||
|
"git_commit": 1
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_updates": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"token_estimate": {
|
||||||
|
"method": "character_density_approximation",
|
||||||
|
"char_density_ratio": 3.8,
|
||||||
|
"input_context_tokens_est": 3079082,
|
||||||
|
"output_tokens_est": 20381,
|
||||||
|
"total_tokens_est": 3099463
|
||||||
|
}
|
||||||
|
}
|
||||||
+376
@@ -0,0 +1,376 @@
|
|||||||
|
# Implementation Plan: BDInvite SSO Benchmark & Checkpoint Roadmap (Frozen Specification v6)
|
||||||
|
|
||||||
|
## Goal Description
|
||||||
|
Establish a controlled, reproducible A/B benchmark comparing two autonomous agents implementing application-level OpenID Connect (OIDC) Single Sign-On (SSO) in the `bdinvite` repository:
|
||||||
|
1. **Control Agent**: Standard repository exploration and toolchain (`grep`, `find`, `view_file`, `git`, etc.).
|
||||||
|
2. **Treatment Agent (Graphify)**: Standard toolchain **plus** Graphify-augmented exploration (`graphify query`, `graphify path`, `graphify explain`, and `graphify update .`).
|
||||||
|
|
||||||
|
### Core Architectural Invariant: Hexagonal Authentication Boundary
|
||||||
|
The benchmark moves authentication from an infrastructure property (Traefik reverse proxy + Authelia ForwardAuth + `Remote-User` header inspection) into a **decoupled application port (`AuthPort`)**:
|
||||||
|
* **Strict Separation of Authentication vs. Authorization**:
|
||||||
|
- **Authentication ("Who are you?")**: Handled by `AuthPort`, which resolves requests into typed `Identity` objects carrying standard attributes and group memberships (`groups: list[str]`).
|
||||||
|
- **Authorization ("What are you allowed to do?")**: Handled exclusively by the **Application Domain**, which evaluates application policies against `identity.groups` (e.g., `"bdinvite_admins" in identity.groups`). `AuthPort` does not own authorization decisions.
|
||||||
|
* **Identity Origin Integrity**: `Identity` contains only claims authenticated and validated by the authentication module. Application code must **never** construct an authenticated `Identity` directly from unvalidated request-controlled data (headers, query parameters, body).
|
||||||
|
* **OIDC Authentication Module**: Implements `AuthPort` and communicates with any standards-compliant OIDC Provider through a generic OIDC client (discovery, PKCE/state/nonce, token exchange, JWKS signature validation).
|
||||||
|
* **Deployment Independence**: The exact same codebase runs:
|
||||||
|
- Locally / standalone against a disposable standards-compliant OIDC test container.
|
||||||
|
- In homelab production against **Authelia configured as an OIDC Provider**, reducing Traefik strictly to TLS termination and reverse-proxy routing (zero ForwardAuth middleware).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Epistemic Roles of Benchmark Artifacts
|
||||||
|
|
||||||
|
The experiment maintains a strict division of artifact roles across three distinct locations:
|
||||||
|
|
||||||
|
| Artifact | Location | Epistemic Role | Mutability |
|
||||||
|
| :--- | :--- | :--- | :--- |
|
||||||
|
| **Canonical Engineering Plan** | `Brain/01-plans/bdinvite/sso-benchmark-roadmap.md` | Vault knowledge graph, project topology, roadmap | Mutable across project lifecycle |
|
||||||
|
| **Immutable Benchmark Snapshot** | `benchmark/specification/bdinvite_sso_benchmark_plan.md` | Concrete experimental input; hashed (SHA-256) | **Immutable / Frozen** |
|
||||||
|
| **Machine Event Ledger** | `Brain/00-inbox/commit-log.csv` | Lossless event capture from `commit-logger` | Append-only raw data |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Frozen Experimental Invariants & Decisions
|
||||||
|
|
||||||
|
1. **Authentication vs. Authorization Separation**:
|
||||||
|
- `AuthPort` defines only authentication mechanics: `current_identity(request)`, `login(request)`, and `logout(request)`.
|
||||||
|
- `Identity` carries `subject`, `email`, `name`, and `groups: list[str]`.
|
||||||
|
- Group authorization is an application-domain policy: `require_group("bdinvite_admins")` verifies `"bdinvite_admins" in identity.groups`.
|
||||||
|
2. **Identity Origin Integrity**:
|
||||||
|
- Identity fields must be derived exclusively from claims contained in the cryptographically validated ID token / validated OIDC authentication result. Unvalidated userinfo or request data must not be used to construct `Identity`.
|
||||||
|
3. **Session Contract & Session Fixation Protection**:
|
||||||
|
- Browser session uses `HttpOnly: true` and an explicit `SameSite` policy. No bearer tokens exposed to JavaScript.
|
||||||
|
- Successful authentication must establish a **new session identifier**; an existing pre-authentication session identifier must not be promoted into an authenticated session (`pre_auth_session_id != post_auth_session_id`).
|
||||||
|
- `Secure` flag contract: `Secure=True` in production; configurable (`Secure=False`) in the local HTTP test environment so browsers do not reject cookies over local test ports.
|
||||||
|
- Internal storage (client-side encrypted/signed vs server-side SQLite table) is left to the agent's architectural discretion.
|
||||||
|
4. **Provider Model & Group Claim**:
|
||||||
|
- The test fixture uses a standards-compliant disposable OIDC provider container pre-seeded with discovery, JWKS, and standard users.
|
||||||
|
- The fixture's group claim is frozen as `"groups": ["bdinvite_admins"]` (for admin) and `"groups": ["guests"]` (for guest). The auth module maps this configured claim to `Identity.groups`.
|
||||||
|
5. **Git Workflow Invariant (Subagent Delegation)**:
|
||||||
|
- At every meaningful implementation milestone required by the roadmap, the primary implementation agent **must recruit the `git-commit` skill via subagent delegation** (`invoke_subagent` with Role: "Git History Custodian").
|
||||||
|
- **Both Control and Treatment agents MUST use the identical `git-commit` workflow.**
|
||||||
|
- **Graphify is explicitly excluded from the `git-commit` subagent's toolset and prompt.** The experimental variable remains strictly confined to the primary agent's repository exploration.
|
||||||
|
- The benchmark harness records the resulting commit SHA, parent SHA, subject, checkpoint, and timing. The harness itself **never** creates implementation commits.
|
||||||
|
- Commits created solely to manipulate benchmark metrics without meaningful code/test changes are prohibited.
|
||||||
|
6. **Graphify Lifecycle Rules**:
|
||||||
|
- The Graphify agent may run `graphify update .` whenever repository changes make the existing graph stale.
|
||||||
|
- Every graph update, query, path, and explanation is recorded in telemetry under `graph_lifecycle`.
|
||||||
|
- The prompt does **not** force the agent to use Graphify; Graphify is simply available as an additional capability alongside standard tools.
|
||||||
|
7. **Evaluator Immutability Barrier**:
|
||||||
|
- Neither agent may alter the roadmap, checkpoint definitions, verification test suite, test credentials, or telemetry logger. All evaluation occurs via an external test runner outside the agents' worktrees.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pre-Experiment Preparation & Freeze Phase
|
||||||
|
|
||||||
|
Before either implementation agent touches a worktree, the experiment harness executes the **Pre-Experiment Freeze Gate**:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
Start["Pre-Experiment Freeze Gate"] --> FreezeSpec["1. Write & Hash Specification<br/>benchmark/specification/bdinvite_sso_benchmark_plan.md<br/>Compute SHA-256"]
|
||||||
|
FreezeSpec --> FreezeHarness["2. Freeze Evaluator & Test Suite<br/>(External pytest + Playwright tests)"]
|
||||||
|
FreezeHarness --> FreezeFixture["3. Freeze OIDC Fixture & Credentials<br/>(Docker Compose + JWKS + Users)"]
|
||||||
|
FreezeFixture --> BaselineManifest["4. Generate baseline.json<br/>(Observed Commit SHA, 25 Passing Tests, Builds)"]
|
||||||
|
BaselineManifest --> Worktrees["5. Stand Up Isolated Worktrees<br/>control/ & graphify/<br/>Verify Identical Starting Commit"]
|
||||||
|
Worktrees --> CP0Done["CP0 Readiness Verified<br/>Launch Benchmark Execution"]
|
||||||
|
```
|
||||||
|
|
||||||
|
1. **Specification Hashing**:
|
||||||
|
- Write immutable snapshot to `/home/kiskaadee/Projects/tests/bdinvite-benchmark/specification/bdinvite_sso_benchmark_plan.md`.
|
||||||
|
- Calculate and record its SHA-256 hash in `manifest.json`.
|
||||||
|
2. **Evaluator Freeze**:
|
||||||
|
- Scaffold external evaluation scripts and test suites under `benchmark/evaluator/`.
|
||||||
|
3. **Fixture Freeze**:
|
||||||
|
- Stand up the disposable OIDC provider container (pre-seeded with discovery, JWKS, client credentials, and users).
|
||||||
|
4. **Baseline Manifest Generation**:
|
||||||
|
- Record observed starting commit (`42927b9858c1b091bb6e78d3abcf6f9500bd7547`), verify 25 passing backend tests, frontend build, and Docker container build.
|
||||||
|
5. **Worktree Provisioning**:
|
||||||
|
- Create worktree: `/home/kiskaadee/Projects/tests/bdinvite-benchmark/control` (branch `control/feat/sso-auth`).
|
||||||
|
- Create worktree: `/home/kiskaadee/Projects/tests/bdinvite-benchmark/graphify` (branch `graphify/feat/sso-auth`).
|
||||||
|
- Run initial `graphify extract . --code-only` inside the `graphify` worktree.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sequential Checkpoint Roadmap (CP1 – CP8)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
CP1["CP1: AuthPort Contract"] --> CP2["CP2: OIDC Client & PKCE"]
|
||||||
|
CP2 --> CP3["CP3: Identity Resolution"]
|
||||||
|
CP3 --> CP4["CP4: HttpOnly Session & Fixation"]
|
||||||
|
CP4 --> CP5["CP5: DI Dependencies"]
|
||||||
|
CP5 --> CP6["CP6: Admin Route Migration"]
|
||||||
|
CP6 --> CP7["CP7: Browser SSO Flow"]
|
||||||
|
CP7 --> CP8["CP8: Hardening & Independence"]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 1 (CP1): The Authentication Port (`AuthPort`)
|
||||||
|
* **Objective**: Define the application-facing authentication boundary and identity domain models, decoupling the application domain completely from upstream protocols and proxies.
|
||||||
|
* **Behavioral Requirements**:
|
||||||
|
- Define domain abstraction: `Identity` (holding `subject: str`, `email: str`, `name: Optional[str]`, `groups: list[str]`).
|
||||||
|
- Identity Origin Integrity: `Identity` must only be constructed from validated authentication results, never raw client headers.
|
||||||
|
- Define `AuthPort` protocol establishing:
|
||||||
|
* `current_identity(request: Request) -> Optional[Identity]`
|
||||||
|
* `login(request: Request) -> Response`
|
||||||
|
* `logout(request: Request) -> Response`
|
||||||
|
- Zero application routes or domain models may import or reference OIDC, OAuth, JWT, or proxy headers.
|
||||||
|
* **Verification & Invariant**:
|
||||||
|
- Unit tests verifying `AuthPort` contract with a test mock implementation.
|
||||||
|
- **Behavioral Invariant**: **No externally observable application behavior changes during CP1.** (Minimal dependency wiring and unit tests are allowed; existing endpoints behave identically).
|
||||||
|
- All 25 baseline tests continue to pass.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- `AuthPort` abstraction established and testable in isolation.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 2 (CP2): Generic OIDC Client, PKCE & Cryptographic Verification
|
||||||
|
* **Objective**: Implement the generic OIDC protocol client capable of communicating with any OIDC provider with strict PKCE, CSRF state, and replay nonce validation.
|
||||||
|
* **Protocol Invariants & Behavioral Requirements**:
|
||||||
|
- Fetch and parse OIDC discovery document (`/.well-known/openid-configuration`).
|
||||||
|
- **PKCE (RFC 7636)**:
|
||||||
|
* Generate cryptographically random `code_verifier`.
|
||||||
|
* Derive `code_challenge` using SHA-256 (`code_challenge_method=S256`).
|
||||||
|
* Include `code_challenge` and `code_challenge_method` in the authorization request.
|
||||||
|
* Persist `code_verifier` across the transaction and supply it in the token exchange.
|
||||||
|
- **Transaction Correlation (`state`)**: Construct authorization URL with a cryptographic `state` parameter; validate `state` on callback to prevent CSRF attacks.
|
||||||
|
- **Replay Protection (`nonce`)**: Construct authorization URL with a cryptographic `nonce`; validate that the signed ID token's `nonce` claim matches the initiated request.
|
||||||
|
- Exchange authorization code for token response (`/token`).
|
||||||
|
- Cryptographically validate ID Token:
|
||||||
|
* Signature verification against provider's JWKS endpoint (`/jwks.json`).
|
||||||
|
* Issuer validation (`iss` == configured issuer).
|
||||||
|
* Audience validation (`aud` == configured client ID).
|
||||||
|
* Expiration validation (`exp` > current timestamp).
|
||||||
|
* **Verification**:
|
||||||
|
- Automated tests against the OIDC test container:
|
||||||
|
* Valid code exchange returns signed ID token.
|
||||||
|
* Authorization request verified to contain PKCE and `state`/`nonce` parameters.
|
||||||
|
* Invalid `state` rejected with 400.
|
||||||
|
* Mismatched `nonce`, missing PKCE verifier, or expired token rejected with 401.
|
||||||
|
* Tampered signature rejected with 401.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- OIDC exchange passes all cryptographic and protocol validation gates.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 3 (CP3): OIDC Identity & Group Extraction
|
||||||
|
* **Objective**: Connect the generic OIDC client to the `AuthPort` identity resolution lifecycle, deriving identity strictly from authenticated claims.
|
||||||
|
* **Behavioral Requirements**:
|
||||||
|
- Extract standard claims (`sub`, `email`, `name`).
|
||||||
|
- Extract group membership claims from the frozen fixture claim path (`"groups"`).
|
||||||
|
- Authoritative Provenance: `Identity` fields must be derived exclusively from claims contained in the cryptographically validated ID token / validated OIDC authentication result; unvalidated userinfo or request data must not be used to construct `Identity`.
|
||||||
|
- Confirm `admin@example.com` produces `groups: ["bdinvite_admins"]` and `guest@example.com` produces `groups: ["guests"]`.
|
||||||
|
* **Verification**:
|
||||||
|
- Test verifying end-to-end extraction from OIDC callback to typed `Identity`.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- Clean mapping from provider claims to application `Identity`.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 4 (CP4): Browser Session Management & Session Fixation Protection
|
||||||
|
* **Objective**: Establish and persist an application-level browser session following successful OIDC authentication with session fixation protection.
|
||||||
|
* **Behavioral Requirements**:
|
||||||
|
- Issue session identifier via `HttpOnly`, `SameSite` cookie upon successful authentication.
|
||||||
|
- **Session Fixation Barrier**: Successful authentication must establish a **new session identifier**; an existing pre-authentication session identifier must not be promoted into an authenticated session (`pre_auth_session_id != post_auth_session_id`).
|
||||||
|
- Cookie security configuration: `Secure=True` in production, configurable for local HTTP testing.
|
||||||
|
- Session resolution: identify returning requests from the session cookie.
|
||||||
|
- Expiration: reject expired sessions.
|
||||||
|
- Invalidation: `/birthday/api/auth/logout` revokes session and clears cookie.
|
||||||
|
- Security Invariant: Session token/cookie must not be readable by client-side JavaScript (`HttpOnly: true`).
|
||||||
|
* **Verification**:
|
||||||
|
- Tests verifying:
|
||||||
|
* Pre-authentication session ID is rotated upon login.
|
||||||
|
* Request with valid session cookie resolves to authenticated `Identity`.
|
||||||
|
* Request without cookie resolves to anonymous (`None`).
|
||||||
|
* Tampered cookie rejected (401).
|
||||||
|
* Logout clears session.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- Browser session contract fully functional and verified.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 5 (CP5): FastAPI Dependency Injection (Isolated Verification)
|
||||||
|
* **Objective**: Expose authentication and group authorization to FastAPI endpoints via standard dependency injection (`Depends`), verified independently on isolated test harnesses before modifying production admin routes.
|
||||||
|
* **Behavioral Requirements**:
|
||||||
|
- Implement FastAPI dependencies:
|
||||||
|
* `get_current_identity -> Optional[Identity]`
|
||||||
|
* `require_authenticated -> Identity` (401 if anonymous)
|
||||||
|
* `require_group(group_name: str) -> Callable[..., Identity]` (401 if anonymous, 403 if missing group)
|
||||||
|
- Application authorization policy:
|
||||||
|
* `require_admin = require_group("bdinvite_admins")`
|
||||||
|
* **Verification**:
|
||||||
|
- Verified on dedicated test routes / unit dependency harnesses:
|
||||||
|
* Anonymous request $\to$ 401 Unauthorized.
|
||||||
|
* Authenticated user without `bdinvite_admins` $\to$ 403 Forbidden.
|
||||||
|
* Authenticated user with `bdinvite_admins` $\to$ yields `Identity` object.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- Dependency injection contract verified in isolation without yet altering production admin routes.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 6 (CP6): Admin API Route Migration & Negative Barrier
|
||||||
|
* **Objective**: Migrate all endpoints in `backend/app/routes/admin.py` to use `Depends(require_group("bdinvite_admins"))`, purging `Remote-User` from runtime code.
|
||||||
|
* **Behavioral Requirements**:
|
||||||
|
- Update `/rsvps`, `/export`, `/config`, `/map-preview/generate` to consume the new group authorization dependency.
|
||||||
|
- Update `test_admin.py` test suite to use test session injection rather than mock headers.
|
||||||
|
- Anonymous requests receive 401 Unauthorized.
|
||||||
|
- Authenticated non-admin requests (`guest@example.com`) receive 403 Forbidden.
|
||||||
|
- Authenticated admin requests (`admin@example.com`) succeed.
|
||||||
|
- **CRITICAL NEGATIVE GATE**:
|
||||||
|
```python
|
||||||
|
def test_remote_user_header_strictly_ignored(client):
|
||||||
|
# A request containing Remote-User without a valid session MUST be rejected
|
||||||
|
res = client.get("/birthday/api/admin/rsvps", headers={"Remote-User": "kiskaadee"})
|
||||||
|
assert res.status_code == 401
|
||||||
|
```
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- Negative gate passes.
|
||||||
|
- All existing admin functionality (RSVP listing, CSV export, config updates) passes cleanly.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 7 (CP7): Complete Browser SSO Flow (Playwright Acceptance)
|
||||||
|
* **Objective**: Integrate the React SPA in `frontend/src/admin` with the OIDC authentication flow and verify the complete browser lifecycle using a real browser automation suite (Playwright).
|
||||||
|
* **Deterministic Contract & Behavioral Requirements**:
|
||||||
|
- An unauthenticated navigation to `/birthday/admin` must initiate authentication by navigating to `/birthday/api/auth/login`.
|
||||||
|
- The login endpoint redirects to the configured OIDC authorization endpoint.
|
||||||
|
- Callback completes, sets `HttpOnly` cookie, and redirects user into `/birthday/admin`.
|
||||||
|
- Admin header displays authenticated user info and a working Logout button.
|
||||||
|
- Clicking Logout calls `/birthday/api/auth/logout` and returns UI to unauthenticated state.
|
||||||
|
* **Verification (Playwright Acceptance Suite)**:
|
||||||
|
- Real browser automation validating the entire interactive loop:
|
||||||
|
1. Navigate to `/birthday/admin` $\to$ redirected to OIDC login.
|
||||||
|
2. Submit test credentials (`admin@example.com` / `password123`).
|
||||||
|
3. Browser follows redirect to callback $\to$ receives `HttpOnly` session cookie $\to$ lands on Admin Dashboard.
|
||||||
|
4. Confirm RSVPs table renders live data.
|
||||||
|
5. Click Logout button $\to$ cookie invalidated $\to$ unauthenticated state confirmed.
|
||||||
|
- Frontend TypeScript build compiles with zero errors (`npm run build`).
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- Playwright browser acceptance test passes 100%.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Checkpoint 8 (CP8): Security Hardening & Deployment Independence
|
||||||
|
* **Objective**: Subject the completed application to adversarial edge cases, verify cumulative test status, and verify dual-environment deployment.
|
||||||
|
* **Adversarial & Security Verification**:
|
||||||
|
1. Forged / invalid CSRF `state` $\to$ 400 Bad Request.
|
||||||
|
2. Forged / tampered ID token $\to$ 401 Unauthorized.
|
||||||
|
3. Mismatched / replayed `nonce` $\to$ 401 Unauthorized.
|
||||||
|
4. Missing or invalid PKCE `code_verifier` $\to$ 401 Unauthorized.
|
||||||
|
5. Expired ID token / expired session $\to$ 401 Unauthorized.
|
||||||
|
6. Non-admin user accessing admin APIs $\to$ 403 Forbidden.
|
||||||
|
7. Forged `Remote-User` header $\to$ 401 Unauthorized.
|
||||||
|
* **Deployment Independence Verification**:
|
||||||
|
1. **Direct Standalone Mode**: BDInvite + OIDC test container with NO Traefik and NO Authelia $\to$ **PASS**.
|
||||||
|
2. **Homelab Production Mode**: BDInvite deployed with Authelia acting as an OIDC provider, with Traefik providing pure TLS/ingress $\to$ **PASS**.
|
||||||
|
* **Cumulative Verification Definition**:
|
||||||
|
The cumulative suite requires 100% pass across:
|
||||||
|
- All checkpoint-specific suites (CP1–CP7).
|
||||||
|
- All baseline regression tests (25/25 original tests).
|
||||||
|
- Playwright end-to-end browser suite.
|
||||||
|
- CP8 adversarial security suite.
|
||||||
|
* **Exit Criteria**:
|
||||||
|
- All cumulative verification tests pass.
|
||||||
|
- Multi-stage Docker container builds successfully.
|
||||||
|
- Changes committed via `git-commit` subagent.
|
||||||
|
- Final checkpoint report generated.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Enhanced Telemetry & Metric Capture Protocol
|
||||||
|
|
||||||
|
For each subagent across each checkpoint (CP1 to CP8), the experiment harness records granular telemetry into `results/<agent>/<checkpoint>.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"agent": "control | graphify",
|
||||||
|
"checkpoint": "CP4",
|
||||||
|
"started_at": "2026-10-02T22:30:00Z",
|
||||||
|
"ended_at": "2026-10-02T22:45:00Z",
|
||||||
|
"duration_wall_clock_seconds": 900,
|
||||||
|
"duration_active_seconds": 740,
|
||||||
|
"turns": 14,
|
||||||
|
"attempts": 2,
|
||||||
|
"rework_iterations": 1,
|
||||||
|
"status": "PASS | FAIL | BLOCKED",
|
||||||
|
"outcome_reason": "none | verification_failure | environment_failure | timeout",
|
||||||
|
"verification": {
|
||||||
|
"checkpoint_tests": {
|
||||||
|
"passed": 8,
|
||||||
|
"total": 8
|
||||||
|
},
|
||||||
|
"cumulative_regression_tests": {
|
||||||
|
"passed": 25,
|
||||||
|
"total": 25
|
||||||
|
},
|
||||||
|
"failed_verifications_count": 3
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"commits_created": 2,
|
||||||
|
"checkpoint_commit_sha": "a81f3c2...",
|
||||||
|
"commit_shas": ["91bc7de...", "a81f3c2..."]
|
||||||
|
},
|
||||||
|
"tool_calls": {
|
||||||
|
"exploration": {
|
||||||
|
"view_file": 8,
|
||||||
|
"run_grep_or_find": 4,
|
||||||
|
"graphify_query": 3,
|
||||||
|
"graphify_path": 2,
|
||||||
|
"graphify_explain": 1
|
||||||
|
},
|
||||||
|
"implementation": {
|
||||||
|
"replace_file_content": 5,
|
||||||
|
"write_to_file": 2
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"run_test_command": 4
|
||||||
|
},
|
||||||
|
"graph_lifecycle": {
|
||||||
|
"graph_extractions": 1,
|
||||||
|
"graph_queries": 3,
|
||||||
|
"graph_paths": 2,
|
||||||
|
"graph_explains": 1
|
||||||
|
},
|
||||||
|
"other": {
|
||||||
|
"git_status": 2,
|
||||||
|
"env_checks": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tokens": {
|
||||||
|
"input_tokens": 42100,
|
||||||
|
"output_tokens": 5400,
|
||||||
|
"total_tokens": 47500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Final Independent Evaluation: Static & Behavioral Compliance
|
||||||
|
|
||||||
|
At the conclusion of the experiment, an independent evaluator analyzes both worktrees across three objective axes:
|
||||||
|
|
||||||
|
1. **Functional Correctness**:
|
||||||
|
- 100% pass rate on all cumulative checkpoint verification suites.
|
||||||
|
- 100% pass rate on the baseline regression suite (25/25 original tests).
|
||||||
|
- Playwright end-to-end browser acceptance suite passes.
|
||||||
|
2. **Static Architectural Assertions**:
|
||||||
|
- Runtime `Remote-User` occurrences across `backend/app/` and `frontend/src/` == 0.
|
||||||
|
- Application domain imports of OIDC, OAuth, JWT, or proxy libraries == 0.
|
||||||
|
- `Identity` construction sites enumerated and verified to originate strictly from validated claims.
|
||||||
|
- `AuthPort` interface implementation exists.
|
||||||
|
- Admin routes depend strictly on application group authorization.
|
||||||
|
- OIDC issuer is externalized and loaded from configuration.
|
||||||
|
- Traefik is strictly an ingress/TLS proxy with zero authentication middleware responsibilities.
|
||||||
|
3. **Exploration Efficiency**:
|
||||||
|
- Side-by-side comparison of exploration tool calls vs implementation tool calls.
|
||||||
|
- Total tokens and turns consumed per checkpoint.
|
||||||
|
- Frequency of rework iterations when encountering verification failures.
|
||||||
@@ -1,14 +1,29 @@
|
|||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { fetchAdminRsvps, getExportCsvUrl } from "../api/client";
|
import {
|
||||||
|
deleteAdminRsvp,
|
||||||
|
fetchAdminRsvps,
|
||||||
|
getExportCsvUrl,
|
||||||
|
updateAdminRsvp,
|
||||||
|
} from "../api/client";
|
||||||
import { Button } from "../components/Button";
|
import { Button } from "../components/Button";
|
||||||
import { Spinner } from "../components/Spinner";
|
import { Spinner } from "../components/Spinner";
|
||||||
|
import { useConfig } from "../hooks/useConfig";
|
||||||
import type { RSVPAdminItem } from "../types/config";
|
import type { RSVPAdminItem } from "../types/config";
|
||||||
|
|
||||||
export function RsvpTable() {
|
export function RsvpTable() {
|
||||||
|
const { config } = useConfig();
|
||||||
const [rsvps, setRsvps] = useState<RSVPAdminItem[]>([]);
|
const [rsvps, setRsvps] = useState<RSVPAdminItem[]>([]);
|
||||||
const [count, setCount] = useState<number>(0);
|
const [count, setCount] = useState<number>(0);
|
||||||
const [search, setSearch] = useState<string>("");
|
const [search, setSearch] = useState<string>("");
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
|
const [deletingId, setDeletingId] = useState<number | null>(null);
|
||||||
|
const [editingId, setEditingId] = useState<number | null>(null);
|
||||||
|
const [editForm, setEditForm] = useState<{ name: string; phone: string; email: string }>({
|
||||||
|
name: "",
|
||||||
|
phone: "",
|
||||||
|
email: "",
|
||||||
|
});
|
||||||
|
const [savingId, setSavingId] = useState<number | null>(null);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
const loadData = useCallback(async (searchTerm = "") => {
|
const loadData = useCallback(async (searchTerm = "") => {
|
||||||
@@ -32,8 +47,14 @@ export function RsvpTable() {
|
|||||||
function formatDate(isoStr: string) {
|
function formatDate(isoStr: string) {
|
||||||
if (!isoStr) return "—";
|
if (!isoStr) return "—";
|
||||||
try {
|
try {
|
||||||
const d = new Date(isoStr);
|
// Ensure ISO string without an explicit offset is treated as UTC
|
||||||
|
const normalizedIso =
|
||||||
|
!isoStr.endsWith("Z") && !isoStr.includes("+") && !isoStr.includes("-", 10)
|
||||||
|
? `${isoStr}Z`
|
||||||
|
: isoStr;
|
||||||
|
const d = new Date(normalizedIso);
|
||||||
return d.toLocaleDateString("es-CO", {
|
return d.toLocaleDateString("es-CO", {
|
||||||
|
timeZone: config?.event_timezone || "America/Bogota",
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
month: "short",
|
month: "short",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
@@ -52,6 +73,71 @@ export function RsvpTable() {
|
|||||||
return phone;
|
return phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleDelete(id: number, name: string) {
|
||||||
|
const confirmed = window.confirm(
|
||||||
|
`¿Estás seguro de que deseas eliminar la confirmación de "${name}"? Esta acción no se puede deshacer.`,
|
||||||
|
);
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
|
setDeletingId(id);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
await deleteAdminRsvp(id);
|
||||||
|
setRsvps((prev) => prev.filter((r) => r.id !== id));
|
||||||
|
setCount((prev) => Math.max(0, prev - 1));
|
||||||
|
} catch (err) {
|
||||||
|
setError(
|
||||||
|
err instanceof Error ? err.message : "Error al eliminar el asistente.",
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
setDeletingId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startEditing(row: RSVPAdminItem) {
|
||||||
|
setEditingId(row.id);
|
||||||
|
setEditForm({
|
||||||
|
name: row.name,
|
||||||
|
phone: row.phone,
|
||||||
|
email: row.email || "",
|
||||||
|
});
|
||||||
|
setError(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelEditing() {
|
||||||
|
setEditingId(null);
|
||||||
|
setError(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSaveEdit(id: number) {
|
||||||
|
if (!editForm.name.trim()) {
|
||||||
|
setError("El nombre no puede estar vacío.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!editForm.phone.trim()) {
|
||||||
|
setError("El teléfono no puede estar vacío.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSavingId(id);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const updated = await updateAdminRsvp(id, {
|
||||||
|
name: editForm.name.trim(),
|
||||||
|
phone: editForm.phone.trim(),
|
||||||
|
email: editForm.email.trim() || null,
|
||||||
|
});
|
||||||
|
setRsvps((prev) => prev.map((r) => (r.id === id ? updated : r)));
|
||||||
|
setEditingId(null);
|
||||||
|
} catch (err) {
|
||||||
|
setError(
|
||||||
|
err instanceof Error ? err.message : "Error al actualizar el asistente.",
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
setSavingId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* Top action bar: Count, Search, Export */}
|
{/* Top action bar: Count, Search, Export */}
|
||||||
@@ -164,19 +250,20 @@ export function RsvpTable() {
|
|||||||
<th style={{ padding: "0.9rem 1.2rem" }}>Teléfono</th>
|
<th style={{ padding: "0.9rem 1.2rem" }}>Teléfono</th>
|
||||||
<th style={{ padding: "0.9rem 1.2rem" }}>Correo</th>
|
<th style={{ padding: "0.9rem 1.2rem" }}>Correo</th>
|
||||||
<th style={{ padding: "0.9rem 1.2rem" }}>Fecha de Registro</th>
|
<th style={{ padding: "0.9rem 1.2rem" }}>Fecha de Registro</th>
|
||||||
|
<th style={{ padding: "0.9rem 1.2rem", textAlign: "right" }}>Acciones</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={4} style={{ padding: "3rem", textAlign: "center" }}>
|
<td colSpan={5} style={{ padding: "3rem", textAlign: "center" }}>
|
||||||
<Spinner size={28} />
|
<Spinner size={28} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : rsvps.length === 0 ? (
|
) : rsvps.length === 0 ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
colSpan={4}
|
colSpan={5}
|
||||||
style={{
|
style={{
|
||||||
padding: "3rem",
|
padding: "3rem",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
@@ -194,36 +281,116 @@ export function RsvpTable() {
|
|||||||
key={row.id}
|
key={row.id}
|
||||||
style={{
|
style={{
|
||||||
borderBottom: "1px solid rgba(255, 255, 255, 0.06)",
|
borderBottom: "1px solid rgba(255, 255, 255, 0.06)",
|
||||||
|
backgroundColor:
|
||||||
|
editingId === row.id
|
||||||
|
? "rgba(212, 168, 67, 0.08)"
|
||||||
|
: "transparent",
|
||||||
transition: "background-color 0.15s ease",
|
transition: "background-color 0.15s ease",
|
||||||
}}
|
}}
|
||||||
onMouseEnter={(e) => {
|
onMouseEnter={(e) => {
|
||||||
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.04)";
|
if (editingId !== row.id) {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.04)";
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onMouseLeave={(e) => {
|
onMouseLeave={(e) => {
|
||||||
e.currentTarget.style.backgroundColor = "transparent";
|
if (editingId !== row.id) {
|
||||||
|
e.currentTarget.style.backgroundColor = "transparent";
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
style={{
|
style={{
|
||||||
padding: "0.9rem 1.2rem",
|
padding: editingId === row.id ? "0.5rem 0.8rem" : "0.9rem 1.2rem",
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
color: "#ffffff",
|
color: "#ffffff",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{row.name}
|
{editingId === row.id ? (
|
||||||
</td>
|
<input
|
||||||
<td
|
type="text"
|
||||||
style={{ padding: "0.9rem 1.2rem", color: "var(--color-gold-light)" }}
|
value={editForm.name}
|
||||||
>
|
onChange={(e) =>
|
||||||
{formatPhone(row.phone)}
|
setEditForm((prev) => ({ ...prev, name: e.target.value }))
|
||||||
|
}
|
||||||
|
disabled={savingId === row.id}
|
||||||
|
placeholder="Nombre completo"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
minWidth: "120px",
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||||
|
border: "1px solid var(--color-gold)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "#ffffff",
|
||||||
|
padding: "0.4rem 0.6rem",
|
||||||
|
fontSize: "0.85rem",
|
||||||
|
boxSizing: "border-box",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
row.name
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
style={{
|
style={{
|
||||||
padding: "0.9rem 1.2rem",
|
padding: editingId === row.id ? "0.5rem 0.8rem" : "0.9rem 1.2rem",
|
||||||
|
color: "var(--color-gold-light)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{editingId === row.id ? (
|
||||||
|
<input
|
||||||
|
type="tel"
|
||||||
|
value={editForm.phone}
|
||||||
|
onChange={(e) =>
|
||||||
|
setEditForm((prev) => ({ ...prev, phone: e.target.value }))
|
||||||
|
}
|
||||||
|
disabled={savingId === row.id}
|
||||||
|
placeholder="300 123 4567"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
minWidth: "110px",
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||||
|
border: "1px solid var(--color-gold)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "var(--color-gold-light)",
|
||||||
|
padding: "0.4rem 0.6rem",
|
||||||
|
fontSize: "0.85rem",
|
||||||
|
boxSizing: "border-box",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
formatPhone(row.phone)
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
style={{
|
||||||
|
padding: editingId === row.id ? "0.5rem 0.8rem" : "0.9rem 1.2rem",
|
||||||
color: "rgba(255, 255, 255, 0.7)",
|
color: "rgba(255, 255, 255, 0.7)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{row.email || "—"}
|
{editingId === row.id ? (
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
value={editForm.email}
|
||||||
|
onChange={(e) =>
|
||||||
|
setEditForm((prev) => ({ ...prev, email: e.target.value }))
|
||||||
|
}
|
||||||
|
disabled={savingId === row.id}
|
||||||
|
placeholder="Opcional"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
minWidth: "120px",
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||||
|
border: "1px solid var(--color-gold)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "rgba(255, 255, 255, 0.9)",
|
||||||
|
padding: "0.4rem 0.6rem",
|
||||||
|
fontSize: "0.85rem",
|
||||||
|
boxSizing: "border-box",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
row.email || "—"
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
style={{
|
style={{
|
||||||
@@ -234,6 +401,212 @@ export function RsvpTable() {
|
|||||||
>
|
>
|
||||||
{formatDate(row.created_at)}
|
{formatDate(row.created_at)}
|
||||||
</td>
|
</td>
|
||||||
|
<td style={{ padding: "0.9rem 1.2rem", textAlign: "right", whiteSpace: "nowrap" }}>
|
||||||
|
{editingId === row.id ? (
|
||||||
|
<div style={{ display: "inline-flex", alignItems: "center", gap: "0.4rem" }}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={savingId === row.id}
|
||||||
|
onClick={() => handleSaveEdit(row.id)}
|
||||||
|
style={{
|
||||||
|
background: "rgba(76, 175, 80, 0.15)",
|
||||||
|
border: "1px solid rgba(76, 175, 80, 0.4)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "#81c784",
|
||||||
|
padding: "0.45rem 0.65rem",
|
||||||
|
cursor: savingId === row.id ? "not-allowed" : "pointer",
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
transition: "all 0.15s ease",
|
||||||
|
outline: "none",
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
if (savingId !== row.id) {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(76, 175, 80, 0.3)";
|
||||||
|
e.currentTarget.style.borderColor = "#81c784";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(76, 175, 80, 0.15)";
|
||||||
|
e.currentTarget.style.borderColor = "rgba(76, 175, 80, 0.4)";
|
||||||
|
}}
|
||||||
|
title="Guardar cambios"
|
||||||
|
aria-label="Guardar cambios"
|
||||||
|
>
|
||||||
|
{savingId === row.id ? (
|
||||||
|
<Spinner size={14} />
|
||||||
|
) : (
|
||||||
|
<svg
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
role="img"
|
||||||
|
aria-label="Guardar"
|
||||||
|
>
|
||||||
|
<polyline points="20 6 9 17 4 12" />
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={savingId === row.id}
|
||||||
|
onClick={cancelEditing}
|
||||||
|
style={{
|
||||||
|
background: "rgba(255, 255, 255, 0.08)",
|
||||||
|
border: "1px solid rgba(255, 255, 255, 0.2)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "rgba(255, 255, 255, 0.7)",
|
||||||
|
padding: "0.45rem 0.65rem",
|
||||||
|
cursor: savingId === row.id ? "not-allowed" : "pointer",
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
transition: "all 0.15s ease",
|
||||||
|
outline: "none",
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
if (savingId !== row.id) {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.18)";
|
||||||
|
e.currentTarget.style.color = "#ffffff";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.08)";
|
||||||
|
e.currentTarget.style.color = "rgba(255, 255, 255, 0.7)";
|
||||||
|
}}
|
||||||
|
title="Cancelar edición"
|
||||||
|
aria-label="Cancelar edición"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
role="img"
|
||||||
|
aria-label="Cancelar"
|
||||||
|
>
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18" />
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div style={{ display: "inline-flex", alignItems: "center", gap: "0.4rem" }}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={deletingId === row.id || editingId !== null}
|
||||||
|
onClick={() => startEditing(row)}
|
||||||
|
style={{
|
||||||
|
background: "rgba(212, 168, 67, 0.1)",
|
||||||
|
border: "1px solid rgba(212, 168, 67, 0.35)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "var(--color-gold)",
|
||||||
|
padding: "0.45rem 0.65rem",
|
||||||
|
cursor:
|
||||||
|
deletingId === row.id || editingId !== null ? "not-allowed" : "pointer",
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
transition: "all 0.15s ease",
|
||||||
|
outline: "none",
|
||||||
|
opacity: editingId !== null && editingId !== row.id ? 0.35 : 1,
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
if (deletingId !== row.id && editingId === null) {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(212, 168, 67, 0.25)";
|
||||||
|
e.currentTarget.style.borderColor = "var(--color-gold-light)";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(212, 168, 67, 0.1)";
|
||||||
|
e.currentTarget.style.borderColor = "rgba(212, 168, 67, 0.35)";
|
||||||
|
}}
|
||||||
|
title={`Editar confirmación de ${row.name}`}
|
||||||
|
aria-label={`Editar confirmación de ${row.name}`}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
role="img"
|
||||||
|
aria-label="Editar"
|
||||||
|
>
|
||||||
|
<path d="M12 20h9" />
|
||||||
|
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={deletingId === row.id || editingId !== null}
|
||||||
|
onClick={() => handleDelete(row.id, row.name)}
|
||||||
|
style={{
|
||||||
|
background: "rgba(255, 82, 82, 0.1)",
|
||||||
|
border: "1px solid rgba(255, 82, 82, 0.35)",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "#ff5252",
|
||||||
|
padding: "0.45rem 0.65rem",
|
||||||
|
cursor:
|
||||||
|
deletingId === row.id || editingId !== null ? "not-allowed" : "pointer",
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
transition: "all 0.15s ease",
|
||||||
|
outline: "none",
|
||||||
|
opacity: editingId !== null && editingId !== row.id ? 0.35 : 1,
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
if (deletingId !== row.id && editingId === null) {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(255, 82, 82, 0.25)";
|
||||||
|
e.currentTarget.style.borderColor = "#ff5252";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.backgroundColor = "rgba(255, 82, 82, 0.1)";
|
||||||
|
e.currentTarget.style.borderColor = "rgba(255, 82, 82, 0.35)";
|
||||||
|
}}
|
||||||
|
title={`Eliminar confirmación de ${row.name}`}
|
||||||
|
aria-label={`Eliminar confirmación de ${row.name}`}
|
||||||
|
>
|
||||||
|
{deletingId === row.id ? (
|
||||||
|
<Spinner size={14} />
|
||||||
|
) : (
|
||||||
|
<svg
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
role="img"
|
||||||
|
aria-label="Eliminar"
|
||||||
|
>
|
||||||
|
<polyline points="3 6 5 6 21 6" />
|
||||||
|
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
||||||
|
<line x1="10" y1="11" x2="10" y2="17" />
|
||||||
|
<line x1="14" y1="11" x2="14" y2="17" />
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
@@ -241,5 +614,6 @@ export function RsvpTable() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
import type {
|
import type {
|
||||||
InvitationConfig,
|
InvitationConfig,
|
||||||
RSVPApiResult,
|
RSVPApiResult,
|
||||||
|
RSVPAdminItem,
|
||||||
RSVPListResponse,
|
RSVPListResponse,
|
||||||
RSVPRequest,
|
RSVPRequest,
|
||||||
|
RSVPUpdateRequest,
|
||||||
} from "../types/config";
|
} from "../types/config";
|
||||||
|
|
||||||
const BASE_API = "/birthday/api";
|
const BASE_API = "/birthday/api";
|
||||||
@@ -117,3 +119,42 @@ export async function regenerateMapPreview(
|
|||||||
}
|
}
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function deleteAdminRsvp(rsvpId: number): Promise<void> {
|
||||||
|
const res = await fetch(`${BASE_API}/admin/rsvps/${rsvpId}`, {
|
||||||
|
method: "DELETE",
|
||||||
|
headers: { Accept: "application/json" },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok && res.status !== 204) {
|
||||||
|
const errorJson = await res.json().catch(() => null);
|
||||||
|
const msg = errorJson?.detail || `HTTP ${res.status}`;
|
||||||
|
throw new Error(`Error al eliminar asistente: ${msg}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateAdminRsvp(
|
||||||
|
rsvpId: number,
|
||||||
|
data: RSVPUpdateRequest,
|
||||||
|
): Promise<RSVPAdminItem> {
|
||||||
|
const res = await fetch(`${BASE_API}/admin/rsvps/${rsvpId}`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
const errorJson = await res.json().catch(() => null);
|
||||||
|
const msg =
|
||||||
|
errorJson?.detail ||
|
||||||
|
(errorJson?.errors
|
||||||
|
? Object.values(errorJson.errors).join(", ")
|
||||||
|
: `HTTP ${res.status}`);
|
||||||
|
throw new Error(msg || "Error al actualizar asistente.");
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useRef } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { Button } from "../components/Button";
|
import { Button } from "../components/Button";
|
||||||
import { Spinner } from "../components/Spinner";
|
import { Spinner } from "../components/Spinner";
|
||||||
import { useConfig } from "../hooks/useConfig";
|
import { useConfig } from "../hooks/useConfig";
|
||||||
@@ -11,6 +11,7 @@ import { RsvpResult } from "./RsvpResult";
|
|||||||
export function Invitation() {
|
export function Invitation() {
|
||||||
const { config, status, error, reload } = useConfig();
|
const { config, status, error, reload } = useConfig();
|
||||||
const rsvpForm = useRsvpForm();
|
const rsvpForm = useRsvpForm();
|
||||||
|
const [showDetailsOnly, setShowDetailsOnly] = useState(false);
|
||||||
const rsvpSectionRef = useRef<HTMLDivElement | null>(null);
|
const rsvpSectionRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
function scrollToRsvp() {
|
function scrollToRsvp() {
|
||||||
@@ -112,7 +113,17 @@ export function Invitation() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Section 1: Invitation Hero */}
|
{/* Section 1: Invitation Hero */}
|
||||||
<InvitationHero config={config} onCtaClick={scrollToRsvp} />
|
<InvitationHero
|
||||||
|
config={config}
|
||||||
|
onCtaClick={() => {
|
||||||
|
setShowDetailsOnly(false);
|
||||||
|
scrollToRsvp();
|
||||||
|
}}
|
||||||
|
onShowDetailsClick={() => {
|
||||||
|
setShowDetailsOnly(true);
|
||||||
|
scrollToRsvp();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Section 2: RSVP / Confirmation Flow */}
|
{/* Section 2: RSVP / Confirmation Flow */}
|
||||||
<div
|
<div
|
||||||
@@ -129,7 +140,16 @@ export function Invitation() {
|
|||||||
position: "relative",
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{rsvpForm.formState === "idle" || rsvpForm.formState === "submitting" ? (
|
{showDetailsOnly ? (
|
||||||
|
<RsvpResult
|
||||||
|
formState="idle"
|
||||||
|
confirmedName=""
|
||||||
|
config={config}
|
||||||
|
onRetry={() => setShowDetailsOnly(false)}
|
||||||
|
isDetailsOnly={true}
|
||||||
|
onBackToForm={() => setShowDetailsOnly(false)}
|
||||||
|
/>
|
||||||
|
) : rsvpForm.formState === "idle" || rsvpForm.formState === "submitting" ? (
|
||||||
<RsvpForm
|
<RsvpForm
|
||||||
config={config}
|
config={config}
|
||||||
name={rsvpForm.name}
|
name={rsvpForm.name}
|
||||||
@@ -141,6 +161,7 @@ export function Invitation() {
|
|||||||
formState={rsvpForm.formState}
|
formState={rsvpForm.formState}
|
||||||
errors={rsvpForm.errors}
|
errors={rsvpForm.errors}
|
||||||
onSubmit={rsvpForm.submit}
|
onSubmit={rsvpForm.submit}
|
||||||
|
onShowDetails={() => setShowDetailsOnly(true)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<RsvpResult
|
<RsvpResult
|
||||||
|
|||||||
@@ -4,9 +4,14 @@ import { RsvpCta } from "./RsvpCta";
|
|||||||
interface InvitationHeroProps {
|
interface InvitationHeroProps {
|
||||||
config: InvitationConfig;
|
config: InvitationConfig;
|
||||||
onCtaClick: () => void;
|
onCtaClick: () => void;
|
||||||
|
onShowDetailsClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InvitationHero({ config, onCtaClick }: InvitationHeroProps) {
|
export function InvitationHero({
|
||||||
|
config,
|
||||||
|
onCtaClick,
|
||||||
|
onShowDetailsClick,
|
||||||
|
}: InvitationHeroProps) {
|
||||||
// Parse date into Month, Day, and Day of Week
|
// Parse date into Month, Day, and Day of Week
|
||||||
const [year, monthNum, dayNum] = config.event_date.split("-").map(Number);
|
const [year, monthNum, dayNum] = config.event_date.split("-").map(Number);
|
||||||
const dateObj = new Date(year, (monthNum || 1) - 1, dayNum || 1);
|
const dateObj = new Date(year, (monthNum || 1) - 1, dayNum || 1);
|
||||||
@@ -167,8 +172,46 @@ export function InvitationHero({ config, onCtaClick }: InvitationHeroProps) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 4. RSVP Call to action */}
|
{/* 4. RSVP Call to action */}
|
||||||
<div style={{ marginBottom: "1rem" }}>
|
<div
|
||||||
|
style={{
|
||||||
|
marginBottom: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: "0.8rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<RsvpCta label={config.rsvp_cta} onClick={onCtaClick} />
|
<RsvpCta label={config.rsvp_cta} onClick={onCtaClick} />
|
||||||
|
{onShowDetailsClick && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onShowDetailsClick}
|
||||||
|
style={{
|
||||||
|
background: "none",
|
||||||
|
border: "none",
|
||||||
|
color: "var(--color-text-muted)",
|
||||||
|
fontSize: "0.74rem",
|
||||||
|
letterSpacing: "0.14em",
|
||||||
|
textTransform: "uppercase",
|
||||||
|
cursor: "pointer",
|
||||||
|
padding: "0.3rem 0.6rem",
|
||||||
|
textDecoration: "underline",
|
||||||
|
textUnderlineOffset: "3px",
|
||||||
|
opacity: 0.8,
|
||||||
|
transition: "opacity 0.2s ease, color 0.2s ease",
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
e.currentTarget.style.color = "var(--color-gold)";
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "0.8";
|
||||||
|
e.currentTarget.style.color = "var(--color-text-muted)";
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
¿Ya confirmaste? Ver ubicación y mapa
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ interface RsvpFormProps {
|
|||||||
formState: RsvpFormState;
|
formState: RsvpFormState;
|
||||||
errors: FormErrors;
|
errors: FormErrors;
|
||||||
onSubmit: () => void;
|
onSubmit: () => void;
|
||||||
|
onShowDetails?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RsvpForm({
|
export function RsvpForm({
|
||||||
@@ -29,6 +30,7 @@ export function RsvpForm({
|
|||||||
formState,
|
formState,
|
||||||
errors,
|
errors,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
onShowDetails,
|
||||||
}: RsvpFormProps) {
|
}: RsvpFormProps) {
|
||||||
const isSubmitting = formState === "submitting";
|
const isSubmitting = formState === "submitting";
|
||||||
|
|
||||||
@@ -107,6 +109,40 @@ export function RsvpForm({
|
|||||||
config.submit_label || "TE VEO AHÍ"
|
config.submit_label || "TE VEO AHÍ"
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
{onShowDetails && (
|
||||||
|
<div style={{ marginTop: "1.4rem" }}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onShowDetails}
|
||||||
|
style={{
|
||||||
|
background: "none",
|
||||||
|
border: "none",
|
||||||
|
color: "var(--color-gold)",
|
||||||
|
fontSize: "0.78rem",
|
||||||
|
letterSpacing: "0.14em",
|
||||||
|
textTransform: "uppercase",
|
||||||
|
cursor: "pointer",
|
||||||
|
padding: "0.4rem 0.8rem",
|
||||||
|
borderRadius: "4px",
|
||||||
|
textDecoration: "underline",
|
||||||
|
textUnderlineOffset: "4px",
|
||||||
|
opacity: 0.85,
|
||||||
|
transition: "opacity 0.2s ease, color 0.2s ease",
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
e.currentTarget.style.color = "var(--color-gold-light)";
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "0.85";
|
||||||
|
e.currentTarget.style.color = "var(--color-gold)";
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
¿Ya confirmaste? Ver ubicación y mapa ↓
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ interface RsvpResultProps {
|
|||||||
confirmedName: string;
|
confirmedName: string;
|
||||||
config: InvitationConfig;
|
config: InvitationConfig;
|
||||||
onRetry: () => void;
|
onRetry: () => void;
|
||||||
|
isDetailsOnly?: boolean;
|
||||||
|
onBackToForm?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RsvpResult({
|
export function RsvpResult({
|
||||||
@@ -18,6 +20,8 @@ export function RsvpResult({
|
|||||||
confirmedName,
|
confirmedName,
|
||||||
config,
|
config,
|
||||||
onRetry,
|
onRetry,
|
||||||
|
isDetailsOnly = false,
|
||||||
|
onBackToForm,
|
||||||
}: RsvpResultProps) {
|
}: RsvpResultProps) {
|
||||||
const countdown = useCountdown(
|
const countdown = useCountdown(
|
||||||
config.event_date,
|
config.event_date,
|
||||||
@@ -25,14 +29,108 @@ export function RsvpResult({
|
|||||||
config.event_timezone,
|
config.event_timezone,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isDetailsOnly) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
maxWidth: "440px",
|
||||||
|
margin: "0 auto",
|
||||||
|
padding: "1.5rem 1.5rem 3.5rem 1.5rem",
|
||||||
|
textAlign: "center",
|
||||||
|
}}
|
||||||
|
aria-live="polite"
|
||||||
|
>
|
||||||
|
<h3
|
||||||
|
style={{
|
||||||
|
fontFamily: "var(--font-display)",
|
||||||
|
fontSize: "clamp(2.8rem, 9vw, 3.6rem)",
|
||||||
|
fontWeight: 400,
|
||||||
|
color: "var(--color-gold-light)",
|
||||||
|
lineHeight: 1.15,
|
||||||
|
marginBottom: "0.4rem",
|
||||||
|
textShadow: "0 2px 20px rgba(212, 168, 67, 0.4)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Ubicación del Evento
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
fontSize: "0.85rem",
|
||||||
|
fontWeight: 600,
|
||||||
|
letterSpacing: "0.18em",
|
||||||
|
color: "var(--color-gold)",
|
||||||
|
textTransform: "uppercase",
|
||||||
|
marginBottom: "1.5rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{config.address_name}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{/* Live Countdown */}
|
||||||
|
<Countdown
|
||||||
|
days={countdown.days}
|
||||||
|
hours={countdown.hours}
|
||||||
|
minutes={countdown.minutes}
|
||||||
|
seconds={countdown.seconds}
|
||||||
|
state={countdown.state}
|
||||||
|
label={config.countdown_label}
|
||||||
|
inProgressLabel={config.countdown_in_progress}
|
||||||
|
finishedLabel={config.countdown_finished}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Decorative divider dot */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
gap: "0.4rem",
|
||||||
|
margin: "1.5rem 0",
|
||||||
|
color: "var(--color-gold)",
|
||||||
|
opacity: 0.5,
|
||||||
|
fontSize: "1.2rem",
|
||||||
|
}}
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<span>·</span>
|
||||||
|
<span>·</span>
|
||||||
|
<span>·</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Circular Map Preview and Venue Logistics */}
|
||||||
|
<MapPreview
|
||||||
|
previewUrl={config.map_preview_url}
|
||||||
|
mapUrl={config.map_url}
|
||||||
|
venueName={config.address_name}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VenueInfo venueName={config.address_name} addressLines={config.address_lines} />
|
||||||
|
|
||||||
|
{onBackToForm && (
|
||||||
|
<div style={{ marginTop: "2.5rem" }}>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
onClick={onBackToForm}
|
||||||
|
style={{ fontSize: "0.75rem", padding: "0.6rem 1.4rem" }}
|
||||||
|
>
|
||||||
|
« VOLVER AL FORMULARIO DE ASISTENCIA
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (formState === "duplicate") {
|
if (formState === "duplicate") {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
maxWidth: "420px",
|
maxWidth: "440px",
|
||||||
margin: "0 auto",
|
margin: "0 auto",
|
||||||
padding: "2.5rem 1.5rem",
|
padding: "1.5rem 1.5rem 3.5rem 1.5rem",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
role="alert"
|
role="alert"
|
||||||
@@ -40,29 +138,58 @@ export function RsvpResult({
|
|||||||
<h3
|
<h3
|
||||||
style={{
|
style={{
|
||||||
fontFamily: "var(--font-display)",
|
fontFamily: "var(--font-display)",
|
||||||
fontSize: "3.2rem",
|
fontSize: "clamp(2.8rem, 9vw, 3.6rem)",
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
color: "var(--color-gold-light)",
|
color: "var(--color-gold-light)",
|
||||||
marginBottom: "1rem",
|
marginBottom: "0.8rem",
|
||||||
textShadow: "0 2px 14px rgba(212, 168, 67, 0.3)",
|
textShadow: "0 2px 14px rgba(212, 168, 67, 0.3)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
¡Ups!
|
¡Ya estás registrado!
|
||||||
</h3>
|
</h3>
|
||||||
<p
|
<p
|
||||||
style={{
|
style={{
|
||||||
fontSize: "0.92rem",
|
fontSize: "0.92rem",
|
||||||
lineHeight: 1.7,
|
lineHeight: 1.7,
|
||||||
color: "var(--color-text-muted)",
|
color: "var(--color-text-muted)",
|
||||||
marginBottom: "2rem",
|
marginBottom: "1.8rem",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{config.msg_duplicate ||
|
{config.msg_duplicate ||
|
||||||
"Parece que ya tenemos tus datos registrados. Si necesitas modificar tu información, ponte en contacto con nosotros."}
|
"Parece que ya tenemos tus datos registrados. ¡Te esperamos!"}
|
||||||
</p>
|
</p>
|
||||||
<Button variant="outline" onClick={onRetry}>
|
|
||||||
VOLVER AL FORMULARIO
|
{/* Live Countdown */}
|
||||||
</Button>
|
<Countdown
|
||||||
|
days={countdown.days}
|
||||||
|
hours={countdown.hours}
|
||||||
|
minutes={countdown.minutes}
|
||||||
|
seconds={countdown.seconds}
|
||||||
|
state={countdown.state}
|
||||||
|
label={config.countdown_label}
|
||||||
|
inProgressLabel={config.countdown_in_progress}
|
||||||
|
finishedLabel={config.countdown_finished}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Circular Map Preview and Venue Logistics */}
|
||||||
|
<MapPreview
|
||||||
|
previewUrl={config.map_preview_url}
|
||||||
|
mapUrl={config.map_url}
|
||||||
|
venueName={config.address_name}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VenueInfo venueName={config.address_name} addressLines={config.address_lines} />
|
||||||
|
|
||||||
|
<div style={{ marginTop: "2rem" }}>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
onClick={onRetry}
|
||||||
|
style={{ fontSize: "0.75rem", padding: "0.6rem 1.4rem" }}
|
||||||
|
>
|
||||||
|
VOLVER AL FORMULARIO
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ export interface RSVPRequest {
|
|||||||
email?: string | null;
|
email?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RSVPUpdateRequest {
|
||||||
|
name?: string;
|
||||||
|
phone?: string;
|
||||||
|
email?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export type RSVPApiResult =
|
export type RSVPApiResult =
|
||||||
| { result: "SUCCESS"; name: string }
|
| { result: "SUCCESS"; name: string }
|
||||||
| { result: "DUPLICATE" }
|
| { result: "DUPLICATE" }
|
||||||
|
|||||||
Reference in new issue
Block a user