Implement WP-0009-T04: Control Plane interactive UI on whynot-design

Builds the Control Plane's browser UI (login, dashboard, Phase
registration, Development Credit entry/proposal/review, credential
admin, audit log) as a FastAPI + Jinja2 app over the already-finished
T03 backend, rather than from scratch — whynot-design's Lit web
components are vendored as static assets (source commit 4b62cffc,
v0.4.1), with lit itself resolved via an esm.sh CDN import map.

Session auth re-checks the credential token against the database on
every request rather than trusting the session cookie's cached rights,
so a mid-session revocation takes effect immediately.

9 new Docker-gated HTTP-level tests via FastAPI's TestClient (no
browser-automation tool available, so real rendering of the <wn-*>
components was never visually verified). All four WP-0009 tasks are
now done; workplan marked finished.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-30 15:43:16 +02:00
parent 5fbae0df02
commit c89b4aa4a5
24 changed files with 3486 additions and 3 deletions

View file

@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block title %}{{ manifest.phase.id }} — Target Revenue Control Plane{% endblock %}
{% block content %}
<wn-page-header>
<span slot="title">{{ manifest.phase.milestone_release.name }}</span>
</wn-page-header>
<p><wn-tag>{{ manifest.phase.id }}</wn-tag></p>
<h3>Status</h3>
<table class="wn-plain">
<tr><td>Initial Target</td><td>{{ manifest.phase.initial_target.amount }} {{ manifest.phase.initial_target.currency }}</td></tr>
<tr><td>Cumulative Development Credit</td><td>{{ metrics.facts.cumulative_development_credit }}</td></tr>
<tr><td>Cumulative Remission Credit</td><td>{{ metrics.facts.cumulative_remission_credit }}</td></tr>
<tr><td>Outstanding Target</td><td>{{ metrics.facts.outstanding_target }}</td></tr>
<tr><td>Target satisfaction</td><td>{{ metrics.calculations.target_satisfaction_percentage }}%</td></tr>
<tr><td>Converted</td><td>{{ metrics.facts.is_converted }}</td></tr>
</table>
<h3>Ledger ({{ ledger | length }} entries)</h3>
{% if ledger %}
<table class="wn-plain">
<thead><tr><th>id</th><th>type</th><th>amount</th><th>recognized_at</th></tr></thead>
<tbody>
{% for entry in ledger %}
<tr><td>{{ entry.id }}</td><td>{{ entry.type }}</td><td>{{ entry.amount }}</td><td>{{ entry.recognized_at }}</td></tr>
{% endfor %}
</tbody>
</table>
{% else %}
<wn-empty-state>No ledger entries yet.</wn-empty-state>
{% endif %}
{% if session_rights in ("contributor", "operator", "admin") %}
<h3>
{% if session_rights == "contributor" %}Propose a Development Credit entry{% else %}Add a Development Credit entry{% endif %}
</h3>
<form class="wn-form" method="post" action="/phases/{{ manifest.phase.id }}/ledger">
<wn-field-row label="Entry id (trsl:entry:...)">
<wn-input name="entry_id" required></wn-input>
</wn-field-row>
<wn-field-row label="Amount">
<wn-input type="number" step="0.01" name="amount" required></wn-input>
</wn-field-row>
<wn-field-row label="Currency">
<wn-input name="currency" value="{{ manifest.phase.initial_target.currency }}" required></wn-input>
</wn-field-row>
<wn-field-row label="Recognized at (ISO 8601)">
<wn-input name="recognized_at" required></wn-input>
</wn-field-row>
<wn-field-row label="Evidence reference">
<wn-input name="evidence_reference" required></wn-input>
</wn-field-row>
<wn-field-row label="Extension id (trsl:extension:...)">
<wn-input name="extension_id" required></wn-input>
</wn-field-row>
<wn-field-row label="Extension version">
<wn-input name="extension_version" required></wn-input>
</wn-field-row>
<wn-button type="submit" variant="primary">
{% if session_rights == "contributor" %}Submit for review{% else %}Append{% endif %}
</wn-button>
</form>
{% endif %}
{% endblock %}