Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99f8581cc8 |
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)
|
||||
- [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
|
||||
|
||||
[Unlicense](UNLICENSE) — public domain.
|
||||
@@ -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.
|
||||
Reference in new issue
Block a user