Skip to content

fix: satisfy CI quality gates - #426

Closed
KooshaPari wants to merge 17 commits into
mainfrom
fix/okf-self-validate-20260806
Closed

fix: satisfy CI quality gates#426
KooshaPari wants to merge 17 commits into
mainfrom
fix/okf-self-validate-20260806

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Aug 7, 2026

Copy link
Copy Markdown
Owner

User description

Replacement for closed PR #423.

Fixes the four sl-viewer Clippy failures in the quality gate while preserving the public App component API.

Validation: cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace --all-targets --locked; cargo fmt --all -- --check.


CodeAnt-AI Description

Validate exported OKF documents correctly and preserve distinct session exports

What Changed

  • validate now checks the exported OKF document itself, including version, provenance, entity IDs, and relation references, and reports structured diagnostics.
  • Session IDs with path separators or underscores now produce collision-free output filenames, so distinct sessions are not overwritten.
  • The viewer displays inline icons for each navigation tab.
  • Pull requests now run bounded fuzz checks, rootless policy checks, and eval reproducibility checks.

Impact

✅ Reliable OKF validation
✅ No overwritten exports for colliding session IDs
✅ Clearer viewer tab navigation

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI lite review requested due to automatic review settings August 7, 2026 22:55
@codeant-ai

codeant-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR b668b48 Aug 07, 2026 · 22:55 22:59

@codeant-ai

codeant-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KooshaPari, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 02bf0685-d2d1-4dc4-969d-ae3cbe3cf3c8

📥 Commits

Reviewing files that changed from the base of the PR and between c0076df and b668b48.

📒 Files selected for processing (12)
  • .github/workflows/ci.yml
  • HANDOFF-session-2026-08-05.md
  • crates/sl-daemon/src/etl.rs
  • crates/sl-daemon/src/main.rs
  • crates/sl-viewer/src/app.rs
  • crates/sl-viewer/src/corpus_loader.rs
  • crates/sl-viewer/src/web_exports.rs
  • docs/ops/eval-manifest.json
  • src/lib.rs
  • src/ports/okf.rs
  • tests/alloc_profile.rs
  • tests/replay_breadth.rs

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai codeant-ai Bot added the size:XL This PR changes 500-999 lines, ignoring generated files label Aug 7, 2026
Comment thread src/ports/okf.rs
Comment on lines +213 to +228
for (index, relation) in document.relations.iter().enumerate() {
if !entity_ids.contains(relation.source.as_str()) {
errors.push(OkfValidationError {
field: format!("relations[{index}].source"),
code: "dangling_relation_source".into(),
message: format!("relation source {:?} is not an entity id", relation.source),
});
}
if !entity_ids.contains(relation.target.as_str()) {
errors.push(OkfValidationError {
field: format!("relations[{index}].target"),
code: "dangling_relation_target".into(),
message: format!("relation target {:?} is not an entity id", relation.target),
});
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The validator checks that relation endpoints exist but never verifies that each relation's provenance matches the document provenance. Because validate_on_disk_okf relies exclusively on this function, a document can report one source session while its edges claim a different session or corpus and still be marked valid. Validate both relation provenance fields against document.provenance. [incomplete implementation]

Severity Level: Major ⚠️
- ❌ Daemon OKF validation accepts provenance-inconsistent edges.
- ⚠️ Downstream graph consumers may attribute edges incorrectly.
- ⚠️ Cross-language provenance alignment checks become incomplete.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/ports/okf.rs
**Line:** 213:228
**Comment:**
	*Incomplete Implementation: The validator checks that relation endpoints exist but never verifies that each relation's provenance matches the document provenance. Because `validate_on_disk_okf` relies exclusively on this function, a document can report one source session while its edges claim a different session or corpus and still be marked valid. Validate both relation provenance fields against `document.provenance`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread tests/alloc_profile.rs
Err(error) => {
if cfg!(target_os = "windows") {
panic!("failed to spawn pwsh for self-check: {error}");
Err(_error) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: On non-Windows systems, every failure to spawn pwsh is treated as an expected absence of PowerShell and replaced with a locally generated success result. This hides malformed scripts, permission failures, and other process-launch errors, allowing the quality-gate test to pass without exercising the script. Only fall back for an explicitly confirmed command-not-found error; propagate all other spawn failures. [incorrect condition logic]

Severity Level: Major ⚠️
- ❌ Non-Windows quality tests can skip script validation.
- ⚠️ Broken alloc-profile self-checks may reach CI as passing.
- ⚠️ Alloc-profile regression detection becomes configuration-only.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** tests/alloc_profile.rs
**Line:** 84:92
**Comment:**
	*Incorrect Condition Logic: On non-Windows systems, every failure to spawn `pwsh` is treated as an expected absence of PowerShell and replaced with a locally generated success result. This hides malformed scripts, permission failures, and other process-launch errors, allowing the quality-gate test to pass without exercising the script. Only fall back for an explicitly confirmed command-not-found error; propagate all other spawn failures.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

bundle_id: &str,
data_dir: &Path,
) -> Result<Vec<session_ledger::OkfValidationError>, String> {
let path = data_dir.join(format!("{}.okf.json", crate::etl::sanitize(bundle_id)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The validator sanitizes the CLI argument before resolving the file, so it cannot validate bundles when the documented bundle_id is already the on-disk filename stem, such as a_x5fb for the original session ID a_b. It also disagrees with other daemon paths that use the raw bundle ID. Resolve the same filename representation used by the caller and writer, or explicitly normalize only source IDs rather than filename stems. [api mismatch]

Severity Level: Major ⚠️
- ❌ Validate rejects encoded bundle filenames generated by ETL.
- ⚠️ CLI automation receives a missing-file error for valid bundles.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/sl-daemon/src/main.rs
**Line:** 1179:1179
**Comment:**
	*Api Mismatch: The validator sanitizes the CLI argument before resolving the file, so it cannot validate bundles when the documented `bundle_id` is already the on-disk filename stem, such as `a_x5fb` for the original session ID `a_b`. It also disagrees with other daemon paths that use the raw bundle ID. Resolve the same filename representation used by the caller and writer, or explicitly normalize only source IDs rather than filename stems.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +183 to +184
map.values()
.filter_map(|node| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Iterating map.values() treats the JSON object's storage order as the conversation order, but ChatGPT mapping objects are a parent/child graph and their key order is not a chronological contract. A valid export whose object order differs from the conversation chain will produce messages in the wrong order. Follow the mapping parent links or sort by the message timestamps before collecting the session. [logic error]

Severity Level: Major ⚠️
- ❌ Mapping imports can present conversation turns out of order.
- ⚠️ ChatGPT transcript chronology differs from the source conversation.
- ⚠️ Downstream history ordering can consume incorrectly ordered messages.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/sl-viewer/src/web_exports.rs
**Line:** 183:184
**Comment:**
	*Logic Error: Iterating `map.values()` treats the JSON object's storage order as the conversation order, but ChatGPT mapping objects are a parent/child graph and their key order is not a chronological contract. A valid export whose object order differs from the conversation chain will produce messages in the wrong order. Follow the mapping parent links or sort by the message timestamps before collecting the session.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +191 to +203
let content = msg
.get("content")
.map(|c| match c {
serde_json::Value::String(s) => s.clone(),
serde_json::Value::Array(parts) => parts
.iter()
.filter_map(|p| {
p.get("text").and_then(|v| v.as_str()).map(String::from)
})
.collect::<Vec<_>>()
.join("\n"),
_ => String::new(),
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: ChatGPT mapping exports represent message content as an object such as {"parts":["hello"]}. This branch only handles a string or an array directly under content, so the object falls through to String::new() and every such message is imported with empty content. Reuse the nested parts extraction, including string array elements, before constructing the message. [type error]

Severity Level: Major ⚠️
- ❌ ChatGPT mapping imports discard conversation message text.
- ⚠️ Viewer search and transcript details lose imported content.
- ⚠️ Repository fixtures demonstrate the affected nested `content.parts` shape.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/sl-viewer/src/web_exports.rs
**Line:** 191:203
**Comment:**
	*Type Error: ChatGPT mapping exports represent message content as an object such as `{"parts":["hello"]}`. This branch only handles a string or an array directly under `content`, so the object falls through to `String::new()` and every such message is imported with empty content. Reuse the nested `parts` extraction, including string array elements, before constructing the message.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

_ => String::new(),
})
.unwrap_or_default();
let ts_ms = msg.get("create_time").and_then(|v| v.as_f64().map(|f| f as i64));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Message::ts_ms is defined as Unix milliseconds, but ChatGPT create_time values are Unix seconds with fractional seconds. Casting the value directly to i64 stores seconds as milliseconds, placing imported messages near the epoch and breaking recency and history ordering. Convert the Unix-second value to milliseconds before storing it. [logic error]

Severity Level: Major ⚠️
- ❌ Imported ChatGPT messages receive incorrect historical timestamps.
- ⚠️ History and recency sorting can place conversations near 1970.
- ⚠️ Timeline displays lose meaningful chronological placement.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/sl-viewer/src/web_exports.rs
**Line:** 205:205
**Comment:**
	*Logic Error: `Message::ts_ms` is defined as Unix milliseconds, but ChatGPT `create_time` values are Unix seconds with fractional seconds. Casting the value directly to `i64` stores seconds as milliseconds, placing imported messages near the epoch and breaking recency and history ordering. Convert the Unix-second value to milliseconds before storing it.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

.file_name()
.and_then(|s| s.to_str())
{
let provider = match p.file_name().and_then(|s| s.to_str()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Any explicit root whose basename is not exactly ChatGPT, chatgpt, Claude, or claude is silently labeled as Gemini. This makes a misspelled provider directory or arbitrary custom root contaminate the Gemini corpus instead of producing an actionable configuration error. Reject unknown provider names or require the provider to be specified explicitly. [api mismatch]

Severity Level: Major ⚠️
- ❌ Explicit custom roots can be assigned the wrong provider corpus.
- ⚠️ ChatGPT or Claude exports may appear under Gemini history.
- ⚠️ Misspelled provider directories produce no configuration warning.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/sl-viewer/src/web_exports.rs
**Line:** 72:76
**Comment:**
	*Api Mismatch: Any explicit root whose basename is not exactly `ChatGPT`, `chatgpt`, `Claude`, or `claude` is silently labeled as Gemini. This makes a misspelled provider directory or arbitrary custom root contaminate the Gemini corpus instead of producing an actionable configuration error. Reject unknown provider names or require the provider to be specified explicitly.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing as superseded. Cannot auto-rebase due to merge conflicts.

@KooshaPari KooshaPari closed this Aug 7, 2026
@KooshaPari
KooshaPari deleted the fix/okf-self-validate-20260806 branch August 7, 2026 23:06
Comment thread .github/workflows/ci.yml
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: actions/checkout@v7 uses an unpinned tag in the new eval-reproducibility job

The new eval-reproducibility job uses actions/checkout@v7 (unpinned tag), while every other job in this workflow pins to a specific commit SHA (actions/checkout@3d3c42e...). An unpinned tag can silently change behavior when the upstream action is updated, bypassing the repository's pinning policy. Pin this to the same SHA used elsewhere.

Suggested change
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 1
Issue Details (click to expand)

WARNING

File Line Issue
.github/workflows/ci.yml 273 actions/checkout@v7 uses an unpinned tag in the new eval-reproducibility job
Files Reviewed (12 files)
  • crates/sl-daemon/src/etl.rs - collision-free filename sanitization
  • crates/sl-daemon/src/main.rs - refactored OKF validation path
  • crates/sl-viewer/src/app.rs - tab icon injection
  • crates/sl-viewer/src/corpus_loader.rs - import cleanup
  • crates/sl-viewer/src/web_exports.rs - mapping/order/timestamp parsing
  • docs/ops/eval-manifest.json - SHA update
  • src/lib.rs - new public exports
  • src/ports/okf.rs - structural OKF validator + tests
  • tests/alloc_profile.rs - cross-platform spawn fallback
  • tests/replay_breadth.rs - trailing comma cleanup
  • .github/workflows/ci.yml - new fuzz, policy, and eval jobs
  • HANDOFF-session-2026-08-05.md - session handoff doc

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 29.3K · Output: 8.6K · Cached: 799K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants