Skip to content

test(viewer): session-ledger heuristic context + contract extractor proptest surfaces (WBS-6.2 #464 #465) - #483

Closed
KooshaPari wants to merge 6 commits into
mainfrom
fix/viewer-mock-data-properties-20260809
Closed

test(viewer): session-ledger heuristic context + contract extractor proptest surfaces (WBS-6.2 #464 #465)#483
KooshaPari wants to merge 6 commits into
mainfrom
fix/viewer-mock-data-properties-20260809

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Aug 10, 2026

Copy link
Copy Markdown
Owner

User description

WBS-6.2 surface 4/5: session-ledger distill pipeline P2 adapters.

Branch off rebased main. Test files compile and pass locally.


CodeAnt-AI Description

Add property-based tests that verify session-ledger context and contract data stays complete, consistent, and deterministic

What Changed

  • Added coverage for context extraction, including session metadata, file paths, decisions, symbols, environment notes, case-insensitive matching, and duplicate removal
  • Added coverage for contract extraction, including criteria, verification steps, constraints, do-not-touch rules, formatting, case-insensitive matching, and duplicate removal
  • Verified empty and whitespace-only sessions, deterministic results, consistent trait-based extraction, and accurate empty-state reporting
  • Updated the changelog, traceability records, and WBS evidence for both extractor surfaces

Impact

✅ Fewer missing session context details
✅ Fewer stale acceptance contracts
✅ Consistent session-ledger extraction results

💡 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.

SessionLedger Bot added 6 commits August 9, 2026 22:59
…6.2 #460)

Adds crates/sl-viewer/tests/properties_session_ledger_worklog.rs
with 11 proptest properties pinning the session-ledger worklog
projector (crash-recovery / lost-work pipeline):

* Empty sessions project None.
* Final Role::User turn -> AwaitingAssistantResponse.
* Final Role::Tool / Role::Subagent -> InterruptedExecution.
* Final assistant turn with one of the 9 documented completion
  markers (complete / completed / done / [completed] /
  <completed> / status: complete / status: completed /
  task complete / task completed) projects None.
* Final assistant turn without any marker projects as
  MissingCompletionMarker.
* UnfinishedWorkItem carries the originating session id, corpus,
  and message_count.
* summary never exceeds 241 chars and is single-line.
* project_unfinished_work returns one item per unfinished
  session in input order and is deterministic.
* WorklogProjection::from_session carries message_count and
  matches detect_unfinished exactly.

Updates WBS-6.2 evidence list, TRACEABILITY.json, and CHANGELOG.
…-6.2 #461)

Adds crates/sl-viewer/tests/properties_session_ledger_export.rs with
8 proptest properties pinning session_ledger::export_to_okf
(the OKF v1 export pipeline entry point):

* export_to_okf always produces okf = "1.0" and propagates
  bundle.source_id into source_id + provenance.source_id.
* export_to_okf propagates the corpus arg into provenance.corpus.
* Empty bundles yield zero entities / relations / tags.
* Every exported document passes validate_okf_document.
* export_to_okf is deterministic across calls.
* Intent bundles emit exactly one goal entity (label = goal),
  one acceptance entity per acceptance signal, one constraint
  entity per constraint.
* Context bundles emit exactly one resource entity when cwd is
  present.
* Acceptance bundles emit exactly one gate entity with
  label = "resume-gate" and properties.ready = true /
  scope_sized = true.
* The exporter never produces duplicate entity ids across
  mixed intent / context / acceptance / contract bundles.

Updates WBS-6.2 evidence list, TRACEABILITY.json, and CHANGELOG.
#462)

Adds crates/sl-viewer/tests/properties_session_ledger_distill.rs
with 9 proptest properties pinning session_ledger::distill::compile
and compile_and_store:

* compile(session) always produces a bundle whose source_id
  equals session.id.
* compile(session) always produces an injectable bundle
  (carries an Acceptance slice) — the load-bearing contract
  for resume.
* compile(session) always emits one slice for every documented
  kind (Acceptance / Intent / Context / Contract / Provenance /
  Worklog) — even when the session is empty.
* compile(session) always returns a bundle whose
  total_token_estimate() equals the sum of per-slice
  token_estimate values.
* compile(session) is deterministic across calls.
* The Worklog slice body deserializes to a WorklogProjection
  whose message_count equals session.messages.len().
* compile_and_store returns an injectable bundle with the
  input source_id.
* compile_and_store writes exactly 3 episodic memories
  (intent / contract / context) to the memory store.
* compile_and_store is deterministic across fresh stores.

Updates WBS-6.2 evidence list, TRACEABILITY.json, and CHANGELOG.
…ace (WBS-6.2 #463)

Adds crates/sl-viewer/tests/properties_session_ledger_intent.rs
with 10 proptest properties pinning
session_ledger::distill::extractor::HeuristicIntentExtractor::extract_intent
(the P1 SSOT for what the user wants — drives resume prompt,
search index, and wiki/docs view):

* user_turn_count always equals the count of Role::User messages
  and ignores Assistant / Subagent / Tool / System messages.
* Empty sessions produce an empty Intent.
* Repeated acceptance / constraint patterns are deduplicated.
* Every documented acceptance pattern (16) and every documented
  constraint pattern (19) is recognized in any user message.
* Labeled Goal: / Objective: / Task: lines win over preamble.
* Labeled Constraint: / Requirement: / Boundary: lines carry
  their full text.
* extract_intent is deterministic across calls.

Updates WBS-6.2 evidence list, TRACEABILITY.json, and CHANGELOG.
Copilot AI lite review requested due to automatic review settings August 10, 2026 06:18
@codeant-ai

codeant-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 26f3cb7 Aug 10, 2026 · 06:19 06:21

@codeant-ai

codeant-ai Bot commented Aug 10, 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

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 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 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: 49 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: 06f93305-5a1b-4de3-b97d-ef3a668384e2

📥 Commits

Reviewing files that changed from the base of the PR and between 5d2c60c and 26f3cb7.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • crates/sl-viewer/tests/properties_session_ledger_context.rs
  • crates/sl-viewer/tests/properties_session_ledger_contract.rs
  • docs/ops/TRACEABILITY.json
  • docs/ops/WBS.md

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.

KooshaPari added a commit that referenced this pull request Aug 12, 2026
Adds the viewer context and contract proptest evidence surface that completes the WBS-6.2 #483 #464 #465 #466 handoff.
@KooshaPari KooshaPari closed this Aug 12, 2026
@KooshaPari
KooshaPari deleted the fix/viewer-mock-data-properties-20260809 branch August 12, 2026 08:38
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