Repository navigation
Closed
Labels
area/adapter-functionsGranite adapter functions: framework and adaptiers including RAG, Guardian, Corearea/formatterOutput formatters, structured output, GraniteFormatter, JSON schema formattingarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.testing
Description
Context
PR #818 added ~200 unit tests for mellea/formatters/granite/ (3.2, 3.3, intrinsics, shared functions). During review, two follow-up threads emerged:
- Missing edge cases — @ajbozarth's review flagged unclosed citation tags, duplicate citation IDs, and other malformed model output scenarios not yet covered
- granite-common test alignment — @jakelorocco pointed out granite-common/tests which has complementary test coverage
Proposal
Expand the granite formatter test suite in a follow-up PR with two workstreams:
1. Edge cases from review feedback
- Unclosed/malformed citation tags (e.g.
<co>1without</co>) - Duplicate citation IDs with conflicting doc indices
- Other adversarial/malformed model output patterns for the output parsers
2. Porting viable tests from granite-common
Based on the overlap analysis in PR #818:
| Area | Action |
|---|---|
| Granite 3.2/3.3 input processing — tokenizer golden-truth validation | Cherry-pick tokenizer validation tests — needs import rewrites, @pytest.mark.slow, skip-if-no-model, module-scoped HF fixtures |
Base types (ToolCall, messages, ChatCompletion, GraniteChatCompletion validation) |
Port — pure Pydantic unit tests, only needs granite_common → mellea.formatters.granite import rewrites. Fills a real coverage gap |
IntrinsicsRewriter golden files (answer_relevance_*, gpt_oss_*) |
Copy missing testdata and add scenarios to existing fixtures |
| Meta: orphan file check | Add trivial meta-test ensuring every testdata file is referenced by a test |
Already covered in #818 (skip): Granite 3.2/3.3 output parsing, OpenAI SDK compat, shared output functions.
Out of scope (separate PR): Retrievers (Elasticsearch, InMemoryRetriever, embeddings), E2E with real models.
Related
- test: add unit tests for granite formatters (3.2, 3.3, intrinsics) #812 — original issue
- test: add unit tests for granite formatters (#812) #818 — initial unit test PR
- Epic: Testing Infrastructure & Strategy Overhaul #726 — testing epic
Metadata
Metadata
Assignees
Labels
area/adapter-functionsGranite adapter functions: framework and adaptiers including RAG, Guardian, Corearea/formatterOutput formatters, structured output, GraniteFormatter, JSON schema formattingarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.testing
Activity
ajbozarth commentedon Apr 13, 2026
A note from Claude that it gave in my re-review of #818 on the scope of this follow-up issue:
The two workstreams here have pretty different complexity, and I'd suggest splitting them to avoid the easy stuff getting blocked behind the harder stuff.
The edge cases (unclosed citation tags, duplicate citation IDs) are simple self-contained unit tests with no new dependencies. The granite-common porting involves import rewrites, HF fixtures,
@pytest.mark.slowinfra, and some judgment calls about what's worth bringing over.Suggestion: land the edge cases in a small first PR, then the granite-common alignment in a follow-up. That way the most production-relevant gap (malformed model output handling) gets closed quickly regardless of how the granite-common work goes.
jakelorocco commentedon May 19, 2026
I think some of these tests may have already been added. We should first look at what tests we have for intrinsics before rewriting / adding these.
planetf1 commentedon May 20, 2026
Some of this is already done — the
gpt_oss_*scenarios and orphan-file meta-test are all intest_intrinsics_formatters.pyfrom #818.What's still missing: malformed
<co>tag edge cases (the regex skips them silently, with an untested warning branch),answer_relevance_*scenarios, and invalid-input Pydantic validation. The original split still seems sensible — edge cases first, the rest as a follow-up.planetf1 commentedon Jun 19, 2026
Closing as superseded by #1304. PR #1165 (which covered the test work for this issue) was closed after confirming in discussion #1166 that the
granite3/formatter pipeline is dead code — theGranite32/33processors are not part of any active Mellea code path. Any residual formatter edge-case testing should be scoped under the removal work in #1304 or a fresh issue once that lands.