Draft
Conversation
Existing tests verify aggregation math with synthetic data and basic sanity bounds, but don't confirm duct's measurements match actual resource usage. These tests run programs with known, predictable resource consumption and assert duct reports values within expected bounds: - Memory allocation: allocate N MB, verify peak_rss >= N MB - Wall clock time: sleep N seconds, verify reported time ~= N - Idle CPU: sleep reports near-zero CPU - CPU intensive: busy-loop reports significant CPU - Usage samples: verify JSONL structure and multiple reports - Consistent memory: held allocation visible across samples https://claude.ai/code/session_01FYRR4Y8PzNLBU344ovdDS5
Existing e2e tests verify duct counts child PIDs correctly, but never check that resource stats are actually aggregated across children. These new tests spawn multiple child processes with known memory allocations and verify: - Total RSS reflects sum across all children (N x M MB) - Individual child processes appear in usage.jsonl with correct RSS - total_rss in each sample equals the sum of per-process RSS values Adds test/data/memory_children.py helper that uses multiprocessing to fork N children each holding M MB for a specified duration. https://claude.ai/code/session_01FYRR4Y8PzNLBU344ovdDS5
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #403 +/- ##
=======================================
Coverage 91.87% 91.87%
=======================================
Files 15 15
Lines 1120 1120
Branches 139 139
=======================================
Hits 1029 1029
Misses 69 69
Partials 22 22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Use assert to reference bytearray instead of _ prefix (F841) - Break long f-string debug line into separate variable (B950) https://claude.ai/code/session_01FYRR4Y8PzNLBU344ovdDS5
json.loads() returns Any, so return type annotations of dict/list[dict] trigger mypy's no-any-return check. Use Any instead. https://claude.ai/code/session_01FYRR4Y8PzNLBU344ovdDS5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code — may contain slop, wait for @asmacdo to review
Summary
test/data/memory_children.pyhelper usingmultiprocessing.ProcessTest plan
test/duct_main/test_resource_validation.py)https://claude.ai/code/session_01FYRR4Y8PzNLBU344ovdDS5