Skip to content

v0.1.0b2 - #220

Open
giovannivolpe wants to merge 158 commits into
mainfrom
develop
Open

giovannivolpe wants to merge 158 commits into
mainfrom
develop

Conversation

@giovannivolpe

Copy link
Copy Markdown
Member

No description provided.

giovannivolpe and others added 30 commits November 25, 2026 23:44
…ting

## Overview

This PR extends KíLín's existing tracing infrastructure to support the future implementation of reproducible system testing.

The main objective is to establish a complete, chronologically ordered trace architecture across all conversations within a project, while preserving the existing hierarchical trace format, conversation persistence mechanisms, and concurrency behavior.

This is PR0A, the first in a series of PRs introducing system-testing capabilities into KíLín.

## Main changes

- Introduce a dedicated project-level trace (`logs/traces/project.json`) alongside the existing conversation traces.
- Introduce persistent, project-wide event sequence numbers shared across project and conversation traces and preserved across sessions.
- Extend the trace format to retain explicit event types, event identifiers, correlation metadata, and the sequence numbers and timestamps of both operation starts and completions.
- Separate project-level and conversation-level trace ownership within the GUI engine.
- Use short-lived locks for shared project-trace writes and sequence allocation, preserving the existing exclusive conversation ownership mechanism.
- Prevent duplication of numbered events when conversations are archived.
- Introduce recording-health metadata to support the future detection of incomplete traces.
- Document the trace architecture and extend the automated test suite.

## Design considerations

The implementation extends the existing tracing infrastructure rather than introducing a separate recording mechanism or operation journal.

A small persistent `.sequence.json` file coordinates project-wide event numbering across independent processes. It contains coordination and recording-health metadata only, without duplicating diagnostic events.

The existing hierarchical trace representation and conversation checkpoint contracts are preserved. Tracing remains part of ordinary KíLín operation and does not require a dedicated system-testing mode.

As KíLín is still in prerelease, backward compatibility with earlier diagnostic trace formats is not required for future system-test replay.

## Scope

This PR focuses exclusively on the underlying trace architecture. It does not introduce workspace replay or comparison functionality.

Subsequent PRs will:

- **PR0B:** Complete project operation tracing, including source imports, configuration, and indexing.
- **PR0C:** Complete conversation operation tracing, including feedback and interactive user choices.
- **PR1:** Introduce workspace inspection, trace validation, and chronological timeline reconstruction.
- **PR2:** Implement full workspace replay through the existing `ChatEngine`.
- **PR3:** Introduce quantitative comparisons and system-testing notebooks.

## Verification

The implementation has been checked against baseline commit `a735668`.

- All six modified baseline files verified against their original Git blob hashes.
- Clean patch application.
- Python syntax checks passed.
- All 33 targeted tests passed under both pytest and unittest.
- Concurrent sequence allocation tested across independent processes and threads.
- Existing conversation ownership and GUI resume tests preserved.
- No existing tests or files removed.

The complete repository test suites (`pytest` and `python -m tests`) should be executed before merging.
File	Correction
kilin/trace_logging.py	Track unpublished events and avoid unnecessary writes
kilin/_trace_project.py	Complete NumPy-style documentation
kilin/gui/engine.py	Correct the active-trace documentation
docs/README.md	Register the new reference page
docs/module_map.md	Register the new module and update the module count
docs/trace_architecture.md	Make the documentation permanent and independent of PR numbering
docs/trace_recording.md	Document shared event numbering
docs/conversation_ownership.md	Clarify shared trace ownership and archival
tests/kilin/test__trace_project.py	Restore standard lint directives
tests/kilin/test_trace_logging__project.py	Restore lint directives and add r
## Overview

This PR builds on the project-wide trace architecture to record the operations affecting a project's configuration, sources, indexes, and lifecycle.

## Main changes

- Record initial source imports after safe workspace reservation.
- Record exact historical source selections, import batches, managed destinations, and synchronization decisions.
- Include source content manifests in indexing diagnostics.
- Distinguish explicit creation settings from inherited defaults.
- Record project configuration changes and lifecycle operations.
- Route project-level diagnostics to the shared project trace while preserving conversation-specific diagnostics and checkpoints.
- Adapt trace-based performance benchmarking to the separated diagnostic scopes.
- Extend regression tests and update the corresponding documentation.

The implementation reuses the existing hierarchical trace infrastructure without introducing a separate operation journal.

## Verification

Both complete test suites have been executed. All tests pass except the existing public-API import failure caused by the unavailable `olefile` dependency in the verification environment. Patch application, documentation conventions, and packaging checks pass.

## Scope

This PR completes project operation tracing. Conversation-operation tracing, recording validation, workspace replay, and quantitative comparisons remain the responsibility of subsequent PRs.
Implemented functionality
PR0C completes the conversation-operation recording layer required for future workspace replay.
Operation	Recorded information
Conversation creation	New or reused conversation, original identity
Branching	Parent conversation, original checkpoint, inherited turn count
Conversation selection	Previous and selected identities, including no-op selections
Renaming	Requested name and committed metadata
Automatic titles	Generated title, distinguished from explicit renaming
Deletion	Archived path, deleted identity and replacement conversation
Reset	Previous conversation and newly created conversation
Questions	Exact request, requested settings, effort selection and resolved configuration
Interactive choices	Offered options, selected label and index, response and interaction identity
Plan confirmation	Proposed plan, confirmation policy and actual decision
Feedback	Message UUID, role, requested mutation and committed rating
Memory exclusion	Requested exclusion and committed state
Memory synchronization	Manual or automatic trigger, eligible records and index metadata

Conversation management operations are recorded in the shared project.json. Question-specific operations remain in their respective conversation traces.
3. Important implementation details
Persistent conversation and turn identities. Branches retain the UUIDs of inherited turns. The recording distinguishes inherited history from newly submitted questions, allowing the future replay implementation to avoid asking the same questions again.

Interactive decisions. Each proposal and response shares an interaction ID. Both the numerical index and the selected option's text are retained. Automatic decisions, user responses and callback failures are distinguishable. This prepares replay to match the original choice by meaning rather than button position.

Requested and effective question settings. The recording distinguishes the original question request from its resolved model, retrieval depth and generation settings. For complete GUI settings submissions, differences from the saved project profile are classified as explicit overrides. As with PR0B, reaffirming an unchanged default is not independently observable.

Memory operations. Explicit feedback changes and manual memory synchronization are recorded at project level. Automatic synchronization during answering remains correlated with the corresponding turn. Memory diagnostics retain record identities, fingerprints, priorities and origins without duplicating message texts or embedding vectors.

Recording completeness. I introduced a separate operation_recording_version marker at project creation. This distinguishes newly recorded reference experiments from older workspaces with incomplete operation histories. It does not replace the structural trace-format version or constitute proof of recording completeness.

Existing workspaces are not migrated or marked retrospectively as complete.
## Summary

Several failure paths could leave tracing and core lifecycle behavior inconsistent: a missing project counter could restart numbering despite surviving traces, conversation switching could accept incompatible tracing activation, and strict creation-trace failures could occur after a workspace had already been published.

This PR closes those gaps and fixes a pre-existing RAG initialization cleanup defect.

## Changes

- Recognize project-numbered traces under custom JSON filenames and extension case variants when checking a missing sequence counter. Propagate history traversal failures and reject linked history paths instead of treating inaccessible history as absent.
- Reject conversation switches whose tracing activation differs from the shared project sink before changing paths, state, or ownership.
- Complete and close an owned workspace-creation trace before profile publication, keeping strict diagnostic failures inside the creation rollback boundary.
- Preserve the initiating exception when trace cleanup also fails.
- Close constructed model sessions when final readiness diagnostics or progress callbacks fail during RAG initialization.
- Document trace ownership, publication boundaries, and the distinction between a persisted core answer and a later GUI notification failure.

Normal sequence allocation with an existing counter performs no history scan. Caller-owned sinks retain their existing lifetime, and imports into existing projects retain their cumulative behavior.

## Validation

- Full pytest suite: 3,661 passed, 41 skipped; 8,169 subtests passed.
- Independent unittest runner: 3,676 tests run; OK, 18 skipped.
- Added 18 regression test methods while preserving existing tests and assertions.
- Passed documentation/style checks, wheel and source-distribution builds, distribution checks, and isolated installed-wheel resource checks.
- Verified clean patch application against commit `46de362d4fa6706832557e4e61dcf4f5adaffd08` and byte-for-byte agreement between the patch, changed-files ZIP, and tested source.

Validation was performed on Linux with Python 3.12.14. Native macOS, real model backends, and Qt integration remain subject to their usual environment-specific checks.
Optimize project-configuration recording by replacing repeated unchanged configuration snapshots with compact references to the latest complete snapshot.

- Preserve individual configuration events, global sequence numbers, timestamps, and operation associations.
- Record complete snapshots whenever the effective configuration changes, including workspace relocations.
- Use deterministic configuration encoding and SHA-256 digests to support reference integrity verification.
- Synchronize configuration comparison and publication using the existing project-trace locking mechanism.
- Preserve recording integrity, failure-handling semantics, and compatibility with existing full-snapshot recordings.
- Add independent regression tests covering repeated activations, configuration changes, concurrent writers, and recording failures.
- Update the trace architecture documentation.

Controlled benchmarks show a 66.9% reduction in project-trace size and a 39.6% reduction in configuration-recording time across ten unchanged workspace activations, without reducing the number of recorded events or trace writes.

Verified locally with 45 tests and 38 subtests.
reference_example.py builds check, planted and suggestion projects from the committed article corpus, asks reference_check and suggest_reference at temperature 0 with every claim checked, and scores reference matching, citation detection, planted-miscitation verdicts and suggestion ranks
against reference_annotations.json. The suggestion project leaves out the article, so it cannot suggest itself.
The article, its planted copy and the cited works share one project for both reference checks; the cited works alone form the suggestion project, since suggest_reference cannot be told to leave out the article and its copy.
make_planted.py reads the article as KíLín reads the PDF, changes eight citation numbers (six to unrelated works, two to related ones), writes tiunn26braph2_planted.txt and records the changes in reference_annotations.json. A text copy keeps the sentences as KíLín reads them; editing the PDF split the edited lines into separate blocks.
prepare_code_project now sets temperature 0 and the download policy through configure_project instead of editing profile.ini, so the code example, its no-retrieval baseline and paper_numbers all generate deterministically. Both scripts record the temperature in their results.
Both examples now generate as a new project in the app does: the code example at the code type's temperature and the reference example at the literature type's. The scripts write that value into their sandbox workspaces and record it in the results. The reference example no longer overrides the temperature per question.
Add the callers that appeared since October (_answer_sentences, RAGSession._source_passages, reference_check's _choose_list and _second_look), narrow strip_thinking_callers to answering.py since strip_thinking now has 19 callers, and correct facts where the code changed. The evaluation questions keep their wording.
code_example.py, paper_numbers.py and reference_example.py take --router-model and save it in their sandbox projects, as choosing the intent model in the app's project settings does. Without the option the packaged default is saved. The results record the router model used.
Fifteen sentences in four groups: tools, uses and results (one work states each) and background (several works support each, all listed as acceptable). Papers with the same verdict and score now share a rank and are reported as a tie, and the summary counts each group separately.
Nine questions now start with "Explain", and four name the function they ask about. Each question marks its core facts (core_facts), which the grading worksheet labels.
All 45 questions now start with "Explain" and ask about the code. The development and evaluation sets are dropped, since the questions are examples rather than a held-out benchmark. A passage of a class whose lines contain a whole gold method now counts for that method.
Updated Traces to Make Them Exhaustive
…tion reconstruction

This PR introduces the `kilin.system_testing` package, building on the comprehensive recording infrastructure developed in PR0A–PR0C.

The objective is to establish a model-independent mechanism for inspecting recorded workspaces, validating their completeness and consistency, and reconstructing the chronological sequence of operations required for reproducible system testing.

This PR establishes the foundation for subsequent workspace replay and quantitative comparison.

- Introduce the `Experiment` class as the public entry point for system testing.
- Implement a trace reader that reconstructs individual events from the existing hierarchical project and conversation traces.
- Validate recording versions, event identities, sequence continuity, span relationships, and recording completeness.
- Validate historical source imports, managed source inventories, content hashes, and indexing operations.
- Reconstruct project configuration and distinguish explicit settings overrides from inherited defaults.
- Reconstruct conversation lifecycles, including creation, selection, branching, renaming, deletion, and reset.
- Validate question requests, effective generation settings, persisted turns, and conversation checkpoints.
- Validate interactive decisions, including plan confirmations and semantic option selections.
- Validate feedback, memory exclusions, and memory synchronization operations.
- Distinguish blocking recording inconsistencies from nonblocking environmental differences.
- Introduce structured validation reports and chronological operation timelines.
- Document the system-testing architecture, public API, and reference workspace preparation protocol.

```python
from pathlib import Path

from kilin.system_testing import Experiment

experiment = Experiment(
    Path("workspaces/010_literature_original")
)

report = experiment.validate()

if report.valid:
    timeline = experiment.timeline()
```

The validation report exposes blocking issues, nonblocking warnings, decoded events, and the candidate operation history.

Timeline reconstruction raises `InvalidRecordingError` when the recording does not satisfy the validation requirements. The exception retains the validation report for further inspection.

The implementation is strictly read-only with respect to the reference workspace. It does not initialize models, start the GUI, download resources, create lock files, or modify recorded data.

Validation relies on the existing project and conversation traces rather than introducing a separate recording mechanism. Historical source integrity is checked against the managed workspace copies, allowing reference workspaces to be transferred between computers without requiring access to the original external source locations.

Inherited conversation turns are distinguished from newly submitted questions. Automatically generated conversation titles are retained as diagnostic observations rather than interpreted as explicit user operations.

The implementation also distinguishes durable core operations from subsequent GUI notification failures. A persisted answer remains represented in the candidate timeline even when the enclosing GUI request reports a failure, although such a recording is rejected for replay.

Missing or inconsistent recording information is reported explicitly. The validator does not attempt automatic repairs, legacy migrations, or speculative reconstruction.

Environmental differences are reported as warnings rather than treated as recording failures.

- Introduce five production modules under `kilin/system_testing`.
- Introduce dedicated system-testing regression tests.
- Add system-testing reference documentation and update the documentation index and module map.
- Preserve all existing production modules and tests without modification.

No existing files are removed, and no new runtime dependencies are introduced.

The new regression tests exercise recorded operations through the existing `ChatEngine`, using deterministic model substitutes alongside actual source scanning, chunking, indexing, and conversation persistence.

Verification includes:

- All 20 new system-testing tests passing under pytest and unittest.
- All 47 focused system-testing, documentation, and style tests passing, including 366 documentation subtests.
- Reference workspace preservation and relocation.
- Historical source integrity and malformed-recording rejection.
- Conversation lineage, archived conversations, and interactive decision validation.
- Wheel build and inclusion of the new package.
- Clean patch application and byte-for-byte equivalence between the patch and delivered replacement files.

Both complete test runners were executed before the final validator refinement. Their only failure was caused by the unavailable `olefile` dependency in the verification environment. The final refinement and additional regression tests passed subsequent focused verification.

Complete local verification under the supported Python 3.12 environment remains necessary before merging.

This PR deliberately does not implement workspace replay, model execution, or quantitative comparison.

The remaining development stages are:

- **PR2 — Workspace replay:** Reproduce validated operation histories through the existing `ChatEngine`, generating fresh indexes, answers, and outputs in a separate workspace.
- **PR3 — Quantitative comparison and system-testing notebooks:** Compare original and replayed workspaces and provide reproducible evaluation notebooks.

Before implementing replay, the validator should be exercised on reference workspaces recorded using real models and representative project types. Any recording omissions discovered during this process should be addressed explicitly in the recording infrastructure rather than compensated for through speculative reconstruction.
This PR introduces the second stage of the KíLín system-testing framework: the automatic reproduction of a recorded workspace using the current version of KíLín.

Building on the exhaustive trace recording and the validation and timeline reconstruction introduced in PR1, PR2 reproduces the chronological sequence of user operations in a separate workspace.

The objective is to enable systematic regression testing of KíLín across versions, using realistic workflows rather than isolated questions, while preserving the original reference workspaces.

- **Use ordinary KíLín execution paths.** Replay operates through the existing synchronous `ChatEngine`, without launching the desktop GUI or introducing an alternative implementation of the answering, indexing or conversation workflows.
- **Preserve the original workspace.** All reproduced operations take place in a separate workspace. The original workspace is never modified.
- **Reproduce operations, not results.** Answers, indexes, source cards, conversation titles and generated outputs are produced afresh.
- **Preserve chronological dependencies.** Sources become available at their recorded import stages, and conversations and questions are reproduced in their original chronological order.
- **Use current defaults.** Explicit user overrides are reproduced, while inherited settings follow the defaults of the current KíLín version. Differences in effective settings are reported.
- **Fail explicitly.** Unexpected interactions, incompatible decisions and inconsistent operation outcomes stop the replay rather than triggering speculative reconstruction or silent recovery.

Extend `kilin.system_testing.Experiment` with a `replay()` method that validates the original recording and executes its reconstructed timeline.

The replay supports:

- Project creation, closure and reopening.
- Initial and subsequent source imports.
- Additive source synchronization.
- Questions, including explicit generation settings and effort selections.
- Interactive choices and tool confirmations.
- Conversation creation, selection, renaming, branching, deletion and reset.
- Answer feedback and conversation-memory exclusions.
- Manual memory synchronization.
- Source-card regeneration.

Reconstruct historical source-import batches using the retained source files in the original workspace.

Preserve the recorded file selections, relative directory structures and collision-adjusted filenames, without copying historical indexes or generated artifacts.

Files that were never retained in the original workspace cannot necessarily be reconstructed. Such limitations are reported explicitly.

Reproduce recorded user decisions by matching their meaning rather than relying on positional option indices.

Reordered choices are supported when the recorded selection remains uniquely identifiable. Unexpected, ambiguous or incompatible interactions terminate the replay.

Maintain explicit mappings between original and replayed conversation identifiers and turn UUIDs.

These mappings preserve the relationships required for branching, feedback and memory exclusions, and provide the basis for the comparison functionality planned for PR3.

Introduce structured replay results containing the reproduced workspace, operation count, validation results, identifier mappings and recorded differences.

If replay fails, retain the partially reproduced workspace and report the failing operation and the number of completed operations.

Existing destination workspaces are protected against accidental overwriting.

Extend the system-testing documentation with the replay workflow, notebook examples, supported operations, settings precedence, failure handling and reconstruction limitations.

```python
from kilin.system_testing import Experiment

experiment = Experiment("010_literature_original")

experiment.validate().raise_for_errors()

result = experiment.replay(
    progress=lambda i, n, op: print(f"{i}/{n}: {op.kind}")
)

print(result.workspace)
print(result.operation_count)
print(result.validation.valid)
```

The original and reproduced workspaces can subsequently be opened and inspected independently through the ordinary KíLín GUI.

During implementation, a pre-existing working-directory dependency was identified in `ChatEngine.settings()`: requesting new-project defaults from a directory containing `profile.ini` can inadvertently return settings from that workspace.

This PR introduces a replay-specific safeguard and regression test to prevent this behavior from silently compromising system-testing experiments. The underlying GUI behavior remains unchanged and should be addressed separately.

- Added 14 regression tests covering chronological replay, progressive source imports, conversation branching, identity mapping, interaction matching, settings precedence, failure handling and workspace protection.
- Final focused verification: 61 tests and 368 documentation subtests passed.
- Independent unittest execution: all 14 new replay tests passed.
- Full pytest suite before the final safeguard: 3,683 passed, 52 skipped and 1 failed; 8,181 subtests passed.
- Independent full unittest runner before the final safeguard: 3,709 tests run, with 29 skipped and 1 failure.
- The sole failure in both full test runners was caused by the missing `olefile` dependency in the verification environment.
- Wheel and source-distribution builds passed.
- Installed-package API and resource checks passed.
- Verified clean patch application against the post-PR1 baseline and byte-for-byte agreement between the patch, changed-files archive and tested source.

All existing tests and assertions have been preserved.

Verification was performed using Python 3.13.5. Native macOS execution, real model inference, Qt report generation and actual online tool execution remain to be validated.

This PR is restricted to workspace replay. It does not introduce quantitative comparison, semantic similarity metrics, answer-quality assessment or automated comparison reports.

These capabilities will be addressed in PR3, using the validated original recordings, reproduced workspaces and explicit identity mappings established by PR1 and PR2.

The reference experiments and their data will remain in the separate private `KiLinSystemTests` repository, while the reusable system-testing infrastructure resides in KíLín.
…sting reports

This PR introduces the third and final component of the initially planned system-testing infrastructure for KíLín: the independent comparison of original and replayed workspaces.

Building on the recording infrastructure, workspace validation and chronological reconstruction (PR1), and independent replay (PR2), this PR makes it possible to systematically investigate how changes in KíLín's implementation, models, configurations, and retrieval strategies affect its behavior.

The comparison operates directly on existing workspace recordings, without requiring their re-execution or access to the in-memory results of a previous replay.

Introduces `Experiment.compare()` and the public `Comparison` class.

Both the original and replayed workspaces are independently validated, and their chronological operations are aligned using recorded requests, source operations, conversation identities, turn identities, branch inheritance, and user interactions.

The alignment is independent of the generated answers, allowing corresponding operations to be compared even when their results differ substantially.

The comparison explicitly distinguishes complete, divergent, and invalid recordings. For divergent histories, only the unambiguous common prefix is compared.

Introduces measurements at several levels:

- **Answers:** exact text equality, normalized text equality, token F1, and optional embedding-based cosine similarity.
- **Retrieval:** exact-passage overlap, source-file overlap, ranking-prefix overlap, and rank displacement.
- **Citations:** overlap between referenced evidence passages, independently of citation numbering.
- **Execution:** selected intents, tool outcomes, user interactions, model calls, and intermediate processing stages.
- **Performance:** recorded execution durations and input/output token counts.
- **Configuration:** differences in model settings, project settings, and recorded configuration provenance.
- **Conversation state:** conversation lineage, branching, archival, inherited turns, and feedback.
- **Files:** added, removed, modified, and unchanged sources, templates, and generated outputs.

Unavailable measurements are explicitly distinguished from zero-valued measurements. Aggregate metrics include their measurement coverage.

These metrics characterize differences between executions rather than establishing the correctness or quality of their answers. No composite quality score, arbitrary acceptance threshold, or LLM-based judge is introduced.

Semantic answer similarity can be evaluated using an explicitly selected local or previously cached embedding model.

The same evaluation model instance is used for both original and replayed answers, independently of the models used during their generation.

Embedding evaluation is disabled by default. Comparison does not request model downloads, and an unavailable evaluation model does not prevent the remaining metrics from being calculated.

Comparison results can be accessed programmatically, displayed in notebooks, and saved as:

- `<experiment>_comparison.json`: detailed structured observations for subsequent programmatic analysis.
- `<experiment>_comparison.md`: human-readable summaries for inspection and discussion.

Reports are stored alongside the original and replayed workspaces. Existing reports are replaced only when explicitly requested.

Neither comparison nor report generation modifies the original or replayed workspace.

The implementation is contained within `kilin.system_testing`, with separate modules for:

- `comparison.py`: comparison orchestration and public result interface.
- `_comparison_alignment.py`: chronological alignment and identity reconstruction.
- `_comparison_metrics.py`: quantitative measurements.
- `_comparison_report.py`: report presentation and persistence.

No existing production modules outside `kilin.system_testing` are modified, and no new package dependencies are introduced.

The complete system-testing workflow is now accessible through a single interface:

```python
from kilin.system_testing import Experiment

experiment = Experiment("010_literature_original")

experiment.validate()
experiment.timeline()
experiment.replay()

comparison = experiment.compare()
comparison.display()
comparison.save()
```

Each operation can be performed independently. In particular, an existing replay can be compared repeatedly without regenerating its answers.

Optional semantic evaluation can be enabled through:

```python
comparison = experiment.compare(
    embedding_model="your-embedding-model",
    embedding_backend="auto",
    embedding_revision=None,
)
```

The comparison infrastructure is designed to support the separate `KiLinSystemTests` repository, where reference workspaces, reproduced workspaces, experiment notebooks, and comparison reports can be maintained independently of the main KíLín repository.

Individual and batch execution notebooks have been prepared separately. They support validation, optional replay, comparison, and report generation, without automatically overwriting existing workspaces.

This separation allows the main KíLín repository to remain independent of potentially large or confidential experimental datasets.

This PR adds 22 regression tests covering comparison metrics, chronological alignment, conversation branching, source additions, configuration provenance, retrieval and citation correspondence, incomplete recordings, optional embedding evaluation, report generation, and workspace preservation.

All existing tests have been preserved.

Verification includes:

- All 22 new regression tests passing.
- Full pytest and unittest test suites executed.
- Documentation and coding-style checks passing.
- Individual and batch experiment notebooks successfully executed.
- Original and replayed workspace contents verified to remain unchanged.
- Wheel and source distribution builds passing.
- Comparison successfully executed from an installed wheel outside the repository checkout.
- Clean patch application against the reviewed post-PR2 baseline.

The full pytest suite reports 3,706 passed tests, 52 skipped tests, and one failure associated with the unavailable `olefile` dependency in the verification environment. The independent unittest runner reports the same dependency-related failure.

Verification was performed on Linux with Python 3.13.5. Actual MLX and PyTorch embedding inference remains to be verified in the supported Python 3.12 environment; the evaluation interface and numerical calculations were tested using deterministic model substitutes.

Particular attention should be given to:

- The criteria used to align corresponding operations independently of their generated results.
- The definitions and interpretation of the quantitative comparison metrics.
- The distinction between unavailable measurements and zero-valued measurements.
- The preservation of original and replayed workspace contents.
- The separation between reusable system-testing infrastructure and experiment-specific data.

With this PR, the initial system-testing infrastructure is complete:

- PR0A–PR0C: recording infrastructure.
- PR1: workspace validation and chronological reconstruction.
- PR2: independent workspace replay.
- PR3: quantitative comparison and reporting.

The next phase should focus on establishing a representative collection of genuine KíLín experiments in `KiLinSystemTests`, covering different project types, retrieval strategies, conversation histories, and interactive tools.

These experiments will provide a reproducible basis for evaluating future changes to KíLín, identifying regressions, comparing alternative implementations, and investigating the effects of different models and configurations.
Diagnostic	Implementation
Event inventory	Independent event counts for both recordings
Conversation history	Mapped recent, related and final selected turns
Memory inventory	Mapped record identities, roles and branch origins
Memory retrieval	Retrieved identities, ordering, scores and fingerprints
Model prompts	Raw equality and metadata-normalized structured-message equality
Tool results	Functional comparisons separated from elapsed time
Tool completion	Explicit incomplete outcomes, even when reproduced identically
Conversation names	Distinction between explicit and automatically generated names
Independent inspection	Saved questions and answers available even without a valid replay
GUI inspection	Recognition of additional closed inspection-only sessions

The existing strict alignment, answer-similarity and evidence-comparison semantics are preserved. No additional model inference is required.
The reusable replay-management and reference-publication functionality now belongs to kilin.system_testing, rather than being implemented separately in the experimental repository.
giovannivolpe and others added 30 commits December 2, 2026 21:46
Since startup events moved to logs/traces/project.json, paper_numbers recorded an empty operations_s. It now also reads the events of the session it just opened from the project trace, and includes reading, extracting and chunking the sources.
evaluate_retrieval returns a bootstrap interval of NDCG@10 over the queries, and the code-question notebooks record Wilson intervals for their counts and a bootstrap interval for the mean citation coverage. The bootstrap uses a fixed seed so that a run gives the same interval.
The code-question gold set was annotated on a previous source; since then several functions moved, so the locations pointed at unrelated lines. Every location now matches commit 6cb105d; A3 also cites the code project type's system prompt, which a code project uses.
Rounding could give an upper bound of 0.9999999999999999 for 42 of 42, which failed the test on CI. The bound is exactly 1 (or 0) in these cases, so set it directly.
Completion of Legacy Polishing
Scripts and data for the illustrative examples and benchmarks.
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