Repository navigation
Keep useful diagnostics from isolated integration runs - #241
Santiagocetran wants to merge 7 commits into
Conversation
|
Reviewed against Note: this is a draft PR. The PR body says "This is a draft for review and coordination around the shared harness and testing guide." What follows is a read-level review of the code as written; the draft status means it is not ready to merge as-is — the author should mark it ready and update the CI base before it goes through the merge gate. Claimed: When a command fails or times out in isolated mode, output is now retained in a bounded log outside the temporary directory so it survives cleanup. Verified — retention path and budget accounting are correct: Claimed: Command arguments, environments and stdin are never recorded. Verified — API surface is correct: Claimed: Verified — implementation is correct: Claimed: Tests cover timeouts, interruptions, output limits, unsafe file paths and diagnostic write failures. PR body says 561 tests pass. Verified — CI Python (1m21s) green at Claimed: The advisory Ruff check reports 708 findings vs. an estimated 664 before this change (intentional interruption-safe catches and style warnings). Not independently verified: Ruff is advisory, not a required CI gate. No action needed. All substantial claims held up. The draft flag means the author intends further work before merge. The code as written is correct and the safety patterns are sound. The branch needs a rebase (or merge from develop) before marking ready, since CI ran 8 commits ago on an older base. |
Files changed (8) — as of PR headDiffed against merge-base Note: draft PR. The author should mark it ready and rebase before it goes through the merge gate.
|
| Field | Value |
|---|---|
| Change | Added |
| Lines | +639/-0 |
| Diff | Diagnostics class (run, record, context manager), _Capture (per-stream bounded buffer), ServiceStream (async-friendly wrapper). Budget accounting via _size + shared _retained counters. _secondary(primary, error) interrupt-safe exception-note pattern. |
| Functionality — how & why | How: _Capture.feed() tracks per-stream and total budgets simultaneously; DiagnosticsLimitError is raised on exhaustion with truncated=True. _secondary adds to a primary exception rather than replacing it, preserving SIGINT dominance. Why: Retained diagnostics must survive the temp-directory cleanup that otherwise removes all command output. |
Diff vs current develop HEAD |
None (new file) |
| Recommended merge proposal | Merged as-is once draft flag is lifted and branch is rebased |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/dincli/reports.py
| Field | Value |
|---|---|
| Change | Added |
| Lines | +290/-0 |
| Diff | collect_worker_reports, _atomic_json (O_EXCL + link + unlink pattern), _open_directory (O_NOFOLLOW directory-fd walking). _JOBS patterns exclude wallet paths, salts, and success payloads. |
| Functionality — how & why | How: _atomic_json opens a temp file with `O_EXCL |
Diff vs current develop HEAD |
None (new file) |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/dincli/conftest.py
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +119/-40 |
| Diff | Adds _get_diagnostics() singleton fixture, integrates Diagnostics context manager into the shared harness setup. Existing fixtures updated to pass the diagnostics instance through. |
| Functionality — how & why | Centralizes diagnostics injection so all integration tests share the same bounded-retention context without per-test boilerplate. |
Diff vs current develop HEAD |
None (no overlap with develop-only commits) |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/test_integration_diagnostics.py
| Field | Value |
|---|---|
| Change | Added |
| Lines | +578/-0 |
| Diff | Unit tests for Diagnostics, _Capture, _secondary. Covers timeouts, interruptions, output-limit exhaustion, truncation flag, unsafe file paths, diagnostic write failures. Imports from tests.dincli.diagnostics directly (not the integration harness fixtures), so it runs in the normal pytest pass. |
Diff vs current develop HEAD |
None (new file) |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/test_integration_reports.py
| Field | Value |
|---|---|
| Change | Added |
| Lines | +283/-0 |
| Diff | Tests for collect_worker_reports, _atomic_json, _open_directory. Covers unsafe path rejection, concurrent write safety, symlink-swap defence. |
Diff vs current develop HEAD |
None (new file) |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/test_integration_services.py
| Field | Value |
|---|---|
| Change | Added |
| Lines | +114/-0 |
| Diff | Integration-harness-level smoke tests for service startup and graceful stop under the new diagnostics context. |
Diff vs current develop HEAD |
None (new file) |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
tests/test_integration_harness.py
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +69/-1 |
| Diff | Wires diagnostics context into the harness fixture; adds assertions that diagnostics are captured on command failure. |
Diff vs current develop HEAD |
None |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
Documentation/technical/testing/dincli-testing-guide.md
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +46/-2 |
| Diff | New §: "Retained diagnostics" explaining the bounded-log pattern, budget constants, and how to access captured output in test failures. |
Diff vs current develop HEAD |
None |
| Recommended merge proposal | Merged as-is once ready |
| Actual merge proposal | Soon |
| Pending proposal | Draft flag; rebase needed |
| Local merge conflict | No |
| GitHub merge conflict | Unknown (draft) |
Verification
CI Python (1m21s, 561 passed 0 failed) green on PR head at https://github.com/InfiniteZeroFoundation/DevNet/actions/runs/37822992024/job/113468526909. No foundry/src changes → one peer approval needed, no second sign-off required. Local merge-tree dry run clean.
Draft PR — merge gate blocked until the author marks it ready and rebases onto current develop (8 commits behind).
Local vs. GitHub: local clean; GitHub shows UNKNOWN (expected for draft PRs).
robertocarlous
left a comment
There was a problem hiding this comment.
Bounded-log retention, atomic JSON, interrupt-safe _secondary() pattern, and O_NOFOLLOW directory-fd walking all verified correct. 561 tests pass (CI Python green). Draft PR — merge gate stays blocked until the author marks it ready and rebases (currently 8 commits behind develop). No foundry/src changes, so one peer approval is sufficient.
|
Thanks for the review! Undrafted the PR and updated the branch with the latest develop. |
Retain bounded diagnostic IPFS initialization with all four offline setup steps, both harness test groups, and the combined diagnostics and CI integration guide.
This follows up on #213 by making isolated integration failures easier to investigate.
When a command fails or times out, we keep its output outside the temporary test directory. We also collect a small, filtered summary of worker results and record whether cleanup completed, so useful evidence remains after the temporary files are removed.
The changes include:
The diagnostics work with the existing manual Full GI workflow in
.github/workflows/full-gi.yml, which uploads the results directory on failure. The worker summary is retained atworker-reports/summary.json.Validation: On head
1b235716, CI passed Python, Docs, Solidity and CI OK. The Python 3.12 run passed 699 tests, with 133 integration tests deselected, using the CI dependency constraints. See CI run.The advisory Ruff check reported 743 findings across the repository; it remains non-blocking. Earlier validation on the original implementation passed 561 tests, with 133 integration tests deselected, on Python 3.12 and 3.13. The latest CI run does not revalidate Python 3.13. No live Anvil, IPFS or Docker integration was run for this change.
The PR is ready for review. Wallet migration, lifecycle repairs, full-GI success assertions and Docker ownership remain separate follow-up work.
Related to #228; does not close it.