Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    TypeError
Message:      Couldn't cast array of type
struct<scripts\do_django_release.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, scripts\manage_translations.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, scripts\prepare_commit_msg.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\runtests.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\utils\autoreload.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\utils\version.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\contrib\sessions\backends\file.py: struct<file_path: string, findin
...
, evidence: string>>>, tests\shell\tests.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\storage.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\test_management.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\test_storage.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\gis_tests\gdal_tests\test_raster.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\view_tests\tests\test_debug.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>>
to
{'tests\\test_imports.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\shell_completion.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\testing.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\_termui_impl.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}}
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 99, in get_rows_or_raise
                  return get_rows(
                         ^^^^^^^^^
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                         ^^^^^^^^^^^^^^^^^^^^^
                File "/src/services/worker/src/worker/utils.py", line 77, in get_rows
                  rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2815, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2352, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2377, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 310, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 130, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2303, in cast_table_to_schema
                  cast_array_to_feature(
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 1852, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2149, in cast_array_to_feature
                  raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
              TypeError: Couldn't cast array of type
              struct<scripts\do_django_release.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, scripts\manage_translations.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, scripts\prepare_commit_msg.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\runtests.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\utils\autoreload.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\utils\version.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, django\contrib\sessions\backends\file.py: struct<file_path: string, findin
              ...
              , evidence: string>>>, tests\shell\tests.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\storage.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\test_management.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\staticfiles_tests\test_storage.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\gis_tests\gdal_tests\test_raster.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>, tests\view_tests\tests\test_debug.py: struct<file_path: string, findings: list<item: struct<file_path: string, function_name: string, line_number: int64, check_name: string, category: string, severity: string, detail: string, evidence: string>>>>
              to
              {'tests\\test_imports.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\shell_completion.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\testing.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}, 'src\\click\\_termui_impl.py': {'file_path': Value('string'), 'findings': List({'file_path': Value('string'), 'function_name': Value('string'), 'line_number': Value('int64'), 'check_name': Value('string'), 'category': Value('string'), 'severity': Value('string'), 'detail': Value('string'), 'evidence': Value('string')})}}

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

CodeTruth Agent V2

Deterministic Pre-Modification Governance Layer for Python Code Changes

DOI License GitHub


Overview

CodeTruth Agent V2 is an open-source deterministic governance layer that analyzes candidate Python function pairs using semantic similarity and behavioral analysis, and produces SAFE, REVIEW, or BLOCK governance decisions before repository modification is attempted.

No LLM in the decision path. Fully deterministic. Fully reproducible.


The Problem

AI coding agents generate and apply code changes autonomously. They do not pause to check whether a function that looks similar actually does something completely different.

rollback() and get_rollback() have a semantic score of 0.95. One performs database recovery. The other reads a boolean flag. An autonomous agent cannot detect this distinction from names or embeddings alone.

V2 catches it through behavioral analysis β€” before the patch reaches the repository.


How It Works

Repository Scan
β†’ Candidate Selection
β†’ Semantic Analysis (sentence-transformers/all-MiniLM-L6-v2)
β†’ Behavioral Analysis (AST-based, 10 operation categories)
β†’ Multi-Signal Fusion
β†’ Governance Decision: SAFE / REVIEW / BLOCK / FREEZE_PATCH
β†’ Human Approval
β†’ Safe Application

Governance Decisions

Decision Meaning
SAFE Low risk β€” AUTO_APPLY recommended
REVIEW Medium/High risk β€” human approval required
BLOCK Critical risk β€” individual approval required
FREEZE_PATCH Opposing behavior detected β€” mandatory human review

V2 recommends governance actions. It does not modify files autonomously.


Evaluation Results

Evaluated on 8 open-source Python repositories:

Repository Files Gov Findings Gov BLOCKs Pairs Pipeline BLOCKs Opposing Errors
Flask Tutorial 9 2 0 4 0 0 0
Click 60 3 1 25 3 0 0
HTTPX 60 0 0 25 3 0 0
Flask (Full) 83 4 2 25 8 0 0
DRF 154 2 1 50 24 0 0
Rich 213 14 4 37 9 0 0
Django 2,917 68 16 100 55 0 0
Transformers 4,426 296 76 1,000 464 4 0
Total 7,862 386 99 1,241 563 4 0

Zero pipeline errors across 1,241 function-pair analyses.


Precision Audit

14-pair BLOCK precision audit:

Category Count Proportion
Governance-significant (GENUINE) 6 60%
Family-pattern noise (NOISE_FAMILY) 3 30%
Embedding limitation (NOISE_EMBEDDING) 1 10%

All 4 opposing-behavior detections confirmed GENUINE.


Star Example β€” Opposing Behavior Detection

update_version_in_file vs update_version_in_examples
Semantic score: 0.70 β€” names look related
Tags A: FILE_READ, FILE_WRITE, STATE_MUTATION
Tags B: DELETE_OPERATION
Action: FREEZE_PATCH (CRITICAL)

One function rewrites files. The other deletes content. Semantic similarity alone would not catch this. V2 catches it through behavioral opposition detection.


Dataset Contents

This dataset contains the full evaluation reports from the 8-repository evaluation:

  • tutorial_report.json β€” Flask Tutorial evaluation
  • click_report.json β€” Click evaluation
  • httpx_report.json β€” HTTPX evaluation
  • flask_report.json β€” Flask (Full) evaluation
  • drf_report.json β€” Django REST Framework evaluation
  • rich_report.json β€” Rich evaluation
  • django_report.json β€” Django evaluation
  • transformers_report.json β€” Hugging Face Transformers evaluation

All reports include full decision pipeline results, governance findings, and opposing-behavior detections for independent verification.


Reproduce the Evaluation

import json
import random

with open('transformers_report.json') as f:
    data = json.load(f)

# Reproduce Group B precision audit sample
blocks = [r for r in data['decision_pipeline_results']
          if r['fusion_decision'] == 'BLOCK']
random.seed(20260603)
group_b = random.sample(blocks, 5)

# Get all opposing detections
group_c = [r for r in data['decision_pipeline_results']
           if r['fusion_opposing_detected']]
# Returns exactly 4 pairs

Known Limitations

  • Single-reviewer audit β€” 14 pairs, wide confidence interval
  • Python-only β€” AST parser is Python-specific
  • V1 25-file sampling cap β€” V1-driven extraction did not activate in evaluation
  • NOISE_FAMILY 30% β€” token-overlap on naming families generates combinatorial noise
  • No patch generation β€” V2 decides only, does not generate patches (V3 scope)
  • No interactive HITL UI β€” programmatic API only (V3 scope)

Citation

@software{codetruth_v2_2026,
  author = {Saud, Zeeshan},
  title = {CodeTruth Agent V2: A Deterministic Pre-Modification Governance Layer for Python Code Changes},
  year = {2026},
  doi = {10.5281/zenodo.20569647},
  url = {https://doi.org/10.5281/zenodo.20569647}
}

Links


Author

Zeeshan Saud β€” Independent Researcher, UAE [email protected]


License

GPLv3 β€” see LICENSE

Downloads last month
18