GitNexus/gitnexus/test
samuel mbabhazi 42d97802ea
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
feat(logger): let a host route GitNexus records into its own sink (#3729)
* feat(logger): let a host route GitNexus records into its own sink

A process that embeds GitNexus had no supported way to send the logger's
records into its own logging: the singleton and every named child write
to stderr, and the only redirect was the test-only capture (#3620).

configureLoggerSink({ destination, level, mixin }) routes the default
logger and every later createLogger() child to the host's destination,
with the mixin's fields on each record, and returns a function that puts
the previous state back. flushLoggerSync() flushes a sink destination
that has flushSync. Without a call nothing changes: the default path
gains one branch at logger construction and none per record, no pretty
transport or exit hook is installed for a host sink, and a test capture
keeps precedence while it is active.

* fix(logger): retire a sink on restore so an out-of-order restore cannot revive it

A restore that found its sink displaced by a later one returned without a
trace, and the later sink's restore then handed the state back to the
sink whose owner had already restored it (review on #3729). A restore now
retires its sink for good: when active, the nearest earlier sink that is
still live becomes active again, else stderr; when displaced, the active
state is left alone but the sink can no longer come back.

* test(logger): cover a warn-level host sink and a restore across two retired owners

A sink that already enables debug cannot tell whether a child honoured
debugEnvVar or only inherited the sink level: dropping debugRequested
from the host-sink branch left all 32 tests green. The warn-level case
drops an ordinary child's debug record and keeps the debugEnvVar child's.

The three-sink case walked past a single retired owner, so a one-hop
lookup in nearestLiveSink also passed. Four sinks, with both middle
owners retired before the newest restores, reach the oldest live sink
only through the loop.

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-27 19:38:00 +00:00
..
fixtures feat: add the test scenario map and a Vitest 5 mutation runner (#3686) 2026-10-27 16:46:58 +00:00
helpers fix(taint): avoid false positives for guarded Git arguments (#3703) 2026-10-24 15:37:26 +01:00
integration fix(mcp): shut down when the stdio parent exits (#3737) 2026-10-27 09:56:16 +00:00
unit feat(logger): let a host route GitNexus records into its own sink (#3729) 2026-10-27 19:38:00 +00:00
utils feat(storage): add configurable index storage and content retention tiers (#3060) 2026-09-12 20:31:55 +00:00