CtrlK
BlogDocsLog inGet started
Tessl Logo

martinfrancois/java-optionals

Help AI coding agents use Java Optional well in new code and cleanups, without replacing one antipattern with another.

100

2.08x
Quality

100%

Does it follow best practices?

Impact

100%

2.08x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-2/

{
  "context": "Transcript-derived first-pass implementation scenario from Symphony for Trello: the agent introduced isPresent()/get() while writing retry backoff code with an optional Retry-After header.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Compiles and creates requested artifact",
      "description": "Creates a coherent RetryBackoff.java with RetryBackoff, backoff(Config, int, HttpResponse<?>), parseRetryAfter(String), the nested Config record, and imports compatible with the stated Java 17 baseline.",
      "max_score": 3
    },
    {
      "name": "Implements fallback behavior exactly",
      "description": "Returns the Retry-After duration only when response is non-null and the header parses as valid; otherwise returns config.baseDelay().multipliedBy(1L << Math.min(attempt - 1, 8)).",
      "max_score": 6
    },
    {
      "name": "Parses only positive whole seconds",
      "description": "parseRetryAfter returns Optional.of(Duration.ofSeconds(seconds)) only for positive whole-number seconds and Optional.empty() for null, blank, zero, negative, malformed, fractional, or non-numeric values.",
      "max_score": 3
    },
    {
      "name": "Preserves lazy fallback timing",
      "description": "Does not compute or return fallback work as the selected result when a valid Retry-After duration is present.",
      "max_score": 3
    },
    {
      "name": "Uses Optional boundary for header and parse flow",
      "description": "Uses Optional.ofNullable(response).flatMap(...).flatMap(this::parseRetryAfter).orElseGet(...) or an equivalent direct Optional boundary for the header and parsed duration.",
      "max_score": 60
    },
    {
      "name": "Avoids Optional antipatterns",
      "description": "Does not use isPresent()/isEmpty() followed by get()/orElseThrow(), or use orElse(null), local null branching, Optional.stream().toList(), lists, or loops to unwrap one Optional.",
      "max_score": 20
    },
    {
      "name": "Keeps implementation readable",
      "description": "Keeps parsing and fallback helpers small and clear without unrelated abstractions or behavior changes.",
      "max_score": 5
    }
  ]
}

README.md

tile.json