okstra 0.234.0 → 0.235.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-registry.mjs +7 -0
- package/dist/cli-registry.mjs.map +1 -1
- package/dist/commands/implementation-report/implementation-report.d.mts +1 -0
- package/dist/commands/implementation-report/implementation-report.mjs +73 -0
- package/dist/commands/implementation-report/implementation-report.mjs.map +1 -0
- package/dist/commands/trace/comparison.d.mts +39 -0
- package/dist/commands/trace/comparison.mjs +138 -0
- package/dist/commands/trace/comparison.mjs.map +1 -0
- package/dist/commands/trace/document.d.mts +8 -0
- package/dist/commands/trace/document.mjs +37 -0
- package/dist/commands/trace/document.mjs.map +1 -0
- package/dist/commands/trace/line-counts.d.mts +15 -0
- package/dist/commands/trace/line-counts.mjs +107 -0
- package/dist/commands/trace/line-counts.mjs.map +1 -0
- package/dist/commands/trace/model.d.mts +2 -1
- package/dist/commands/trace/model.mjs +13 -1
- package/dist/commands/trace/model.mjs.map +1 -1
- package/dist/commands/trace/progression.mjs +12 -7
- package/dist/commands/trace/progression.mjs.map +1 -1
- package/dist/commands/trace/task-link.d.mts +3 -0
- package/dist/commands/trace/task-link.mjs.map +1 -1
- package/dist/commands/trace/trace.mjs +66 -46
- package/dist/commands/trace/trace.mjs.map +1 -1
- package/dist/lib/python-helper.d.mts +1 -1
- package/dist/lib/python-helper.mjs +11 -5
- package/dist/lib/python-helper.mjs.map +1 -1
- package/dist/lib/types.d.mts +1 -0
- package/docs/architecture/storage-model.md +50 -0
- package/docs/cli.md +31 -15
- package/docs/project-structure-overview.md +6 -1
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/operations/trace-tests-review.json +6 -0
- package/runtime/prompts/duties/test-reviewer.json +32 -0
- package/runtime/prompts/lead/report-writer.md +13 -1
- package/runtime/python/okstra_ctl/agent/invocation.py +109 -56
- package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +17 -0
- package/runtime/python/okstra_ctl/attempt_evidence.py +5 -2
- package/runtime/python/okstra_ctl/code_review_census.py +38 -0
- package/runtime/python/okstra_ctl/code_review_coverage.py +15 -4
- package/runtime/python/okstra_ctl/code_review_prepare.py +15 -3
- package/runtime/python/okstra_ctl/code_review_scope.py +3 -2
- package/runtime/python/okstra_ctl/code_review_target.py +16 -6
- package/runtime/python/okstra_ctl/conformance_evidence.py +44 -21
- package/runtime/python/okstra_ctl/consumers.py +6 -1
- package/runtime/python/okstra_ctl/design_review.py +6 -26
- package/runtime/python/okstra_ctl/design_review_evidence.py +6 -26
- package/runtime/python/okstra_ctl/dispatch_core.py +9 -2
- package/runtime/python/okstra_ctl/dispatch_state.py +5 -0
- package/runtime/python/okstra_ctl/domain/role.py +1 -0
- package/runtime/python/okstra_ctl/execution_manifest.py +8 -0
- package/runtime/python/okstra_ctl/implementation_comparison/__init__.py +12 -0
- package/runtime/python/okstra_ctl/implementation_comparison/__main__.py +129 -0
- package/runtime/python/okstra_ctl/implementation_comparison/assembly.py +340 -0
- package/runtime/python/okstra_ctl/implementation_comparison/baseline.py +254 -0
- package/runtime/python/okstra_ctl/implementation_comparison/business_reuse.py +118 -0
- package/runtime/python/okstra_ctl/implementation_comparison/commit_source.py +113 -0
- package/runtime/python/okstra_ctl/implementation_comparison/html.py +49 -0
- package/runtime/python/okstra_ctl/implementation_comparison/inputs.py +348 -0
- package/runtime/python/okstra_ctl/implementation_comparison/model.py +47 -0
- package/runtime/python/okstra_ctl/implementation_comparison/preparation.py +195 -0
- package/runtime/python/okstra_ctl/implementation_comparison/publication.py +317 -0
- package/runtime/python/okstra_ctl/implementation_comparison/run_evidence.py +208 -0
- package/runtime/python/okstra_ctl/implementation_comparison/run_integration.py +198 -0
- package/runtime/python/okstra_ctl/implementation_comparison/source.py +342 -0
- package/runtime/python/okstra_ctl/implementation_comparison/target.py +144 -0
- package/runtime/python/okstra_ctl/implementation_comparison/task_assembly.py +333 -0
- package/runtime/python/okstra_ctl/implementation_comparison/task_selection.py +309 -0
- package/runtime/python/okstra_ctl/implementation_generation_evidence.py +134 -0
- package/runtime/python/okstra_ctl/implementation_outcome.py +2 -2
- package/runtime/python/okstra_ctl/initial_prompt_materialization.py +1 -0
- package/runtime/python/okstra_ctl/json_boundary.py +28 -8
- package/runtime/python/okstra_ctl/paths.py +7 -4
- package/runtime/python/okstra_ctl/plan_run_root.py +8 -4
- package/runtime/python/okstra_ctl/qa_procedures.py +33 -2
- package/runtime/python/okstra_ctl/render.py +4 -0
- package/runtime/python/okstra_ctl/report_execution_evidence.py +88 -15
- package/runtime/python/okstra_ctl/report_finalize.py +18 -4
- package/runtime/python/okstra_ctl/report_html/render.py +46 -7
- package/runtime/python/okstra_ctl/report_html/validation.py +32 -0
- package/runtime/python/okstra_ctl/report_synthesis_packet.py +37 -3
- package/runtime/python/okstra_ctl/report_view_artifacts.py +12 -0
- package/runtime/python/okstra_ctl/review_verdicts.py +9 -0
- package/runtime/python/okstra_ctl/run.py +16 -0
- package/runtime/python/okstra_ctl/stage_done.py +11 -3
- package/runtime/python/okstra_ctl/stage_ledger.py +2 -2
- package/runtime/python/okstra_ctl/stage_map.py +3 -3
- package/runtime/python/okstra_ctl/trace_review.py +1 -0
- package/runtime/python/okstra_ctl/trace_tasks.py +22 -7
- package/runtime/python/okstra_ctl/verification_dispatch.py +32 -0
- package/runtime/python/okstra_ctl/verification_evidence.py +23 -3
- package/runtime/python/okstra_ctl/verification_generation.py +3 -2
- package/runtime/python/okstra_ctl/verification_inputs.py +3 -2
- package/runtime/python/okstra_ctl/verification_invocation.py +7 -3
- package/runtime/schemas/report-synthesis-packet-v1.0.schema.json +17 -0
- package/runtime/skills/okstra-brief-gen/SKILL.md +52 -6
- package/runtime/skills/okstra-code-review/SKILL.md +1 -1
- package/runtime/skills/okstra-code-review/references/census-rules.md +1 -1
- package/runtime/skills/okstra-code-review/references/review-calibration.md +1 -1
- package/runtime/skills/okstra-run/SKILL.md +31 -0
- package/runtime/skills/okstra-tdd/SKILL.md +75 -11
- package/runtime/templates/reports/html/assets/implementation-comparison.css +39 -0
- package/runtime/templates/reports/html/assets/implementation-comparison.js +55 -0
- package/runtime/templates/reports/html/i18n/en.json +113 -0
- package/runtime/templates/reports/html/i18n/ko.json +113 -0
- package/runtime/templates/reports/html/implementation-comparison.template.html +77 -0
- package/runtime/templates/reports/implementation-comparison-notes.md +72 -0
- package/runtime/templates/trace/trace.template.md +2 -0
- package/runtime/validators/validate-report-views.py +4 -36
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
"use strict";
|
|
3
|
+
const controls = document.querySelector(".comparison-controls");
|
|
4
|
+
if (!controls) return;
|
|
5
|
+
const search = controls.querySelector("input");
|
|
6
|
+
const affected = controls.querySelector("#comparison-affected");
|
|
7
|
+
const support = controls.querySelector("#comparison-support");
|
|
8
|
+
const stage = controls.querySelector("#comparison-stage");
|
|
9
|
+
const output = controls.querySelector("output");
|
|
10
|
+
const items = [...document.querySelectorAll("[data-search-item]")];
|
|
11
|
+
const noMatches = document.querySelector(".comparison-no-matches");
|
|
12
|
+
function update() {
|
|
13
|
+
const query = search.value.trim().toLocaleLowerCase();
|
|
14
|
+
const visibleEvidence = new Set();
|
|
15
|
+
for (const item of items.filter((row) => row.hasAttribute("data-change"))) {
|
|
16
|
+
const targets = JSON.parse(item.dataset.affected);
|
|
17
|
+
const stages = JSON.parse(item.dataset.stages).map(String);
|
|
18
|
+
const level = !support.value || [...item.querySelectorAll("[data-support]")].some((claim) => claim.dataset.support === support.value);
|
|
19
|
+
item.hidden = !((!query || item.textContent.toLocaleLowerCase().includes(query))
|
|
20
|
+
&& (!affected.value || targets.includes(affected.value)) && (!stage.value || stages.includes(stage.value)) && level);
|
|
21
|
+
if (!item.hidden) for (const link of item.querySelectorAll('a[href^="#evidence-"]')) visibleEvidence.add(link.getAttribute("href").slice(1));
|
|
22
|
+
}
|
|
23
|
+
for (const item of items.filter((row) => !row.hasAttribute("data-change"))) {
|
|
24
|
+
const stages = item.dataset.stages ? JSON.parse(item.dataset.stages).map(String) : null;
|
|
25
|
+
item.hidden = Boolean(stage.value && stages && !stages.includes(stage.value))
|
|
26
|
+
|| (Boolean(query) && !item.textContent.toLocaleLowerCase().includes(query) && !visibleEvidence.has(item.id));
|
|
27
|
+
}
|
|
28
|
+
const visible = items.filter((item) => !item.hidden).length;
|
|
29
|
+
output.textContent = output.dataset.countFormat.replace("{visible}", String(visible)).replace("{total}", String(items.length));
|
|
30
|
+
noMatches.hidden = visible !== 0;
|
|
31
|
+
}
|
|
32
|
+
controls.hidden = false;
|
|
33
|
+
controls.addEventListener("input", update);
|
|
34
|
+
controls.addEventListener("change", update);
|
|
35
|
+
controls.addEventListener("submit", (event) => event.preventDefault());
|
|
36
|
+
controls.addEventListener("reset", () => { search.value = ""; affected.value = ""; support.value = ""; stage.value = ""; update(); });
|
|
37
|
+
document.addEventListener("click", (event) => {
|
|
38
|
+
const link = event.target.closest('a[href^="#"]');
|
|
39
|
+
const target = link && document.getElementById(link.getAttribute("href").slice(1));
|
|
40
|
+
if (!target) return;
|
|
41
|
+
if (target.closest("[data-search-item]")?.hidden) controls.reset();
|
|
42
|
+
const contents = target.querySelector(":scope > details");
|
|
43
|
+
if (contents) contents.open = true;
|
|
44
|
+
for (let parent = target; parent; parent = parent.parentElement) {
|
|
45
|
+
if (parent.tagName === "DETAILS") parent.open = true;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
let closedDetails = [];
|
|
49
|
+
window.addEventListener("beforeprint", () => {
|
|
50
|
+
closedDetails = [...document.querySelectorAll("details:not([open])")];
|
|
51
|
+
for (const detail of closedDetails) detail.open = true;
|
|
52
|
+
});
|
|
53
|
+
window.addEventListener("afterprint", () => { for (const detail of closedDetails) detail.open = false; closedDetails = []; });
|
|
54
|
+
update();
|
|
55
|
+
})();
|
|
@@ -823,5 +823,118 @@
|
|
|
823
823
|
"revision": "Canonical revision",
|
|
824
824
|
"draft": "Still a draft: the user has not confirmed completion."
|
|
825
825
|
}
|
|
826
|
+
},
|
|
827
|
+
"comparison": {
|
|
828
|
+
"title": "Implementation comparison",
|
|
829
|
+
"skip": "Skip to comparison",
|
|
830
|
+
"contents": "Contents",
|
|
831
|
+
"changes": "Scenario comparisons",
|
|
832
|
+
"evidence": "Evidence",
|
|
833
|
+
"coverage": "Change coverage",
|
|
834
|
+
"limitations": "Limits and remaining work",
|
|
835
|
+
"reportStatusLabel": "Comparison report",
|
|
836
|
+
"generatedAt": "Generated at",
|
|
837
|
+
"inputDigest": "Report input SHA-256",
|
|
838
|
+
"recordStep": "Recorded step",
|
|
839
|
+
"recordType": "Recorded check kind",
|
|
840
|
+
"recordedAt": "Recorded at",
|
|
841
|
+
"failureCause": "Recorded failure cause",
|
|
842
|
+
"redLimit": "RED records missing implementation during development; it does not establish a defect in the previous user behavior.",
|
|
843
|
+
"implementationStatus": "Implementation status",
|
|
844
|
+
"record": "Original record",
|
|
845
|
+
"completionLimit": "Final verification and deployment are not established by this report",
|
|
846
|
+
"languageFallback": "Fixed labels use English; authored prose retains its original language:",
|
|
847
|
+
"comparedStates": "Preserved before and after states",
|
|
848
|
+
"comparisonBasis": "This compares preserved working files at the actual start with the target files. Preexisting uncommitted changes belong to the before state. Commit identities alone do not establish this implementation's contribution or authorship.",
|
|
849
|
+
"before": "Before",
|
|
850
|
+
"after": "After",
|
|
851
|
+
"captureStatus": "Capture status",
|
|
852
|
+
"capturedAt": "Observed at",
|
|
853
|
+
"baselineCommit": "Baseline commit",
|
|
854
|
+
"generation": "Target generation",
|
|
855
|
+
"preservedRecord": "Preserved record and identity",
|
|
856
|
+
"noBaseline": "No preserved baseline; previous behavior cannot be established",
|
|
857
|
+
"noTarget": "No preserved target source",
|
|
858
|
+
"search": "Search scenarios, claims, evidence, files and limits",
|
|
859
|
+
"affected": "Affected audience or surface",
|
|
860
|
+
"supportLabel": "Support level",
|
|
861
|
+
"originLabel": "Evidence origin",
|
|
862
|
+
"stage": "Stage",
|
|
863
|
+
"all": "All",
|
|
864
|
+
"reset": "Reset filters",
|
|
865
|
+
"matchCount": "Showing {visible} of {total} items",
|
|
866
|
+
"noScript": "All content and evidence are available without JavaScript. Search and filters require JavaScript.",
|
|
867
|
+
"scenario": "Scenario",
|
|
868
|
+
"input": "Input and preconditions",
|
|
869
|
+
"requirements": "Requirements",
|
|
870
|
+
"useCases": "Use cases",
|
|
871
|
+
"cause": "Previous cause",
|
|
872
|
+
"principle": "Changed processing",
|
|
873
|
+
"impact": "Resulting effect",
|
|
874
|
+
"noClaim": "No claim was recorded",
|
|
875
|
+
"noEvidence": "No evidence reference was recorded",
|
|
876
|
+
"noChanges": "No change explanations were recorded",
|
|
877
|
+
"noMatches": "No items match the search conditions",
|
|
878
|
+
"evidenceLimit": "Origin and support are separate. Existing verification does not independently establish every causal explanation.",
|
|
879
|
+
"exitCode": "Exit code",
|
|
880
|
+
"targetBound": "This record is bound to the target source",
|
|
881
|
+
"targetUnbound": "This record is not bound to the target source",
|
|
882
|
+
"unexplained": "Unexplained file changes",
|
|
883
|
+
"unobserved": "Declared changes not observed",
|
|
884
|
+
"excluded": "Excluded paths",
|
|
885
|
+
"noneRecorded": "None recorded",
|
|
886
|
+
"fileChanges": "Observed file identities",
|
|
887
|
+
"path": "Path",
|
|
888
|
+
"change": "Observed change",
|
|
889
|
+
"contentIdentity": "Content SHA-256",
|
|
890
|
+
"notCaptured": "Not captured",
|
|
891
|
+
"origins": {
|
|
892
|
+
"source-inspected": "Source inspection",
|
|
893
|
+
"agent-recorded": "Session record",
|
|
894
|
+
"runner-observed": "Runner observation",
|
|
895
|
+
"mixed": "Evidence from multiple origins",
|
|
896
|
+
"expected": "Expectation",
|
|
897
|
+
"existing-document": "Existing document"
|
|
898
|
+
},
|
|
899
|
+
"supports": {
|
|
900
|
+
"supported": "Supported",
|
|
901
|
+
"partial": "Partially supported",
|
|
902
|
+
"unverified": "Unverified",
|
|
903
|
+
"conflict": "Conflicting"
|
|
904
|
+
},
|
|
905
|
+
"reportStatuses": {
|
|
906
|
+
"ready": "Report ready",
|
|
907
|
+
"partial": "Partial report",
|
|
908
|
+
"stale": "Inputs changed; regenerate",
|
|
909
|
+
"not-generated": "Not generated"
|
|
910
|
+
},
|
|
911
|
+
"captureStatuses": {
|
|
912
|
+
"complete": "Complete",
|
|
913
|
+
"partial": "Partial",
|
|
914
|
+
"unavailable": "Unavailable"
|
|
915
|
+
},
|
|
916
|
+
"sides": {
|
|
917
|
+
"before": "Before source",
|
|
918
|
+
"after": "After source"
|
|
919
|
+
},
|
|
920
|
+
"fileStatuses": {
|
|
921
|
+
"added": "Added",
|
|
922
|
+
"removed": "Removed",
|
|
923
|
+
"modified": "Modified",
|
|
924
|
+
"unchanged": "Unchanged",
|
|
925
|
+
"unknown": "Unknown"
|
|
926
|
+
},
|
|
927
|
+
"wholeTask": "Whole task",
|
|
928
|
+
"stageOverview": "Stage comparisons",
|
|
929
|
+
"stageBeforeContext": "A later stage may already include earlier changes in its before state. Stage effects and changed lines are not added together.",
|
|
930
|
+
"cumulativeProven": "One preserved target contains every selected stage.",
|
|
931
|
+
"cumulativeUnproven": "A single cumulative target is not established. Review the separate stage states and union of observed paths.",
|
|
932
|
+
"stageState": "Stored lifecycle state",
|
|
933
|
+
"stageReport": "Original stage report",
|
|
934
|
+
"pendingStage": "No valid completed comparison is selected for this stage.",
|
|
935
|
+
"detailsUnavailable": "A source report is selected, but comparison details are unavailable.",
|
|
936
|
+
"originalSource": "Original record",
|
|
937
|
+
"reconstruction": "Content reconstructed from a recorded commit; the original uncommitted state is unknown.",
|
|
938
|
+
"storedImplementationStatus": "Stored implementation status"
|
|
826
939
|
}
|
|
827
940
|
}
|
|
@@ -823,5 +823,118 @@
|
|
|
823
823
|
"revision": "정본 확정본",
|
|
824
824
|
"draft": "아직 초안입니다. 사용자가 완료를 확인하지 않았습니다."
|
|
825
825
|
}
|
|
826
|
+
},
|
|
827
|
+
"comparison": {
|
|
828
|
+
"title": "구현 전후 비교",
|
|
829
|
+
"skip": "비교 본문으로 이동",
|
|
830
|
+
"contents": "목차",
|
|
831
|
+
"changes": "시나리오별 전후 비교",
|
|
832
|
+
"evidence": "확인 근거",
|
|
833
|
+
"coverage": "변경 설명 범위",
|
|
834
|
+
"limitations": "한계와 남은 일",
|
|
835
|
+
"reportStatusLabel": "비교 보고서",
|
|
836
|
+
"generatedAt": "생성 시각",
|
|
837
|
+
"inputDigest": "보고서 입력 SHA-256",
|
|
838
|
+
"recordStep": "기록 단계",
|
|
839
|
+
"recordType": "기록된 검사 종류",
|
|
840
|
+
"recordedAt": "기록 시각",
|
|
841
|
+
"failureCause": "기록된 실패 원인",
|
|
842
|
+
"redLimit": "RED는 개발 중 구현 부재를 기록하며 기존 사용자 동작의 결함을 입증하지 않습니다.",
|
|
843
|
+
"implementationStatus": "구현 상태",
|
|
844
|
+
"record": "원본 기록",
|
|
845
|
+
"completionLimit": "이 보고서는 최종 검증이나 배포 완료를 입증하지 않습니다",
|
|
846
|
+
"languageFallback": "고정 문구는 영어로 표시하고 본문은 원래 언어를 유지합니다:",
|
|
847
|
+
"comparedStates": "보존된 이전·이후 상태",
|
|
848
|
+
"comparisonBasis": "보존한 실제 시작 작업 파일과 종료 파일을 비교합니다. 구현 전에 있던 미커밋 변경은 이전 상태에 포함합니다. 커밋 신원만으로 이번 구현의 성과나 작성자를 단정하지 않습니다.",
|
|
849
|
+
"before": "이전",
|
|
850
|
+
"after": "이후",
|
|
851
|
+
"captureStatus": "수집 상태",
|
|
852
|
+
"capturedAt": "관찰 시점",
|
|
853
|
+
"baselineCommit": "기준 커밋",
|
|
854
|
+
"generation": "종료 대상 세대",
|
|
855
|
+
"preservedRecord": "보존 기록과 내용 식별자",
|
|
856
|
+
"noBaseline": "보존된 변경 전 기준이 없어 이전 동작을 확인할 수 없습니다",
|
|
857
|
+
"noTarget": "보존된 종료 소스가 없습니다",
|
|
858
|
+
"search": "시나리오·주장·근거·파일·한계 검색",
|
|
859
|
+
"affected": "영향 대상",
|
|
860
|
+
"supportLabel": "확인 수준",
|
|
861
|
+
"originLabel": "근거 출처",
|
|
862
|
+
"stage": "단계",
|
|
863
|
+
"all": "전체",
|
|
864
|
+
"reset": "필터 초기화",
|
|
865
|
+
"matchCount": "전체 {total}개 중 {visible}개 표시",
|
|
866
|
+
"noScript": "자바스크립트 없이도 본문과 상세 근거를 읽을 수 있습니다. 검색·필터에는 자바스크립트가 필요합니다.",
|
|
867
|
+
"scenario": "시나리오",
|
|
868
|
+
"input": "입력과 사전 조건",
|
|
869
|
+
"requirements": "요구사항",
|
|
870
|
+
"useCases": "사용 사례",
|
|
871
|
+
"cause": "기존 원인",
|
|
872
|
+
"principle": "수정한 처리",
|
|
873
|
+
"impact": "결과 영향",
|
|
874
|
+
"noClaim": "작성된 주장이 없습니다",
|
|
875
|
+
"noEvidence": "연결된 근거가 없습니다",
|
|
876
|
+
"noChanges": "작성된 변경 설명이 없습니다",
|
|
877
|
+
"noMatches": "검색 조건에 맞는 항목이 없습니다",
|
|
878
|
+
"evidenceLimit": "출처와 확인 수준은 별개입니다. 기존 검증이 모든 인과 설명의 독립 검토를 입증하지는 않습니다.",
|
|
879
|
+
"exitCode": "종료 코드",
|
|
880
|
+
"targetBound": "종료 대상 소스와 결합된 기록입니다",
|
|
881
|
+
"targetUnbound": "종료 대상 소스와 결합되지 않은 기록입니다",
|
|
882
|
+
"unexplained": "미설명 파일 변경",
|
|
883
|
+
"unobserved": "선언했지만 관찰하지 못한 변경",
|
|
884
|
+
"excluded": "제외한 경로",
|
|
885
|
+
"noneRecorded": "기록 없음",
|
|
886
|
+
"fileChanges": "관찰한 파일 내용 식별자",
|
|
887
|
+
"path": "경로",
|
|
888
|
+
"change": "관찰한 변경",
|
|
889
|
+
"contentIdentity": "내용 SHA-256",
|
|
890
|
+
"notCaptured": "수집하지 않음",
|
|
891
|
+
"origins": {
|
|
892
|
+
"source-inspected": "소스 확인",
|
|
893
|
+
"agent-recorded": "세션 기록",
|
|
894
|
+
"runner-observed": "실행기 관측",
|
|
895
|
+
"mixed": "여러 출처의 근거",
|
|
896
|
+
"expected": "예상",
|
|
897
|
+
"existing-document": "기존 문서"
|
|
898
|
+
},
|
|
899
|
+
"supports": {
|
|
900
|
+
"supported": "뒷받침됨",
|
|
901
|
+
"partial": "일부 확인",
|
|
902
|
+
"unverified": "미확인",
|
|
903
|
+
"conflict": "충돌"
|
|
904
|
+
},
|
|
905
|
+
"reportStatuses": {
|
|
906
|
+
"ready": "보고서 준비됨",
|
|
907
|
+
"partial": "부분 보고서",
|
|
908
|
+
"stale": "입력 변경됨: 다시 생성 필요",
|
|
909
|
+
"not-generated": "미생성"
|
|
910
|
+
},
|
|
911
|
+
"captureStatuses": {
|
|
912
|
+
"complete": "완전 수집",
|
|
913
|
+
"partial": "일부 수집",
|
|
914
|
+
"unavailable": "수집 불가"
|
|
915
|
+
},
|
|
916
|
+
"sides": {
|
|
917
|
+
"before": "변경 전 소스",
|
|
918
|
+
"after": "변경 후 소스"
|
|
919
|
+
},
|
|
920
|
+
"fileStatuses": {
|
|
921
|
+
"added": "추가",
|
|
922
|
+
"removed": "삭제",
|
|
923
|
+
"modified": "수정",
|
|
924
|
+
"unchanged": "동일",
|
|
925
|
+
"unknown": "확인 불가"
|
|
926
|
+
},
|
|
927
|
+
"wholeTask": "작업 전체",
|
|
928
|
+
"stageOverview": "단계별 전후 비교",
|
|
929
|
+
"stageBeforeContext": "후행 단계의 이전 상태에는 선행 변경이 포함될 수 있습니다. 단계별 효과와 변경 줄 수를 합산하지 않습니다.",
|
|
930
|
+
"cumulativeProven": "선택된 모든 단계를 포함하는 보존 대상을 확인했습니다.",
|
|
931
|
+
"cumulativeUnproven": "하나의 누적 종료 대상을 확인하지 못했습니다. 단계별 상태와 관찰한 경로의 합집합을 확인하세요.",
|
|
932
|
+
"stageState": "저장된 진행 상태",
|
|
933
|
+
"stageReport": "단계의 원본 보고서",
|
|
934
|
+
"pendingStage": "이 단계에서 유효한 완료 비교를 선택하지 못했습니다.",
|
|
935
|
+
"detailsUnavailable": "원본 보고서를 선택했지만 비교 상세 내용은 표시할 수 없습니다.",
|
|
936
|
+
"originalSource": "원본 기록",
|
|
937
|
+
"reconstruction": "기록된 커밋에서 내용을 사후 복원했습니다. 당시 미커밋 상태는 확인하지 못했습니다.",
|
|
938
|
+
"storedImplementationStatus": "저장된 구현 상태"
|
|
826
939
|
}
|
|
827
940
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{% macro claim(label, value) -%}
|
|
2
|
+
<div class="comparison-claim" data-origin="{{ value.origin }}" data-support="{{ value.support }}">
|
|
3
|
+
<h4>{{ label }}</h4>
|
|
4
|
+
<dl class="claim-level"><div><dt>{{ labels.originLabel }}</dt><dd>{{ labels.origins[value.origin] }}</dd></div><div><dt>{{ labels.supportLabel }}</dt><dd>{{ labels.supports[value.support] }}</dd></div></dl>
|
|
5
|
+
<div lang="{{ data.source.language }}">{% if value.text %}{{ value.text | paragraphs }}{% else %}<p>{{ labels.noClaim }}</p>{% endif %}</div>
|
|
6
|
+
<ul class="claim-refs" aria-label="{{ labels.evidence }}">{% for ref in value.evidence %}{% set record = evidence_by_id[ref] %}<li><a href="#{{ evidence_anchors[ref] }}">{% if record.get('stage') %}{{ labels.stage }} {{ record.stage }} · {% endif %}{{ record.path ~ ':' ~ record.startLine if record.kind == 'source' else record.get('label') or labels.record }}</a></li>{% else %}<li>{{ labels.noEvidence }}</li>{% endfor %}</ul>
|
|
7
|
+
</div>
|
|
8
|
+
{%- endmacro %}
|
|
9
|
+
<!DOCTYPE html>
|
|
10
|
+
<html lang="{{ language }}">
|
|
11
|
+
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>{{ data.source.title }} · {{ labels.title }}</title><style>{{ css | safe }}</style></head>
|
|
12
|
+
<body>
|
|
13
|
+
<a class="skip-link" href="#comparison-content">{{ labels.skip }}</a>
|
|
14
|
+
<header class="human-report-header"><p class="eyebrow">{{ labels.title }}</p><h1 lang="{{ data.source.language }}">{{ data.source.title }}</h1>
|
|
15
|
+
{% if data.source.get('summary') %}<div class="lede" lang="{{ data.source.language }}">{{ data.source.summary | paragraphs }}</div>{% endif %}
|
|
16
|
+
<dl class="report-meta"><div><dt>{{ labels.reportStatusLabel }}</dt><dd data-report-status="{{ data.status }}">{{ labels.reportStatuses[data.status] }}</dd></div><div><dt>{{ labels.storedImplementationStatus if data.source.kind == "task" else labels.implementationStatus }}</dt><dd data-implementation-status="{{ data.source.status }}"><code>{{ data.source.status }}</code></dd></div><div><dt>{{ labels.record }}</dt><dd><code>{{ data.source.path }}</code></dd></div></dl>
|
|
17
|
+
{% if data.get('generatedAt') %}<p>{{ labels.generatedAt }} <time datetime="{{ data.generatedAt }}">{{ data.generatedAt }}</time></p>{% endif %}
|
|
18
|
+
{% if data.get('inputDigest') %}<details class="report-section-toggle"><summary>{{ labels.inputDigest }}</summary><p><code>{{ data.inputDigest }}</code></p></details>{% endif %}
|
|
19
|
+
<details class="report-section-toggle"><summary>{{ labels.record }} SHA-256</summary><p><code>{{ data.source.digest }}</code></p></details>
|
|
20
|
+
<p>{{ labels.completionLimit }}</p>
|
|
21
|
+
{% if data.source.language != language %}<p>{{ labels.languageFallback }} <code>{{ data.source.language }}</code></p>{% endif %}
|
|
22
|
+
<nav aria-label="{{ labels.contents }}"><a href="#changes">{{ labels.changes }}</a> · <a href="#evidence">{{ labels.evidence }}</a> · <a href="#coverage">{{ labels.coverage }}</a> · <a href="#limitations">{{ labels.limitations }}</a></nav>
|
|
23
|
+
</header>
|
|
24
|
+
<main id="comparison-content" class="comparison-report">
|
|
25
|
+
<section><details class="report-section-toggle"><summary><h2>{{ labels.comparedStates }}</h2></summary>
|
|
26
|
+
{% if data.status == 'stale' %}<p role="status">{{ labels.reportStatuses.stale }}</p>
|
|
27
|
+
{% else %}<p>{{ labels.comparisonBasis }}</p><div class="comparison-pair">
|
|
28
|
+
{% for name, snapshot in ((labels.before, data.baseline), (labels.after, data.target)) %}<article><h3>{{ name }}</h3><dl><dt>{{ labels.captureStatus }}</dt><dd>{{ labels.captureStatuses[snapshot.status] }}</dd>{% if snapshot.get('capturedAt') %}<dt>{{ labels.capturedAt }}</dt><dd><time>{{ snapshot.capturedAt }}</time></dd>{% endif %}{% if snapshot.get('head') %}<dt>HEAD</dt><dd><code>{{ snapshot.head }}</code></dd>{% endif %}{% if loop.first and snapshot.get('baselineCommit') %}<dt>{{ labels.baselineCommit }}</dt><dd><code>{{ snapshot.baselineCommit }}</code></dd>{% endif %}{% if snapshot.get('generation') %}<dt>{{ labels.generation }}</dt><dd><code>{{ snapshot.generation }}</code></dd>{% endif %}</dl>
|
|
29
|
+
{% if snapshot.get("reconstruction") %}<p>{{ labels.reconstruction }}</p>{% endif %}
|
|
30
|
+
{% if snapshot.ref %}<details open><summary>{{ labels.preservedRecord }}</summary><p><code>{{ snapshot.ref.path }}</code></p><p>SHA-256 <code>{{ snapshot.ref.digest }}</code></p></details>{% else %}<p>{{ labels.noBaseline if loop.first else labels.noTarget }}</p>{% endif %}
|
|
31
|
+
{% for limitation in snapshot.limitations %}<p class="comparison-limit" lang="{{ data.source.language }}">{{ limitation }}</p>{% endfor %}</article>{% endfor %}
|
|
32
|
+
</div>{% endif %}</details></section>
|
|
33
|
+
{% if data.get('stageCards') is not none %}
|
|
34
|
+
<section id="stage-comparisons"><h2>{{ labels.stageOverview }}</h2><p>{{ labels.stageBeforeContext }}</p>
|
|
35
|
+
<p>{{ labels.cumulativeProven if data.get('integration', {}).get('status') == 'proven' else labels.cumulativeUnproven }}</p>
|
|
36
|
+
{% for card in data.stageCards %}<article class="summary-card" data-stage-card data-search-item data-stages="{{ [card.stage] | tojson | forceescape }}">
|
|
37
|
+
<h3>{{ labels.stage }} {{ card.stage }}</h3><dl><dt>{{ labels.stageState }}</dt><dd><code>{{ card.lifecycle }}</code></dd><dt>{{ labels.reportStatusLabel }}</dt><dd>{{ labels.reportStatuses[card.status] }}</dd></dl>
|
|
38
|
+
{% if card.source %}<div class="comparison-pair">{% for name, snapshot in ((labels.before, card.baseline), (labels.after, card.target)) %}<div><h4>{{ name }}</h4><p>{{ labels.captureStatuses[snapshot.status] }}</p>{% if snapshot.get('head') %}<p>HEAD <code>{{ snapshot.head }}</code></p>{% endif %}{% if snapshot.get('reconstruction') %}<p>{{ labels.reconstruction }}</p>{% endif %}{% for text in snapshot.limitations %}<p>{{ text }}</p>{% endfor %}</div>{% endfor %}</div>
|
|
39
|
+
<details><summary>{{ labels.stageReport }}</summary><p><code>{{ card.reportPath }}</code></p><p>SHA-256 <code>{{ card.source.digest }}</code></p><p><code>{{ card.runManifestPath }}</code></p></details>
|
|
40
|
+
<ul>{% for ref in card.changeIds %}<li><a href="#{{ change_anchors[ref] }}">{{ changes_by_id[ref].title }}</a></li>{% endfor %}</ul>
|
|
41
|
+
{% else %}<p>{{ labels.detailsUnavailable if card.reportPath else labels.pendingStage }}</p>{% endif %}
|
|
42
|
+
{% if card.limitations %}<details><summary>{{ labels.limitations }}</summary><ul>{% for text in card.limitations %}<li>{{ text }}</li>{% endfor %}</ul></details>{% endif %}
|
|
43
|
+
{% if card.get("coverage", {}).get("unexplained") %}<details><summary>{{ labels.unexplained }}</summary><ul>{% for path in card.coverage.unexplained %}<li><code>{{ path }}</code></li>{% endfor %}</ul></details>{% endif %}
|
|
44
|
+
</article>{% endfor %}</section>
|
|
45
|
+
{% endif %}
|
|
46
|
+
<section id="changes"><h2>{{ labels.changes }}</h2>
|
|
47
|
+
<form class="comparison-controls" hidden role="search" aria-label="{{ labels.search }}">
|
|
48
|
+
<label for="comparison-search">{{ labels.search }}<input id="comparison-search" type="search" autocomplete="off"></label>
|
|
49
|
+
<label for="comparison-affected">{{ labels.affected }}<select id="comparison-affected"><option value="">{{ labels.all }}</option>{% for value in affected %}<option>{{ value }}</option>{% endfor %}</select></label>
|
|
50
|
+
<label for="comparison-support">{{ labels.supportLabel }}<select id="comparison-support"><option value="">{{ labels.all }}</option>{% for value, label in labels.supports.items() %}<option value="{{ value }}">{{ label }}</option>{% endfor %}</select></label>
|
|
51
|
+
<label for="comparison-stage">{{ labels.stage }}<select id="comparison-stage"><option value="">{{ labels.all }}</option>{% for value in stages %}<option>{{ value }}</option>{% endfor %}</select></label>
|
|
52
|
+
<button type="reset">{{ labels.reset }}</button><output aria-live="polite" data-count-format="{{ labels.matchCount }}"></output>
|
|
53
|
+
</form><noscript><p>{{ labels.noScript }}</p></noscript>
|
|
54
|
+
{% for row in data.changes %}<article id="{{ change_anchors[row.id] }}" class="comparison-change summary-card" data-search-item data-change data-change-id="{{ row.id }}" data-affected="{{ row.affected | tojson | forceescape }}" data-stages="{{ ([row.stage] if row.get('stage') else row.stages) | tojson | forceescape }}">
|
|
55
|
+
<h3 lang="{{ data.source.language }}">{{ row.title }}</h3><dl class="comparison-context"><dt>{{ labels.scenario }}</dt><dd lang="{{ data.source.language }}">{{ row.scenario }}</dd><dt>{{ labels.input }}</dt><dd lang="{{ data.source.language }}">{{ row.input }}</dd>{% for label, values in ((labels.affected, row.affected), (labels.requirements, row.requirements), (labels.useCases, row.useCases), (labels.stage, row.stages)) if values %}<dt>{{ label }}</dt><dd>{{ values | join(', ') }}</dd>{% endfor %}</dl>
|
|
56
|
+
<div class="comparison-pair">{{ claim(labels.before, row.before) }}{{ claim(labels.after, row.after) }}</div>
|
|
57
|
+
{{ claim(labels.cause, row.cause) }}{{ claim(labels.principle, row.principle) }}{{ claim(labels.impact, row.impact) }}
|
|
58
|
+
{% if row.limitations %}<h4>{{ labels.limitations }}</h4><ul lang="{{ data.source.language }}">{% for text in row.limitations %}<li>{{ text }}</li>{% endfor %}</ul>{% endif %}
|
|
59
|
+
</article>{% else %}<p>{{ labels.noChanges }}</p>{% endfor %}
|
|
60
|
+
<p class="comparison-no-matches" hidden>{{ labels.noMatches }}</p>
|
|
61
|
+
</section>
|
|
62
|
+
<section id="evidence"><h2>{{ labels.evidence }}</h2><p>{{ labels.evidenceLimit }}</p>
|
|
63
|
+
{% for row in data.evidence %}<article id="{{ evidence_anchors[row.id] }}" class="comparison-evidence" data-search-item data-evidence data-evidence-id="{{ row.id }}"{% if row.get('stage') %} data-stages="{{ [row.stage] | tojson | forceescape }}"{% endif %}><details open><summary>{{ row.path if row.kind == 'source' else row.get('label') or labels.record }} · {{ labels.origins[row.origin] }}</summary>
|
|
64
|
+
{% if row.kind == 'source' %}<p>{{ labels.sides[row.side] }} · <code>{{ row.path }}:{{ row.startLine }}–{{ row.endLine }}</code></p><p>SHA-256 <code>{{ row.digest or labels.notCaptured }}</code></p><pre><code>{{ row.excerpt }}</code></pre>
|
|
65
|
+
{% else %}<dl>{% for label, key in ((labels.recordStep, 'step'), (labels.recordType, 'recordType'), (labels.recordedAt, 'recordedAt'), (labels.failureCause, 'failureCause')) if row.get(key) %}<dt>{{ label }}</dt><dd><code>{{ row[key] }}</code></dd>{% endfor %}</dl>
|
|
66
|
+
{% if row.get('recordPath') %}<p>{{ labels.originalSource }} <code>{{ row.recordPath }}</code></p><p>SHA-256 <code>{{ row.recordDigest }}</code></p>{% endif %}
|
|
67
|
+
{% if row.get('command') %}<pre><code>{{ row.command }}</code></pre>{% endif %}{% if row.get('exitCode') is not none %}<p>{{ labels.exitCode }} <code>{{ row.exitCode }}</code></p>{% endif %}{% if row.get('summary') %}<div lang="{{ data.source.language }}">{{ row.summary | paragraphs }}</div>{% endif %}{% if row.kind != 'document' %}<p>{{ labels.targetBound if row.get('targetBound') else labels.targetUnbound }}</p>{% endif %}{% if row.get('step') == 'tests-red' %}<p>{{ labels.redLimit }}</p>{% endif %}{% endif %}
|
|
68
|
+
{% if row.limitations %}<ul lang="{{ data.source.language }}">{% for text in row.limitations %}<li>{{ text }}</li>{% endfor %}</ul>{% endif %}
|
|
69
|
+
</details></article>{% else %}<p>{{ labels.noEvidence }}</p>{% endfor %}
|
|
70
|
+
</section>
|
|
71
|
+
<section id="coverage"><h2>{{ labels.coverage }}</h2><h3>{{ labels.unexplained }}</h3><ul>{% for path in data.coverage.unexplained %}<li data-search-item><code>{{ path }}</code></li>{% else %}<li>{{ labels.noneRecorded }}</li>{% endfor %}</ul>
|
|
72
|
+
<h3>{{ labels.unobserved }}</h3><ul>{% for ref in data.coverage.unobserved %}<li data-search-item>{% if ref in changes_by_id %}<a href="#{{ change_anchors[ref] }}">{{ changes_by_id[ref].title }}</a>{% else %}<code>{{ ref }}</code>{% endif %}</li>{% else %}<li>{{ labels.noneRecorded }}</li>{% endfor %}</ul>
|
|
73
|
+
<details open><summary>{{ labels.fileChanges }}</summary><table class="comparison-files"><thead><tr><th>{{ labels.path }}</th><th>{{ labels.change }}</th><th>{{ labels.contentIdentity }}</th></tr></thead><tbody>{% for row in data.coverage.files %}<tr data-search-item><td data-label="{{ labels.path }}"><code>{{ row.path }}</code> · {{ row.kind }}</td><td data-label="{{ labels.change }}">{{ labels.fileStatuses[row.change] }}</td><td data-label="{{ labels.contentIdentity }}"><dl><dt>{{ labels.before }}</dt><dd><code>{{ row.beforeDigest or labels.notCaptured }}</code></dd><dt>{{ labels.after }}</dt><dd><code>{{ row.afterDigest or labels.notCaptured }}</code></dd></dl></td></tr>{% endfor %}</tbody></table></details>
|
|
74
|
+
<h3>{{ labels.excluded }}</h3><ul>{% for path in data.coverage.excluded %}<li data-search-item><code>{{ path }}</code></li>{% else %}<li>{{ labels.noneRecorded }}</li>{% endfor %}</ul>
|
|
75
|
+
</section>
|
|
76
|
+
<section id="limitations"><h2>{{ labels.limitations }}</h2><ul lang="{{ data.source.language }}">{% for text in data.limitations %}<li data-search-item>{{ text }}</li>{% else %}<li>{{ labels.noneRecorded }}</li>{% endfor %}</ul></section>
|
|
77
|
+
</main><script>{{ js | safe }}</script></body></html>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Implementation comparison notes
|
|
2
|
+
|
|
3
|
+
Read the baseline and target references supplied by the saved completion or
|
|
4
|
+
synthesis packet. If `notesPath` is null or missing for a trace, refresh the
|
|
5
|
+
same attempt with `okstra trace status --path <trace-path>`. Use the returned
|
|
6
|
+
path only when that response supplies one. If the bridge remains unavailable,
|
|
7
|
+
leave notes unwritten and tell the user that comparison reporting is unavailable,
|
|
8
|
+
including the capture limitations, saved implementation and task synchronization
|
|
9
|
+
status, and report recovery command. A trace path or comparison directory is not
|
|
10
|
+
permission to invent a notes path.
|
|
11
|
+
|
|
12
|
+
When a `notesPath` is supplied, write only that path. A null baseline or target
|
|
13
|
+
reference with an available notes path permits a partial report: preserve the
|
|
14
|
+
null reference and explain which source was not captured. Reuse the original
|
|
15
|
+
implementation explanation and evidence; preserve the saved integration instead
|
|
16
|
+
of advancing it again or collecting a replacement target.
|
|
17
|
+
|
|
18
|
+
Use this shape with the supplied owner and exact references. Keep a missing
|
|
19
|
+
reference `null`. This fictitious example is not evidence of a repository defect.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"schemaVersion": "1.0",
|
|
24
|
+
"owner": {"kind": "trace", "path": ".okstra/traces/example/attempt.md", "createdAt": "copy the supplied value"},
|
|
25
|
+
"baselineRef": {"path": "copy the supplied path", "digest": "copy the supplied digest"},
|
|
26
|
+
"targetRef": {"path": "copy the supplied path", "digest": "copy the supplied digest"},
|
|
27
|
+
"changes": [{
|
|
28
|
+
"id": "resume-request",
|
|
29
|
+
"title": "Resume a saved request",
|
|
30
|
+
"scenario": "A request is repeated after history synchronization fails",
|
|
31
|
+
"input": "The save succeeded and history synchronization failed",
|
|
32
|
+
"affected": ["Command users"],
|
|
33
|
+
"requirements": [], "useCases": [], "stages": [],
|
|
34
|
+
"limitations": ["An external outage was not reproduced"],
|
|
35
|
+
"before": {"text": "Describe the preserved previous handling, or why it is unknown", "evidence": []},
|
|
36
|
+
"after": {"text": "Describe the observed ending behavior and its limits", "evidence": []},
|
|
37
|
+
"cause": {"text": "Connect the triggering condition to the previous handling", "evidence": []},
|
|
38
|
+
"principle": {"text": "Explain which changed processing alters that outcome", "evidence": []},
|
|
39
|
+
"impact": {"text": "State the supported result and distinguish an unmeasured expectation", "evidence": []}
|
|
40
|
+
}]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Each claim has nonempty explanatory text and its own evidence references. When
|
|
45
|
+
evidence is absent, explain the limitation; an empty list remains unverified.
|
|
46
|
+
Use either of these reference shapes:
|
|
47
|
+
|
|
48
|
+
- Preserved source: `{"side":"before","path":"src/request.ts","startLine":12,"endLine":20}`.
|
|
49
|
+
Use `after` for ending source. Paths and line numbers belong to the preserved
|
|
50
|
+
inventory and content, not the current working file. Cite the necessary
|
|
51
|
+
excerpt, at most 80 lines; the report displays at most 8 KiB per excerpt.
|
|
52
|
+
- Original record: `{"recordId":"trace:integration:1"}`. Trace IDs use the saved
|
|
53
|
+
step and one-based position in its evidence list. Run records use the IDs in
|
|
54
|
+
the normalized original or synthesis packet; do not guess them.
|
|
55
|
+
|
|
56
|
+
Link requirements, use cases and stages only when they exist in the original.
|
|
57
|
+
`affected` describes the audience or surface. Changed files are derived from
|
|
58
|
+
preserved content and source references; an affected label does not prove a file
|
|
59
|
+
changed. Unlinked changes remain visible as unexplained changes.
|
|
60
|
+
|
|
61
|
+
Do not author hashes, command results, evidence origins, target attribution or
|
|
62
|
+
support grades in claims. The assembler resolves those facts from their owners.
|
|
63
|
+
Trace commands remain session records. RED records missing implementation during
|
|
64
|
+
development, rather than proving a previous user-facing defect. Source inspection
|
|
65
|
+
does not prove runtime behavior; existing independent verification does not
|
|
66
|
+
establish every causal explanation. Identify unmeasured improvements as expected.
|
|
67
|
+
|
|
68
|
+
`implementation_comparison/assembly.py` enforces identity, exact claim fields,
|
|
69
|
+
reference shapes and bounds, checked by
|
|
70
|
+
`tests/report/test_implementation_comparison.py`. Notes are limited to 1 MiB,
|
|
71
|
+
200 changes and 1,000 links per list. Missing or invalid notes produce a partial
|
|
72
|
+
report and do not replace the original implementation result.
|
|
@@ -53,13 +53,9 @@ from okstra_ctl.report_views import ( # noqa: E402
|
|
|
53
53
|
from okstra_ctl.report_view_artifacts import html_view_path # noqa: E402
|
|
54
54
|
from okstra_ctl.final_report_paths import final_report_data_path # noqa: E402
|
|
55
55
|
from okstra_ctl.report_contract import required_human_fields_for_report # noqa: E402
|
|
56
|
+
from okstra_ctl.report_html.validation import dead_in_page_links, external_resource_errors # noqa: E402
|
|
56
57
|
|
|
57
58
|
|
|
58
|
-
_EXTERNAL_URL_RE = re.compile(
|
|
59
|
-
r'<(?:script|link|img|iframe|source|video|audio)\s[^>]*?(?:src|href)\s*=\s*["\']https?://',
|
|
60
|
-
re.IGNORECASE,
|
|
61
|
-
)
|
|
62
|
-
|
|
63
59
|
_RESPONSE_ID_ATTR_RE = re.compile(r'data-response-id="(C-\d+)"')
|
|
64
60
|
_ANALYSIS_REVIEW_SECTION_RE = re.compile(
|
|
65
61
|
r'<section id="analysis-review">(?P<body>.*?)</section>', re.DOTALL
|
|
@@ -133,38 +129,11 @@ def _validate_v2(report_path: Path, data_path: Path, data: dict) -> list[str]:
|
|
|
133
129
|
failures.append(
|
|
134
130
|
f"Response ID mismatch: data.json has {data_ids}, HTML has {html_ids}"
|
|
135
131
|
)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
failures.extend(_dead_in_page_links(html_text))
|
|
132
|
+
failures.extend(external_resource_errors(html_text))
|
|
133
|
+
failures.extend(dead_in_page_links(html_text))
|
|
139
134
|
return failures
|
|
140
135
|
|
|
141
136
|
|
|
142
|
-
_ANCHOR_HREF_RE = re.compile(r'href="#([^"]+)"')
|
|
143
|
-
_ELEMENT_ID_RE = re.compile(r'\bid="([^"]+)"')
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def _dead_in_page_links(html_text: str) -> list[str]:
|
|
147
|
-
"""(7) every in-page link lands on an element of this page.
|
|
148
|
-
|
|
149
|
-
The renderer links every id the record defines (`report_html/common.py`
|
|
150
|
-
`anchor_index`); a link to a missing anchor means the index claimed a row
|
|
151
|
-
the template never drew — 2026-09-05 audit of 28 shipped reports found
|
|
152
|
-
`A-`, `UQ-`, `PI-` and `IC-` links dead this way. The cause is always
|
|
153
|
-
renderer-side, so the finding stays with the page, not the author.
|
|
154
|
-
"""
|
|
155
|
-
body = html_text.split("<body", 1)[-1]
|
|
156
|
-
body = re.sub(r"<script.*?</script>|<style.*?</style>", "", body, flags=re.DOTALL)
|
|
157
|
-
ids = set(_ELEMENT_ID_RE.findall(body))
|
|
158
|
-
dead = sorted({target for target in _ANCHOR_HREF_RE.findall(body) if target not in ids})
|
|
159
|
-
if not dead:
|
|
160
|
-
return []
|
|
161
|
-
return [
|
|
162
|
-
"dead in-page link(s): "
|
|
163
|
-
+ ", ".join(f"#{target}" for target in dead[:12])
|
|
164
|
-
+ (f" (+{len(dead) - 12} more)" if len(dead) > 12 else "")
|
|
165
|
-
]
|
|
166
|
-
|
|
167
|
-
|
|
168
137
|
def _no_form_sections(html_body: str) -> list[str]:
|
|
169
138
|
"""Return a list of strings, each being the rendered chunk of a
|
|
170
139
|
no-form section (5.6 / 5.7 / 5.8) up to the next h2/h3. Used to
|
|
@@ -265,8 +234,7 @@ def validate(report_path: Path) -> list[str]:
|
|
|
265
234
|
break
|
|
266
235
|
|
|
267
236
|
# (4) no external URLs in <script src> / <link href> / etc.
|
|
268
|
-
|
|
269
|
-
failures.append("html contains external URL in script/link/img — must be self-contained")
|
|
237
|
+
failures.extend(external_resource_errors(html_text))
|
|
270
238
|
|
|
271
239
|
# (5) Response ID parity: HTML form rows ↔ §1 C-* rows in MD.
|
|
272
240
|
# Bidirectional — catches both "MD has C-* the HTML lost" AND
|