Fallout-build / Fallout-build/Fallout

[Foundation] FT-6: Make logging thread-safe and per-run scoped (prereq for parallel execution)

Open
#311 0 comments 0 reactions 0 assignees View on GitHub
enhancement target/vCurrent
Dominant language
C#
Stars
154
Forks
19
Avg merge
1d 22h
Merged PRs (30d)
15

Description

## Summary

Make logging thread-safe and per-run scoped, so concurrent target execution (FT-8) is safe. Prerequisite for parallelism.

## Findings (file:line)

- `Logging.cs:214` — `InMemorySink.Instance` with an unlocked `List` (`_logEvents`); concurrent emits race.
- `Logging.cs:239-243` — target-context enricher uses a static `s_property` (`SetAndRestore`), not safe under concurrent targets.
- `Logging.cs:20` — global `LevelSwitch`; per-run level should live on the context.

## Scope

- Lock or use a concurrent collection for `InMemorySink`.
- Replace the enricher's static `s_property` with `AsyncLocal` so per-target context is correct under concurrency.
- Per-run level switch held on `BuildContext.Logging`.

## Acceptance criteria

- Concurrent emits don't race (stress test).
- Per-target log context is correct under parallel execution.

## Notes

- **Non-breaking.**
- Depends on: FT-2. Prerequisite for: FT-8.
- Size: **M**.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.