Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
92e120f
R06 runtime: define structured parallel witness answer DTO
Oleksii-debug Sep 29, 2026
c73d1ef
R06 runtime: preserve structured parallel witness provenance
Oleksii-debug Sep 29, 2026
6330176
R06 runtime: stop adapting parallel witness truth as choice
Oleksii-debug Sep 29, 2026
1c7d312
R06 runtime: grade parallel witness synthesis and witnesses separately
Oleksii-debug Sep 29, 2026
fa036d5
R06 UI: render structured parallel witness answers accessibly
Oleksii-debug Sep 29, 2026
d902fb4
R06 platform: stop projecting parallel witness truth as choice
Oleksii-debug Sep 29, 2026
3a22415
R06 tests: cover structured parallel witness contract provenance
Oleksii-debug Sep 29, 2026
7e4fe67
R06 tests: grade structured parallel witnesses fail closed
Oleksii-debug Sep 29, 2026
7b2d010
R06 platform tests: bind structured parallel answer descriptor
Oleksii-debug Sep 29, 2026
36c04db
R06 platform tests: prevent parallel witness truth leakage
Oleksii-debug Sep 29, 2026
6240e14
R06 accessibility: assert linear parallel witness renderer
Oleksii-debug Sep 29, 2026
a8275e9
R06 qualification: parse structured renderer in hosted Node gate
Oleksii-debug Sep 29, 2026
63fccc5
R06: reconverge structured parallel witness contract onto current pac…
Oleksii-debug Sep 29, 2026
689f8a4
R06 accessibility: treat parallel witness as structured text surface
Oleksii-debug Sep 29, 2026
05172db
R06 accessibility tests: qualify structured parallel witness surface
Oleksii-debug Sep 29, 2026
6a5aae7
R06 runtime: split legacy parallel choice from structured synthesis
Oleksii-debug Sep 29, 2026
02c2997
R06 runtime: provenance supports legacy and structured parallel modes
Oleksii-debug Sep 29, 2026
aff2e79
R06 runtime: preserve legacy parallel choice adapter
Oleksii-debug Sep 29, 2026
d11f58a
R06 runtime: keep legacy parallel choice grader and add synthesis grader
Oleksii-debug Sep 29, 2026
5627cf9
R06 UI: preserve legacy parallel choice and add synthesis renderer
Oleksii-debug Sep 29, 2026
c914106
R06 platform: derive structured parallel runtime type by authored shape
Oleksii-debug Sep 29, 2026
00667a5
R06 accessibility: qualify both parallel witness runtime surfaces
Oleksii-debug Sep 29, 2026
7701eb5
R06 runtime: expose structured parallel synthesis transport contract
Oleksii-debug Sep 29, 2026
39b508f
R06 tests: preserve legacy parallel choice while deriving D2 synthesis
Oleksii-debug Sep 29, 2026
95a7a7d
R06 tests: grade derived parallel witness synthesis type
Oleksii-debug Sep 29, 2026
c2aa3f1
R06 platform tests: preserve legacy and structured parallel contracts
Oleksii-debug Sep 29, 2026
a3a6339
R06 accessibility tests: require derived synthesis renderer registration
Oleksii-debug Sep 29, 2026
13fb32a
R06 platform tests: assert derived parallel synthesis presentation type
Oleksii-debug Sep 29, 2026
dec1bec
R06: omit empty legacy answer metadata from task surface
Oleksii-debug Sep 29, 2026
bbfa5c1
R06 platform: expose derived parallel synthesis answer fields
Oleksii-debug Sep 29, 2026
988544a
R06 cross-lane: prove legacy and D2 parallel witness semantics coexist
Oleksii-debug Sep 29, 2026
7f853f2
R06 platform: reuse runtime node-context task resolver
Oleksii-debug Sep 29, 2026
76176fc
R06 platform: bind presentation typing to runtime node resolver
Oleksii-debug Sep 29, 2026
8f0f617
R06: split structured witness input on real line breaks
Oleksii-debug Sep 29, 2026
e36e562
R06: separate authored and derived witness task taxonomy
Oleksii-debug Sep 29, 2026
aad7e46
R06: expose derived witness contract outside canonical task taxonomy
Oleksii-debug Sep 29, 2026
1d5638f
R06: regress canonical vs derived witness task taxonomy
Oleksii-debug Sep 29, 2026
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 lanes/dev1/repair_overlay/frontend/renderers-base.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"CLAIM_EVIDENCE",
"SPEAKER_RECIPIENT",
"PARALLEL_WITNESS_COMPARE",
"PARALLEL_WITNESS_SYNTHESIS",
"OT_NT_LINK",
"COMPOSITE_MULTI_STEP",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import Any
from scripture_archive_platform.domain.models import CONTENT_SCHEMA_VERSION
from scripture_archive_platform.transport.answer_contracts import canonical_task_type, answer_contract_descriptor
from scripture_archive_platform.transport.answer_contracts import canonical_node_task_type, canonical_task_type, answer_contract_descriptor
from scripture_archive_platform.composite_accessibility import inspect_packaged_task

class ContentLoadError(RuntimeError): pass
Expand Down Expand Up @@ -72,7 +72,7 @@ class TaskPresentationMapper:
)
def infer_task_type(self,node:dict[str,Any])->str:
explicit=node.get('task_type')
if explicit:return canonical_task_type(str(explicit))
if explicit:return canonical_node_task_type(node)
mode=(str(node.get('response_mode',''))+' '+str(node.get('task_family',''))).lower()
if 'speaker' in mode and 'recipient' in mode:return 'SPEAKER_RECIPIENT'
if 'parallel' in mode and 'witness' in mode:return 'PARALLEL_WITNESS_COMPARE'
Expand Down Expand Up @@ -201,10 +201,12 @@ def to_renderable(self,node:dict[str,Any],mission:dict[str,Any]|None=None)->dict
'source_references':self._source_refs(node,mission),'options':options,'items':items,'pairs':pairs,
'evidence_options':evidence_options,'steps':normalized_steps,'fields':list(ui.get('fields') or []),
'witnesses':list(ui.get('witnesses') or []),'relation_types':relation_types,
'answer_contract':answer_contract,'legacy_answer_contract':legacy_answer_contract,
'answer_contract':answer_contract,
'accessibility':{'nonvisual_equivalent':node.get('functional_nonvisual_equivalent',''),'announcements':'Result, evidence, confidence/TX1 and next action are textual.'},
'visual':dict(node.get('visual_metadata') or {'state_badge':node.get('confidence_code'),'media_slot':None}),
}
if legacy_answer_contract:
surface['legacy_answer_contract']=legacy_answer_contract
inspection=inspect_packaged_task(surface)
surface['accessibility']['inspection']=inspection.to_dict()
surface['accessibility']['inspection_linear']=list(inspection.linear())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from runtime_engine.scripture_archive_runtime.answer_contracts import (
ANSWER_CONTRACT_VERSION,
answer_contract_descriptor,
canonical_node_task_type,
canonical_task_type,
validate_answer_dto,
)
Expand All @@ -17,6 +18,6 @@
"SINGLE_CHOICE", "MULTI_SELECT", "SHORT_TEXT", "LONG_TEXT", "ARGUMENT",
"COMBOBOX_SELECT", "ORDERING", "MATCHING", "EVIDENCE_SELECT",
"CLAIM_EVIDENCE", "COMPOSITE_MULTI_STEP", "SPEAKER_RECIPIENT",
"PARALLEL_WITNESS_COMPARE", "OT_NT_LINK",
"PARALLEL_WITNESS_COMPARE", "PARALLEL_WITNESS_SYNTHESIS", "OT_NT_LINK",
)
}
14 changes: 14 additions & 0 deletions lanes/dev1/repair_overlay/tests/test_accessibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ def test_ordering_is_keyboard_operable_and_restores_focus_after_redraw(self):
self.assertIn("button:not(:disabled)", self.renderers)
self.assertIn("(preferred||fallback)?.focus()", self.renderers)

def test_parallel_witness_renderer_is_keyboard_linear_and_structured(self):
for marker in (
"register('PARALLEL_WITNESS_COMPARE'",
"register('PARALLEL_WITNESS_SYNTHESIS'",
"document.createElement('fieldset')",
"document.createElement('legend')",
"synthesisLabel.htmlFor='parallel-synthesis'",
"witnessesLabel.htmlFor='parallel-witnesses'",
"synthesis: synthesis.value",
"witnesses:witnesses.value.split(/\\r?\\n/)",
):
self.assertIn(marker.replace("synthesis: synthesis.value", "synthesis:synthesis.value"), self.renderers)
self.assertNotIn("dto(task,{choice:c.one()})});\nregister('OT_NT_LINK'", self.renderers)

def test_composite_renderer_dispatches_child_registry_and_scopes_ids(self):
self.assertIn('RendererRegistry.get(child.task_type).render(child,childHost)', self.renderers)
self.assertIn('scopeIds(childHost,', self.renderers)
Expand Down
34 changes: 34 additions & 0 deletions lanes/dev1/repair_overlay/tests/test_accessibility_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,40 @@ def test_ordering_without_numbered_keyboard_items_fails_closed(self) -> None:
{item["code"] for item in inspection["findings"]},
)

def test_parallel_witness_structured_text_surface_does_not_require_choice_options(self) -> None:
node = dict(self.node)
node.update(
{
"node_id": "PA03-N041",
"mission_id": "PA-03",
"task_type": "PARALLEL_WITNESS_COMPARE",
"response_mode": "PARALLEL_WITNESS_COMPARE",
"task_family": "parallel_witness_compare",
"player_prompt": "Порівняйте джерельні межі.",
"source_scope_visible_to_player": "Acts 9:10–19; Acts 22:12–16",
"accepted_answer": {
"synthesis": "Canonical private synthesis.",
"witnesses": ["Acts 9:10–19; Acts 22:12–16"],
},
"ui_metadata": {},
"functional_nonvisual_equivalent": (
"Два підписані багаторядкові текстові поля: синтез і джерельні блоки."
),
}
)
task = self.mapper.to_renderable(node, self.mission)

self.assertEqual([], task["options"])
self.assertEqual(
{"synthesis": "string", "witnesses": "string[]"},
task["answer_contract"]["fields"],
)
self.assertTrue(task["accessibility"]["inspection"]["passed"])
self.assertNotIn(
"A11Y_SEMANTIC_ITEMS_MISSING",
{item["code"] for item in task["accessibility"]["inspection"]["findings"]},
)

def test_media_requires_explicit_text_equivalent(self) -> None:
node = dict(self.node)
node["visual_metadata"] = {"media_slot": "map://case-1"}
Expand Down
12 changes: 12 additions & 0 deletions lanes/dev1/repair_overlay/tests/test_answer_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ def test_exact_shared_descriptors(self):
'COMPOSITE_MULTI_STEP':{'steps':'{step_id:string,answer:object}[]'},
}
for task_type,fields in expected.items(): self.assertEqual(fields,answer_contract_descriptor(task_type)['fields'])
def test_parallel_witness_contract_preserves_choice_and_adds_structured_synthesis(self):
legacy=validate_answer_dto('PARALLEL_WITNESS_COMPARE',{'choice':'Luke'})
self.assertEqual('Luke',legacy['choice'])
dto=validate_answer_dto('PARALLEL_WITNESS_SYNTHESIS',{'synthesis':'Порівняння без гармонізації','witnesses':['Acts 9; Acts 22']})
self.assertEqual('Порівняння без гармонізації',dto['synthesis'])
self.assertEqual(['Acts 9; Acts 22'],dto['witnesses'])
self.assertEqual(
{'synthesis':'string','witnesses':'string[]'},
answer_contract_descriptor('PARALLEL_WITNESS_SYNTHESIS')['fields'],
)
with self.assertRaises(AnswerContractError): validate_answer_dto('PARALLEL_WITNESS_SYNTHESIS',{'choice':'legacy'})

def test_normalizes_matching_and_composite(self):
m=validate_answer_dto('MATCHING',{'schema':'ANSWER_DTO_v1','task_type':'MATCHING','pairs':{'a':'b'}})
self.assertEqual([{'left':'a','right':'b'}],m['pairs'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class PackagedReviewTrainingSyntaxTest(unittest.TestCase):
def test_review_frontend_javascript_parses_when_node_is_available(self):
node = "node"
for name in ("review-queue-ui.js", "app.js"):
for name in ("review-queue-ui.js", "app.js", "renderers-base.js"):
path = ROOT / "frontend" / name
try:
result = subprocess.run([node, "--check", str(path)], capture_output=True, text=True, check=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,41 @@ def test_matching_grading_pairs_are_not_player_presentation(self) -> None:
self.assertNotIn("GRADING-SECRET-LEFT", serialized)
self.assertNotIn("GRADING-SECRET-RIGHT", serialized)

def test_parallel_witness_public_surface_uses_structured_contract_without_truth_leak(self) -> None:
task = self.mapper.to_renderable(
{
"node_id": "PA03-N041",
"mission_id": "PA-03",
"task_type": "PARALLEL_WITNESS_COMPARE",
"task_family": "parallel_witness_compare",
"player_prompt": "Порівняйте джерельні межі.",
"source_scope_visible_to_player": "Acts 9:10–19; Acts 22:12–16",
"functional_nonvisual_equivalent": "Два підписані текстові поля.",
"accepted_answer": {
"synthesis": "GRADING-SECRET-SYNTHESIS",
"witnesses": ["GRADING-SECRET-WITNESS"],
},
"grading": {
"accepted_propositions": [
{"id": "P1", "required": True, "aliases": ["GRADING-SECRET-SYNTHESIS"]}
],
"required_witnesses": ["GRADING-SECRET-WITNESS"],
},
},
self.loader.mission,
)

self.assertEqual("PARALLEL_WITNESS_SYNTHESIS", task["task_type"])
self.assertEqual(
{"synthesis": "string", "witnesses": "string[]"},
task["answer_contract"]["fields"],
)
self.assertEqual([], task["witnesses"])
self.assertNotIn("legacy_answer_contract", task)
serialized = json.dumps(task, ensure_ascii=False, sort_keys=True)
self.assertNotIn("GRADING-SECRET-SYNTHESIS", serialized)
self.assertNotIn("GRADING-SECRET-WITNESS", serialized)

def test_required_evidence_is_not_synthesized_into_answer_options_or_source_refs(self) -> None:
task = self.mapper.to_renderable(
{
Expand Down
20 changes: 18 additions & 2 deletions runtime_engine/scripture_archive_runtime/answer_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def canonical_task_type(value: str) -> str:
ANSWER_TASK_TYPES = frozenset({
"SINGLE_CHOICE", "MULTI_SELECT", "SHORT_TEXT", "LONG_TEXT", "COMBOBOX_SELECT",
"ORDERING", "MATCHING", "EVIDENCE_SELECT", "CLAIM_EVIDENCE", "SPEAKER_RECIPIENT",
"PARALLEL_WITNESS_COMPARE", "OT_NT_LINK", "COMPOSITE_MULTI_STEP", "ARGUMENT",
"PARALLEL_WITNESS_COMPARE", "PARALLEL_WITNESS_SYNTHESIS", "OT_NT_LINK", "COMPOSITE_MULTI_STEP", "ARGUMENT",
})

_LEGACY_LONG_TEXT_MARKERS = (
Expand All @@ -55,7 +55,16 @@ def canonical_node_task_type(node: Mapping[str, Any]) -> str:
"""
explicit = node.get("task_type")
if explicit is not None and str(explicit).strip():
return canonical_task_type(str(explicit))
explicit_type = canonical_task_type(str(explicit))
accepted = node.get("accepted_answer")
if (
explicit_type == "PARALLEL_WITNESS_COMPARE"
and isinstance(accepted, Mapping)
and "synthesis" in accepted
and "witnesses" in accepted
):
return "PARALLEL_WITNESS_SYNTHESIS"
return explicit_type

response_mode = str(node.get("response_mode") or "").strip()
task_family = str(node.get("task_family") or "").strip()
Expand Down Expand Up @@ -132,6 +141,12 @@ def validate_answer_dto(task_type: str, value: Any) -> dict[str, Any]:
if ctype in {"SINGLE_CHOICE", "COMBOBOX_SELECT", "PARALLEL_WITNESS_COMPARE"}:
allowed = {"choice"}
result = {"choice": _require_str(dto.get("choice"), "choice")}
elif ctype == "PARALLEL_WITNESS_SYNTHESIS":
allowed = {"synthesis", "witnesses"}
result = {
"synthesis": _require_str(dto.get("synthesis"), "synthesis"),
"witnesses": _require_str_list(dto.get("witnesses"), "witnesses"),
}
elif ctype == "MULTI_SELECT":
allowed = {"choices"}
result = {"choices": _require_str_list(dto.get("choices"), "choices")}
Expand Down Expand Up @@ -196,6 +211,7 @@ def answer_contract_descriptor(task_type: str) -> dict[str, Any]:
"SINGLE_CHOICE": {"choice": "string"},
"COMBOBOX_SELECT": {"choice": "string"},
"PARALLEL_WITNESS_COMPARE": {"choice": "string"},
"PARALLEL_WITNESS_SYNTHESIS": {"synthesis": "string", "witnesses": "string[]"},
"MULTI_SELECT": {"choices": "string[]"},
"SHORT_TEXT": {"text": "string"},
"LONG_TEXT": {"text": "string"},
Expand Down
Loading
Loading