Skip to content

fix: log the natural key skip during export at debug level - #6

Open
blaipr wants to merge 2 commits into
ctrliq:mainfrom
blaipr:fix/quiet-natural-key-skip
Open

fix: log the natural key skip during export at debug level#6
blaipr wants to merge 2 commits into
ctrliq:mainfrom
blaipr:fix/quiet-natural-key-skip

Conversation

@blaipr

@blaipr blaipr commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

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 (/api/v2/projects/N/webhook_key/) 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. cli/client.py configures logging only under --verbose, so with no handler attached Python's last-resort handler prints any WARNING straight to stderr:

$ ascender export --projects
Unable to construct a natural key for 'webhook_key' of object /api/v2/projects/1/, skipping.

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 debug level, where --verbose still 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:97 and the foreign key set to null at api.py:119 both describe a real departure from the happy path. get_natural_key in page.py is untouched as well, since the guard here means it is no longer reached for these fields.

Effect on ctrliq.ascender

None. The collection's export and import modules attach a log gobbler to ascenderkit.api.pages.api and .page with both logger and handler at ERROR, so a WARNING was already dropped before reaching the capture buffer and never appeared in module output. This only affects direct library and CLI users.

Type of Change

  • Bug fix
  • New feature or enhancement
  • Breaking change
  • Documentation / tooling

Component

API client (ascenderkit/api/pages/api.py), export path.

Checklist

  • Tests pass (pytest tests/unit): 351 passed
  • Linting passes (black --check ascenderkit tests setup.py, flake8 ascenderkit)
  • Changelog entry added under Unreleased
  • Documentation updated (if applicable): no documentation covers this log line

blaipr added 2 commits August 19, 2026 01:00
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant