tractor/ai/prompt-io/20261011T053737Z_a966928d_p...

6.4 KiB
Raw Blame History

Prompt

The user supplied this original request:

maybe we can add a commit to tractor on top of addr_unpacking, also scan for any other downstream from main logging history and cherry it there and then add your fix, and finally move piker_pin to that? rather not hackaround bug alreadypinningnonmain

The current instruction narrowed execution to a managed Tractor worktree, wkt/address_logging_levels, starting at the verified addr_unpacking OID a966928dea. Scan local logging history, preserve relevant originals where possible, implement the standard-name fix with meaningful tests, and verify Piker’s original cache-hit regression through an import overlay. Leave changes uncommitted for human review and leave piker_pin, Piker’s workaround, environments, and lockfiles intact.

Response summary

Created the managed worktree and recorded approved local discovery in Git administrative storage. No equivalent name-resolution fix or additional prerequisite was found. Patch-ID comparisons of tractor/log.py and tests/test_log_sys.py identified these already-landed equivalents:

  • d653cd2c -> a2c8af55: fast caller lookup.
  • 4f811a87 -> d1d3fc58: lazy optional imports.
  • 361f6fcc and other copies -> bb0b2ffa: custom-level factory.
  • 11b9a870 and other copies -> b6bf865f: nested logger names.
  • 74784780 and other copies -> 8bb9df9e: logging-spec API.

The base also includes 88cc68ed (custom-level re-registration), 67280c28 (disable-aware guards), and 089e158d (dynamic caller fallback). The non-equivalent 53e10861 thread-header change is unrelated and was excluded. No cherry-pick was needed.

The source fix uses public stdlib name resolution after Tractor’s custom-level lookup. It keeps the existing KeyError contract instead of introducing a ValueError compatibility change.

Files changed

  • tractor/log.py: standard/application name resolution and integer-capable adapter annotation.
  • tests/test_log_sys.py: 62 raw/adapted regression cases with detailed failure-mechanism documentation and isolated log state.
  • ai/prompt-io/README.md: shared provenance policy.
  • This structured record and its immutable raw partner.

Verification

Run from the new Tractor worktree:

env PYTHONPATH=/home/goodboy/repos/tractor/wkts/address_logging_levels /home/goodboy/repos/tractor/py313/bin/python -m pytest tests/test_log_sys.py -k at_least_level

Before the source fix: 30 failed, 32 passed, 8 deselected. Failures were name-lookup KeyErrors, including INFO and NOTSET.

env PYTHONPATH=/home/goodboy/repos/tractor/wkts/address_logging_levels /home/goodboy/repos/tractor/py313/bin/python -m pytest tests/test_log_sys.py
/nix/store/qmrz7inmmlfmx1nghix8ymghh5yd9gnv-ruff-0.15.22/bin/ruff check tractor/log.py tests/test_log_sys.py
git diff --check

After the fix: 70 passed; Ruff and whitespace checks passed. Tractor tests used CPython 3.13.11 and pytest 9.1.0. Source imports were asserted beneath the new worktree. The inherited VIRTUAL_ENV named Modden, but the explicit Tractor interpreter was used; TRACTOR_SPAWN_METHOD and TRACTOR_LOGLEVEL were unset.

The existing modern_consumer_probe.py was run through an isolated wrapper with the new Tractor source and Piker’s existing land_flake_update/py313 interpreter (CPython 3.13.14). Original Piker Git-tree modules and tests were overlaid only in memory; the --standard-level-fix option was absent. All 8 cases passed, including both cache-miss and cache-hit variants from b691422b. The installed Tractor distribution metadata still identifies the base OID; import assertions independently verified that executable Tractor and its logging module came from the new source worktree.

Direct Piker imports first failed for missing native libraries (libstdc++, then libzstd). A process-local LD_LIBRARY_PATH containing already-present library outputs resolved from Piker’s locked Nix input fixed those imports. No shell hook, dependency installation, environment synchronization, live broker, or actor suite was run.

Human edits

The human directed the upstream Tractor fix instead of a Piker workaround, selected the exact stack base and local discovery scope, required compatibility and consumer verification, and reserved commits and ref publication for review. These are human-directed agent changes; no subsequent manual edits or acceptance are recorded.

Subsequent local Tuicr review supplied 17 human-selected comments in address_logging_levels@wkt-address_logging_levels/staged/a966928. The reviewer directed explicit INFO(20) fixture documentation, boolean selector meanings, the is_info_level_enabled callable name, threshold comments at numeric values, and precise API and failure descriptions instead of vague terms or Piker-specific context. The agent applied those directions and replaced the custom level membership/subscript pair with CUSTOM_LEVELS.get(name) plus a lazy stdlib fallback on None, preserving zero and KeyError. The registered-level regression now uses 35, between WARNING(30) and ERROR(40), and tests it at INFO(20) then ERROR(40).

After these review adjustments, all 70 logging tests passed with the same source-verified Tractor CPython 3.13.11 environment. Targeted Ruff and git diff --check also passed. The staged index was preserved; review adjustments remain unstaged for human review. The original .raw.md watermark and response capture are unchanged.

A second review selected three follow-up comments about the logger registration hook, fixture parameter meaning, and the INFO-specific query name after changing the logger’s threshold to ERROR. The fixture now distinguishes instance-local level/disabled settings from temporary registration and the process-global disable cutoff, and includes a short consumer example. Each fixture case allocates a fresh raw logger; only the query form varies between the module function and an adapter method wrapping that logger. The test which changes the threshold now names its query is_level_enabled.

All 70 logging tests passed again with source imports verified in this worktree under Tractor’s CPython 3.13.11 interpreter. Targeted Ruff and whitespace checks passed. These follow-up adjustments are unstaged; the current human-staged baseline and original raw prompt record are preserved.