Skip to content

Warn (don't error) when optional services (entity-fishing, glutton) are unavailable#13

Merged
lfoppiano merged 1 commit into
devfrom
claude/warn-optional-services
Apr 14, 2026
Merged

Warn (don't error) when optional services (entity-fishing, glutton) are unavailable#13
lfoppiano merged 1 commit into
devfrom
claude/warn-optional-services

Conversation

@lfoppiano
Copy link
Copy Markdown
Collaborator

Summary

Supersedes #12. Both entity-fishing (disambiguation) and Glutton (reference consolidation) are optional external services. When unreachable or unconfigured, datastet should warn clearly and continue, not log ERROR stacktraces or throw GrobidException.

Entity-fishing (DatasetDisambiguator)

  • Single WARN at startup when host is blank or unreachable (not repeated per request)
  • All runtime failures → WARN with short reason, not ERROR/stacktrace
  • disambiguate() short-circuits with !serverStatus guard (avoids wasted HTTP calls)
  • Replaced all e.printStackTrace() with LOGGER.warn()

Glutton (DatasetParser)

  • Gate all 3 Consolidation.getInstance() call sites with the gluttonHost blank check (previously only 1 site was gated — the other 2 in processPDF would crash with GrobidException if glutton was unreachable)
  • When gluttonHost unset: WARN once per JVM (via AtomicBoolean flag) that consolidation will be skipped — not on every request
  • When glutton call throws: WARN per-request instead of GrobidException (which was crashing the whole request)

Result

  • Clean deployment logs when optional services are absent
  • User is still clearly informed what functionality was skipped and why
  • No more request crashes when glutton goes down mid-flight

Test plan

  • ./gradlew test passes
  • Run with unreachable entity-fishing → single WARN at startup, no per-request errors
  • Run with unset glutton → single WARN on first request, no per-request errors
  • Run with reachable services → no warnings, full functionality

https://claude.ai/code/session_018EBZhK2RtGtsvN4E1rp2tF

Entity-fishing (disambiguation) and Glutton (ref consolidation) are
optional external services. When unconfigured or unreachable, datastet
should warn clearly and continue, not log ERROR stacktraces or throw
GrobidException.

Entity-fishing (DatasetDisambiguator):
- Single WARN at startup when host is blank or unreachable
- All runtime failures → WARN with short reason, not ERROR/stacktrace
- disambiguate() short-circuits with !serverStatus guard
- Replaced all e.printStackTrace() with LOGGER.warn()

Glutton (DatasetParser):
- Gate all 3 Consolidation.getInstance() call sites with gluttonHost
  blank check (previously only 1 site was gated)
- When gluttonHost unset: WARN once per JVM (AtomicBoolean flag) that
  consolidation will be skipped
- When glutton call throws: WARN per-request instead of GrobidException
  (which crashed the whole request)

Result: clean deployment logs when optional services are absent, but
the user is still informed what was skipped and why.

https://claude.ai/code/session_018EBZhK2RtGtsvN4E1rp2tF
@lfoppiano lfoppiano merged commit 1b60756 into dev Apr 14, 2026
@lfoppiano lfoppiano deleted the claude/warn-optional-services branch April 14, 2026 05:50
lfoppiano pushed a commit that referenced this pull request Apr 14, 2026
The fix in #13 made DatasetDisambiguator.disambiguate() gracefully
short-circuit via serverStatus when entity-fishing is unavailable, but
that guard never ran: DatasetParser.disambiguator was always null,
because the private constructor only takes `configuration` while the
three collaborator assignments were field-to-field self-assignments
(no such parameters exist on the ctor), and every caller of
getInstance(...) passes `null, null, null`. A request with
disambiguate=true therefore NPE'd at DatasetParser:276 before the
internal short-circuit could help.

- DatasetParser constructor now obtains the existing @singleton via
  DatasetDisambiguator.getInstance(configuration.getDatastetConfiguration()),
  so #13's serverStatus guard does its job when entity-fishing is not
  configured.
- Add a warn-once AtomicBoolean guard at the disambiguate() call site
  mirroring the existing gluttonWarningLogged pattern, so any future
  null disambiguator path also degrades to a single WARN instead of
  crashing the request.

Result: one WARN at startup ("entity-fishing host not configured,
dataset disambiguation will be skipped"), no stacktrace, requests
return 200.

https://claude.ai/code/session_014ZyP9j7nprZKKtJMtbWmvA
lfoppiano added a commit that referenced this pull request Apr 14, 2026
…#18)

The fix in #13 made DatasetDisambiguator.disambiguate() gracefully
short-circuit via serverStatus when entity-fishing is unavailable, but
that guard never ran: DatasetParser.disambiguator was always null,
because the private constructor only takes `configuration` while the
three collaborator assignments were field-to-field self-assignments
(no such parameters exist on the ctor), and every caller of
getInstance(...) passes `null, null, null`. A request with
disambiguate=true therefore NPE'd at DatasetParser:276 before the
internal short-circuit could help.

- DatasetParser constructor now obtains the existing @singleton via
  DatasetDisambiguator.getInstance(configuration.getDatastetConfiguration()),
  so #13's serverStatus guard does its job when entity-fishing is not
  configured.
- Add a warn-once AtomicBoolean guard at the disambiguate() call site
  mirroring the existing gluttonWarningLogged pattern, so any future
  null disambiguator path also degrades to a single WARN instead of
  crashing the request.

Result: one WARN at startup ("entity-fishing host not configured,
dataset disambiguation will be skipped"), no stacktrace, requests
return 200.

https://claude.ai/code/session_014ZyP9j7nprZKKtJMtbWmvA

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants