-
Notifications
You must be signed in to change notification settings - Fork 5
feat(web-ui): per-gate evidence display and run history (#567) #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,11 +7,12 @@ | |
|
|
||
| import logging | ||
| import uuid | ||
| from datetime import datetime, timezone | ||
| from typing import Optional | ||
|
|
||
| from codeframe.core.proof import ledger | ||
| from codeframe.core.proof.evidence import attach_evidence | ||
| from codeframe.core.proof.models import Gate, ReqStatus | ||
| from codeframe.core.proof.models import Gate, ProofRun, ReqStatus | ||
| from codeframe.core.proof.scope import get_changed_scope, intersects | ||
| from codeframe.core.workspace import Workspace | ||
|
|
||
|
|
@@ -68,6 +69,8 @@ def run_proof( | |
| if not run_id: | ||
| run_id = str(uuid.uuid4())[:8] | ||
|
|
||
| started_at = datetime.now(timezone.utc) | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Expire any stale waivers | ||
| expired = ledger.check_expired_waivers(workspace) | ||
| if expired: | ||
|
|
@@ -76,6 +79,19 @@ def run_proof( | |
| # Get all open requirements | ||
| reqs = ledger.list_requirements(workspace, status=ReqStatus.OPEN) | ||
| if not reqs: | ||
| completed_at = datetime.now(timezone.utc) | ||
| ledger.save_run( | ||
| workspace, | ||
| ProofRun( | ||
| run_id=run_id, | ||
| workspace_id=workspace.id, | ||
| started_at=started_at, | ||
| completed_at=completed_at, | ||
| triggered_by="human", | ||
| overall_passed=True, | ||
| duration_ms=int((completed_at - started_at).total_seconds() * 1000), | ||
| ), | ||
|
Comment on lines
+83
to
+93
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Suggested fix def run_proof(
workspace: Workspace,
*,
full: bool = False,
gate_filter: Optional[Gate] = None,
run_id: Optional[str] = None,
+ triggered_by: str = "human",
) -> dict[str, list[tuple[Gate, bool]]]:
@@
ProofRun(
run_id=run_id,
workspace_id=workspace.id,
started_at=started_at,
completed_at=completed_at,
- triggered_by="human",
+ triggered_by=triggered_by,
overall_passed=True,
duration_ms=int((completed_at - started_at).total_seconds() * 1000),
),
@@
ProofRun(
run_id=run_id,
workspace_id=workspace.id,
started_at=started_at,
completed_at=completed_at,
- triggered_by="human",
+ triggered_by=triggered_by,
overall_passed=overall_passed,
duration_ms=duration_ms,
),Also applies to: 150-160 🤖 Prompt for AI Agents |
||
| ) | ||
| return {} | ||
|
|
||
| # Get changed scope (skip if running full) | ||
|
|
@@ -127,4 +143,21 @@ def run_proof( | |
| req.status = ReqStatus.SATISFIED | ||
| ledger.save_requirement(workspace, req) | ||
|
|
||
| completed_at = datetime.now(timezone.utc) | ||
| duration_ms = int((completed_at - started_at).total_seconds() * 1000) | ||
| executed = [passed for gate_results in results.values() for _, passed in gate_results] | ||
| overall_passed = all(executed) if executed else True | ||
| ledger.save_run( | ||
| workspace, | ||
| ProofRun( | ||
| run_id=run_id, | ||
| workspace_id=workspace.id, | ||
| started_at=started_at, | ||
| completed_at=completed_at, | ||
| triggered_by="human", | ||
| overall_passed=overall_passed, | ||
| duration_ms=duration_ms, | ||
| ), | ||
| ) | ||
|
|
||
| return results | ||
Uh oh!
There was an error while loading. Please reload this page.