test: handle mainnet logs in combine_logs.py

bitcoin/bitcoin: PR #36982

The review is inconclusive; no findings were published.

Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Reliable combined logs are a failure-diagnosis requirement across supported platforms. Issue #16894 reported that missing combined logs made functional-test failures harder to investigate. PR #16973 addressed Windows separators by using pathlib for discovery and converting paths to POSIX-style strings while retaining the existing regex, rather than rewriting the regex for platform-specific separators.

This explains why filesystem discovery and path interpretation are central to this helper: finding a debug.log is insufficient unless its path can also be interpreted consistently. The affected read_logs() behavior serves the same diagnostic workflow, merging node logs with test_framework.log.

Source 1 · Source 2

Recursive discovery was not an intentional expansion of the supported log layouts. In the historical #16973 review, a reviewer explicitly asked whether recursion was deliberate; the author answered that it was not and that non-recursive discovery would suffice.

The pinned helper still uses node0/**/debug.log. This history distinguishes the purpose of the earlier change—Windows compatibility—from the additional paths its recursive glob can discover. It does not support treating arbitrary nesting or mainnet support as deliberate design goals of #16973.

Source 1 · Source 2

Discovery historically assumed a single applicable debug.log under node0, rather than selecting among several chains. The #16973 discussion proposed checking that no second match existed, and the author recorded adding an assertion.

The pinned implementation preserves this bounded model by rejecting multiple matches and deriving one relative log directory from node0. Handling a mainnet log therefore concerns another location for the single expected log, not historical support for merging several networks from one node directory.

Source 1 · Source 2

Ralph's inferences

A nonempty chain subdirectory is not a universal property of a network-specific data directory. Mainnet's base-chain parameters specify an empty suffix, whereas regtest specifies regtest; directory construction appends the suffix only when it is nonempty. The address-validation functional test explicitly selects mainnet.

These pinned-code premises explain why a legitimate functional-test run can have the root-level layout described in the assignment. The log-directory component represents a filesystem location, which may be empty, rather than necessarily a textual chain name.

The helper uses a simple test-run layout model: discover the log directory once from node0, reuse it for consecutively numbered nodes, then merge their event streams with the framework log. It is not a general per-node or per-network log inventory.

The affected path extraction sits inside that shared-layout assumption. The pinned relative-path expression changes how the common directory is represented while leaving node enumeration, the single-log restriction, and timestamp merging in place. This is a diagnostic-tool constraint, not a consensus or peer-adversarial rule.