Skip to content

feat: put bulk-load batch progress behind a debug flag - #197

Merged
jvendetti merged 2 commits into
developmentfrom
feature/quiet-bulk-load-output
Aug 18, 2026
Merged

jvendetti merged 2 commits into
developmentfrom
feature/quiet-bulk-load-output

Conversation

@jvendetti

Copy link
Copy Markdown
Member

Problem

append_triples_batch printed a progress line for every batch, unconditionally. Running a single unit test in a dependent gem (ontologies_linked_data) produces dozens of them:

TestAncestorsPrecompute#test_memoization = 0.00 s = .
Appending triples in batch of 146449 triples from line 0
Appending triples in batch of 5 triples from line 0
Appending triples in batch of 1698 triples from line 0
... (dozens more)

The information is useful when debugging a slow or failing ontology load, and noise everywhere else.

Change

Adds a data_load_debug flag, following the shape of the existing queries_debug switch directly above it:

  • Goo.data_load_debug / Goo.data_load_debug? in lib/goo.rb
  • GOO_DATA_LOAD_DEBUG env var, plumbed through config.rb and documented in config.rb.sample
  • the puts at lib/goo/sparql/client.rb:189 is now guarded by it

Off by default in lib/goo.rb itself, so callers that never reach Goo.config — unit tests in dependent gems, notably — get the quiet default with no change on their side. Opt back in with GOO_DATA_LOAD_DEBUG=true or a direct Goo.data_load_debug(true).

Notes for review

  • The setter is positional (data_load_debug(flag)) rather than data_load_debug=, because it is called inside a Goo.configure block where conf.x = v would parse as a local variable assignment rather than a method call. This matches queries_debug.
  • The env var is parsed for truthiness (%w[1 true yes on].include?) rather than taken raw. The neighbouring queries_debug line uses the raw form, where QUERIES_DEBUG=false is a non-empty String and therefore turns debug on; this is the same trap already called out in the query_logging comment. That pre-existing line is left alone here.
  • The error-path puts calls in the same method are deliberately untouched. They report real failures and must not be gated behind a debug flag. Whether they belong on stderr (warn, as resilience.rb and cache.rb already do) is a separate question, intentionally left out of this PR.

Verification

  • flag defaults to false, and toggles correctly
  • env parsing accepts 1 / true / on / YES; rejects false / FALSE / 0 / no / unset
  • calling append_triples_batch with a stubbed network call prints nothing when off, and exactly one line when on
  • config.rb.sample loads and yields false as shipped, true with the line uncommented
  • test/test_cache_unit.rb passes (17 tests, 43 assertions, 0 failures)

No automated test accompanies the flag; happy to add one covering the env parsing if reviewers would prefer.

🤖 Generated with Claude Code

jvendetti and others added 2 commits August 13, 2026 17:23
append_triples_batch printed one line per batch unconditionally. A single
unit test in a dependent gem (ontologies_linked_data) emits dozens of them,
burying the test output that actually matters in progress lines that say
nothing about the test.

* new Goo.data_load_debug / Goo.data_load_debug? pair, mirroring the shape
  of queries_debug above it -- positional setter, not `=`, because it is
  called inside a Goo.configure block where `conf.x = v` would parse as a
  local assignment rather than a method call.
* off by default in lib/goo.rb itself, so code paths that never reach
  Goo.config (unit tests in dependent gems, notably) get the quiet default
  without any change on their side. Opt back in with GOO_DATA_LOAD_DEBUG or
  a direct Goo.data_load_debug(true) when debugging a slow or failing load.
* the env var is parsed for truthiness rather than taken raw, unlike the
  queries_debug line directly above it: GOO_DATA_LOAD_DEBUG=false is a
  non-empty String and would otherwise turn the output back ON. Same
  treatment as query_logging and use_cache.

The error-path puts in the same method are deliberately left alone; whether
those belong on stderr is a separate question.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The sample documents every other knob (query logging depth/TTL, redis
split, use_cache), so the new flag belongs there too. Left commented out,
matching the other opt-in settings, so copying the sample keeps the quiet
default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jvendetti
jvendetti merged commit 031e976 into development Aug 18, 2026
10 checks passed
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