fix: log the natural key skip during export at debug level - #6
Open
blaipr wants to merge 2 commits into
Open
Conversation
The export walks the POST fields from the resource's OPTIONS response. Write-only related fields such as webhook_key appear both there and in the object's related links, but resolve to an endpoint whose page class has no NATURAL_KEY, so they cannot be expressed as a portable reference and are skipped. That skip was logged as a warning. The CLI configures logging only under --verbose, so Python's last-resort handler printed the line to stderr on every successful export touching projects, job templates or workflow job templates, where it reads as a failure that did not happen. Skipping such a field is the expected outcome for it, so log it at debug level, where --verbose still shows it alongside the rest of the export trace. The genuine problems around it, a reconstructed endpoint and a foreign key set to null, stay warnings.
The sibling case in this file, a selector that matches nothing, is checked through caplog because the level is the whole point of it: the export and import modules in ctrliq.ascender gobble these loggers and fail the module on anything at ERROR, and the CLI prints WARNING and above to stderr with no handler configured. The skip is checked the same way, along with its counterpart, a related field that does have a natural key and must still be exported, so that the guard cannot quietly widen into ordinary foreign keys.
8 tasks
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.
Summary
The export walks the POST fields from the resource's
OPTIONSresponse. Write-only related fields such aswebhook_keyappear both there and in the object's related links, but resolve to an endpoint (/api/v2/projects/N/webhook_key/) whose page class has noNATURAL_KEY, so they cannot be expressed as a portable reference and are skipped.That skip was logged as a warning.
cli/client.pyconfigures logging only under--verbose, so with no handler attached Python's last-resort handler prints anyWARNINGstraight to stderr:on an export that fully succeeded. The message reads as a failure that did not happen, on every export touching projects, job templates or workflow job templates.
Skipping such a field is the expected outcome for it rather than an export problem, so this logs it at
debuglevel, where--verbosestill shows it alongside the rest of the export trace. The exported document, the exit status and every other log line are unchanged.The genuine problems on either side of it stay warnings: the reconstructed endpoint at
api.py:97and the foreign key set to null atapi.py:119both describe a real departure from the happy path.get_natural_keyinpage.pyis untouched as well, since the guard here means it is no longer reached for these fields.Effect on
ctrliq.ascenderNone. The collection's
exportandimportmodules attach a log gobbler toascenderkit.api.pages.apiand.pagewith both logger and handler atERROR, so aWARNINGwas already dropped before reaching the capture buffer and never appeared in module output. This only affects direct library and CLI users.Type of Change
Component
API client (
ascenderkit/api/pages/api.py), export path.Checklist
pytest tests/unit): 351 passedblack --check ascenderkit tests setup.py,flake8 ascenderkit)Unreleased