Skip to content

test: pin empty selection_reason passthrough in build_certificate - #30

Merged
cschanhniem merged 1 commit into
mainfrom
feat/certificate-empty-selection-reason
Jun 28, 2026
Merged

cschanhniem merged 1 commit into
mainfrom
feat/certificate-empty-selection-reason

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

Final gap from audit: the _make_scored() test helper in test_certificate.py uses selection_reason or ["default"], which means selection_reason=[] silently becomes the default value. No existing test has ever exercised build_certificate() with an empty selection_reason list.

Added test_empty_selection_reason_passthrough that bypasses the helper and directly constructs ScoredCandidate(selection_reason=[]). Verifies:

  • build_certificate() passes the empty list through unchanged
  • cert["selection_reason"] == []
  • The JSON schema allows this (no minItems constraint on selection_reason)

This is a low-risk gap (the code correctly handles it) but the untested blind spot in the helper was worth documenting explicitly.

Test plan

  • pytest tests/test_certificate.py — 23 passed (1 new test)
  • Full suite: 822 passed

The _make_scored() helper in test_certificate.py uses 'or' short-circuit
(selection_reason or ['default']), so passing selection_reason=[] silently
becomes the default value — no test has ever exercised the empty-list path.

Added test_empty_selection_reason_passthrough that bypasses the helper and
directly constructs ScoredCandidate(selection_reason=[]) to verify:
1. build_certificate() passes the empty list through unchanged
2. cert['selection_reason'] == [] (the JSON schema allows this — no minItems)

This is the final audit-identified gap from the pre-synthesis quality sprint.
@cschanhniem
cschanhniem merged commit 85b2444 into main Jun 28, 2026
2 checks passed
@cschanhniem
cschanhniem deleted the feat/certificate-empty-selection-reason branch June 28, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant