Skip to content

Commit d22864c

Browse files
Show reuse package readiness
Signed-off-by: yoshifuminakamura <nakamura@riken.jp>
1 parent 35110f6 commit d22864c

5 files changed

Lines changed: 298 additions & 6 deletions

File tree

‎result_server/templates/_usage_report_evidence_snapshot_section.html‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"row_count": 0,
44
"result_count": 0,
55
"profiled_count": 0,
6-
"estimated_count": 0
6+
"estimated_count": 0,
7+
"public_packet_eligible_count": 0,
8+
"reuse_package_complete_count": 0
79
},
810
"rows": []
911
}, true) %}
@@ -16,6 +18,8 @@ <h2 class="section-title">Evidence Snapshot</h2>
1618
<span><strong>Configured:</strong> yes = enabled and implemented; partial = enabled but script support incomplete; off = configured off; no = not listed.</span>
1719
<span><strong>Result Quality:</strong> missing = no result; basic = core result only; ready = estimation bindings present; rich = source provenance and artifacts present.</span>
1820
<span><strong>Input Status:</strong> None = no input_info; Declared = input_info only; Covered = repo-local input fixed by source_info; Verified = digest-backed input verification.</span>
21+
<span><strong>Reuse Package:</strong> complete = public packet eligible with profile and estimate evidence; public packet eligible = source material is ready for a public Markdown reuse packet.</span>
22+
<span><strong>Public Packet:</strong> eligible = public result with public source provenance and public input binding.</span>
1923
<span><strong>Next Action:</strong> the first practical follow-up suggested by the current evidence state.</span>
2024
</div>
2125

@@ -28,6 +32,10 @@ <h3>Rows</h3>
2832
<h3>Evidence</h3>
2933
<p>{{ evidence_snapshot.summary.result_count }} executed / {{ evidence_snapshot.summary.profiled_count }} profiled / {{ evidence_snapshot.summary.estimated_count }} estimated</p>
3034
</div>
35+
<div class="diagnostic-card">
36+
<h3>Reuse</h3>
37+
<p>{{ evidence_snapshot.summary.public_packet_eligible_count|default(0) }} packet eligible / {{ evidence_snapshot.summary.reuse_package_complete_count|default(0) }} complete</p>
38+
</div>
3139
<div class="diagnostic-card">
3240
<h3>Export</h3>
3341
<p><a class="usage-btn" href="{{ url_for('results.usage_evidence_snapshot_csv') }}">Download CSV</a></p>
@@ -44,7 +52,7 @@ <h3>Export</h3>
4452
<th>Result Evidence</th>
4553
<th>Profile / Estimate</th>
4654
<th>Provenance</th>
47-
<th>Next Action</th>
55+
<th>Reuse / Next Action</th>
4856
</tr>
4957
</thead>
5058
<tbody>
@@ -84,6 +92,9 @@ <h3>Export</h3>
8492
<span class="profile-usage-subline"><span class="evidence-snapshot-label">Build Cache</span> {{ row.build_cache_status }}</span>
8593
</td>
8694
<td>
95+
<span class="evidence-snapshot-label">Reuse</span> {{ row.reuse_package_status }}
96+
<span class="profile-usage-subline">Public packet: {{ row.public_packet_status }}</span>
97+
<span class="profile-usage-subline">{{ row.public_packet_next_action }}</span>
8798
<span class="evidence-snapshot-value">{{ row.next_action }}</span>
8899
<span class="profile-usage-subline">Maturity Gaps: {{ row.missing_reason }}</span>
89100
</td>

‎result_server/tests/test_evidence_snapshot.py‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def test_evidence_snapshot_builds_flat_review_rows(tmp_path):
7575
assert snapshot["summary"]["result_count"] == 1
7676
assert snapshot["summary"]["profiled_count"] == 1
7777
assert snapshot["summary"]["estimated_count"] == 1
78+
assert snapshot["summary"]["public_packet_eligible_count"] == 1
79+
assert snapshot["summary"]["reuse_package_complete_count"] == 1
7880

7981
demosystem = next(row for row in snapshot["rows"] if row["system"] == "DemoSystem")
8082
assert demosystem["configured"] == "yes"
@@ -88,11 +90,78 @@ def test_evidence_snapshot_builds_flat_review_rows(tmp_path):
8890
assert demosystem["input_status"] == "Covered"
8991
assert demosystem["build_cache_status"] == "hit"
9092
assert demosystem["public_result_available"] == "yes"
93+
assert demosystem["reuse_package_status"] == "complete"
94+
assert demosystem["public_packet_status"] == "eligible"
95+
assert demosystem["public_packet_next_action"] == "Prepare public Markdown packet"
9196
assert demosystem["next_action"] == "Ready for review"
9297
assert demosystem["missing_reason"] == "none"
9398
assert all(row["system"] != "FutureSystem" for row in snapshot["rows"])
9499

95100

101+
def test_evidence_snapshot_requires_public_source_for_public_packet(tmp_path):
102+
received_dir = tmp_path / "received"
103+
estimated_dir = tmp_path / "estimated"
104+
received_dir.mkdir()
105+
estimated_dir.mkdir()
106+
107+
_write_json(
108+
received_dir / "result_20260901_010101_aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.json",
109+
{
110+
"code": "demoapp",
111+
"system": "DemoSystem",
112+
"Exp": "CASE0",
113+
"FOM": 1.0,
114+
"source_info": {
115+
"source_type": "git",
116+
"repo_url": "git@example.com:demoapp.git",
117+
"ref_name": "main",
118+
"resolved_commit": "abcdef1234567890",
119+
},
120+
"input_info": {
121+
"inputs": [
122+
{
123+
"repo_relative_path": "benchmarks/case0",
124+
"source": "source_info",
125+
"verification_status": "covered_by_source_commit",
126+
}
127+
],
128+
},
129+
"profile_data": {"tool": "ncu", "level": "kernel"},
130+
},
131+
)
132+
_write_json(
133+
estimated_dir / "estimate_20260902_020202_bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee.json",
134+
{
135+
"code": "demoapp",
136+
"exp": "CASE0",
137+
"current_system": {"system": "DemoSystem"},
138+
"future_system": {"system": "FutureSystem"},
139+
"applicability": {"status": "applicable"},
140+
},
141+
)
142+
143+
snapshot = build_evidence_snapshot(
144+
str(received_dir),
145+
str(estimated_dir),
146+
generated_at="2026-09-07T00:00:00Z",
147+
app_support_rows=[
148+
{
149+
"app": "demoapp",
150+
"systems": {
151+
"DemoSystem": {"status": "enabled"},
152+
},
153+
}
154+
],
155+
)
156+
157+
row = snapshot["rows"][0]
158+
assert row["source_status"] == "tracked"
159+
assert row["input_status"] == "Covered"
160+
assert row["public_packet_status"] == "needs public source"
161+
assert row["public_packet_next_action"] == "Record public source provenance"
162+
assert row["reuse_package_status"] == "needs public evidence"
163+
164+
96165
def test_evidence_snapshot_uses_estimate_benchmark_systems_without_future_target_rows(tmp_path):
97166
received_dir = tmp_path / "received"
98167
estimated_dir = tmp_path / "estimated"

‎result_server/tests/test_portal_list_templates.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ def test_usage_report_evidence_snapshot_consolidates_coverage_and_quality():
754754
"result_count": 1,
755755
"profiled_count": 0,
756756
"estimated_count": 0,
757+
"public_packet_eligible_count": 0,
758+
"reuse_package_complete_count": 0,
757759
},
758760
"rows": [
759761
{
@@ -775,6 +777,9 @@ def test_usage_report_evidence_snapshot_consolidates_coverage_and_quality():
775777
"input_status": "None",
776778
"build_cache_status": "not recorded",
777779
"public_result_available": "yes",
780+
"reuse_package_status": "needs evidence",
781+
"public_packet_status": "needs public source",
782+
"public_packet_next_action": "Record public source provenance",
778783
"next_action": "Record source provenance",
779784
"missing_reason": "no profile; no estimate; source incomplete; input not declared",
780785
}
@@ -809,7 +814,11 @@ def test_usage_report_evidence_snapshot_consolidates_coverage_and_quality():
809814
assert "Evidence Snapshot:</strong> the roll-up and CSV export source" in html
810815
assert "Configured:</strong> yes = enabled and implemented" in html
811816
assert "Result Quality:</strong> missing = no result" in html
817+
assert "Reuse Package:</strong> complete = public packet eligible" in html
818+
assert "Public Packet:</strong> eligible = public result with public source provenance" in html
812819
assert "Next Action" in html
820+
assert "Reuse / Next Action" in html
821+
assert "needs public source" in html
813822
assert "Record source provenance" in html
814823
assert "Maturity Gaps" in html
815824
assert "Input Status" in html

‎result_server/tests/test_usage_route.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def test_usage_page_shows_consolidated_evidence_snapshot(self, client, tmp_dirs)
112112
assert "Result Evidence" in text
113113
assert "Profile / Estimate" in text
114114
assert "Provenance" in text
115+
assert "Reuse / Next Action" in text
115116
assert "Application/System Coverage" not in text
116117
assert "Latest Result Quality Details" not in text
117118
assert "Maturity Gaps" in text
@@ -195,6 +196,8 @@ def fake_build_usage_report_context(
195196
"result_count": 0,
196197
"profiled_count": 0,
197198
"estimated_count": 0,
199+
"public_packet_eligible_count": 0,
200+
"reuse_package_complete_count": 0,
198201
},
199202
"rows": [],
200203
},
@@ -225,6 +228,7 @@ def test_usage_page_shows_evidence_snapshot_and_csv_link(self, client, tmp_dirs)
225228
assert "Evidence Snapshot:</strong> the roll-up and CSV export source" in text
226229
assert "reported queue values may not include scheduler-side wait" in text
227230
assert "Input Status:</strong> None = no input_info" in text
231+
assert "Public Packet:</strong> eligible = public result with public source provenance" in text
228232
assert "/results/usage/evidence-snapshot.csv" in text
229233

230234
def test_usage_evidence_snapshot_csv_requires_admin(self, client):
@@ -274,7 +278,8 @@ def test_usage_evidence_snapshot_csv_exports_flat_rows(self, client, tmp_dirs):
274278
assert resp.mimetype == "text/csv"
275279
assert "attachment; filename=evidence_snapshot_" in resp.headers["Content-Disposition"]
276280
assert "snapshot_time,benchkit_commit,code,system,configured" in text
277-
assert "public_result_available,next_action,missing_reason" in text
281+
assert "public_result_available,reuse_package_status" in text
282+
assert "public_packet_status,public_packet_next_action,next_action,missing_reason" in text
278283
assert "demoapp,DemoSystem" in text
279284
assert "Decide whether to add this app/system condition" in text
280285
assert "hit" in text

0 commit comments

Comments
 (0)