Diagnose table-padding truncation and complete local-first investigation

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a0cffe-206f-7323-89d3-b20ca4cf4bf9
This commit is contained in:
tegwick 2026-09-25 01:55:22 +02:00
parent 509e86d9c5
commit 90d1f86b8f
50 changed files with 2197 additions and 13 deletions

View file

@ -55,3 +55,16 @@ def test_claim_endpoint_rejected_even_with_valid_candidate_ledger():
result = admission.screen(block({'candidates': [candidate]}), block([edge]))
assert len(result['findings']) == 1
assert 'invalid object_candidate_id' in result['findings'][0]
def test_live_negative_result_with_terminal_json_is_valid():
result = admission.audit(REPO / 'research/bench/infospaces/local-first-authority-06')
assert result['structural_status'] == 'passed'
assert result['admission'] == 'not_granted'
def test_ambiguous_or_malformed_bare_json_is_not_repaired():
for text in ('{}\n{}', '{"candidates": []}\nextra prose',
'{"candidates": [}', '```json\n{}\n```\n```json\n{}\n```'):
assert admission.screen(text, block([]))['structural_status'] == 'blocked'

View file

@ -190,6 +190,7 @@ def test_llm_connect_service_contract(tmp_path, finish, content, complete):
with pytest.raises(ValueError, match='empty or incomplete'):
bench.execute(root, live)
assert len(calls) == 1
assert (root / 'reports/rejected-response.md').read_text() == content
receipt_text = (root / 'reports/research-run.json').read_text()
receipt = json.loads(receipt_text)
assert receipt['responses'][0]['model'] == 'resolved/model'
@ -234,3 +235,22 @@ def test_llm_connect_http_failure_is_safe_and_not_retried(tmp_path):
assert 'SECRET-SENTINEL' not in text + str(raised.value)
finally:
server.stop()
def test_diagnostics_allowlist_excludes_raw_provider_data():
raw = {'debug': {'provider_request': {'headers': {'Authorization': 'SECRET'},
'payload': {'messages': ['SECRET'], 'max_tokens': 1000, 'reasoning_effort': 'low'}},
'provider_response': {'body': {'choices': ['SECRET'], 'usage': {
'total_tokens': 1200, 'cost': 0.01, 'private': 'SECRET',
'completion_tokens_details': {'reasoning_tokens': 900, 'private': 'SECRET'}}}}}}
summary = bench.diagnostic_summary(raw)
assert summary['effective_settings']['reasoning_effort_present']
assert summary['provider_usage']['completion_tokens_details']['reasoning_tokens'] == 900
assert 'SECRET' not in json.dumps(summary)
def test_current_llm_connect_drops_reasoning_effort():
from llm_connect._payload import merge_openai_chat_model_params
payload = {'max_tokens': 1000}
merge_openai_chat_model_params(payload, {'reasoning_effort': 'low'})
assert 'reasoning_effort' not in payload