Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
python -m pytest -vv -o addopts='' \
tests/test_profile_story_checks.py::test_profile_and_trace_shortcuts_open_recorded_evidence \
tests/test_knowledge_navigation_browser.py \
tests/test_round_decisions_browser.py \
tests/test_dashboard_experiments_browser.py \
tests/test_result_delivery.py::test_offline_html_remains_readable_without_scripts_or_network \
--junitxml="$RUNNER_TEMP/dashboard-browser-results.xml"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
209 changes: 202 additions & 7 deletions docs/examples/dashboard-profile-review.html

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/knowledge-retrieval-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,45 @@ from PR #401, and the experiment identities and navigation from PR #405. The
implementation PR records the exact main revision used for validation. These
interfaces do not depend on unfinished general statistics or workflow proposals.

## Round decisions

The **Round decisions / 逐轮决策** panel places four stages next to each other
for the selected round, in both layouts and in offline/live views:

| Stage | Recorded source and meaning |
| --- | --- |
| Retrieval results | Explicitly linked capture IDs and shared search records; returned entries, versions, assembly/omission state and caller-declared use or rejection. Shared search queries and expandable request/event evidence remain available even without a capture. Open the capture for its full evidence. |
| Alternatives | That candidate/run's `optimization_trace.search_space`, plus option IDs explicitly referenced by the round's optimization-log candidates. The campaign-wide search space is a separate disclosure, not a reconstructed round shortlist. |
| Final selection | Caller-declared candidate/option choices, reasons, knowledge references and trace attempts. This is selection **to try**, not adoption after validation. |
| Execution results | Every recorded candidate/run in the round, its verdict, quality, measured values and post-validation decision. Caller decisions remain separate from run records; disagreements are visible. Open the exact run for change and execution evidence. |

The selector starts at the earliest explicitly recorded round. Records without
a round appear under **Round not recorded**; their position never implies
round 1. Missing snapshots, alternatives, selection reasons and results remain
missing. A trace's caller-written context is labelled separately from a retained
retrieval snapshot. Tampered captures cannot supply returned entries or assembled
context, and cross-round association conflicts remain visible. Knowledge
declarations do not establish consumption or causal performance improvement.

Round selection, expanded details and keyboard focus survive live updates;
language changes retain the selected round and expanded details. The columns
adapt to the panel's available width, including the narrower profile layout.
The profile layout keeps this panel collapsed initially; its **Round decisions**
navigation link opens it, preserving the existing trend-first landing view.

This is a read-only presentation of existing contracts. It does not collect
missing history, create a second control record for managed campaigns, or
complete the real-campaign workflow integration tracked by #491. Managed
campaigns still use the shared Harness controller; do not use legacy record or
decision operations to fill their missing associations.

The following screenshots show the implemented panel using synthetic inputs
and synthetic measurements; they are not real optimization results:

- [Default layout, round 1 in Chinese](assets/dashboard-round-decisions-default-zh.png)
- [Profile layout, round 1 in Chinese](assets/dashboard-round-decisions-profile-zh.png)
- [Mobile profile layout in Chinese](assets/dashboard-round-decisions-mobile-zh.png)

## Execution observations

`knowledge search` and `collect` remain separate operations. Neither calls the
Expand Down Expand Up @@ -159,6 +198,7 @@ the full assembled context.
PYTHONPATH=src python tests/fixtures/knowledge_retrieval.py <OUTPUT_DIRECTORY>
pytest tests/test_retrieval_projection.py
pytest tests/test_knowledge_navigation_browser.py
pytest tests/test_round_decisions_browser.py
```

The browser tests require Playwright and Chromium. Open the generated
Expand Down
6 changes: 4 additions & 2 deletions src/inferrsi/apps/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ def render_dashboard(snapshot: dict, *, live: bool = False) -> str:
)
if live:
template = template.replace("img-src data:;", "img-src data:; connect-src 'self';")
replacements = {"__DASHBOARD_KNOWLEDGE__": files("inferrsi").joinpath(
replacements = {"__DASHBOARD_ROUND_DECISIONS__": files("inferrsi").joinpath(
"apps", "views", "round_decision_view.html").read_text(encoding="utf-8"),
"__DASHBOARD_KNOWLEDGE__": files("inferrsi").joinpath(
"apps", "views", "knowledge_view.html").read_text(encoding="utf-8"),
"__DASHBOARD_OVERVIEW__": files("inferrsi").joinpath(
"apps", "views", "overview_view.html").read_text(encoding="utf-8"),
Expand All @@ -363,7 +365,7 @@ def render_dashboard(snapshot: dict, *, live: bool = False) -> str:
"__DASHBOARD_EXPERIMENTS__": files("inferrsi").joinpath(
"apps", "views", "experiment_view.html").read_text(encoding="utf-8")}
return re.sub(
r"__DASHBOARD_(?:DATA|CHART|TEMPORAL|EXPERIMENTS|KNOWLEDGE|OVERVIEW)__",
r"__DASHBOARD_(?:DATA|CHART|TEMPORAL|EXPERIMENTS|KNOWLEDGE|OVERVIEW|ROUND_DECISIONS)__",
lambda match: replacements[match.group()],
template,
)
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/views/knowledge_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,6 @@
captures.forEach(c=>button(section,tr('Open retrieval · ','打开检索 · ')+c.context_id,()=>showCapture(c.context_id)));
searches.forEach(s=>button(section,'R'+s.round+' · v'+s.schema_version,()=>{round=String(s.round);selected=null;opened.add('navigation');opened.add(s.path);render();const d=document.querySelector('#knowledge-navigation > details');d.open=true;d.querySelector('summary').focus();d.scrollIntoView({block:'start'});}));
}
return {render,trace,backLinks};
return {render,trace,backLinks,openCapture:showCapture,openRun};
}};
</script>
22 changes: 16 additions & 6 deletions src/inferrsi/apps/views/review_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ <h1 id="review-title"></h1>
</div>
<nav id="review-links" aria-label="实验记录">
<a id="goal-link" href="#review-goal"></a>
<a id="round-decisions-link" href="#round-decision-panel"></a>
<a id="knowledge-link" href="#knowledge-navigation" hidden></a>
<a id="profiles-link" href="#profiles" hidden></a>
<a id="trace-link" href="#trace" hidden></a>
Expand All @@ -137,6 +138,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
</details>
</details>
</section>
<section aria-labelledby="round-decision-title"><h2 class="panel-heading" aria-labelledby="round-decision-title"></h2><details id="round-decision-panel" class="panel" data-key="round-decisions"><summary id="round-decision-title"></summary><div id="round-decisions" role="region" aria-label="Round decisions"></div></details></section>
<section aria-labelledby="goal-title"><h2 class="panel-heading" aria-labelledby="goal-title"></h2><details id="review-goal" class="panel" data-key="goal"><summary><span id="goal-title"></span></summary><div id="goal"></div></details></section>
<section id="story-checks" hidden aria-labelledby="checks-title"><h2 class="panel-heading" aria-labelledby="checks-title"></h2><details class="panel" data-key="checks"><summary><span id="checks-title"></span> <span id="checks-count"></span></summary><ul id="checks-list"></ul></details></section>
<section aria-labelledby="baseline-title"><h2 class="panel-heading" aria-labelledby="baseline-title"></h2><details id="trace" class="panel" data-key="timings"><summary><span id="baseline-title"></span></summary><div id="baseline"></div></details></section>
Expand All @@ -150,6 +152,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
</main>
__DASHBOARD_EXPERIMENTS__
__DASHBOARD_KNOWLEDGE__
__DASHBOARD_ROUND_DECISIONS__
<script id="dashboard-data" type="application/json">__DASHBOARD_DATA__</script>
<script>
(() => {
Expand Down Expand Up @@ -632,9 +635,13 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
},opened);
}
const knowledgeView=window.InferRSIKnowledge.create({getData:()=>data,getLanguage:()=>language,
openRun:link=>{const target=[...document.querySelectorAll('[data-experiment-id]')].find(n=>n.dataset.experimentId===link.experiment_id);
openRun:link=>{const key=JSON.stringify([link.round,link.candidate_id,link.run_id]);
const matches=[...document.querySelectorAll('#rounds [data-run-identity]')].filter(n=>link.experiment_id?n.dataset.experimentId===link.experiment_id:n.dataset.runIdentity===key);
const target=matches.length===1?matches[0]:null;
if(target){for(let p=target;p;p=p.parentElement)if(p.tagName==='DETAILS')p.open=true;
target.focus();target.scrollIntoView({block:'start'});}}});
const roundDecisionView=window.InferRSIRoundDecisions.create({getData:()=>data,getLanguage:()=>language,
narrative:recorded,openCapture:knowledgeView.openCapture,openRun:knowledgeView.openRun});
const experimentView=window.InferRSIExperiments.create({
getData:()=>data,getLanguage:()=>language,narrative:recorded,
openExperiment:id=>{const target=[...document.querySelectorAll('[data-experiment-id]')].find(n=>n.dataset.experimentId===id);if(target){for(let parent=target.parentElement;parent;parent=parent.parentElement){if(parent.tagName==='DETAILS')parent.open=true;}target.scrollIntoView({block:'start'});target.focus();}}
Expand Down Expand Up @@ -795,7 +802,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
}
function render(){
const opened=new Set([...document.querySelectorAll('details[open]')].map(f=>f.dataset.key));
const previousFocus=document.activeElement?.closest('details')?.dataset.key;
const previousFocus=document.activeElement?.closest('#round-decisions')?null:document.activeElement?.closest('details')?.dataset.key;
document.documentElement.lang=language==='zh'?'zh-CN':'en';
const reviewTitle=tr('实验复盘','Experiment review');
document.title='InferRSI · '+reviewTitle;
Expand All @@ -808,6 +815,8 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
const retrievals=data.knowledge_trace?.retrievals?.length;
byId('goal-link').textContent=tr('目标与验收','Goal and criteria');
byId('goal-link').dataset.caption=tr('任务','Campaign');
byId('round-decisions-link').textContent=tr('逐轮决策','Round decisions');
byId('round-decisions-link').dataset.caption=tr('检索到结果','Retrieval to results');
byId('profiles-link').dataset.caption=captures?captures+tr(' 份采集',' captures'):tr('采集不可用','Capture unavailable');
byId('trace-link').dataset.caption=steps+tr(' 个步骤',' steps');
byId('knowledge-link').dataset.caption=retrievals?retrievals+tr(' 次检索',' retrievals'):tr('搜索记录','Search records');
Expand Down Expand Up @@ -878,7 +887,8 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
outer.dataset.key='round:'+JSON.stringify([r.round,r.candidate_id,r.run_id]);outer.open=opened.has(outer.dataset.key);
name.append(el('span',rowLabel(r),'tag'),document.createTextNode(recorded(r.title||r.candidate_id)));
outer.append(name,a);rounds.append(outer);
name.dataset.experimentId=r.experiment_id;name.tabIndex=-1;
if(r.experiment_id)name.dataset.experimentId=r.experiment_id;
name.dataset.runIdentity=JSON.stringify([r.round,r.candidate_id,r.run_id]);name.tabIndex=-1;
const jump=el('button'),gain=Number.isFinite(r.improvement_pct)?(r.improvement_pct>0?'+':'')+fmt(r.improvement_pct,2)+'%':dash;
jump.type='button';
jump.title=tr('查看本轮依据、改动和实测','Open round evidence, changes and results');
Expand Down Expand Up @@ -935,7 +945,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
for(const [key,zh,en] of [['lessons','经验','Lessons'],['limitations','限制','Limitations']]){summaryBox.append(el('h3',tr(zh,en)));for(const item of summary[key])p(summaryBox,recorded(item));}
}
experimentView.render([byId('chart'),byId('summary-experiments')]);
knowledgeView.render();
knowledgeView.render();roundDecisionView.render();
if(previousFocus){for(const node of document.querySelectorAll('details'))if(node.dataset.key===previousFocus)node.querySelector('summary').focus({preventScroll:true});}
}
byId('language').addEventListener('click',()=>{
Expand Down Expand Up @@ -965,7 +975,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
const summary=details.querySelector(':scope > summary');
summary.focus({preventScroll:true});summary.scrollIntoView({block:'start'});
}
if(['#review-goal','#review-decisions'].includes(window.location.hash))reveal(byId(window.location.hash.slice(1)));
if(['#review-goal','#review-decisions','#round-decision-panel'].includes(window.location.hash))reveal(byId(window.location.hash.slice(1)));
if(window.location.hash==='#trace' && !byId('trace-link').hidden){
byId('trace').open=true;
reveal(byId('baseline').querySelector('[data-key="experiment-all"]'));
Expand All @@ -981,7 +991,7 @@ <h2 class="panel-heading" aria-labelledby="chart-title"></h2>
if(ready)reveal(ready);
}
}
for(const link of ['goal-link','profiles-link','trace-link','decisions-link'].map(byId)){
for(const link of ['goal-link','profiles-link','trace-link','decisions-link','round-decisions-link'].map(byId)){
link.addEventListener('click',event=>{
if(link.hash===window.location.hash && !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey){
event.preventDefault();openEvidenceLink();
Expand Down
Loading
Loading