Adjust backend main functions to support lazy init of environ and initialize main variables - #612
Open
jonasbardino wants to merge 54 commits into
Conversation
This was referenced Jul 22, 2026
Draft
jonasbardino
marked this pull request as ready for review
July 23, 2026 08:11
This was referenced Jul 23, 2026
Contributor
Author
|
All backends reachable from the user front page as well as those used in #395 are now covered and functional. So perhaps we're approaching a good first merge point with remaining backends as follow-up PRs 🤔 |
This was referenced Jul 24, 2026
…nd `main` functions for consistent lazy `environ` and `initialize_main_variables` set up without clunky `_main` wrappers. This should make it easier to achieve a standardized runtime environment in all interfaces, and allow us to considerably simplify the unit tests relying on more direct access to tweaking the environment and calls. Extended `environ` passing to `validate_input` for symmetry with `validate_input_and_cert`. Made argument passing from the latter use explicit keywords for clarity, too. Applied various linting suggestions from `ruff`.
Expose `path_info` in `create_http_environ` and rename previously "private" `_only_output_objects` to "public" `filter_output_objects`.
…s in the `cat.py` and `datatransfer.py` functionality backends to significantly simplify the clunky `main` + `_main` wrapping introduced for their unit tests. We can proceed with all the other backend functions after adjusting those unit tests accordingly.
… shared helpers from wsgisupp. Apply various updates to current unit testing support helpers. Tightened a few of the output_object checks to be more thorough about all entries. Applied make format and lint with some fixes for consistency.
…d inject it in `initialize_main_variables` calls there to let individual backends override options like `op_header` easily. Swapped the order of `environ` and `init_main_res`, so that `init_kw` sticks with `init_main_res` both in `main` and `lazy_init_backend`. Moved the dynamic `op_menu` logic into `initialize_main_variables` so that backends can just pass 'AUTO' if menu should only be shown if page was accessed with login (i.e. `client_id` value is set).
…riables in order to really let unit tests inherit the init_kwargs from main function e.g. in the docs.py test suite. Extended docs.py tests to cover more anonymous and authenticated use and in particular exercise the previsouly mentioned inheritance logic.
NOTE: identified two bugs in the backend while testing. So tests are left disabled but should be fixed separately with re-enabling the tests.
optional args instead of duplicating that effort (half-heartedly). Update tests to fit this consistent init with all `output_object` entries and re-enable all the tests that previously needed additional init tweaking. This is much cleaner and effectively renders the stand-alone extension branch fix/possibly-missing-title-entry-style-and-script-sub-dicts-and-empty-dict-default-arg-values obsolete.
Skip disabled test until backend is fixed to properly report error.
Skip disabled and invalid content tests until backend is fixed to properly handle those errors.
…yload issues causing other errors than intended.
disabled for now because not all backends treat such errors consistently. Extend vgridworkflows unit tests to cover another common case where user does not have the required vgrid access.
Skip disabled test for now because resources enabled check is missing in the backend.
Temporarily disable default test until backend truncate env is fixed.
Temporarily disable main test until backend is adjusted to properly pass environ to its helper functions throughout.
Temporarily disable main test until backend is adjusted to properly pass environ to its helper functions throughout.
separate PR on top of this branch along with enabling the corresponding unit test.
… separate PR on top of this branch along with enabling the corresponding unit test.
jonasbardino
force-pushed
the
adjust/backend-main-functions-to-support-lazy-init-of-environ-and-initialize-main-variables
branch
from
July 29, 2026 15:44
3d89d0f to
fc30471
Compare
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.
Add a shared
lazy_init_backendhelper for use in reworking of backendmainfunctions for consistent lazyenvironandinitialize_main_variablesset up without clunky_mainwrappers.This should make it easier to achieve a standardized runtime environment in all interfaces, and allow us to considerably simplify the unit tests relying on more direct access to tweaking the environment and calls.
Refactor and clean up the corresponding backend unit tests while at it.
The fundamentals are now in place and working so taking it out of draft, but I'll continue adjusting the N remaining backends and add unit tests along the way.