ENG-1408 - Suppress env errors if SUPABASE_USE_DB="none"#760
ENG-1408 - Suppress env errors if SUPABASE_USE_DB="none"#760
Conversation
…riable support in compile script and conditionally initializing Supabase sync based on its value.
This comment was marked as outdated.
This comment was marked as outdated.
…t variable, ensuring it defaults to "null" when not defined.
…more flexible variable naming.
|
@maparent will |
…getVariant, ensuring it is returned alongside parsed dotenv data.
|
Ok, sorry it took me so long to get to this. I'll be honest: The error is verbose, and I'm not against trying to make it a bit less so, but I think it's a real error and I'm -1 on silencing it in the first place. You have set suggestion mode on, it cannot work because you disabled that database, it's an error condition you should be warned of. |
That is not sufficient from a DX standpoint. I reload the plugin dozens of times a day. When the database is intentionally disabled, receiving an error on every reload is unnecessary noise. You said: “You have Suggestive mode on. It cannot work because you disabled the database. It’s an error condition you should be warned of.” That is not accurate in this context. I am explicitly stating that I do not want to use database-backed features. If I set The overwhelming majority of our functions are local-only. Requiring a developer to manually toggle all database-related settings inside the graph introduces unnecessary time overhead and friction. A single variable to disable DB behavior is a clean and efficient development switch. You also stated that the runtime should not know about this, but the core question remains unanswered:
If there is a concrete downside, please explain it clearly. If there is not, please go ahead and review this PR. |
|
Ok. I won't fight this further. Do as you wish. Send the variable. I will ask for one modification: In that case, have a console.warn("The database was expected disabled through developer-mode settings") or some such, so people know what's happening if they forget what setting they set and they expect the database to work. |
|
I'll review tomorrow, done for the day. |
maparent
left a comment
There was a problem hiding this comment.
This is only one of many places that call getLoggedInClient.
Instead of doing this at call points, I suggest doing this globally in the getLoggedInClient function. It would require passing the USE_SUBAPABASE_DB variable in obsidian build.
If you want to do it at call points, look for getLoggedInClient globally.
In all cases, the error should be converted in a warning. A developer who got the wrong settings in their build console should get a signal to understand why they are not getting database access.
These error messages appear on every plugin load/reload, which is poor DX—especially when the configuration explicitly indicates that the database is not in use (
SUPABASE_USE_DB="none").https://github.com/DiscourseGraphs/discourse-graph/blob/main/packages/database/README.md#L11-L12
This PR introduces a small, targeted fix and establishes a clear pattern we can reuse for handling future database-specific functionality.