Skip to content

perf: reuse logging locks and cache source paths - #416

Merged
codeforester merged 33 commits into
mainfrom
enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
Oct 5, 2026
Merged

codeforester merged 33 commits into
mainfrom
enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib

Conversation

@codeforester

@codeforester codeforester commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Persistent logging now reuses its private sidecar descriptor and caches human-log source paths per invocation. Repeated source paths avoid filesystem resolution, forked children reopen their lock descriptor, and sidecar failures use logging's error handler so commands can complete.

Fixes #381.

Branch maintenance

Refs #426. Targets the branch for #415. Retarget and refresh after that parent is squash-merged; preserve the ordered stack.

The branch was refreshed without rewriting history to include main at a576cc279739eae5e4cfc33ffab2a7fb56de24de.

Current-head validation

At 66ce2689a0b5859ad25927aaa9274c7a4ff5ab19: uv lock freshness and baseline, runtime, strict typing, style, and contracts passed locally with all declared extras. Runtime result: 616 passed, 1 warning, 262 subtests passed in 8.57s.

Hosted checks: 7/7 required checks passed; 0 checks pending; 0 unsuccessful checks at 2026-10-04T14:19:40.760978+00:00. See the PR Checks tab and #426 for subsequent results.

…ff-check-and-mypy-do-not-cover-the-compatibility-consum
…-compatibility-consum' into bug/387-20261003-bug-configure-logger-closes-consumer-owned-handlers-and-forc
…wned-handlers-and-forc' into enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
…-compatibility-consum' into bug/387-20261003-bug-configure-logger-closes-consumer-owned-handlers-and-forc
…wned-handlers-and-forc' into enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
…wned-handlers-and-forc' into enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
Comment thread lib/python/base_cli/logging.py Outdated
Comment thread lib/python/base_cli/logging.py Outdated
Comment thread lib/python/base_cli/logging.py
Comment thread lib/python/base_cli/logging.py
Comment thread lib/python/base_cli/logging.py Outdated
@codeforester

Copy link
Copy Markdown
Contributor Author

Additional finding (unchanged line outside this diff's hunks, so not postable as an inline comment):

lib/python/base_cli/logging.py:353 — format() now calls self._source_path(record) (the new method), but the old module-level _source_path() plus its helpers _active_project_root()/_active_application_home() are left in place, byte-for-byte unchanged, and are no longer called from anywhere in this file or elsewhere in the repo. Two functions named _source_path now coexist implementing diverging root-resolution logic — confusing for a future maintainer, and a likely source of a bug if someone edits the wrong copy believing it's live. Worth deleting the dead module-level trio in a follow-up.

…ff-check-and-mypy-do-not-cover-the-compatibility-consum
…d-mypy-do-not-cover-the-compatibility-consum' into bug/387-20261003-bug-configure-logger-closes-consumer-owned-handlers-and-forc

# Conflicts:
#	docs/integrations.md
…ogger-closes-consumer-owned-handlers-and-forc' into enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
Base automatically changed from bug/387-20261003-bug-configure-logger-closes-consumer-owned-handlers-and-forc to main October 5, 2026 13:36
@codeforester

Copy link
Copy Markdown
Contributor Author

Addressed the blocking sidecar-loss regression in the pushed head 8a2ef793.

The handler now stats the sidecar before permission repair, treats a deleted/replaced sidecar as stale, reopens it, and preserves later records. The dead module-level _source_path/active-context helpers were also removed; the cached formatter method is the sole implementation. Added a regression test for deleting the sidecar during a live handler.

Validation: the supported runtime gate passes (626 tests, 262 subtests), and the style gate passes.

@codeforester

Copy link
Copy Markdown
Contributor Author

Follow-up: the first hosted Windows matrix exposed that the new deletion regression test itself cannot unlink an open sidecar on Windows. The test is now explicitly POSIX-only in c4e4b9b9; the production recovery code remains unchanged and cross-platform. The focused logging tests and Ruff pass locally, and the hosted matrix has been restarted on the corrected head.

…003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib
@codeforester

Copy link
Copy Markdown
Contributor Author

Branch maintenance complete.

  • Synced with current main (including security: centralize secret-name redaction heuristics #400) in merge commit 250bbe40; Git reported no textual conflicts.
  • Targeted logging/performance tests and the full test suite pass locally.
  • Ruff, formatting, and strict mypy pass.
  • Fresh hosted checks are queued; no failures reported yet.

The PR remains open and unmerged.

@codeforester
codeforester merged commit 22bebe2 into main Oct 5, 2026
117 checks passed
@codeforester
codeforester deleted the enhancement/381-20261003-perf-lifecycle-logging-costs-107-us-record-about-20x-stdlib branch October 5, 2026 14:55
codeforester added a commit that referenced this pull request Oct 5, 2026
Run-bundle retention now has a native Windows removal path that pins
directory ancestors, refuses reparse points and volume crossings, and
preserves existing lease/metadata checks. POSIX keeps
descriptor-relative deletion. Unsupported platforms skip the pass with
one warning, and absent directory flags raise a handled error.

Fixes #378.

## Branch maintenance

Refs #426. Targets the branch for #416. Retarget and refresh after that
parent is squash-merged; preserve the ordered stack.

The branch was refreshed without rewriting history to include `main` at
`a576cc279739eae5e4cfc33ffab2a7fb56de24de`.

## Current-head validation

At `e82ce1fbfd7fd3675e8d703a027840d1a82d44bb`: uv lock freshness and
baseline, runtime, strict typing, style, and contracts passed locally
with all declared extras. Runtime result: 620 passed, 1 warning, 262
subtests passed in 8.74s.

Hosted checks: 7/7 required checks passed; 0 checks pending; 0
unsuccessful checks at 2026-10-04T14:19:40.760978+00:00. See the PR
Checks tab and #426 for subsequent results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: lifecycle logging costs ~107 us/record, about 20x stdlib

1 participant