ReviewDecision domain model

This commit is contained in:
2026-04-26 00:24:02 +02:00
parent 5aa76af78c
commit 29e855e5b3
7 changed files with 130 additions and 0 deletions

View File

@@ -267,6 +267,7 @@ def repository_detail(
repository = service.get_repository(repository_id)
runs = service.list_analysis_runs(repository_id)
ability_map = service.ability_map(repository_id)
decisions = service.list_review_decisions(repository_id)
facts = service.list_observed_facts(repository_id)
languages = sorted({fact.name for fact in facts if fact.kind == "language"})
frameworks = sorted({fact.name for fact in facts if fact.kind == "framework"})
@@ -307,6 +308,10 @@ def repository_detail(
{render_ability_map(asdict(ability_map))}
</section>
</div>
<section class="panel" style="margin-top:18px">
<h2>Review Decisions</h2>
{render_review_decisions(decisions)}
</section>
"""
return page(repository.name, body)
@@ -336,6 +341,7 @@ def analysis_run_detail(
repository = service.get_repository(repository_id)
candidate_graph = service.candidate_graph(repository_id, analysis_run_id)
facts = service.list_observed_facts(repository_id, analysis_run_id)
decisions = service.list_review_decisions(repository_id, analysis_run_id)
fact_rows = "\n".join(
f"""
<tr>
@@ -368,6 +374,8 @@ def analysis_run_detail(
<thead><tr><th>Kind</th><th>Name</th><th>Path</th><th>Value</th></tr></thead>
<tbody>{fact_rows or '<tr><td colspan="4" class="muted">No observed facts.</td></tr>'}</tbody>
</table>
<h2>Review Decisions</h2>
{render_review_decisions(decisions)}
</section>
</div>
"""
@@ -743,6 +751,27 @@ def render_repository_facts(languages: list[str], frameworks: list[str]) -> str:
return f'<p class="actions">{language_pills}{framework_pills}</p>'
def render_review_decisions(decisions: list) -> str:
if not decisions:
return '<p class="muted">No review decisions yet.</p>'
rows = "\n".join(
f"""
<tr>
<td>{escape(decision.action)}</td>
<td class="source">{escape(decision.created_at)}</td>
<td>{escape(decision.notes)}</td>
</tr>
"""
for decision in decisions
)
return f"""
<table>
<thead><tr><th>Action</th><th>Created</th><th>Notes</th></tr></thead>
<tbody>{rows}</tbody>
</table>
"""
def render_candidate_ability_actions(
ability: dict,
repository_id: int,