fix(process): reject invalid temporal cohorts - #4
Open
stacknil wants to merge 6 commits into
Open
Conversation
Owner
Author
|
Post-CI final diff review (2026-08-20)
No unresolved material reuse, quality, efficiency, clarity, privacy, or scope finding remains in the immediate review. The PR stays open for the required later independent review and is not being merged in this creation pass. |
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.
Summary
datetimeto truncate it silentlyWhy
build_diff_envelope()previously validated host and source only. It accepted reversed before/after snapshots and mismatched process/socket-link observation times, allowing a directional diff to be generated from an invalid temporal cohort.Design decision
Compare timezone-aware instants rather than timestamp strings. Each snapshot requires process time == link time, followed by before < after. Snapshot normalization preserves up to six fractional-second digits while retaining the existing whole-second
...Zrepresentation. Inputs with finer precision fail closed becausedatetimecannot represent their ordering without loss. Source envelope and telemetry adapter contract versions remain unchanged because the successful output shape is unchanged.Main risk
Previously accepted equal, reversed, mismatched, or over-precision cohorts now return a CLI error. This is intentional fail-closed behavior, but consumers that relied on invalid ordering or nanosecond timestamps will need to correct capture provenance or quantize explicitly before ingestion. Matching timestamps still do not prove procfs and
sswere collected atomically.Compatibility impact
Rollback path
Revert the behavior and documentation commits to restore v0.3 behavior; no data migration or schema downgrade is required. The test commits can remain as executable records of the rejected safety contracts or be reverted with the PR.
How to validate
The two TDD red phases produced 7 temporal-cohort failures and 2 precision-boundary failures before their implementations. The final process suite includes the unchanged golden diff/report regression plus explicit CLI rejection coverage.
Review timing
This changes evidence/report behavior. Leave the PR open for a later independent diff review even after CI passes; do not merge in the creation pass.