Skip to content

fix(inspection): order failure patterns chronologically - #3603

Closed
eneekoruiz wants to merge 2 commits into
affaan-m:mainfrom
eneekoruiz:codex/fix-inspection-timestamp-order
Closed

eneekoruiz wants to merge 2 commits into
affaan-m:mainfrom
eneekoruiz:codex/fix-inspection-timestamp-order

Conversation

@eneekoruiz

@eneekoruiz eneekoruiz commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Compare parsed timestamps when ordering failures and breaking ties between patterns. String ordering incorrectly treats 04:00+04:00 as later than 01:00Z, reversing first/last seen. Missing dates sort after valid dates, including timestamps before 1970, and undated ties remain stable.

Validation: reproduced both offset and pre-epoch regressions before their fixes; 18 inspection tests pass. Coverage: 92.72% lines, 92.15% branches, 85.71% functions. ESLint, diff checks and independent review passed.

@eneekoruiz
eneekoruiz requested a review from affaan-m as a code owner October 16, 2026 13:17
@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: 075d55e9cb3138c41a0bc1298095bc1e3fd765d9

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 2 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: 075d55e9cb3138c41a0bc1298095bc1e3fd765d9

PR taxonomy review recommended (neutral)

Detected 1 PR taxonomy bucket(s): CI/CD Recommendation.

Scanned 2 changed file(s).

Roadmap taxonomy buckets:

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 1 CI or workflow path(s) changed

Paths:

  • tests/lib/inspection.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: 075d55e9cb3138c41a0bc1298095bc1e3fd765d9

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 2 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: 075d55e9cb3138c41a0bc1298095bc1e3fd765d9

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: affaan-m/ECC/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fe54af6e-0a44-4aaa-aa48-0cc761f10056
📥 Commits

Reviewing files that changed from the base of the PR and between 075d55e and 774dfd6.

📒 Files selected for processing: 2
  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 1
  • GitHub Check: Greptile Review
🧰 Additional context used
📚 Code guidelines: 4
.cursor/rules/typescript-security.md — unknown
.cursor/rules/common-hooks.md — unknown
.cursor/rules/typescript-coding-style.md — unknown
.cursor/rules/typescript-hooks.md — unknown
📓 Path-based instructions: 5
Focus on command injection, unsafe subprocess usage, path traversal, SSRF, secret exposure, and missing tests for new CLI behavior.

⚙️ CodeRabbit configuration file

Files:

  • scripts/lib/inspection.js
Source excerpt: Source excerpt: Use **security-reviewer** skill for comprehensive security audits

📄 CodeRabbit inference engine (.cursor/rules/typescript-security.md)

Files:

  • tests/lib/inspection.test.js
  • scripts/lib/inspection.js
Source excerpt: Use with caution: Source excerpt: Use with caution: Enable for trusted, well-defined plans Source excerpt: Use with caution: Disable for exploratory work Source excerpt: Use with caution: Never use dangerously-skip-permissio...

📄 CodeRabbit inference engine (.cursor/rules/common-hooks.md)

Files:

  • tests/lib/inspection.test.js
  • scripts/lib/inspection.js
Source excerpt: Use spread operator for immutable updates: Source excerpt: Use async/await with try-catch: Source excerpt: Use Zod for schema-based validation: Source excerpt: Use proper logging libraries instead

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

Files:

  • tests/lib/inspection.test.js
  • scripts/lib/inspection.js
Source excerpt: **console.log audit**: Check all modified files for `console.log` before session ends

📄 CodeRabbit inference engine (.cursor/rules/typescript-hooks.md)

Files:

  • tests/lib/inspection.test.js
  • scripts/lib/inspection.js
📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Run and pattern ordering now follows actual chronological timestamps, including timestamps with different UTC offsets, instead of comparing timestamp text.
    • Runs and patterns with valid timestamps appear before those with missing or invalid timestamps. Undated runs retain their input order, and their patterns keep null first- and last-seen values.
    • When patterns have equal counts, their order is determined by the same chronological timestamp rules.

Pattern detection now orders runs and equal-count patterns using parsed timestamps. Tests cover UTC offsets, skill-ID ordering, run-ID ordering, and groups with undated runs.

Changes: Pattern Ordering

Layer / File(s) Summary
Timestamp ordering and coverage
scripts/lib/inspection.js, tests/lib/inspection.test.js
Run ordering and equal-count pattern ordering use parsed timestamps. Invalid or missing timestamps sort after valid timestamps. Tests cover UTC offsets, skill-ID ordering, chronological run IDs, pre-epoch dates, and null timestamps.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 774df

The PR corrects timestamp ordering across UTC offsets. The reported firstSeen behavior predates this change, so no remaining merge risk is supported.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description directly explains the timestamp-ordering fix, missing-date behavior, regression coverage, and validation results.
Title check Passed The title clearly and concisely identifies the main change: chronological ordering of failure patterns.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments: 1
scripts/lib/inspection.js-82-82: 1

82-82: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Keep missing timestamps out of firstSeen.

If a group has one dated run and one run with createdAt: null, the 0 fallback sorts the null run last. Line 85 then reports firstSeen: null, even though the group has a known first timestamp. Sort undated runs separately and derive firstSeen and lastSeen from dated runs. Apply the same missing-date policy to the pattern comparison on Line 109.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: affaan-m/ECC/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 70928369-2e42-42a5-98a8-54bd77c0f3d7
📥 Commits

Reviewing files that changed from the base of the PR and between 76aaa77 and 075d55e.

📒 Files selected for processing: 2
  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout: 1
  • GitHub Check: Greptile Review
🧰 Additional context used
📚 Code guidelines: 4
.cursor/rules/typescript-security.md — unknown
.cursor/rules/common-hooks.md — unknown
.cursor/rules/typescript-coding-style.md — unknown
.cursor/rules/typescript-hooks.md — unknown
📓 Path-based instructions: 5
Focus on command injection, unsafe subprocess usage, path traversal, SSRF, secret exposure, and missing tests for new CLI behavior.

⚙️ CodeRabbit configuration file

Files:

  • scripts/lib/inspection.js
Source excerpt: Source excerpt: Use **security-reviewer** skill for comprehensive security audits

📄 CodeRabbit inference engine (.cursor/rules/typescript-security.md)

Files:

  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js
Source excerpt: Use with caution: Source excerpt: Use with caution: Enable for trusted, well-defined plans Source excerpt: Use with caution: Disable for exploratory work Source excerpt: Use with caution: Never use dangerously-skip-permissio...

📄 CodeRabbit inference engine (.cursor/rules/common-hooks.md)

Files:

  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js
Source excerpt: Use spread operator for immutable updates: Source excerpt: Use async/await with try-catch: Source excerpt: Use Zod for schema-based validation: Source excerpt: Use proper logging libraries instead

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

Files:

  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js
Source excerpt: **console.log audit**: Check all modified files for `console.log` before session ends

📄 CodeRabbit inference engine (.cursor/rules/typescript-hooks.md)

Files:

  • scripts/lib/inspection.js
  • tests/lib/inspection.test.js

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No outstanding findings block merging. The current comparison explicitly places missing dates after valid timestamps in both failure ordering and pattern tie-breaking.

Summary

Orders failures and equally frequent patterns by their actual timestamps instead of text order.

  • Failure patterns follow the actual order of their timestamps.

The previous finding is fully addressed in both comparisons. No new actionable issues were found. No outstanding findings block merging.

Reviews (2) · Last reviewed commit: "fix: sort missing inspection dates after..." · Reviewed by Greptile

Comment thread scripts/lib/inspection.js Resolved
@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: 774dfd689437515e6c289ed7b053a270694449fc

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 2 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: 774dfd689437515e6c289ed7b053a270694449fc

PR taxonomy review recommended (neutral)

Detected 1 PR taxonomy bucket(s): CI/CD Recommendation.

Scanned 2 changed file(s).

Roadmap taxonomy buckets:

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 1 CI or workflow path(s) changed

Paths:

  • tests/lib/inspection.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: 774dfd689437515e6c289ed7b053a270694449fc

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 2 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: 774dfd689437515e6c289ed7b053a270694449fc

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@haelyra

haelyra commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Thank you for ordering inspection failure patterns by actual time. We carried your contribution into #3654 with attribution and the related follow-up fixes. That integration merged as e494799, and the resulting main passed CI, CodeQL, and Supply-Chain Watch. I’m closing this source PR as delivered. We appreciate your work and hope you’ll keep contributing.

@haelyra haelyra closed this Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants