feat: put bulk-load batch progress behind a debug flag - #197
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
append_triples_batchprinted a progress line for every batch, unconditionally. Running a single unit test in a dependent gem (ontologies_linked_data) produces dozens of them:The information is useful when debugging a slow or failing ontology load, and noise everywhere else.
Change
Adds a
data_load_debugflag, following the shape of the existingqueries_debugswitch directly above it:Goo.data_load_debug/Goo.data_load_debug?inlib/goo.rbGOO_DATA_LOAD_DEBUGenv var, plumbed throughconfig.rband documented inconfig.rb.sampleputsatlib/goo/sparql/client.rb:189is now guarded by itOff by default in
lib/goo.rbitself, so callers that never reachGoo.config— unit tests in dependent gems, notably — get the quiet default with no change on their side. Opt back in withGOO_DATA_LOAD_DEBUG=trueor a directGoo.data_load_debug(true).Notes for review
data_load_debug(flag)) rather thandata_load_debug=, because it is called inside aGoo.configureblock whereconf.x = vwould parse as a local variable assignment rather than a method call. This matchesqueries_debug.%w[1 true yes on].include?) rather than taken raw. The neighbouringqueries_debugline uses the raw form, whereQUERIES_DEBUG=falseis a non-empty String and therefore turns debug on; this is the same trap already called out in thequery_loggingcomment. That pre-existing line is left alone here.putscalls 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, asresilience.rbandcache.rbalready do) is a separate question, intentionally left out of this PR.Verification
false, and toggles correctly1/true/on/YES; rejectsfalse/FALSE/0/no/ unsetappend_triples_batchwith a stubbed network call prints nothing when off, and exactly one line when onconfig.rb.sampleloads and yieldsfalseas shipped,truewith the line uncommentedtest/test_cache_unit.rbpasses (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