@ngocsangairvds/vsaf 3.2.14 → 3.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/vsaf.js +18 -4
- package/package.json +1 -1
- package/src/config.js +167 -0
- package/src/global.js +1 -48
- package/src/project.js +1 -0
- package/src/utils.js +44 -1
- package/tools/vds-scripts/Makefile +9 -31
- package/tools/vds-scripts/docker/docker-compose.cli.yml +1 -117
- package/tools/vds-scripts/docker/docker-compose.services.yml +1 -40
- package/tools/vds-scripts/docker/infrastructure/init-schemas.sql +0 -34
- package/tools/vds-scripts/docker/infrastructure/pgbouncer/pgbouncer.ini +2 -6
- package/tools/vds-scripts/pyproject.toml +1 -33
- package/tools/vds-scripts/uv.lock +80 -1651
- package/tools/vds-scripts/vds_cli/pyproject.toml +3 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/cli.py +1 -127
- package/tools/vds-scripts/vds_cli/src/vds_cli/commands/lint_cli.py +1 -20
- package/tools/vds-scripts/vds_cli/src/vds_cli/router.py +0 -100
- package/tools/vds-scripts/vds_cli/tests/conftest.py +0 -2
- package/tools/vds-scripts/vds_cli/tests/unit/test_cli.py +0 -25
- package/tools/vds-scripts/vds_cli/tests/unit/test_lint_cli.py +2 -2
- package/tools/vds-scripts/vds_cli/tests/unit/test_router.py +0 -2
- package/tools/vds-scripts/CLOSURE.md +0 -340
- package/tools/vds-scripts/ECOSYSTEM-CHANGELOG.md +0 -52
- package/tools/vds-scripts/ECOSYSTEM-DOCS.md +0 -602
- package/tools/vds-scripts/ECOSYSTEM_ALIGNMENT.md +0 -133
- package/tools/vds-scripts/ENV-HYGIENE-OPS-NOTE.md +0 -65
- package/tools/vds-scripts/INVESTIGATION-cloud-401.md +0 -103
- package/tools/vds-scripts/MEM0_2.0_API_REFERENCE.md +0 -238
- package/tools/vds-scripts/PACKAGE_P125B_IMPLEMENTATION_SUMMARY.md +0 -131
- package/tools/vds-scripts/PHASE-MERGE-SUMMARY.md +0 -121
- package/tools/vds-scripts/PHASES-3-ARCHIVE.md +0 -59
- package/tools/vds-scripts/PROJECT_COMPLETION_SUMMARY.md +0 -45
- package/tools/vds-scripts/SEARCH-CRASH-REPRO.md +0 -51
- package/tools/vds-scripts/analyze_hexagonal.py +0 -217
- package/tools/vds-scripts/analyze_profiles.py +0 -60
- package/tools/vds-scripts/audit-checklist.xlsx +0 -0
- package/tools/vds-scripts/audit_orchestrator/.audit_approvals/approvals_index.json +0 -1
- package/tools/vds-scripts/audit_orchestrator/.env.example +0 -85
- package/tools/vds-scripts/audit_orchestrator/.github/workflows/audit.yml +0 -47
- package/tools/vds-scripts/audit_orchestrator/Dockerfile +0 -92
- package/tools/vds-scripts/audit_orchestrator/GOOGLE_SHEETS_IMPLEMENTATION_SUMMARY.md +0 -218
- package/tools/vds-scripts/audit_orchestrator/PHASE3_INTEGRATION_SUMMARY.md +0 -268
- package/tools/vds-scripts/audit_orchestrator/PHASE7-MERGE-SUMMARY.md +0 -174
- package/tools/vds-scripts/audit_orchestrator/README.md +0 -1573
- package/tools/vds-scripts/audit_orchestrator/TSK-168-IMPLEMENTATION-SUMMARY.md +0 -191
- package/tools/vds-scripts/audit_orchestrator/TSK-196-IMPLEMENTATION-SUMMARY.md +0 -201
- package/tools/vds-scripts/audit_orchestrator/alembic/env.py +0 -37
- package/tools/vds-scripts/audit_orchestrator/alembic/script.py.mako +0 -28
- package/tools/vds-scripts/audit_orchestrator/alembic/versions/0001_initial_audit_state_schema.py +0 -1260
- package/tools/vds-scripts/audit_orchestrator/alembic.ini +0 -68
- package/tools/vds-scripts/audit_orchestrator/config/category-mapping.json +0 -81
- package/tools/vds-scripts/audit_orchestrator/config/profile-timeouts.yaml +0 -17
- package/tools/vds-scripts/audit_orchestrator/create_sample.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/data/corpus_accuracy_report.json +0 -17
- package/tools/vds-scripts/audit_orchestrator/data/exemplar_quality_report.json +0 -1606
- package/tools/vds-scripts/audit_orchestrator/data/instruction_plan_fixtures.json +0 -163
- package/tools/vds-scripts/audit_orchestrator/data/requirement_exemplars.json +0 -3443
- package/tools/vds-scripts/audit_orchestrator/data/requirement_scope_fixtures.json +0 -172
- package/tools/vds-scripts/audit_orchestrator/debug_rg.py +0 -46
- package/tools/vds-scripts/audit_orchestrator/demo_code_pack.py +0 -127
- package/tools/vds-scripts/audit_orchestrator/docs/AGENT_SDK_SELECTION_SPEC.md +0 -720
- package/tools/vds-scripts/audit_orchestrator/docs/API.md +0 -804
- package/tools/vds-scripts/audit_orchestrator/docs/CONTENT_ANALYSIS_APPROACH.md +0 -1041
- package/tools/vds-scripts/audit_orchestrator/docs/CONTENT_SCORING_EVOLUTION_SPEC.md +0 -868
- package/tools/vds-scripts/audit_orchestrator/docs/DEPLOYMENT.md +0 -778
- package/tools/vds-scripts/audit_orchestrator/docs/LLM_AGENT_AUDIT_SPEC.md +0 -721
- package/tools/vds-scripts/audit_orchestrator/docs/LLM_CONTENT_ANALYSIS_SPEC.md +0 -1143
- package/tools/vds-scripts/audit_orchestrator/docs/LSP_SETUP_GUIDE.md +0 -221
- package/tools/vds-scripts/audit_orchestrator/docs/MULTI_REPO_AUDIT_SPEC.md +0 -951
- package/tools/vds-scripts/audit_orchestrator/docs/OLLAMA_EMBEDDINGS_SETUP.md +0 -119
- package/tools/vds-scripts/audit_orchestrator/docs/PHASE32_REAL_BENCHMARK_2026-02-08.md +0 -66
- package/tools/vds-scripts/audit_orchestrator/docs/PHASE_64_TO_92_HISTORICAL_SPEC.md +0 -1772
- package/tools/vds-scripts/audit_orchestrator/docs/TSK-193-flow-trace.md +0 -201
- package/tools/vds-scripts/audit_orchestrator/docs/TSK-193-verification.md +0 -124
- package/tools/vds-scripts/audit_orchestrator/docs/phase152-hierarchical-query-surface.md +0 -46
- package/tools/vds-scripts/audit_orchestrator/examples/bitbucket_metadata_example.json +0 -50
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/README.md +0 -68
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase117_phase118_shared_state.sql +0 -64
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase154_published_pages.sql +0 -28
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase157_dispatch_tables.sql +0 -94
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase157_events.sql +0 -91
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase157_scope_snapshots.sql +0 -24
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase157_status_view.sql +0 -22
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/phase169_dispatch_observability.sql +0 -55
- package/tools/vds-scripts/audit_orchestrator/legacy/migrations/state_repair_hardening.sql +0 -24
- package/tools/vds-scripts/audit_orchestrator/pyproject.toml +0 -211
- package/tools/vds-scripts/audit_orchestrator/pyrightconfig.json +0 -51
- package/tools/vds-scripts/audit_orchestrator/pytest.ini +0 -37
- package/tools/vds-scripts/audit_orchestrator/reproduce_scanner.py +0 -40
- package/tools/vds-scripts/audit_orchestrator/scripts/README.md +0 -116
- package/tools/vds-scripts/audit_orchestrator/scripts/benchmark_crawl_modes.py +0 -455
- package/tools/vds-scripts/audit_orchestrator/scripts/benchmark_dspy.py +0 -513
- package/tools/vds-scripts/audit_orchestrator/scripts/benchmark_nlp_accuracy.py +0 -138
- package/tools/vds-scripts/audit_orchestrator/scripts/benchmark_retrieval_modes.py +0 -176
- package/tools/vds-scripts/audit_orchestrator/scripts/benchmark_upload_update_mode.py +0 -167
- package/tools/vds-scripts/audit_orchestrator/scripts/build_check.py +0 -76
- package/tools/vds-scripts/audit_orchestrator/scripts/check_live_progress.py +0 -61
- package/tools/vds-scripts/audit_orchestrator/scripts/cli_integration_test.py +0 -400
- package/tools/vds-scripts/audit_orchestrator/scripts/index_workspace.py +0 -178
- package/tools/vds-scripts/audit_orchestrator/scripts/inspect_route_conformance.py +0 -196
- package/tools/vds-scripts/audit_orchestrator/scripts/monitor_postgres.py +0 -145
- package/tools/vds-scripts/audit_orchestrator/scripts/optimize_audit.py +0 -462
- package/tools/vds-scripts/audit_orchestrator/scripts/verify.py +0 -673
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase111_requirement_analysis.py +0 -375
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase117_cross_repo_evidence.py +0 -77
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase121_short_circuit.py +0 -680
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase122_instruction_handling.py +0 -478
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase125_skill_integration.py +0 -832
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase_36.py +0 -394
- package/tools/vds-scripts/audit_orchestrator/scripts/verify_phase_37.py +0 -58
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/__init__.py +0 -17
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/__init__.py +0 -29
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/_langchain_warnings.py +0 -17
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/agentic_investigator.py +0 -4130
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/approval.py +0 -490
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/audit_loop_hooks.py +0 -107
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/audit_state.py +0 -50
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/base.py +0 -4035
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/code_agent.py +0 -667
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/code_analysis_helpers.py +0 -236
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/code_analysis_prompts.py +0 -146
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/docs_agent.py +0 -1234
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/langgraph_workflow.py +0 -2002
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/pydantic_base.py +0 -1227
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/requirement_analysis_agent.py +0 -593
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/security_agent.py +0 -1829
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/security_scanner.py +0 -686
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/skill_tools.py +0 -204
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/synthesis_agent.py +0 -1463
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/tool_efficiency_guard.py +0 -609
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/tool_registry.py +0 -3822
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/__init__.py +0 -52
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/evidence_corpus.py +0 -385
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/filesystem.py +0 -1134
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/lsp.py +0 -458
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/mcp_toolset.py +0 -491
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/skills_toolset.py +0 -997
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/toolsets/vector_evidence.py +0 -842
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/usage_tracker.py +0 -682
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/agents/visualization.py +0 -303
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/analyze_cmds.py +0 -892
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checklist_query/__init__.py +0 -15
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checklist_query/service.py +0 -171
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/__init__.py +0 -20
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/base.py +0 -60
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/bitbucket/__init__.py +0 -6
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/bitbucket/checks.py +0 -257
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/confluence/__init__.py +0 -10
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/confluence/checks.py +0 -78
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/git/__init__.py +0 -6
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/git/file_checks.py +0 -133
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/llm_checks/__init__.py +0 -17
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/llm_checks/api_docs_check.py +0 -80
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/llm_checks/readme_check.py +0 -76
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/llm_checks/security_docs_check.py +0 -78
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/registry.py +0 -402
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/sonarqube/__init__.py +0 -10
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/checks/sonarqube/checks.py +0 -276
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/cli.py +0 -12
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/cli_common.py +0 -128
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/cli_impl.py +0 -9826
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/clients/bitbucket_cli_client.py +0 -187
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/clients/confluence_cli_client.py +0 -977
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/clients/sonarqube_cli_client.py +0 -28
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/__init__.py +0 -21
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/base.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/bitbucket_downloader.py +0 -644
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/bitbucket_metadata.py +0 -133
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/checklist_parser.py +0 -180
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/completeness/__init__.py +0 -31
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/completeness/bitbucket_probe.py +0 -443
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/completeness/confluence_probe.py +0 -365
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/completeness/freshness_evaluator.py +0 -330
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/completeness/material_completeness_service.py +0 -1079
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/confluence_collector.py +0 -259
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/diagram_extractor.py +0 -280
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/enrichment_extractor.py +0 -200
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/evidence_cache.py +0 -35
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/git_collector.py +0 -148
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/graphify_collector.py +0 -171
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/image_extractor.py +0 -359
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/linked_page_tracker.py +0 -120
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/markdown_converter.py +0 -344
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/material_cache.py +0 -1252
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/material_downloader.py +0 -1165
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/orchestrator.py +0 -168
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/registry_parser.py +0 -3063
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/requirements.py +0 -70
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/runner.py +0 -119
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/collectors/sonarqube_collector.py +0 -113
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config.py +0 -1943
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/__init__.py +0 -23
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/discovery.py +0 -90
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/environment_resolver.py +0 -56
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/evidence.py +0 -78
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/models.py +0 -73
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/precedence.py +0 -10
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/config_resolution/redaction.py +0 -20
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/confluence_connectivity.py +0 -140
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/corpus_cmds.py +0 -278
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/db/__init__.py +0 -7
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/db/alembic_filters.py +0 -57
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/docs/__init__.py +0 -29
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/docs/diataxis_validator.py +0 -687
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/doctor_cmds.py +0 -3295
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/dspy_modules/__init__.py +0 -5
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/dspy_modules/evaluation.py +0 -301
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/dspy_modules/modules.py +0 -172
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/dspy_modules/runtime.py +0 -836
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/dspy_modules/signatures.py +0 -406
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/__init__.py +0 -192
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/ad_hoc_analyzer.py +0 -399
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/aggregator.py +0 -220
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/auditor.py +0 -504
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/batch_evidence_cache.py +0 -111
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/batch_processor.py +0 -4776
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/calibration.py +0 -217
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/checklist_generator.py +0 -1201
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/checklist_projection.py +0 -192
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/checklist_scoping.py +0 -221
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/checkpoint.py +0 -159
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/cl003_shared_lib_guard.py +0 -194
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/companion_context_service.py +0 -445
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/confluence_checklist_contract.py +0 -7425
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/cross_check_rules.py +0 -213
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/deterministic_evaluator.py +0 -237
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/drift_detector.py +0 -157
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/dspy_requirement_classifier.py +0 -640
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/evidence_assembler.py +0 -407
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/evidence_collector.py +0 -119
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/evidence_diversity.py +0 -101
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/gap_analyzer.py +0 -549
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/graduated.py +0 -185
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/grounding_validator.py +0 -287
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/instruction_analyzer.py +0 -882
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/instruction_compliance.py +0 -172
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/llm_row_evaluator.py +0 -9270
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/loader.py +0 -1070
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/manual_check_config.py +0 -136
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/mapping.py +0 -269
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/multi_judge.py +0 -65
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/phase120_checklist_update.py +0 -416
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/profile_scorer.py +0 -427
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/project_evidence_context.py +0 -449
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/project_knowledge_query_service.py +0 -155
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/project_knowledge_store.py +0 -383
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/project_topology.py +0 -1920
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/provider_failure_classifier.py +0 -778
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/readiness_cli_helpers.py +0 -341
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/readiness_extractor.py +0 -303
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/readiness_synthesizer.py +0 -730
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/regression_guard.py +0 -138
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/repo_type_classifier.py +0 -297
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/requirement_analysis.py +0 -1433
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/requirement_classification.py +0 -1725
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/result_merger.py +0 -814
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/route_matrix.py +0 -267
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/row_evaluator.py +0 -9437
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/row_evaluator_runtime.py +0 -1270
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/row_evaluator_types.py +0 -2102
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/rubric.py +0 -592
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/scorer.py +0 -1239
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/section_packs.py +0 -645
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/skill_recommendation.py +0 -1183
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/stability_harness.py +0 -207
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/target_selector.py +0 -841
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/telemetry.py +0 -347
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/template_analyzer.py +0 -469
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/token_tracker.py +0 -111
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/tool_first_planner.py +0 -7905
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/topology_query_service.py +0 -80
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/validator.py +0 -449
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/engine/weight_policy.py +0 -464
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/errors.py +0 -430
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/extract_cmds.py +0 -4887
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/identity.py +0 -146
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/incremental/__init__.py +0 -52
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/incremental/baseline.py +0 -378
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/incremental/change_analyzer.py +0 -407
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/incremental/delta_report.py +0 -189
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/incremental/diff_detector.py +0 -301
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/integrations/__init__.py +0 -3
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/__init__.py +0 -50
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/audit_schemas.py +0 -459
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/codex_oauth.py +0 -340
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/cost_tracker.py +0 -288
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/engine.py +0 -751
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/evaluator.py +0 -245
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/__init__.py +0 -32
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/api_docs_evaluation.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/gap_analysis.py +0 -31
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/instruction_templates.py +0 -634
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/readme_evaluation.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/row_evaluation.py +0 -247
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/security_docs_evaluation.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts/template_analysis.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/prompts.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/llm/provider.py +0 -626
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/logging_config.py +0 -577
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/mappings/__init__.py +0 -58
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/mappings/default_checklist_mapping.json +0 -18
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/mappings/vietnamese_checklist_mapping.json +0 -38
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/misc_cmds.py +0 -4689
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/__init__.py +0 -153
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/calibration.py +0 -98
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/checklist.py +0 -921
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/completeness.py +0 -309
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/enrichment.py +0 -58
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/enums.py +0 -97
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/evidence.py +0 -351
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/findings.py +0 -381
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/gaps.py +0 -299
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/graph.py +0 -42
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/multi_judge.py +0 -50
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/readiness.py +0 -309
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/registry.py +0 -386
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/reporting.py +0 -32
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/task.py +0 -549
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/models/template.py +0 -477
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/observability/__init__.py +0 -31
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/observability/metrics.py +0 -404
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/parse_cmds.py +0 -608
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/pdf_cmds.py +0 -208
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/performance_gates.py +0 -224
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/phase151_projection.py +0 -84
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/profiles/__init__.py +0 -65
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/profiles/detection.py +0 -842
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/profiles/models.py +0 -474
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/__init__.py +0 -1
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/_confluence_macros.py +0 -145
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/_field_sanitizer.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/_table_builder.py +0 -63
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/_vietnamese_templates.py +0 -103
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/bitbucket_link_resolver.py +0 -34
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/checklist_renderer.py +0 -483
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/confluence_publisher.py +0 -3048
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/hierarchy_publisher.py +0 -213
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/live_data_injector.py +0 -152
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/macro_builder.py +0 -101
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/markdown_converter.py +0 -154
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/priority_renderer.py +0 -133
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/project_aggregate_renderer.py +0 -423
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/readiness_renderer.py +0 -186
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/system_doc_hierarchy_renderer.py +0 -382
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/publishers/system_doc_renderer.py +0 -683
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/report_cmds.py +0 -788
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/__init__.py +0 -13
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/aggregation_report.py +0 -86
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/checklist_generator.py +0 -425
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/excel_generator.py +0 -599
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/gap_report.py +0 -131
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/json_generator.py +0 -188
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/markdown_generator.py +0 -595
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/__init__.py +0 -154
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/collector.py +0 -61
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/department_builder.py +0 -77
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/errors.py +0 -9
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/md_renderer.py +0 -386
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/pdf_models.py +0 -95
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/pdf_writer.py +0 -27
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/pdf/repo_project_builders.py +0 -274
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/readiness_report.py +0 -447
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/reporting.py +0 -94
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/reports/sarif_generator.py +0 -519
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/runtime_profiles.py +0 -98
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/seed/__init__.py +0 -29
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/seed/seed_loader.py +0 -561
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/skills/__init__.py +0 -5
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/skills/skill_routing.py +0 -312
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/base.py +0 -110
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/bitbucket.py +0 -129
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/git_url.py +0 -60
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/github.py +0 -75
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sources/local.py +0 -58
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/spec_sync_validator.py +0 -15
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/state/__init__.py +0 -6285
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/state/readiness_helpers.py +0 -74
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/state/skill_readiness.py +0 -487
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/state/store.py +0 -12927
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/state_cmds.py +0 -1868
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sync/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sync/repo_sync.py +0 -409
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/sync_cmds.py +0 -1247
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/utils/__init__.py +0 -3
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/utils/debug_bundle.py +0 -214
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/validators/checklist_validator.py +0 -342
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflow_cmds.py +0 -19147
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/__init__.py +0 -9
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/_test_audit_daily_batch.py +0 -192
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/audit_daily_batch.py +0 -308
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/audit_deep_monthly.py +0 -193
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/audit_drift_scan.py +0 -178
- package/tools/vds-scripts/audit_orchestrator/src/vds_audit_orchestrator/workflows/audit_security_daily.py +0 -183
- package/tools/vds-scripts/audit_orchestrator/templates/sample_audit_template.xlsx +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/_helpers.py +0 -32
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/completeness/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/completeness/test_bitbucket_probe.py +0 -403
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/completeness/test_confluence_probe.py +0 -423
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_bitbucket_downloader.py +0 -289
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_image_extractor.py +0 -260
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_markdown_converter.py +0 -57
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_material_cache.py +0 -197
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_material_downloader.py +0 -550
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_registry_parser.py +0 -3514
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_registry_parser_department_entry.py +0 -214
- package/tools/vds-scripts/audit_orchestrator/tests/collectors/test_registry_parser_flow.py +0 -200
- package/tools/vds-scripts/audit_orchestrator/tests/conftest.py +0 -988
- package/tools/vds-scripts/audit_orchestrator/tests/engine/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/engine/test_calibration.py +0 -48
- package/tools/vds-scripts/audit_orchestrator/tests/engine/test_confluence_checklist_phase22_helpers.py +0 -6065
- package/tools/vds-scripts/audit_orchestrator/tests/engine/test_multi_judge.py +0 -62
- package/tools/vds-scripts/audit_orchestrator/tests/engine/test_stability_harness.py +0 -61
- package/tools/vds-scripts/audit_orchestrator/tests/engine/test_structured_metadata.py +0 -419
- package/tools/vds-scripts/audit_orchestrator/tests/factories/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/factories/models.py +0 -534
- package/tools/vds-scripts/audit_orchestrator/tests/factories/templates.py +0 -241
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/diagrams/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/diagrams/compressed.drawio +0 -2
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/diagrams/mockup.bmpr +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/diagrams/simple.drawio +0 -26
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/bitbucket/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/bitbucket/branch_permissions_cli.json +0 -26
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/bitbucket/branch_permissions_direct.json +0 -24
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/bitbucket/repo_conditions_cli.json +0 -14
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/bitbucket/repo_conditions_direct.json +0 -12
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/confluence/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/confluence/page_cli.json +0 -7
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/confluence/page_direct.json +0 -7
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/confluence/search_cli.json +0 -11
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/confluence/search_direct.json +0 -7
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/sonarqube/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/sonarqube/quality_gate_cli.json +0 -12
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/golden/sonarqube/quality_gate_direct.json +0 -12
- package/tools/vds-scripts/audit_orchestrator/tests/fixtures/requirement_strategy_phase115.json +0 -118
- package/tools/vds-scripts/audit_orchestrator/tests/integration/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/conftest.py +0 -107
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/expected_outcomes.md +0 -50
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/auth.py +0 -27
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/config.py +0 -16
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/db.py +0 -24
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/main.py +0 -18
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/src/__init__.py +0 -1
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_audit_repo/src/utils.py +0 -22
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_checklist_template.json +0 -110
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/code_evidence_pack.json +0 -40
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/manifest.json +0 -49
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/brd.md +0 -19
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/design.md +0 -32
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/security.md +0 -23
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/srs.md +0 -25
- package/tools/vds-scripts/audit_orchestrator/tests/integration/fixtures/mock_evidence/projects/mock-audit-project/test.md +0 -30
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_checkpoint_merge.py +0 -1371
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_decoupling_route_p149.py +0 -176
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_gap_analyzer_batch_p149.py +0 -151
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_hybrid_search.py +0 -799
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_mcp_integration.py +0 -741
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_merge_ranking_p149.py +0 -98
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_modality_mismatch_p149.py +0 -171
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_phase117_118_storage.py +0 -350
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_phase121_short_circuit.py +0 -732
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_phase18_workflow.py +0 -223
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_phase48_e2e_verification.py +0 -763
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_phase81_doc_anchor_regression.py +0 -252
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_provider_failure_finding_p149.py +0 -339
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_readiness_e2e.py +0 -430
- package/tools/vds-scripts/audit_orchestrator/tests/integration/test_refined_workflow.py +0 -1180
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/snapshots/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/snapshots/department_renderer.md +0 -24
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/snapshots/project_renderer.md +0 -8
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/snapshots/repo_renderer.md +0 -10
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_department_pdf.py +0 -112
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_e2e_pdf.py +0 -135
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_idempotency.py +0 -45
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_md_renderer.py +0 -46
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_pdf_cmds.py +0 -97
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_pdf_snapshot.py +0 -77
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_pdf_writer.py +0 -65
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_project_builder.py +0 -199
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_public_api.py +0 -135
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_repo_builder.py +0 -246
- package/tools/vds-scripts/audit_orchestrator/tests/pdf/test_workflow_pdf_flags.py +0 -36
- package/tools/vds-scripts/audit_orchestrator/tests/property/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/property/test_properties.py +0 -807
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_agent_error_compat.py +0 -38
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_agentic_skill_policy_skip.py +0 -234
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_base_event_stream_logging.py +0 -785
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_base_timeout_policy.py +0 -277
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_base_trace_payload_sanitization.py +0 -92
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_code_agent.py +0 -2311
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_code_agent_re_exports.py +0 -25
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_code_analysis_helpers.py +0 -94
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_create_audit_agent_reasoning_effort.py +0 -69
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_docs_agent.py +0 -2044
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_langgraph_workflow_efficiency_metrics.py +0 -71
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_output_validators.py +0 -317
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_phase41_toolsets.py +0 -6427
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_pydantic_ai_models.py +0 -1219
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_pydantic_base_url_resolution.py +0 -84
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_security_agent.py +0 -2069
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_skill_manager_focus.py +0 -439
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_synthesis_agent.py +0 -1195
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_tool_efficiency_guard_fr120.py +0 -683
- package/tools/vds-scripts/audit_orchestrator/tests/test_agents/test_toolsets.py +0 -716
- package/tools/vds-scripts/audit_orchestrator/tests/test_aggregator_p149.py +0 -171
- package/tools/vds-scripts/audit_orchestrator/tests/test_alembic_migrations.py +0 -287
- package/tools/vds-scripts/audit_orchestrator/tests/test_anchor_allowlist_p149.py +0 -273
- package/tools/vds-scripts/audit_orchestrator/tests/test_audit_otel.py +0 -283
- package/tools/vds-scripts/audit_orchestrator/tests/test_checklist_models.py +0 -583
- package/tools/vds-scripts/audit_orchestrator/tests/test_checks/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_checks/test_base_check.py +0 -211
- package/tools/vds-scripts/audit_orchestrator/tests/test_checks/test_llm_checks.py +0 -126
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_analyze_command.py +0 -400
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_archive_stale_page_cli.py +0 -217
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_bitbucket_metadata_cli.py +0 -354
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_cli_impl_profile_availability.py +0 -114
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_codex_profile.py +0 -174
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_compare_backends_cli.py +0 -449
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_confluence_parent_auto_resolve.py +0 -451
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_corpus_purge_cli.py +0 -290
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_credentials_preflight.py +0 -106
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_debug_bundle.py +0 -37
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_deprecation_phase157.py +0 -484
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_dispatch_concurrency_diagnostics.py +0 -758
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_check_confluence_cli.py +0 -320
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_codex.py +0 -187
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_corpus_status_cli.py +0 -236
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_correlation_cli.py +0 -128
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_crawl_status_cli.py +0 -192
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_credentials_cli.py +0 -86
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_dispatch_status_cli.py +0 -421
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_heartbeat_phase169.py +0 -173
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_hierarchy_status_cli.py +0 -199
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_locks_cli.py +0 -134
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_logs_follow_cli.py +0 -305
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_migration.py +0 -333
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_profile_availability_cli.py +0 -151
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_doctor_skills_policy_cli.py +0 -153
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_evidence_quality_cli.py +0 -307
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_export_debug_bundle_phase36.py +0 -60
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_export_git_manifest_cli.py +0 -172
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_file_removal_phase157e.py +0 -770
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_grounding_classifier.py +0 -226
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_logging.py +0 -49
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_materials_cli.py +0 -9127
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_metadata_completeness_phase92.py +0 -364
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_parent_dispatch_finalization_phase168f.py +0 -111
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_parse_cli.py +0 -590
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_phase117_118_feature_flags.py +0 -219
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_phase164_control_plane.py +0 -718
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_phase165_runner_scripts.py +0 -230
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_preparation_classifications.py +0 -146
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_prepare_cli.py +0 -398
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_publication_quality_gate.py +0 -126
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_publish_system_doc_cli.py +0 -158
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_query_checklist_cli.py +0 -219
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_readiness_cli.py +0 -673
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_readiness_cli_integration.py +0 -689
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_removed_flags_phase92.py +0 -36
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_report_cmds.py +0 -1317
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_run_history_index.py +0 -57
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_run_management.py +0 -1194
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_runtime_profiles_cli.py +0 -1658
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_smart_run_selection.py +0 -1562
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_state_cli.py +0 -2467
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_state_migration.py +0 -339
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_sync_repos_debug_artifacts.py +0 -1109
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_upload_results_cli.py +0 -809
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_validate_checklist.py +0 -178
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_validate_checklist_cli.py +0 -110
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_validate_spec_sync_cli.py +0 -519
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_default_parameters_baseline.py +0 -101
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_options.py +0 -7896
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_project_db_modes.py +0 -6516
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_project_project_scope.py +0 -831
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_project_target.py +0 -611
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_projects_phase131_lifecycle.py +0 -2488
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_projects_phase131_scaffolding.py +0 -96
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_row_key_guard.py +0 -78
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli/test_workflow_summary_artifacts.py +0 -1872
- package/tools/vds-scripts/audit_orchestrator/tests/test_cli_paths_phase2.py +0 -45
- package/tools/vds-scripts/audit_orchestrator/tests/test_clients/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_clients/test_bitbucket_cli_client.py +0 -124
- package/tools/vds-scripts/audit_orchestrator/tests/test_clients/test_cli_parity.py +0 -110
- package/tools/vds-scripts/audit_orchestrator/tests/test_clients/test_confluence_cli_client.py +0 -1149
- package/tools/vds-scripts/audit_orchestrator/tests/test_clients/test_sonarqube_cli_client.py +0 -19
- package/tools/vds-scripts/audit_orchestrator/tests/test_collectors/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_collectors/test_linked_page_tracker.py +0 -118
- package/tools/vds-scripts/audit_orchestrator/tests/test_companion_context_service.py +0 -230
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/conftest.py +0 -11
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_compile_artifact.py +0 -465
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_cross_provider_critique.py +0 -120
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_cross_provider_critique_e2e.py +0 -75
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_evaluation.py +0 -515
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_runtime_loader.py +0 -537
- package/tools/vds-scripts/audit_orchestrator/tests/test_dspy_modules/test_signatures_normalization.py +0 -172
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_auditor_applicability.py +0 -68
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_checklist_generator.py +0 -1252
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_checklist_projection.py +0 -54
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_confluence_checklist_projection_consistency.py +0 -1696
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_critique_merger_matrix.py +0 -120
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_cross_check_rules.py +0 -459
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_cross_provider_critique.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_doc_loader.py +0 -73
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_drift_detector.py +0 -34
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_evidence_collectors.py +0 -93
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_lease_timeout.py +0 -114
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_loader.py +0 -350
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_loader_parity.py +0 -179
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_low_confidence_reeval.py +0 -691
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_phase145a_completion.py +0 -209
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_phase31_row_consistency_retry_benchmark.py +0 -150
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_profile_detector.py +0 -286
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_regression_guard.py +0 -53
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_result_merger.py +0 -619
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_row_evaluator.py +0 -15783
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_row_failover.py +0 -215
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_scorer.py +0 -597
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_skill_breakdown_telemetry_fr137.py +0 -421
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_targeted_auto_merge.py +0 -229
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_timeout_failover.py +0 -488
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_timeout_telemetry.py +0 -73
- package/tools/vds-scripts/audit_orchestrator/tests/test_engine/test_validator.py +0 -419
- package/tools/vds-scripts/audit_orchestrator/tests/test_incremental/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_incremental/test_diff_detector.py +0 -111
- package/tools/vds-scripts/audit_orchestrator/tests/test_infra_persistence.py +0 -291
- package/tools/vds-scripts/audit_orchestrator/tests/test_integration/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_integration/test_phase3_integration.py +0 -516
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_cache.py +0 -670
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_codex_model_builder.py +0 -281
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_codex_oauth.py +0 -330
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_codex_streaming.py +0 -433
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_cost_tracker.py +0 -27
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_engine.py +0 -876
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_evaluator.py +0 -212
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_instruction_templates.py +0 -639
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_prompt_metadata.py +0 -97
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_prompts.py +0 -660
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_provider.py +0 -330
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_provider_contract_sync.py +0 -18
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_reasoning_effort_validation.py +0 -565
- package/tools/vds-scripts/audit_orchestrator/tests/test_llm/test_schemas.py +0 -827
- package/tools/vds-scripts/audit_orchestrator/tests/test_logging_config.py +0 -297
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/test_enums.py +0 -185
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/test_findings.py +0 -1159
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/test_project_profile.py +0 -307
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/test_registry.py +0 -532
- package/tools/vds-scripts/audit_orchestrator/tests/test_models/test_template.py +0 -708
- package/tools/vds-scripts/audit_orchestrator/tests/test_observability/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_observability/test_metrics.py +0 -60
- package/tools/vds-scripts/audit_orchestrator/tests/test_paths_config_phase2.py +0 -21
- package/tools/vds-scripts/audit_orchestrator/tests/test_performance/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_performance/test_fr79_performance_guardrails.py +0 -199
- package/tools/vds-scripts/audit_orchestrator/tests/test_phase156_hardening.py +0 -498
- package/tools/vds-scripts/audit_orchestrator/tests/test_phase93_regression_guards.py +0 -123
- package/tools/vds-scripts/audit_orchestrator/tests/test_pipeline_integration.py +0 -517
- package/tools/vds-scripts/audit_orchestrator/tests/test_profiles/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_profiles/test_detection.py +0 -146
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_bitbucket_link_resolver.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_checklist_renderer.py +0 -84
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_checklist_renderer_projection.py +0 -97
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_confluence_macros.py +0 -58
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_confluence_publisher.py +0 -2171
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_evidence_links.py +0 -129
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_field_sanitizer.py +0 -108
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_hierarchy_publisher.py +0 -134
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_incremental_plan_parser.py +0 -62
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_live_data_injector.py +0 -48
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_macro_builder.py +0 -22
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_p161_confluence_optimization.py +0 -168
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_priority_renderer.py +0 -96
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_project_aggregate_renderer.py +0 -364
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_storage_validation.py +0 -273
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_summary_refactor.py +0 -118
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_system_doc_hierarchy.py +0 -50
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_table_builder.py +0 -23
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_vietnamese_templates.py +0 -37
- package/tools/vds-scripts/audit_orchestrator/tests/test_publishers/test_wiring_integration.py +0 -290
- package/tools/vds-scripts/audit_orchestrator/tests/test_reports/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_reports/test_aggregation_report.py +0 -181
- package/tools/vds-scripts/audit_orchestrator/tests/test_reports/test_checklist_generator.py +0 -258
- package/tools/vds-scripts/audit_orchestrator/tests/test_reports/test_gap_report.py +0 -73
- package/tools/vds-scripts/audit_orchestrator/tests/test_reports/test_json_generator.py +0 -317
- package/tools/vds-scripts/audit_orchestrator/tests/test_result_merger_p149.py +0 -347
- package/tools/vds-scripts/audit_orchestrator/tests/test_route_mode_p149.py +0 -178
- package/tools/vds-scripts/audit_orchestrator/tests/test_rubric_parser.py +0 -179
- package/tools/vds-scripts/audit_orchestrator/tests/test_scorer.py +0 -110
- package/tools/vds-scripts/audit_orchestrator/tests/test_state/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_state/test_sparse_coverage.py +0 -117
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow/test_langgraph_workflow.py +0 -2072
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow/test_p161_runtime_hardening.py +0 -341
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow_cmds_p149.py +0 -112
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow_cmds_p172.py +0 -126
- package/tools/vds-scripts/audit_orchestrator/tests/test_workflow_guidance_p150.py +0 -95
- package/tools/vds-scripts/audit_orchestrator/tests/unit/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_agentic_investigator_phase115.py +0 -42
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_requirement_analysis_agent.py +0 -412
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_security_agent_updates.py +0 -131
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_security_scanner.py +0 -397
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_skill_executor.py +0 -316
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_skill_fallback.py +0 -299
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_skill_policy.py +0 -520
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_skill_telemetry.py +0 -306
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_synthesis_fixes.py +0 -761
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_argument_robustness.py +0 -272
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_registry.py +0 -2548
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_registry_ast_grep.py +0 -87
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_registry_phase123_scoping.py +0 -353
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_registry_phase94_ff.py +0 -445
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_tool_registry_vector_search_phase115.py +0 -35
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_utils.py +0 -1007
- package/tools/vds-scripts/audit_orchestrator/tests/unit/agents/test_vector_evidence_toolset.py +0 -622
- package/tools/vds-scripts/audit_orchestrator/tests/unit/cli/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/cli/test_workflow_cli.py +0 -123
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/test_cache_guard.py +0 -479
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/test_checklist_parser_phase120.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/test_diagram_extractor.py +0 -467
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/test_enrichment_extractor.py +0 -59
- package/tools/vds-scripts/audit_orchestrator/tests/unit/collectors/test_graphify_collector.py +0 -158
- package/tools/vds-scripts/audit_orchestrator/tests/unit/completeness/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/completeness/test_completeness.py +0 -563
- package/tools/vds-scripts/audit_orchestrator/tests/unit/completeness/test_freshness_evaluator.py +0 -493
- package/tools/vds-scripts/audit_orchestrator/tests/unit/completeness/test_material_cache_metrics.py +0 -365
- package/tools/vds-scripts/audit_orchestrator/tests/unit/completeness/test_material_completeness_service.py +0 -2736
- package/tools/vds-scripts/audit_orchestrator/tests/unit/config_resolution/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/config_resolution/test_discovery.py +0 -47
- package/tools/vds-scripts/audit_orchestrator/tests/unit/config_resolution/test_redaction.py +0 -15
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_ad_hoc_analyzer.py +0 -576
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_agent_loop.py +0 -1896
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_anchor_filter_cl003.py +0 -181
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_batch_evidence_cache.py +0 -155
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_batch_processor.py +0 -3608
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_checklist_contract.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_checklist_scoping.py +0 -371
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_config_companion_phase123.py +0 -142
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_config_evidence_phase123.py +0 -249
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_confluence_checklist_contract_export_parity.py +0 -813
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_cross_repo_config_phase122.py +0 -613
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_dspy_requirement_classifier.py +0 -517
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_evidence_diversity.py +0 -144
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_evidence_truncation.py +0 -108
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_grounding_validator.py +0 -127
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_guidance_injection_phase120.py +0 -105
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_instruction_analysis_phase122.py +0 -761
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_instruction_pre_filter_phase167.py +0 -334
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_llm_row_evaluator_retries.py +0 -3684
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_loader_phase123.py +0 -345
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_manual_check_gating_phase122.py +0 -474
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_parallel_eval.py +0 -263
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_phase122_verifier_phase122.py +0 -169
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_phase166_route_failover.py +0 -437
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_post_eval_cl003_shared_lib.py +0 -267
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_postproc_streaming.py +0 -194
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_pre_eval_gating_phase122.py +0 -362
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_prepare_topology_coverage.py +0 -247
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_private_dns_sanitization_phase104.py +0 -397
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_project_evidence_context.py +0 -450
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_project_knowledge_store.py +0 -487
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_project_topology.py +0 -1142
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_provider_failure_classifier.py +0 -195
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_readiness_extractor.py +0 -496
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_readiness_synthesizer.py +0 -653
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_repo_type_classifier.py +0 -303
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_analysis.py +0 -508
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_analysis_execution_scope.py +0 -239
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_analysis_phase114.py +0 -919
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_analysis_phase115.py +0 -97
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_analysis_shared_lib.py +0 -340
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_classification_drift.py +0 -729
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_classification_nlp.py +0 -670
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_requirement_scope_phase122.py +0 -615
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_route_matrix.py +0 -258
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_route_override.py +0 -141
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_routing_precision.py +0 -650
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_row_evaluator_dual_evidence.py +0 -2987
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_row_evaluator_instruction_runtime_phase122.py +0 -365
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_row_evaluator_runtime.py +0 -830
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_runtime_hardening_phase122.py +0 -225
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_scoped_na_skip.py +0 -107
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_scoring_enhancements.py +0 -404
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_shared_library_retrieval_phase123.py +0 -441
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_shared_library_routing_phase123.py +0 -279
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_shared_resource_indexing_phase122.py +0 -188
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_skill_recommendation.py +0 -225
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_skill_routing_cl003_shared_lib.py +0 -338
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_skills_toolset.py +0 -319
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_stability_metric.py +0 -60
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_target_selector.py +0 -958
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_token_tracker.py +0 -121
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_token_wiring.py +0 -119
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_tool_first_planner.py +0 -7103
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_topology_knowledge_persistence.py +0 -332
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_topology_query_service.py +0 -55
- package/tools/vds-scripts/audit_orchestrator/tests/unit/engine/test_unverified_ref_retry.py +0 -909
- package/tools/vds-scripts/audit_orchestrator/tests/unit/models/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/models/test_evidence.py +0 -515
- package/tools/vds-scripts/audit_orchestrator/tests/unit/models/test_gaps.py +0 -422
- package/tools/vds-scripts/audit_orchestrator/tests/unit/models/test_readiness.py +0 -428
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_confluence_hierarchy.py +0 -227
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_project_title_generation.py +0 -335
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_publisher_registry_helpers.py +0 -290
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_publisher_registry_integration.py +0 -557
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_readiness_renderer.py +0 -381
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_repo_title_consistency.py +0 -266
- package/tools/vds-scripts/audit_orchestrator/tests/unit/publishers/test_upload_hierarchy_integration.py +0 -470
- package/tools/vds-scripts/audit_orchestrator/tests/unit/scripts/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/scripts/test_benchmark_dspy.py +0 -177
- package/tools/vds-scripts/audit_orchestrator/tests/unit/scripts/test_benchmark_nlp_accuracy.py +0 -72
- package/tools/vds-scripts/audit_orchestrator/tests/unit/scripts/test_benchmark_retrieval_modes.py +0 -123
- package/tools/vds-scripts/audit_orchestrator/tests/unit/scripts/test_verify_phase111_requirement_analysis.py +0 -409
- package/tools/vds-scripts/audit_orchestrator/tests/unit/seed/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/seed/test_seed_chain_cli.py +0 -277
- package/tools/vds-scripts/audit_orchestrator/tests/unit/seed/test_seed_loader.py +0 -502
- package/tools/vds-scripts/audit_orchestrator/tests/unit/skills/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/skills/test_skill_routing.py +0 -209
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sources/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sources/test_bitbucket_source.py +0 -66
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sources/test_non_retryable_markers.py +0 -88
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sources/test_repo_info.py +0 -212
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_completeness.py +0 -598
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_dispatch_events_contract_phase169.py +0 -100
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_dispatch_hardening_phase158.py +0 -392
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_dispatch_persistence_phase157.py +0 -914
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_embedding_client.py +0 -64
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_get_latest_completed_run.py +0 -313
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_heartbeat_phase169.py +0 -109
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_hybrid_search.py +0 -398
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_normalize_url.py +0 -262
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_phase152_query_surface.py +0 -59
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_phase98_confluence_document_model.py +0 -202
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_published_pages.py +0 -754
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_readiness_helpers.py +0 -193
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_run_ledger.py +0 -522
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_run_management.py +0 -378
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_schema_contract_phase170.py +0 -755
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_state_cmds.py +0 -231
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_state_loaders.py +0 -2151
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_state_run_api.py +0 -2226
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_store.py +0 -1435
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_store_dispatch.py +0 -646
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_store_dispatch_status_view.py +0 -181
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_store_scope.py +0 -213
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_utilization_persist_phase169.py +0 -77
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_vds_search.py +0 -263
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_vector_index_api.py +0 -319
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_vector_index_runtime.py +0 -175
- package/tools/vds-scripts/audit_orchestrator/tests/unit/state/test_vector_index_store.py +0 -1756
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sync/__init__.py +0 -0
- package/tools/vds-scripts/audit_orchestrator/tests/unit/sync/test_repo_sync.py +0 -257
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_artifact_exclusion.py +0 -119
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_auto_promote_phase158.py +0 -337
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_carry_forward_artifact_filtering.py +0 -317
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_checklist_precache_p160a.py +0 -416
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_cli_decomposition_fr219.py +0 -269
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_code_chunk_carry_forward.py +0 -203
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_config_coherence.py +0 -180
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_config_secret_policy.py +0 -522
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_corpus_project_id_migration.py +0 -318
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_corpus_status_diagnostics.py +0 -239
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_department_priority_ordering.py +0 -131
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_dispatch_coordinator_phase158.py +0 -402
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_dispatch_job_identity_p167a.py +0 -238
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_dispatch_ramp_up_phase171.py +0 -434
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_dispatcher.py +0 -911
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_doc_type_en_inference.py +0 -246
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_early_exit_unchunked_repos.py +0 -111
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_errors.py +0 -237
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_errors_taxonomy.py +0 -83
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_extract_chunking_config_phase98.py +0 -73
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_extract_cmds_state_helpers.py +0 -33
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_extract_docs_code_chunking.py +0 -260
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_finalize_dispatch_run_phase168.py +0 -341
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_identity.py +0 -221
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_infrastructure_detection.py +0 -441
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_junction_table_phase95.py +0 -259
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_late_binding_assignment_p167c.py +0 -286
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_misc_cmds_fr224_225_hardening.py +0 -194
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_p172_integration.py +0 -306
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_parent_provider_preflight.py +0 -118
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_performance_gates_phase92.py +0 -141
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_performance_gates_phase93.py +0 -50
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase115_search_strategy.py +0 -106
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase154_title_consistency.py +0 -117
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase155_param_forwarding.py +0 -304
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase158_concurrency_defaults.py +0 -207
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase170_doctor_schema.py +0 -319
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase170_regression.py +0 -334
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase94_corpus_lifecycle.py +0 -307
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_phase96_repo_key_migration.py +0 -305
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_pipelined_scheduling.py +0 -130
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_profile_availability_probe.py +0 -616
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_profile_aware_row_timeout.py +0 -102
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_profile_timeout_stagger_p160cd.py +0 -205
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_progress_summary_phase169.py +0 -96
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_registry_checklist_diagnostics.py +0 -124
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_resume_manifest_p167b.py +0 -268
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_risk_mitigations_p160e1.py +0 -348
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_single_row_shards_p160b.py +0 -357
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_state_repo_discovery.py +0 -504
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_sync_metadata_entries.py +0 -57
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_task_models.py +0 -1796
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_utilization_telemetry_p167e.py +0 -259
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_vietnamese_fts_hardening.py +0 -160
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_workflow_phase98_enrichment.py +0 -92
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_workflow_project_merge_materialization.py +0 -322
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_workflow_row_key_migration_guard.py +0 -88
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_workflow_short_circuit_phase121.py +0 -564
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_workflow_single_target_row_context.py +0 -49
- package/tools/vds-scripts/audit_orchestrator/tests/unit/test_zero_result_messaging.py +0 -76
- package/tools/vds-scripts/bandit-report.json +0 -2974
- package/tools/vds-scripts/brd_orchestrator/README.md +0 -29
- package/tools/vds-scripts/brd_orchestrator/pyproject.toml +0 -63
- package/tools/vds-scripts/brd_orchestrator/src/vds_brd_orchestrator/__init__.py +0 -17
- package/tools/vds-scripts/brd_orchestrator/src/vds_brd_orchestrator/cli.py +0 -187
- package/tools/vds-scripts/brd_orchestrator/src/vds_brd_orchestrator/validator.py +0 -121
- package/tools/vds-scripts/brd_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/brd_orchestrator/tests/test_cli.py +0 -62
- package/tools/vds-scripts/brd_orchestrator/tests/test_validator.py +0 -33
- package/tools/vds-scripts/circular_dependency_orchestrator/README.md +0 -30
- package/tools/vds-scripts/circular_dependency_orchestrator/pyproject.toml +0 -43
- package/tools/vds-scripts/circular_dependency_orchestrator/src/vds_circular_dependency_orchestrator/__init__.py +0 -16
- package/tools/vds-scripts/circular_dependency_orchestrator/src/vds_circular_dependency_orchestrator/cli.py +0 -904
- package/tools/vds-scripts/circular_dependency_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/circular_dependency_orchestrator/tests/unit/__init__.py +0 -0
- package/tools/vds-scripts/circular_dependency_orchestrator/tests/unit/test_cli.py +0 -354
- package/tools/vds-scripts/coverage.json +0 -1
- package/tools/vds-scripts/create_pr.py +0 -57
- package/tools/vds-scripts/diagram_generator/README.md +0 -663
- package/tools/vds-scripts/diagram_generator/ci_validate.sh +0 -16
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-component.png +0 -0
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-component.puml +0 -23
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-sequence.png +0 -0
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-sequence.puml +0 -21
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-usecase.png +0 -0
- package/tools/vds-scripts/diagram_generator/docs-nttc/projects/INSURANCE/analysis/current-state/insurance-claim-business/insurance-claim-business-usecase.puml +0 -14
- package/tools/vds-scripts/diagram_generator/examples/github-actions-validate.yml +0 -39
- package/tools/vds-scripts/diagram_generator/generate_all_diagrams.py +0 -827
- package/tools/vds-scripts/diagram_generator/generate_insurance_c4_diagrams.py +0 -261
- package/tools/vds-scripts/diagram_generator/generate_insurance_c4_quick.py +0 -486
- package/tools/vds-scripts/diagram_generator/pyproject.toml +0 -28
- package/tools/vds-scripts/diagram_generator/render_png.py +0 -59
- package/tools/vds-scripts/diagram_generator/src/vds_diagram_generator/__init__.py +0 -3
- package/tools/vds-scripts/diagram_generator/src/vds_diagram_generator/cli.py +0 -50
- package/tools/vds-scripts/diagram_generator/test_c4_hierarchical.py +0 -142
- package/tools/vds-scripts/diagram_generator/test_c4_quick.py +0 -131
- package/tools/vds-scripts/diagram_generator/tests/__init__.py +0 -0
- package/tools/vds-scripts/diagram_generator/tests/test_analyzer_completeness.py +0 -260
- package/tools/vds-scripts/diagram_generator/tests/test_c4_syntax_correctness.py +0 -138
- package/tools/vds-scripts/diagram_generator/tests/test_component_coverage.py +0 -182
- package/tools/vds-scripts/diagram_generator/tests/test_mermaid_output.py +0 -80
- package/tools/vds-scripts/diagram_generator/tests/test_png_generation.py +0 -112
- package/tools/vds-scripts/diagram_generator/tests/test_scenario_templates.py +0 -15
- package/tools/vds-scripts/diagram_generator/tests/test_sequence_accuracy.py +0 -93
- package/tools/vds-scripts/diagram_generator/tests/test_structurizr_export.py +0 -177
- package/tools/vds-scripts/diagram_generator/tests/test_style_consistency.py +0 -174
- package/tools/vds-scripts/diagram_generator/tests/test_usecase_generator.py +0 -201
- package/tools/vds-scripts/diagram_generator/tests/test_usecase_integration.py +0 -124
- package/tools/vds-scripts/docker/compose.phase2-verification.yml +0 -31
- package/tools/vds-scripts/docker-compose.openapi-validator.yml +0 -14
- package/tools/vds-scripts/excel_orchestrator/README.md +0 -288
- package/tools/vds-scripts/excel_orchestrator/RESEARCH_BASED_UPDATES_REPORT.md +0 -261
- package/tools/vds-scripts/excel_orchestrator/add_essential_missing_effort.py +0 -255
- package/tools/vds-scripts/excel_orchestrator/adjust_effort_complexity.py +0 -184
- package/tools/vds-scripts/excel_orchestrator/brd_analysis_and_task_breakdown.py +0 -632
- package/tools/vds-scripts/excel_orchestrator/brd_analysis_comprehensive.py +0 -1029
- package/tools/vds-scripts/excel_orchestrator/check_overlaps_and_brd_coverage.py +0 -570
- package/tools/vds-scripts/excel_orchestrator/clean_remarks_column.py +0 -127
- package/tools/vds-scripts/excel_orchestrator/comprehensive_brd_check.py +0 -322
- package/tools/vds-scripts/excel_orchestrator/create_buffered_summary.py +0 -119
- package/tools/vds-scripts/excel_orchestrator/create_service_totals_sheet.py +0 -118
- package/tools/vds-scripts/excel_orchestrator/examples/basic_operations.py +0 -85
- package/tools/vds-scripts/excel_orchestrator/expand_all_tasks.py +0 -341
- package/tools/vds-scripts/excel_orchestrator/expand_tasks.py +0 -304
- package/tools/vds-scripts/excel_orchestrator/fill_brd_references.py +0 -347
- package/tools/vds-scripts/excel_orchestrator/fill_remarks_and_colors.py +0 -132
- package/tools/vds-scripts/excel_orchestrator/finalize_brd_and_cleanup.py +0 -295
- package/tools/vds-scripts/excel_orchestrator/finalize_brd_coverage.py +0 -327
- package/tools/vds-scripts/excel_orchestrator/fix_all_formulas.py +0 -99
- package/tools/vds-scripts/excel_orchestrator/fix_detail_presentation.py +0 -113
- package/tools/vds-scripts/excel_orchestrator/fix_presentation_and_effort.py +0 -116
- package/tools/vds-scripts/excel_orchestrator/fix_presentation_consistency.py +0 -231
- package/tools/vds-scripts/excel_orchestrator/fix_remarks_matching.py +0 -179
- package/tools/vds-scripts/excel_orchestrator/group_tasks_by_service_id.py +0 -210
- package/tools/vds-scripts/excel_orchestrator/increase_brd_coverage.py +0 -497
- package/tools/vds-scripts/excel_orchestrator/increase_effort_complexity.py +0 -155
- package/tools/vds-scripts/excel_orchestrator/organize_and_deduplicate.py +0 -273
- package/tools/vds-scripts/excel_orchestrator/pyproject.toml +0 -64
- package/tools/vds-scripts/excel_orchestrator/rebuild_all_formulas.py +0 -146
- package/tools/vds-scripts/excel_orchestrator/remove_base_multiplier_and_check_duplicates.py +0 -310
- package/tools/vds-scripts/excel_orchestrator/remove_duplicate_brd_tasks.py +0 -137
- package/tools/vds-scripts/excel_orchestrator/research_based_updates.py +0 -457
- package/tools/vds-scripts/excel_orchestrator/restore_e_values.py +0 -172
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/__init__.py +0 -5
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/cli.py +0 -746
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/config.py +0 -74
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/converters.py +0 -226
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/errors.py +0 -88
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/excel_client.py +0 -443
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/formatters.py +0 -211
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/logging.py +0 -57
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/source_contract.py +0 -29
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/target_state_status.py +0 -837
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/ulnc_alignment.py +0 -1291
- package/tools/vds-scripts/excel_orchestrator/src/vds_excel_orchestrator/validators.py +0 -164
- package/tools/vds-scripts/excel_orchestrator/sync_detail_and_total_sheets.py +0 -211
- package/tools/vds-scripts/excel_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/excel_orchestrator/tests/conftest.py +0 -36
- package/tools/vds-scripts/excel_orchestrator/tests/test_cli.py +0 -383
- package/tools/vds-scripts/excel_orchestrator/tests/test_excel_client.py +0 -129
- package/tools/vds-scripts/excel_orchestrator/tests/test_ulnc_alignment.py +0 -373
- package/tools/vds-scripts/excel_orchestrator/tests/test_validators.py +0 -64
- package/tools/vds-scripts/excel_orchestrator/update_api_database_effort.py +0 -261
- package/tools/vds-scripts/excel_orchestrator/update_buffers_inline.py +0 -115
- package/tools/vds-scripts/excel_orchestrator/update_complex_services_and_add_new.py +0 -336
- package/tools/vds-scripts/excel_orchestrator/update_responsibility_and_fix_rows.py +0 -208
- package/tools/vds-scripts/excel_orchestrator/update_task_breakdown_vietnamese.py +0 -309
- package/tools/vds-scripts/excel_orchestrator/update_vietnamese_and_responsibility.py +0 -415
- package/tools/vds-scripts/excel_orchestrator/verify_brd_coverage_comprehensive.py +0 -401
- package/tools/vds-scripts/hexagonal_orchestrator/README.md +0 -530
- package/tools/vds-scripts/hexagonal_orchestrator/pyproject.toml +0 -48
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/__init__.py +0 -39
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/analyzers/__init__.py +0 -19
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/analyzers/base.py +0 -95
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/analyzers/fallback.py +0 -614
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/analyzers/java.py +0 -372
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/analyzers/python.py +0 -437
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/cache.py +0 -331
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/classifier.py +0 -263
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/cli.py +0 -554
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/config.py +0 -577
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/models.py +0 -159
- package/tools/vds-scripts/hexagonal_orchestrator/src/vds_hexagonal_orchestrator/profiler.py +0 -451
- package/tools/vds-scripts/hexagonal_orchestrator/test-config.yaml +0 -38
- package/tools/vds-scripts/hexagonal_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/adapter/driven/persistence/InMemoryUserRepository.java +0 -62
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/adapter/driving/api/UserController.java +0 -101
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/application/port/EmailService.java +0 -33
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/application/port/UserRepository.java +0 -45
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/application/usecase/CreateUser.java +0 -58
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/domain/entity/Email.java +0 -80
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-compliant/domain/entity/User.java +0 -98
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-noncompliant/domain/User.java +0 -64
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-with-frameworks/domain/Menu.java +0 -13
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/java-with-frameworks/domain/Product.java +0 -16
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/application/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/application/ports/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/application/ports/email_service.py +0 -60
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/application/ports/user_repository.py +0 -78
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/domain/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/domain/entities/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/domain/entities/user.py +0 -56
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/domain/value_objects/__init__.py +0 -1
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-compliant/domain/value_objects/email.py +0 -63
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-noncompliant/application/user_service.py +0 -1837
- package/tools/vds-scripts/hexagonal_orchestrator/tests/fixtures/python-noncompliant/domain/user.py +0 -43
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_cache.py +0 -458
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_cli_integration.py +0 -942
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_cli_unit.py +0 -557
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_cross_repo_pollution.py +0 -275
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_foundation.py +0 -129
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_integration.py +0 -1524
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_java_analyzer.py +0 -642
- package/tools/vds-scripts/hexagonal_orchestrator/tests/test_timing_unit.py +0 -60
- package/tools/vds-scripts/intellij_orchestrator/README.md +0 -55
- package/tools/vds-scripts/intellij_orchestrator/pyproject.toml +0 -64
- package/tools/vds-scripts/intellij_orchestrator/src/vds_intellij_orchestrator/__init__.py +0 -17
- package/tools/vds-scripts/intellij_orchestrator/src/vds_intellij_orchestrator/cli.py +0 -210
- package/tools/vds-scripts/intellij_orchestrator/src/vds_intellij_orchestrator/core.py +0 -260
- package/tools/vds-scripts/intellij_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/intellij_orchestrator/tests/test_cli.py +0 -112
- package/tools/vds-scripts/intellij_orchestrator/tests/test_core.py +0 -83
- package/tools/vds-scripts/links_orchestrator/README.md +0 -63
- package/tools/vds-scripts/links_orchestrator/pyproject.toml +0 -64
- package/tools/vds-scripts/links_orchestrator/src/vds_links_orchestrator/__init__.py +0 -10
- package/tools/vds-scripts/links_orchestrator/src/vds_links_orchestrator/cli.py +0 -254
- package/tools/vds-scripts/links_orchestrator/src/vds_links_orchestrator/validator.py +0 -244
- package/tools/vds-scripts/links_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/links_orchestrator/tests/test_cli.py +0 -128
- package/tools/vds-scripts/links_orchestrator/tests/test_validator.py +0 -76
- package/tools/vds-scripts/lsp_orchestrator/.dockerignore +0 -69
- package/tools/vds-scripts/lsp_orchestrator/ARCHITECTURE.md +0 -383
- package/tools/vds-scripts/lsp_orchestrator/CODE_QUALITY_IMPROVEMENTS.md +0 -196
- package/tools/vds-scripts/lsp_orchestrator/COMMANDS.md +0 -870
- package/tools/vds-scripts/lsp_orchestrator/Dockerfile +0 -59
- package/tools/vds-scripts/lsp_orchestrator/IMPLEMENTATION_SUMMARY.md +0 -490
- package/tools/vds-scripts/lsp_orchestrator/LSP_ISSUES_AND_FINDINGS.md +0 -380
- package/tools/vds-scripts/lsp_orchestrator/README.md +0 -616
- package/tools/vds-scripts/lsp_orchestrator/SETUP.md +0 -143
- package/tools/vds-scripts/lsp_orchestrator/TEST_COVERAGE_SUMMARY.md +0 -255
- package/tools/vds-scripts/lsp_orchestrator/VERIFICATION_CHECKLIST.md +0 -814
- package/tools/vds-scripts/lsp_orchestrator/docker-compose.yml +0 -102
- package/tools/vds-scripts/lsp_orchestrator/docs/FOR_LLMS.md +0 -401
- package/tools/vds-scripts/lsp_orchestrator/docs/explanation/lsp-response-matching.md +0 -79
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/automate-with-json.md +0 -159
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/docker-mode.md +0 -256
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/navigate-code.md +0 -116
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/parallel-processing.md +0 -179
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/project-tool-detection.md +0 -320
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/type-check-code.md +0 -46
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/use-daemon-mode.md +0 -78
- package/tools/vds-scripts/lsp_orchestrator/docs/how-to-guides/wsl2-optimization.md +0 -227
- package/tools/vds-scripts/lsp_orchestrator/docs/index.md +0 -88
- package/tools/vds-scripts/lsp_orchestrator/docs/operator-hover-definition.md +0 -143
- package/tools/vds-scripts/lsp_orchestrator/docs/reference/commands.md +0 -581
- package/tools/vds-scripts/lsp_orchestrator/docs/reference/configuration.md +0 -422
- package/tools/vds-scripts/lsp_orchestrator/docs/tutorials/00-quick-start.md +0 -169
- package/tools/vds-scripts/lsp_orchestrator/pyproject.toml +0 -63
- package/tools/vds-scripts/lsp_orchestrator/src/test_file.py +0 -5
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/__init__.py +0 -3
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/aggregator.py +0 -340
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/basedpyright_runner.py +0 -167
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/cli.py +0 -3370
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/code_actions.py +0 -79
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/core.py +0 -3295
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/daemon_client.py +0 -672
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/daemon_manager.py +0 -577
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/daemon_server.py +0 -1040
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/detectors/__init__.py +0 -9
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/detectors/project_detector.py +0 -537
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/formatters.py +0 -141
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/ipc_protocol.py +0 -225
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/lsp_client.py +0 -957
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/lsp_router.py +0 -335
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/mcp_server.py +0 -181
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/models/__init__.py +0 -201
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/models/project_detector.py +0 -646
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/models/project_tools.py +0 -114
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/models.py +0 -399
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/mypy_runner.py +0 -209
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/protocols.py +0 -52
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/ruff_lsp_client.py +0 -109
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/ruff_runner.py +0 -44
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/utils.py +0 -959
- package/tools/vds-scripts/lsp_orchestrator/src/vds_lsp_orchestrator/workspace_indexer.py +0 -1037
- package/tools/vds-scripts/lsp_orchestrator/test_workspace_lsp.py +0 -6
- package/tools/vds-scripts/lsp_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/lsp_orchestrator/tests/conftest.py +0 -6
- package/tools/vds-scripts/lsp_orchestrator/tests/test_aggregator.py +0 -59
- package/tools/vds-scripts/lsp_orchestrator/tests/test_cli.py +0 -111
- package/tools/vds-scripts/lsp_orchestrator/tests/test_detect_tools_command.py +0 -186
- package/tools/vds-scripts/lsp_orchestrator/tests/test_formatter_linter_detection.py +0 -519
- package/tools/vds-scripts/lsp_orchestrator/tests/test_integration_phase9_10_11.py +0 -367
- package/tools/vds-scripts/lsp_orchestrator/tests/test_mypy_runner.py +0 -482
- package/tools/vds-scripts/lsp_orchestrator/tests/test_package_manager_detection.py +0 -399
- package/tools/vds-scripts/lsp_orchestrator/tests/test_phase10.py +0 -389
- package/tools/vds-scripts/lsp_orchestrator/tests/test_phase11.py +0 -327
- package/tools/vds-scripts/lsp_orchestrator/tests/test_phase12_integration.py +0 -634
- package/tools/vds-scripts/lsp_orchestrator/tests/test_phase9.py +0 -196
- package/tools/vds-scripts/lsp_orchestrator/tests/test_project_detector.py +0 -377
- package/tools/vds-scripts/lsp_orchestrator/tests/test_test_runner_detection.py +0 -549
- package/tools/vds-scripts/lsp_orchestrator/tests/test_type_checker_routing.py +0 -362
- package/tools/vds-scripts/lsp_orchestrator/tests/test_workspace_indexer.py +0 -144
- package/tools/vds-scripts/markdown_orchestrator/README.md +0 -72
- package/tools/vds-scripts/markdown_orchestrator/pyproject.toml +0 -39
- package/tools/vds-scripts/markdown_orchestrator/src/vds_markdown_orchestrator/__init__.py +0 -5
- package/tools/vds-scripts/markdown_orchestrator/src/vds_markdown_orchestrator/cli.py +0 -102
- package/tools/vds-scripts/multi_agent_orchestrator/Dockerfile +0 -65
- package/tools/vds-scripts/multi_agent_orchestrator/README.md +0 -306
- package/tools/vds-scripts/multi_agent_orchestrator/postman/README.md +0 -264
- package/tools/vds-scripts/multi_agent_orchestrator/postman/TEST_RESULTS_SUMMARY.md +0 -197
- package/tools/vds-scripts/multi_agent_orchestrator/postman/VDS-Multi-Agent-Orchestrator-API.postman_collection.json +0 -1010
- package/tools/vds-scripts/multi_agent_orchestrator/postman/environments/local-development.postman_environment.json +0 -55
- package/tools/vds-scripts/multi_agent_orchestrator/postman/test-results.json +0 -24146
- package/tools/vds-scripts/multi_agent_orchestrator/pyproject.toml +0 -63
- package/tools/vds-scripts/multi_agent_orchestrator/run_api.py +0 -9
- package/tools/vds-scripts/multi_agent_orchestrator/run_mock_api.py +0 -9
- package/tools/vds-scripts/multi_agent_orchestrator/simple_test.py +0 -53
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/__init__.py +0 -25
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/agent_pool.py +0 -433
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/api/__init__.py +0 -5
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/api/main.py +0 -722
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/api/mock_main.py +0 -812
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/change_log.py +0 -515
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/cli.py +0 -424
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/config.py +0 -220
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/conflict_resolver.py +0 -462
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/coordinator.py +0 -627
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/models.py +0 -389
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/progress_dashboard.py +0 -380
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/redis_client.py +0 -245
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/scheduler_subscriber.py +0 -272
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/task_manager.py +0 -536
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/task_tracking.py +0 -550
- package/tools/vds-scripts/multi_agent_orchestrator/src/vds_multi_agent_orchestrator/vds_ai_memory_client.py +0 -352
- package/tools/vds-scripts/multi_agent_orchestrator/test_complete_system.py +0 -149
- package/tools/vds-scripts/multi_agent_orchestrator/test_infrastructure_only.py +0 -194
- package/tools/vds-scripts/multi_agent_orchestrator/test_integration.py +0 -108
- package/tools/vds-scripts/multi_agent_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/multi_agent_orchestrator/tests/test_agent_registration_credential_validator.py +0 -223
- package/tools/vds-scripts/multi_agent_orchestrator/tests/test_config.py +0 -210
- package/tools/vds-scripts/multi_agent_orchestrator/tests/test_models.py +0 -195
- package/tools/vds-scripts/multi_agent_orchestrator/tests/test_w9_agent_routes.py +0 -321
- package/tools/vds-scripts/openapi_orchestrator/README.md +0 -197
- package/tools/vds-scripts/openapi_orchestrator/pyproject.toml +0 -106
- package/tools/vds-scripts/openapi_orchestrator/src/vds_openapi_orchestrator/__init__.py +0 -29
- package/tools/vds-scripts/openapi_orchestrator/src/vds_openapi_orchestrator/cli.py +0 -345
- package/tools/vds-scripts/openapi_orchestrator/src/vds_openapi_orchestrator/full_validator.py +0 -183
- package/tools/vds-scripts/openapi_orchestrator/src/vds_openapi_orchestrator/spec_validator.py +0 -197
- package/tools/vds-scripts/openapi_orchestrator/tests/__init__.py +0 -1
- package/tools/vds-scripts/openapi_orchestrator/tests/test_cli.py +0 -234
- package/tools/vds-scripts/openapi_orchestrator/tests/test_full_validator.py +0 -203
- package/tools/vds-scripts/openapi_orchestrator/tests/test_spec_validator.py +0 -295
- package/tools/vds-scripts/pdf_orchestrator/.dockerignore +0 -93
- package/tools/vds-scripts/pdf_orchestrator/.env.example +0 -40
- package/tools/vds-scripts/pdf_orchestrator/.ruff_rules.py +0 -350
- package/tools/vds-scripts/pdf_orchestrator/.yamllint.yml +0 -43
- package/tools/vds-scripts/pdf_orchestrator/DEVELOPMENT_PLAN.md +0 -80
- package/tools/vds-scripts/pdf_orchestrator/Dockerfile +0 -87
- package/tools/vds-scripts/pdf_orchestrator/README.md +0 -608
- package/tools/vds-scripts/pdf_orchestrator/cli_verification_test/test.md +0 -6
- package/tools/vds-scripts/pdf_orchestrator/cli_verification_test/test.pdf +0 -0
- package/tools/vds-scripts/pdf_orchestrator/config/alertmanager.yml +0 -83
- package/tools/vds-scripts/pdf_orchestrator/config/prometheus.prod.yml +0 -98
- package/tools/vds-scripts/pdf_orchestrator/config/prometheus.yml +0 -40
- package/tools/vds-scripts/pdf_orchestrator/config/redis.conf +0 -78
- package/tools/vds-scripts/pdf_orchestrator/docs/COMPETITIVE_ANALYSIS_REPORT.md +0 -309
- package/tools/vds-scripts/pdf_orchestrator/docs/FEATURES_GUIDE.md +0 -518
- package/tools/vds-scripts/pdf_orchestrator/docs/MULTI_USER_DEPLOYMENT_GUIDE.md +0 -615
- package/tools/vds-scripts/pdf_orchestrator/docs/USER_GUIDE.md +0 -829
- package/tools/vds-scripts/pdf_orchestrator/pyproject.toml +0 -87
- package/tools/vds-scripts/pdf_orchestrator/pytest.ini +0 -71
- package/tools/vds-scripts/pdf_orchestrator/ruff.toml +0 -6
- package/tools/vds-scripts/pdf_orchestrator/scripts/debug_security_report.py +0 -59
- package/tools/vds-scripts/pdf_orchestrator/scripts/demo_library_selector.py +0 -109
- package/tools/vds-scripts/pdf_orchestrator/scripts/generate_project_stats.py +0 -52
- package/tools/vds-scripts/pdf_orchestrator/scripts/generate_styled_pdf.py +0 -95
- package/tools/vds-scripts/pdf_orchestrator/scripts/migrate_render_pdfs.py +0 -285
- package/tools/vds-scripts/pdf_orchestrator/scripts/setup_team.bat +0 -283
- package/tools/vds-scripts/pdf_orchestrator/scripts/setup_team.sh +0 -324
- package/tools/vds-scripts/pdf_orchestrator/src/vds_pdf_orchestrator/__init__.py +0 -5
- package/tools/vds-scripts/pdf_orchestrator/src/vds_pdf_orchestrator/cli.py +0 -542
- package/tools/vds-scripts/pdf_orchestrator/src/vds_pdf_orchestrator/config.py +0 -33
- package/tools/vds-scripts/pdf_orchestrator/tests/README.md +0 -650
- package/tools/vds-scripts/pdf_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/pdf_orchestrator/tests/conftest.py +0 -520
- package/tools/vds-scripts/pdf_orchestrator/tests/requirements.txt +0 -51
- package/tools/vds-scripts/pdf_orchestrator/tests/run_tests.py +0 -659
- package/tools/vds-scripts/pdf_orchestrator/tests/test_config.py +0 -36
- package/tools/vds-scripts/progress_report_orchestrator/Dockerfile +0 -77
- package/tools/vds-scripts/progress_report_orchestrator/README.md +0 -39
- package/tools/vds-scripts/progress_report_orchestrator/alembic/env.py +0 -42
- package/tools/vds-scripts/progress_report_orchestrator/alembic/script.py.mako +0 -28
- package/tools/vds-scripts/progress_report_orchestrator/alembic/versions/0001_initial_progress_schema.py +0 -180
- package/tools/vds-scripts/progress_report_orchestrator/alembic.ini +0 -67
- package/tools/vds-scripts/progress_report_orchestrator/pyproject.toml +0 -67
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/__init__.py +0 -3
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/analyzers/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/analyzers/endpoint_scanner.py +0 -238
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/analyzers/git_activity.py +0 -159
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/analyzers/hexagonal.py +0 -100
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/analyzers/test_scanner.py +0 -136
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/cli.py +0 -743
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/config.py +0 -50
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/db/__init__.py +0 -12
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/db/alembic_filters.py +0 -64
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/memory.py +0 -82
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/models/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/models/analysis.py +0 -84
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/models/report.py +0 -117
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/models/topology.py +0 -101
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/parsers/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/parsers/kg_parser.py +0 -252
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/parsers/uc_reader.py +0 -159
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/concurrency.py +0 -39
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/llm_eval.py +0 -570
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/report.py +0 -1256
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/structural.py +0 -384
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/pipeline/sync.py +0 -143
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/recommendations/__init__.py +0 -5
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/recommendations/engine.py +0 -105
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/recommendations/templates.py +0 -236
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/scheduler_subscriber.py +0 -238
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/skills/README.md +0 -56
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/skills/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/skills/srs-architecture-reviewer/SKILL.md +0 -67
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/skills/srs-endpoint-matcher/SKILL.md +0 -67
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/state/__init__.py +0 -1
- package/tools/vds-scripts/progress_report_orchestrator/src/progress_report_orchestrator/state/schema.py +0 -625
- package/tools/vds-scripts/progress_report_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/__init__.py +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/.gitkeep +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/__init__.py +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/doc-dependencies.yaml +0 -79
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/fr-to-docs.yaml +0 -478
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/fr-to-services.yaml +0 -18
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/kg/registry.yaml +0 -346
- package/tools/vds-scripts/progress_report_orchestrator/tests/fixtures/phase3_baseline_standard.md +0 -564
- package/tools/vds-scripts/progress_report_orchestrator/tests/integration/__init__.py +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/integration/test_checkpoint.py +0 -276
- package/tools/vds-scripts/progress_report_orchestrator/tests/test_alembic_migrations.py +0 -265
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/__init__.py +0 -0
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_analyzers.py +0 -267
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_bounded_gather.py +0 -176
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_cli_phase_report.py +0 -119
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_delta.py +0 -169
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_error_handling.py +0 -150
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_gate_exit_codes.py +0 -230
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_git_activity.py +0 -215
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_kg_parser.py +0 -267
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_llm_autodetect.py +0 -183
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_llm_eval.py +0 -529
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_memory_integration.py +0 -151
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_migration_contract.py +0 -254
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_mode_rendering.py +0 -576
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_models.py +0 -251
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_progress_llm_config.py +0 -67
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_recommendations.py +0 -480
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_report_enhancements.py +0 -415
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_resume_reload.py +0 -343
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_trend_regression.py +0 -294
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_uc_reader.py +0 -169
- package/tools/vds-scripts/progress_report_orchestrator/tests/unit/test_valence_gap.py +0 -293
- package/tools/vds-scripts/project-cycle-report.json +0 -14
- package/tools/vds-scripts/project-dependency-graph.json +0 -11361
- package/tools/vds-scripts/project-topology.json +0 -99
- package/tools/vds-scripts/public_interface_boundary_orchestrator/pyproject.toml +0 -18
- package/tools/vds-scripts/public_interface_boundary_orchestrator/src/vds_public_interface_boundary_orchestrator/__init__.py +0 -0
- package/tools/vds-scripts/public_interface_boundary_orchestrator/src/vds_public_interface_boundary_orchestrator/cli.py +0 -232
- package/tools/vds-scripts/public_interface_boundary_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/public_interface_boundary_orchestrator/tests/test_cli.py +0 -108
- package/tools/vds-scripts/research_orchestrator/README.md +0 -68
- package/tools/vds-scripts/research_orchestrator/py.typed +0 -0
- package/tools/vds-scripts/research_orchestrator/pyproject.toml +0 -95
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/__init__.py +0 -3
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/_env.py +0 -11
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/cli.py +0 -335
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/config.py +0 -43
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/evidence/__init__.py +0 -0
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/evidence/models.py +0 -89
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/evidence/scoring.py +0 -102
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/exceptions.py +0 -78
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/http_client.py +0 -160
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/logging.py +0 -49
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/output/__init__.py +0 -0
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/output/formatters.py +0 -93
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/py.typed +0 -1
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/report/__init__.py +0 -0
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/report/build.py +0 -156
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/report/format.py +0 -147
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/tools/__init__.py +0 -0
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/tools/health.py +0 -66
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/tools/health_graph.py +0 -52
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/tools/registry.py +0 -127
- package/tools/vds-scripts/research_orchestrator/src/vds_research_orchestrator/tools/search.py +0 -230
- package/tools/vds-scripts/research_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/research_orchestrator/tests/conftest.py +0 -53
- package/tools/vds-scripts/research_orchestrator/tests/test_cli.py +0 -222
- package/tools/vds-scripts/research_orchestrator/tests/test_config.py +0 -23
- package/tools/vds-scripts/research_orchestrator/tests/test_exceptions.py +0 -62
- package/tools/vds-scripts/research_orchestrator/tests/test_formatters.py +0 -89
- package/tools/vds-scripts/research_orchestrator/tests/test_graph_integration.py +0 -149
- package/tools/vds-scripts/research_orchestrator/tests/test_http_client.py +0 -134
- package/tools/vds-scripts/research_orchestrator/tests/test_report_build.py +0 -128
- package/tools/vds-scripts/research_orchestrator/tests/test_report_format.py +0 -91
- package/tools/vds-scripts/research_orchestrator/tests/test_scoring.py +0 -95
- package/tools/vds-scripts/research_orchestrator/tests/vds_research_orchestrator/test_tools/__init__.py +0 -1
- package/tools/vds-scripts/research_orchestrator/tests/vds_research_orchestrator/test_tools/test_health.py +0 -139
- package/tools/vds-scripts/research_orchestrator/tests/vds_research_orchestrator/test_tools/test_registry.py +0 -135
- package/tools/vds-scripts/research_orchestrator/tests/vds_research_orchestrator/test_tools/test_search.py +0 -238
- package/tools/vds-scripts/run-history.json +0 -26
- package/tools/vds-scripts/schema_converter/README.md +0 -109
- package/tools/vds-scripts/schema_converter/pyproject.toml +0 -37
- package/tools/vds-scripts/schema_converter/src/vds_schema_converter/__init__.py +0 -3
- package/tools/vds-scripts/schema_converter/src/vds_schema_converter/cli.py +0 -50
- package/tools/vds-scripts/schema_converter/tests/__init__.py +0 -0
- package/tools/vds-scripts/schema_converter/tests/test_json_schema_generator.py +0 -115
- package/tools/vds-scripts/schema_converter/tests/test_mermaid_generator.py +0 -112
- package/tools/vds-scripts/schema_converter/tests/test_parser.py +0 -111
- package/tools/vds-scripts/schema_converter/tests/test_plantuml_generator.py +0 -112
- package/tools/vds-scripts/schema_converter/tests/test_plantuml_validator.py +0 -69
- package/tools/vds-scripts/schema_converter/tests/test_prisma_generator.py +0 -113
- package/tools/vds-scripts/schema_converter/tests/test_sql_generator.py +0 -138
- package/tools/vds-scripts/schema_converter/tests/test_typeorm_generator.py +0 -110
- package/tools/vds-scripts/schema_converter/tests/test_validators.py +0 -96
- package/tools/vds-scripts/spec_orchestrator/README.md +0 -13
- package/tools/vds-scripts/spec_orchestrator/pyproject.toml +0 -40
- package/tools/vds-scripts/spec_orchestrator/src/vds_spec_orchestrator/__init__.py +0 -5
- package/tools/vds-scripts/spec_orchestrator/src/vds_spec_orchestrator/cli.py +0 -162
- package/tools/vds-scripts/spec_orchestrator/src/vds_spec_orchestrator/core.py +0 -575
- package/tools/vds-scripts/spec_orchestrator/src/vds_spec_orchestrator/sync.py +0 -306
- package/tools/vds-scripts/spec_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/spec_orchestrator/tests/test_frontmatter_drift.py +0 -243
- package/tools/vds-scripts/spec_orchestrator/tests/test_sync.py +0 -342
- package/tools/vds-scripts/structure_orchestrator/README.md +0 -60
- package/tools/vds-scripts/structure_orchestrator/pyproject.toml +0 -103
- package/tools/vds-scripts/structure_orchestrator/src/vds_structure_orchestrator/__init__.py +0 -13
- package/tools/vds-scripts/structure_orchestrator/src/vds_structure_orchestrator/cli.py +0 -308
- package/tools/vds-scripts/structure_orchestrator/src/vds_structure_orchestrator/validator.py +0 -257
- package/tools/vds-scripts/structure_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/structure_orchestrator/tests/test_cli.py +0 -161
- package/tools/vds-scripts/structure_orchestrator/tests/test_helpers.py +0 -115
- package/tools/vds-scripts/structure_orchestrator/tests/test_validator.py +0 -104
- package/tools/vds-scripts/task_orchestrator/README.md +0 -50
- package/tools/vds-scripts/task_orchestrator/__init__.py +0 -18
- package/tools/vds-scripts/task_orchestrator/pyproject.toml +0 -43
- package/tools/vds-scripts/task_orchestrator/scripts/run_excel_sync.py +0 -36
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/__init__.py +0 -13
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/audit.py +0 -134
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/cli.py +0 -127
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/debug.py +0 -133
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/normalize.py +0 -113
- package/tools/vds-scripts/task_orchestrator/src/vds_task_orchestrator/refine.py +0 -201
- package/tools/vds-scripts/task_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/task_orchestrator/tests/test_task_orchestrator.py +0 -84
- package/tools/vds-scripts/temp_query_projects.py +0 -2
- package/tools/vds-scripts/test_small.md +0 -1
- package/tools/vds-scripts/text_utils_orchestrator/pyproject.toml +0 -20
- package/tools/vds-scripts/text_utils_orchestrator/src/vds_text_utils/__init__.py +0 -7
- package/tools/vds-scripts/text_utils_orchestrator/src/vds_text_utils/i18n.py +0 -143
- package/tools/vds-scripts/text_utils_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/text_utils_orchestrator/tests/test_i18n.py +0 -53
- package/tools/vds-scripts/upgrade_major.py +0 -61
- package/tools/vds-scripts/upgrade_major_v2.py +0 -64
- package/tools/vds-scripts/verify_violations.py +0 -57
- package/tools/vds-scripts/workflow-summary.json +0 -325
- package/tools/vds-scripts/workflow-summary.md +0 -8
|
@@ -1,3608 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import json
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from datetime import UTC, datetime
|
|
5
|
-
from typing import Any
|
|
6
|
-
from unittest.mock import AsyncMock, MagicMock
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
from vds_agent_core.llm.budget import (
|
|
10
|
-
BudgetExceededError,
|
|
11
|
-
BudgetScope,
|
|
12
|
-
BudgetStatus,
|
|
13
|
-
BudgetUsage,
|
|
14
|
-
)
|
|
15
|
-
from vds_audit_orchestrator.engine import batch_processor as batch_processor_module
|
|
16
|
-
from vds_audit_orchestrator.engine.batch_processor import (
|
|
17
|
-
BatchBudgetExceededError,
|
|
18
|
-
BatchCheckpoint,
|
|
19
|
-
BatchConfig,
|
|
20
|
-
BatchResult,
|
|
21
|
-
BatchRowProcessor,
|
|
22
|
-
)
|
|
23
|
-
from vds_audit_orchestrator.engine.row_evaluator import RowEvaluator
|
|
24
|
-
from vds_audit_orchestrator.engine.row_evaluator_types import RowEvaluationResult
|
|
25
|
-
from vds_audit_orchestrator.engine.target_selector import TargetSelection, TargetType
|
|
26
|
-
from vds_audit_orchestrator.errors import AUDIT_ERROR_CODES
|
|
27
|
-
from vds_audit_orchestrator.evidence.matcher import EvidenceMatcher, RowEvidenceContext
|
|
28
|
-
from vds_audit_orchestrator.models.checklist import (
|
|
29
|
-
VERIFICATION_REASON_EXCERPT_VERIFIED_IN_CONTEXT,
|
|
30
|
-
VERIFICATION_REASON_FALLBACK_REF_INHERITED,
|
|
31
|
-
EvidenceAnchor,
|
|
32
|
-
RowProvenance,
|
|
33
|
-
RowStatus,
|
|
34
|
-
ScoreBreakdown,
|
|
35
|
-
)
|
|
36
|
-
from vds_audit_orchestrator.models.template import AuditCheck, AuditSection, AuditTemplate
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@dataclass
|
|
40
|
-
class _DeterministicEvidenceContext:
|
|
41
|
-
row_id: str
|
|
42
|
-
requirement_text: str
|
|
43
|
-
evidence_refs: list[str]
|
|
44
|
-
retrieval_trace: dict[str, Any] | None = None
|
|
45
|
-
total_chars: int = 0
|
|
46
|
-
truncated: bool = False
|
|
47
|
-
matched_docs: list[Any] | None = None
|
|
48
|
-
matched_code: list[Any] | None = None
|
|
49
|
-
|
|
50
|
-
def format_for_llm(self) -> str:
|
|
51
|
-
return f"context::{self.requirement_text}"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# -----------------------------------------------------------------------------
|
|
55
|
-
# Fixtures
|
|
56
|
-
# -----------------------------------------------------------------------------
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
@pytest.fixture
|
|
60
|
-
def mock_template():
|
|
61
|
-
"""Create a mock AuditTemplate with 10 checks."""
|
|
62
|
-
checks = []
|
|
63
|
-
for i in range(10):
|
|
64
|
-
checks.append(AuditCheck(id=f"CHK-{i}", name=f"Check {i}", description=f"Description {i}", section_id="SEC-1"))
|
|
65
|
-
|
|
66
|
-
section = AuditSection(id="SEC-1", name="Section 1", weight=100.0, checks=checks)
|
|
67
|
-
|
|
68
|
-
return AuditTemplate(name="Test Template", version="1.0.0", sections=[section])
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@pytest.fixture
|
|
72
|
-
def mock_evaluator():
|
|
73
|
-
"""Create a mock RowEvaluator."""
|
|
74
|
-
evaluator = MagicMock(spec=RowEvaluator)
|
|
75
|
-
evaluator.template_hash = "hash_123"
|
|
76
|
-
evaluator.evidence_hash = "ev_hash_456"
|
|
77
|
-
evaluator.aevaluate_row = AsyncMock()
|
|
78
|
-
evaluator.config = MagicMock()
|
|
79
|
-
evaluator.config.mode.value = "test_mode"
|
|
80
|
-
return evaluator
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@pytest.fixture
|
|
84
|
-
def mock_evidence_matcher():
|
|
85
|
-
"""Create a mock EvidenceMatcher."""
|
|
86
|
-
matcher = MagicMock(spec=EvidenceMatcher)
|
|
87
|
-
context = MagicMock(spec=RowEvidenceContext)
|
|
88
|
-
context.format_for_llm.return_value = "Evidence Content"
|
|
89
|
-
context.evidence_refs = ["ref1", "ref2"]
|
|
90
|
-
context.retrieval_trace = {"mode": "lexical", "docs": [{"source_path": "docs/a.md", "score": 0.9}]}
|
|
91
|
-
matcher.match_row.return_value = context
|
|
92
|
-
return matcher
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
@pytest.fixture
|
|
96
|
-
def default_result():
|
|
97
|
-
"""Create a default RowEvaluationResult."""
|
|
98
|
-
return RowEvaluationResult(
|
|
99
|
-
row_id="test_row",
|
|
100
|
-
check_id="test_check",
|
|
101
|
-
status=RowStatus.PASS,
|
|
102
|
-
score=100.0,
|
|
103
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
104
|
-
reason="Test reason",
|
|
105
|
-
finding="Test finding",
|
|
106
|
-
evidence_anchors=[],
|
|
107
|
-
provenance=RowProvenance(
|
|
108
|
-
row_llm_mode="test",
|
|
109
|
-
protocol=None,
|
|
110
|
-
model=None,
|
|
111
|
-
template_hash="hash",
|
|
112
|
-
rubric_version="1",
|
|
113
|
-
evidence_hash="hash",
|
|
114
|
-
evaluated_at=datetime.now(UTC),
|
|
115
|
-
),
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
# -----------------------------------------------------------------------------
|
|
120
|
-
# Tests
|
|
121
|
-
# -----------------------------------------------------------------------------
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def test_repo_row_distribution_helper_resolves_profiles_and_assignment(
|
|
125
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
126
|
-
):
|
|
127
|
-
config = BatchConfig(
|
|
128
|
-
batch_size=4,
|
|
129
|
-
row_timeout_ms=1000,
|
|
130
|
-
run_context={
|
|
131
|
-
"repo_profile_execution_mode": "distributed",
|
|
132
|
-
"repo_distribution_profiles": ["profile-a", "profile-b", "profile-a", "profile-c"],
|
|
133
|
-
},
|
|
134
|
-
)
|
|
135
|
-
processor = BatchRowProcessor(
|
|
136
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
assert processor._repo_row_distribution_profiles() == ["profile-a", "profile-b", "profile-c"]
|
|
140
|
-
assert processor._repo_row_distribution_enabled() is True
|
|
141
|
-
assert processor._assigned_repo_profile_for_row(0) == "profile-a"
|
|
142
|
-
assert processor._assigned_repo_profile_for_row(1) == "profile-b"
|
|
143
|
-
assert processor._assigned_repo_profile_for_row(2) == "profile-c"
|
|
144
|
-
assert processor._assigned_repo_profile_for_row(3) == "profile-a"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
@pytest.mark.asyncio
|
|
148
|
-
async def test_invoke_row_evaluator_distributed_mode_activates_assigned_profile(
|
|
149
|
-
monkeypatch: pytest.MonkeyPatch,
|
|
150
|
-
mock_template,
|
|
151
|
-
mock_evaluator,
|
|
152
|
-
mock_evidence_matcher,
|
|
153
|
-
) -> None:
|
|
154
|
-
config = BatchConfig(
|
|
155
|
-
batch_size=2,
|
|
156
|
-
row_timeout_ms=1000,
|
|
157
|
-
run_context={
|
|
158
|
-
"repo_profile_execution_mode": "distributed",
|
|
159
|
-
"repo_distribution_profiles": ["profile-a", "profile-b"],
|
|
160
|
-
"repo_primary_profile": "profile-a",
|
|
161
|
-
"active_profile": "profile-a",
|
|
162
|
-
},
|
|
163
|
-
)
|
|
164
|
-
processor = BatchRowProcessor(
|
|
165
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
mock_evaluator.evidence_bundle = None
|
|
169
|
-
|
|
170
|
-
monkeypatch.setattr(
|
|
171
|
-
batch_processor_module, "RowEvaluator", lambda config, template, evidence_bundle=None: mock_evaluator
|
|
172
|
-
)
|
|
173
|
-
monkeypatch.setattr(
|
|
174
|
-
batch_processor_module,
|
|
175
|
-
"inherit_runtime_llm_policy",
|
|
176
|
-
lambda profile_name, source_llm=None: type(
|
|
177
|
-
"_LLM", (), {"protocol": "openai", "model_standard": f"model-{profile_name}"}
|
|
178
|
-
)(),
|
|
179
|
-
)
|
|
180
|
-
|
|
181
|
-
expected = RowEvaluationResult(
|
|
182
|
-
row_id="CHK-1:row_1",
|
|
183
|
-
check_id="CHK-1",
|
|
184
|
-
status=RowStatus.PASS,
|
|
185
|
-
score=90.0,
|
|
186
|
-
score_breakdown=ScoreBreakdown.compute(90.0),
|
|
187
|
-
reason="distributed",
|
|
188
|
-
finding="distributed",
|
|
189
|
-
evidence_anchors=[],
|
|
190
|
-
provenance=RowProvenance(
|
|
191
|
-
row_llm_mode="test",
|
|
192
|
-
protocol=None,
|
|
193
|
-
model=None,
|
|
194
|
-
template_hash="hash",
|
|
195
|
-
rubric_version="1",
|
|
196
|
-
evidence_hash="hash",
|
|
197
|
-
evaluated_at=datetime.now(UTC),
|
|
198
|
-
),
|
|
199
|
-
)
|
|
200
|
-
mock_evaluator.aevaluate_row.return_value = expected
|
|
201
|
-
|
|
202
|
-
result = await processor._invoke_row_evaluator(
|
|
203
|
-
check=mock_template.sections[0].checks[1],
|
|
204
|
-
row_id="CHK-1:row_1",
|
|
205
|
-
row_index=1,
|
|
206
|
-
evidence_context="ctx",
|
|
207
|
-
evidence_refs=["ref1"],
|
|
208
|
-
project_profile=None,
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
assert result is expected
|
|
212
|
-
assert result.provenance.original_provider == "profile-b"
|
|
213
|
-
assert result.provenance.final_provider == "profile-b"
|
|
214
|
-
assert result.provenance.failover_chain == ["profile-b"]
|
|
215
|
-
assert result.retrieval_trace["row_distribution_profile"] == "profile-b"
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
@pytest.mark.asyncio
|
|
219
|
-
async def test_batch_processing_logic(mock_template, mock_evaluator, mock_evidence_matcher, default_result):
|
|
220
|
-
"""Test that rows are processed in correct batch sizes."""
|
|
221
|
-
# Config: 10 rows total, batch size 4 -> 3 batches (4, 4, 2)
|
|
222
|
-
config = BatchConfig(batch_size=4, row_timeout_ms=1000)
|
|
223
|
-
processor = BatchRowProcessor(
|
|
224
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
# Create unique results for each row to avoid deduplication
|
|
228
|
-
call_count = 0
|
|
229
|
-
|
|
230
|
-
async def create_unique_result(*args, **kwargs):
|
|
231
|
-
nonlocal call_count
|
|
232
|
-
call_count += 1
|
|
233
|
-
row_id = kwargs.get("row_id", f"row_{call_count}")
|
|
234
|
-
return RowEvaluationResult(
|
|
235
|
-
row_id=row_id,
|
|
236
|
-
check_id="test_check",
|
|
237
|
-
status=RowStatus.PASS,
|
|
238
|
-
score=100.0,
|
|
239
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
240
|
-
reason="Test reason",
|
|
241
|
-
finding="Test finding",
|
|
242
|
-
evidence_anchors=[],
|
|
243
|
-
provenance=RowProvenance(
|
|
244
|
-
row_llm_mode="test",
|
|
245
|
-
protocol=None,
|
|
246
|
-
model=None,
|
|
247
|
-
template_hash="hash",
|
|
248
|
-
rubric_version="1",
|
|
249
|
-
evidence_hash="hash",
|
|
250
|
-
evaluated_at=datetime.now(UTC),
|
|
251
|
-
),
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
255
|
-
|
|
256
|
-
results = await processor.process_all(thread_id="test-thread")
|
|
257
|
-
|
|
258
|
-
assert len(results) == 10
|
|
259
|
-
assert mock_evaluator.aevaluate_row.call_count == 10
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
@pytest.mark.asyncio
|
|
263
|
-
async def test_row_retrieval_trace_merges_matcher_context(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
264
|
-
"""Row retrieval trace should preserve matcher context and row evaluator fields."""
|
|
265
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
266
|
-
|
|
267
|
-
config = BatchConfig(batch_size=1, row_timeout_ms=1_000)
|
|
268
|
-
processor = BatchRowProcessor(
|
|
269
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
mock_evaluator.aevaluate_row.return_value = RowEvaluationResult(
|
|
273
|
-
row_id="CHK-0:row_0",
|
|
274
|
-
check_id="CHK-0",
|
|
275
|
-
status=RowStatus.PASS,
|
|
276
|
-
score=90.0,
|
|
277
|
-
score_breakdown=ScoreBreakdown.compute(90.0),
|
|
278
|
-
reason="merged trace",
|
|
279
|
-
finding="merged trace",
|
|
280
|
-
evidence_anchors=[],
|
|
281
|
-
retrieval_trace={
|
|
282
|
-
"selected_backend": "prompt_evaluator",
|
|
283
|
-
"mode": None,
|
|
284
|
-
"docs": None,
|
|
285
|
-
"tool_first_loop": {"steps_executed": 5},
|
|
286
|
-
},
|
|
287
|
-
provenance=RowProvenance(
|
|
288
|
-
row_llm_mode="test",
|
|
289
|
-
protocol=None,
|
|
290
|
-
model=None,
|
|
291
|
-
template_hash="hash",
|
|
292
|
-
rubric_version="1",
|
|
293
|
-
evidence_hash="hash",
|
|
294
|
-
evaluated_at=datetime.now(UTC),
|
|
295
|
-
),
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
results = await processor.process_all(thread_id="test-row-trace-merge")
|
|
299
|
-
|
|
300
|
-
assert len(results) == 1
|
|
301
|
-
trace = results[0].retrieval_trace
|
|
302
|
-
assert isinstance(trace, dict)
|
|
303
|
-
assert trace.get("mode") == "lexical"
|
|
304
|
-
assert trace.get("selected_backend") == "prompt_evaluator"
|
|
305
|
-
assert trace.get("tool_first_loop", {}).get("steps_executed") == 5
|
|
306
|
-
assert trace.get("docs", [{}])[0].get("source_path") == "docs/a.md"
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
@pytest.mark.asyncio
|
|
310
|
-
async def test_batch_progress_callback_emits_incremental_updates(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
311
|
-
"""Processed batches should emit incremental progress snapshots."""
|
|
312
|
-
config = BatchConfig(batch_size=4, row_timeout_ms=1000)
|
|
313
|
-
processor = BatchRowProcessor(
|
|
314
|
-
template=mock_template,
|
|
315
|
-
evaluator=mock_evaluator,
|
|
316
|
-
evidence_matcher=mock_evidence_matcher,
|
|
317
|
-
config=config,
|
|
318
|
-
)
|
|
319
|
-
|
|
320
|
-
async def create_unique_result(*args, **kwargs):
|
|
321
|
-
row_id = kwargs.get("row_id", "missing-row-id")
|
|
322
|
-
check_id = kwargs.get("check").id
|
|
323
|
-
return RowEvaluationResult(
|
|
324
|
-
row_id=row_id,
|
|
325
|
-
check_id=check_id,
|
|
326
|
-
status=RowStatus.PASS,
|
|
327
|
-
score=100.0,
|
|
328
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
329
|
-
reason="ok",
|
|
330
|
-
finding="ok",
|
|
331
|
-
evidence_anchors=[],
|
|
332
|
-
provenance=RowProvenance(
|
|
333
|
-
row_llm_mode="test",
|
|
334
|
-
protocol=None,
|
|
335
|
-
model=None,
|
|
336
|
-
template_hash="hash",
|
|
337
|
-
rubric_version="1",
|
|
338
|
-
evidence_hash="hash",
|
|
339
|
-
evaluated_at=datetime.now(UTC),
|
|
340
|
-
),
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
344
|
-
|
|
345
|
-
progress_events: list[tuple[str, int, int, int]] = []
|
|
346
|
-
|
|
347
|
-
async def on_progress(progress, current_results):
|
|
348
|
-
progress_events.append(
|
|
349
|
-
(progress.emission_kind, progress.batch_index, progress.batch_count, len(current_results))
|
|
350
|
-
)
|
|
351
|
-
|
|
352
|
-
results = await processor.process_all(thread_id="test-progress", progress_callback=on_progress)
|
|
353
|
-
|
|
354
|
-
assert len(results) == 10
|
|
355
|
-
row_events = [event for event in progress_events if event[0] == "row"]
|
|
356
|
-
batch_events = [event for event in progress_events if event[0] == "batch"]
|
|
357
|
-
# Row events include both "started" and "success" emissions per row:
|
|
358
|
-
# 10 rows × 2 events = 20 total row events
|
|
359
|
-
assert len(row_events) == 20
|
|
360
|
-
assert len(batch_events) == 3 # 10 rows with batch size 4 => 3 completed batches
|
|
361
|
-
# First row event is "started" (completed_rows=0), second is "success" (completed_rows=1)
|
|
362
|
-
assert row_events[0] == ("row", 0, 3, 0) # row started
|
|
363
|
-
assert row_events[1] == ("row", 0, 3, 0) # row started (concurrent)
|
|
364
|
-
assert row_events[4] == ("row", 0, 3, 1) # first row completed
|
|
365
|
-
assert batch_events[0] == ("batch", 0, 3, 4)
|
|
366
|
-
assert batch_events[1] == ("batch", 1, 3, 8)
|
|
367
|
-
assert batch_events[2] == ("batch", 2, 3, 10)
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
@pytest.mark.asyncio
|
|
371
|
-
async def test_parallel_batch_deduplicates_shared_matcher_work(monkeypatch, mock_template, mock_evaluator):
|
|
372
|
-
"""Parallel rows with identical retrieval inputs should share one matcher call per batch."""
|
|
373
|
-
mock_template.sections[0].checks = [
|
|
374
|
-
AuditCheck(id="CHK-A", name="Check A", description="same requirement", section_id="SEC-1"),
|
|
375
|
-
AuditCheck(id="CHK-B", name="Check B", description="same requirement", section_id="SEC-1"),
|
|
376
|
-
]
|
|
377
|
-
|
|
378
|
-
class _Matcher:
|
|
379
|
-
retrieval_mode = "lexical"
|
|
380
|
-
|
|
381
|
-
def __init__(self) -> None:
|
|
382
|
-
self.calls: list[tuple[str, str, str | None]] = []
|
|
383
|
-
|
|
384
|
-
def match_row(
|
|
385
|
-
self, *, row_id: str, requirement_text: str, section_id: str | None, log_retrieval_trace_event: bool = True
|
|
386
|
-
): # type: ignore[no-untyped-def]
|
|
387
|
-
_ = log_retrieval_trace_event
|
|
388
|
-
self.calls.append((row_id, requirement_text, section_id))
|
|
389
|
-
return _DeterministicEvidenceContext(
|
|
390
|
-
row_id=row_id,
|
|
391
|
-
requirement_text=requirement_text,
|
|
392
|
-
evidence_refs=[f"ref::{requirement_text}"],
|
|
393
|
-
retrieval_trace={"mode": "lexical", "row_id": row_id},
|
|
394
|
-
)
|
|
395
|
-
|
|
396
|
-
matcher = _Matcher()
|
|
397
|
-
|
|
398
|
-
async def _result(*args, **kwargs):
|
|
399
|
-
row_id = kwargs["row_id"]
|
|
400
|
-
check = kwargs["check"]
|
|
401
|
-
return RowEvaluationResult(
|
|
402
|
-
row_id=row_id,
|
|
403
|
-
check_id=check.id,
|
|
404
|
-
status=RowStatus.PASS,
|
|
405
|
-
score=100.0,
|
|
406
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
407
|
-
reason="ok",
|
|
408
|
-
finding="ok",
|
|
409
|
-
evidence_anchors=[],
|
|
410
|
-
provenance=RowProvenance(
|
|
411
|
-
row_llm_mode="test",
|
|
412
|
-
protocol=None,
|
|
413
|
-
model=None,
|
|
414
|
-
template_hash="hash",
|
|
415
|
-
rubric_version="1",
|
|
416
|
-
evidence_hash="hash",
|
|
417
|
-
evaluated_at=datetime.now(UTC),
|
|
418
|
-
),
|
|
419
|
-
)
|
|
420
|
-
|
|
421
|
-
mock_evaluator.aevaluate_row.side_effect = _result
|
|
422
|
-
|
|
423
|
-
config = BatchConfig(batch_size=2, row_timeout_ms=1000, row_concurrency=2)
|
|
424
|
-
processor = BatchRowProcessor(
|
|
425
|
-
template=mock_template,
|
|
426
|
-
evaluator=mock_evaluator,
|
|
427
|
-
evidence_matcher=matcher,
|
|
428
|
-
config=config,
|
|
429
|
-
)
|
|
430
|
-
|
|
431
|
-
results = await processor.process_all(thread_id="test-parallel-dedup")
|
|
432
|
-
|
|
433
|
-
assert len(results) == 2
|
|
434
|
-
assert len(matcher.calls) == 1
|
|
435
|
-
assert matcher.calls[0] == ("CHK-A:row_0", "same requirement", "SEC-1")
|
|
436
|
-
assert all(
|
|
437
|
-
result.retrieval_trace.get("mode") == "lexical"
|
|
438
|
-
for result in results
|
|
439
|
-
if isinstance(result.retrieval_trace, dict)
|
|
440
|
-
)
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
@pytest.mark.asyncio
|
|
444
|
-
async def test_targeted_execution_complete_log_includes_run_context(
|
|
445
|
-
monkeypatch, mock_template, mock_evaluator, mock_evidence_matcher
|
|
446
|
-
):
|
|
447
|
-
"""Targeted completion logs should include thread/repo/project identity."""
|
|
448
|
-
target_selection = TargetSelection(
|
|
449
|
-
target_type=TargetType.ROW_IDS,
|
|
450
|
-
raw_value="1",
|
|
451
|
-
row_indices=frozenset({0}),
|
|
452
|
-
)
|
|
453
|
-
config = BatchConfig(
|
|
454
|
-
batch_size=4,
|
|
455
|
-
row_timeout_ms=1000,
|
|
456
|
-
target_selection=target_selection,
|
|
457
|
-
run_context={"repo_key": "demo-repo", "project_key": "demo-project"},
|
|
458
|
-
)
|
|
459
|
-
processor = BatchRowProcessor(
|
|
460
|
-
template=mock_template,
|
|
461
|
-
evaluator=mock_evaluator,
|
|
462
|
-
evidence_matcher=mock_evidence_matcher,
|
|
463
|
-
config=config,
|
|
464
|
-
)
|
|
465
|
-
|
|
466
|
-
async def create_unique_result(*args, **kwargs):
|
|
467
|
-
row_id = kwargs.get("row_id", "missing-row-id")
|
|
468
|
-
check_id = kwargs.get("check").id
|
|
469
|
-
return RowEvaluationResult(
|
|
470
|
-
row_id=row_id,
|
|
471
|
-
check_id=check_id,
|
|
472
|
-
status=RowStatus.PASS,
|
|
473
|
-
score=100.0,
|
|
474
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
475
|
-
reason="ok",
|
|
476
|
-
finding="ok",
|
|
477
|
-
evidence_anchors=[],
|
|
478
|
-
provenance=RowProvenance(
|
|
479
|
-
row_llm_mode="test",
|
|
480
|
-
protocol=None,
|
|
481
|
-
model=None,
|
|
482
|
-
template_hash="hash",
|
|
483
|
-
rubric_version="1",
|
|
484
|
-
evidence_hash="hash",
|
|
485
|
-
evaluated_at=datetime.now(UTC),
|
|
486
|
-
),
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
490
|
-
|
|
491
|
-
captured: list[tuple[str, dict[str, object]]] = []
|
|
492
|
-
|
|
493
|
-
def fake_info(event, **kwargs):
|
|
494
|
-
captured.append((event, kwargs))
|
|
495
|
-
|
|
496
|
-
monkeypatch.setattr(batch_processor_module.logger, "info", fake_info)
|
|
497
|
-
|
|
498
|
-
await processor.process_all(thread_id="test-targeted-log-context")
|
|
499
|
-
|
|
500
|
-
targeted_event = next(kwargs for event, kwargs in captured if event == "targeted_execution_complete")
|
|
501
|
-
assert targeted_event["repo_key"] == "demo-repo"
|
|
502
|
-
assert targeted_event["project_key"] == "demo-project"
|
|
503
|
-
assert targeted_event["thread_id"] == "test-targeted-log-context"
|
|
504
|
-
assert targeted_event["completion_scope"] == "targeted"
|
|
505
|
-
assert targeted_event["targeted_total_rows"] == 1
|
|
506
|
-
assert targeted_event["targeted_completed_rows"] == 1
|
|
507
|
-
assert targeted_event["targeted_completion_pct"] == 100.0
|
|
508
|
-
|
|
509
|
-
batch_progress_event = next(kwargs for event, kwargs in captured if event == "batch_progress")
|
|
510
|
-
assert batch_progress_event["completion_scope"] == "targeted"
|
|
511
|
-
assert batch_progress_event["targeted_total_rows"] == 1
|
|
512
|
-
assert batch_progress_event["targeted_completed_rows"] == 1
|
|
513
|
-
assert batch_progress_event["targeted_completion_pct"] == 100.0
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
@pytest.mark.asyncio
|
|
517
|
-
@pytest.mark.parametrize("row_concurrency", [1, 3])
|
|
518
|
-
async def test_targeted_row_progress_omits_null_identity_skipped_events(
|
|
519
|
-
mock_template, mock_evaluator, mock_evidence_matcher, row_concurrency
|
|
520
|
-
):
|
|
521
|
-
"""Targeted runs should not emit row progress entries without row/check identifiers."""
|
|
522
|
-
target_selection = TargetSelection(
|
|
523
|
-
target_type=TargetType.ROW_IDS,
|
|
524
|
-
raw_value="1,3,6",
|
|
525
|
-
row_indices=frozenset({0, 2, 5}),
|
|
526
|
-
)
|
|
527
|
-
config = BatchConfig(
|
|
528
|
-
batch_size=10,
|
|
529
|
-
row_timeout_ms=1000,
|
|
530
|
-
target_selection=target_selection,
|
|
531
|
-
force_refresh_targets=True,
|
|
532
|
-
row_concurrency=row_concurrency,
|
|
533
|
-
)
|
|
534
|
-
processor = BatchRowProcessor(
|
|
535
|
-
template=mock_template,
|
|
536
|
-
evaluator=mock_evaluator,
|
|
537
|
-
evidence_matcher=mock_evidence_matcher,
|
|
538
|
-
config=config,
|
|
539
|
-
)
|
|
540
|
-
|
|
541
|
-
async def create_unique_result(*args, **kwargs):
|
|
542
|
-
row_id = kwargs.get("row_id", "missing-row-id")
|
|
543
|
-
check_id = kwargs.get("check").id
|
|
544
|
-
return RowEvaluationResult(
|
|
545
|
-
row_id=row_id,
|
|
546
|
-
check_id=check_id,
|
|
547
|
-
status=RowStatus.PASS,
|
|
548
|
-
score=100.0,
|
|
549
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
550
|
-
reason="ok",
|
|
551
|
-
finding="ok",
|
|
552
|
-
evidence_anchors=[],
|
|
553
|
-
provenance=RowProvenance(
|
|
554
|
-
row_llm_mode="test",
|
|
555
|
-
protocol=None,
|
|
556
|
-
model=None,
|
|
557
|
-
template_hash="hash",
|
|
558
|
-
rubric_version="1",
|
|
559
|
-
evidence_hash="hash",
|
|
560
|
-
evaluated_at=datetime.now(UTC),
|
|
561
|
-
),
|
|
562
|
-
)
|
|
563
|
-
|
|
564
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
565
|
-
progress_events: list[tuple[str, str | None, str | None, int]] = []
|
|
566
|
-
|
|
567
|
-
async def on_progress(progress, current_results):
|
|
568
|
-
progress_events.append(
|
|
569
|
-
(
|
|
570
|
-
progress.emission_kind,
|
|
571
|
-
getattr(progress, "current_row_id", None),
|
|
572
|
-
getattr(progress, "current_check_id", None),
|
|
573
|
-
len(current_results),
|
|
574
|
-
)
|
|
575
|
-
)
|
|
576
|
-
|
|
577
|
-
results = await processor.process_all(
|
|
578
|
-
thread_id=f"test-targeted-no-null-row-progress-{row_concurrency}",
|
|
579
|
-
progress_callback=on_progress,
|
|
580
|
-
)
|
|
581
|
-
|
|
582
|
-
row_events = [event for event in progress_events if event[0] == "row"]
|
|
583
|
-
assert len(results) == 3
|
|
584
|
-
assert len(row_events) >= 3
|
|
585
|
-
assert all(event[1] is not None and event[2] is not None for event in row_events)
|
|
586
|
-
assert {event[3] for event in row_events}.issuperset({0, 1, 2, 3})
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
@pytest.mark.asyncio
|
|
590
|
-
async def test_targeted_row_progress_emits_started_identity_before_result(
|
|
591
|
-
mock_template,
|
|
592
|
-
mock_evaluator,
|
|
593
|
-
mock_evidence_matcher,
|
|
594
|
-
):
|
|
595
|
-
config = BatchConfig(
|
|
596
|
-
batch_size=1,
|
|
597
|
-
row_timeout_ms=1000,
|
|
598
|
-
target_selection=TargetSelection(
|
|
599
|
-
target_type=TargetType.CHECK_IDS,
|
|
600
|
-
raw_value="CHK-0",
|
|
601
|
-
check_ids=frozenset({"CHK-0"}),
|
|
602
|
-
row_indices=frozenset({0}),
|
|
603
|
-
),
|
|
604
|
-
)
|
|
605
|
-
processor = BatchRowProcessor(
|
|
606
|
-
template=mock_template,
|
|
607
|
-
evaluator=mock_evaluator,
|
|
608
|
-
evidence_matcher=mock_evidence_matcher,
|
|
609
|
-
config=config,
|
|
610
|
-
)
|
|
611
|
-
|
|
612
|
-
async def create_result(*args, **kwargs):
|
|
613
|
-
return RowEvaluationResult(
|
|
614
|
-
row_id=kwargs.get("row_id", "CHK-0:row_0"),
|
|
615
|
-
check_id=kwargs.get("check").id,
|
|
616
|
-
status=RowStatus.PASS,
|
|
617
|
-
score=100.0,
|
|
618
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
619
|
-
reason="ok",
|
|
620
|
-
finding="ok",
|
|
621
|
-
evidence_anchors=[],
|
|
622
|
-
provenance=RowProvenance(
|
|
623
|
-
row_llm_mode="test",
|
|
624
|
-
protocol=None,
|
|
625
|
-
model=None,
|
|
626
|
-
template_hash="hash",
|
|
627
|
-
rubric_version="1",
|
|
628
|
-
evidence_hash="hash",
|
|
629
|
-
evaluated_at=datetime.now(UTC),
|
|
630
|
-
),
|
|
631
|
-
)
|
|
632
|
-
|
|
633
|
-
mock_evaluator.aevaluate_row.side_effect = create_result
|
|
634
|
-
|
|
635
|
-
progress_events: list[tuple[str, str | None, str | None, int]] = []
|
|
636
|
-
|
|
637
|
-
async def on_progress(progress, current_results):
|
|
638
|
-
progress_events.append(
|
|
639
|
-
(
|
|
640
|
-
progress.emission_kind,
|
|
641
|
-
getattr(progress, "current_row_id", None),
|
|
642
|
-
getattr(progress, "current_check_id", None),
|
|
643
|
-
len(current_results),
|
|
644
|
-
)
|
|
645
|
-
)
|
|
646
|
-
|
|
647
|
-
await processor.process_all(thread_id="test-targeted-started-row-progress", progress_callback=on_progress)
|
|
648
|
-
|
|
649
|
-
row_events = [event for event in progress_events if event[0] == "row"]
|
|
650
|
-
assert row_events
|
|
651
|
-
first_row_event = row_events[0]
|
|
652
|
-
assert first_row_event[1] == "CHK-0:row_0"
|
|
653
|
-
assert first_row_event[2] == "CHK-0"
|
|
654
|
-
assert first_row_event[3] == 0
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
@pytest.mark.asyncio
|
|
658
|
-
async def test_row_progress_uses_assigned_profile_from_result_provenance(
|
|
659
|
-
monkeypatch: pytest.MonkeyPatch,
|
|
660
|
-
mock_template,
|
|
661
|
-
mock_evaluator,
|
|
662
|
-
mock_evidence_matcher,
|
|
663
|
-
):
|
|
664
|
-
config = BatchConfig(
|
|
665
|
-
batch_size=1,
|
|
666
|
-
row_timeout_ms=1000,
|
|
667
|
-
target_selection=TargetSelection(
|
|
668
|
-
target_type=TargetType.CHECK_IDS,
|
|
669
|
-
raw_value="CHK-1",
|
|
670
|
-
check_ids=frozenset({"CHK-1"}),
|
|
671
|
-
row_indices=frozenset({0}),
|
|
672
|
-
),
|
|
673
|
-
run_context={
|
|
674
|
-
"active_profile": "zai-openai",
|
|
675
|
-
"repo_primary_profile": "zai-openai",
|
|
676
|
-
"repo_profile_execution_mode": "distributed",
|
|
677
|
-
"repo_distribution_profiles": ["zai-openai", "alibaba-openai"],
|
|
678
|
-
"executed_profile": "zai-openai",
|
|
679
|
-
},
|
|
680
|
-
)
|
|
681
|
-
processor = BatchRowProcessor(
|
|
682
|
-
template=mock_template,
|
|
683
|
-
evaluator=mock_evaluator,
|
|
684
|
-
evidence_matcher=mock_evidence_matcher,
|
|
685
|
-
config=config,
|
|
686
|
-
)
|
|
687
|
-
mock_evaluator.evidence_bundle = None
|
|
688
|
-
monkeypatch.setattr(processor, "_build_row_assigned_evaluator", lambda assigned_profile: mock_evaluator)
|
|
689
|
-
|
|
690
|
-
async def create_result(*args, **kwargs):
|
|
691
|
-
return RowEvaluationResult(
|
|
692
|
-
row_id=kwargs.get("row_id", "CHK-1:row_0"),
|
|
693
|
-
check_id=kwargs.get("check").id,
|
|
694
|
-
status=RowStatus.PASS,
|
|
695
|
-
score=100.0,
|
|
696
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
697
|
-
reason="ok",
|
|
698
|
-
finding="ok",
|
|
699
|
-
evidence_anchors=[],
|
|
700
|
-
provenance=RowProvenance(
|
|
701
|
-
row_llm_mode="test",
|
|
702
|
-
protocol=None,
|
|
703
|
-
model=None,
|
|
704
|
-
original_provider="alibaba-openai",
|
|
705
|
-
final_provider="alibaba-openai",
|
|
706
|
-
template_hash="hash",
|
|
707
|
-
rubric_version="1",
|
|
708
|
-
evidence_hash="hash",
|
|
709
|
-
evaluated_at=datetime.now(UTC),
|
|
710
|
-
),
|
|
711
|
-
retrieval_trace={"row_distribution_profile": "alibaba-openai"},
|
|
712
|
-
)
|
|
713
|
-
|
|
714
|
-
mock_evaluator.aevaluate_row.side_effect = create_result
|
|
715
|
-
|
|
716
|
-
captured: list[tuple[str, dict[str, object]]] = []
|
|
717
|
-
|
|
718
|
-
def fake_info(event, **kwargs):
|
|
719
|
-
captured.append((event, kwargs))
|
|
720
|
-
|
|
721
|
-
monkeypatch.setattr(batch_processor_module.logger, "info", fake_info)
|
|
722
|
-
|
|
723
|
-
await processor.process_all(thread_id="test-row-progress-assigned-profile")
|
|
724
|
-
|
|
725
|
-
started_event = next(kwargs for event, kwargs in captured if event == "row_progress" and kwargs.get("row_outcome") == "started")
|
|
726
|
-
success_event = next(kwargs for event, kwargs in captured if event == "row_progress" and kwargs.get("row_outcome") == "success")
|
|
727
|
-
assert started_event["executed_profile"] == "zai-openai"
|
|
728
|
-
assert started_event["active_profile"] == "zai-openai"
|
|
729
|
-
assert success_event["origin_profile"] == "alibaba-openai"
|
|
730
|
-
assert success_event["row_distribution_profile"] == "alibaba-openai"
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
@pytest.mark.asyncio
|
|
734
|
-
async def test_timeout_handling(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
735
|
-
"""Test handling of row timeout (FR-3.2)."""
|
|
736
|
-
# Only 1 check for simplicity
|
|
737
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
738
|
-
|
|
739
|
-
config = BatchConfig(batch_size=1, row_timeout_ms=100)
|
|
740
|
-
processor = BatchRowProcessor(
|
|
741
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
742
|
-
)
|
|
743
|
-
|
|
744
|
-
# Simulate timeout
|
|
745
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
746
|
-
|
|
747
|
-
results = await processor.process_all(thread_id="test-thread")
|
|
748
|
-
|
|
749
|
-
assert len(results) == 1
|
|
750
|
-
assert results[0].status == RowStatus.ERROR
|
|
751
|
-
assert "timeout" in results[0].error_message.lower()
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
@pytest.mark.asyncio
|
|
755
|
-
async def test_batch_timeout_fallback_preserves_progress_snapshot_and_prompt_summary(
|
|
756
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
757
|
-
):
|
|
758
|
-
"""Batch timeout fallback should retain progress snapshot + prompt telemetry summary."""
|
|
759
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
760
|
-
|
|
761
|
-
config = BatchConfig(batch_size=1, row_timeout_ms=60_000, batch_timeout_ms=100)
|
|
762
|
-
processor = BatchRowProcessor(
|
|
763
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
764
|
-
)
|
|
765
|
-
|
|
766
|
-
async def _slow_eval(*args, **kwargs):
|
|
767
|
-
await asyncio.sleep(1.0)
|
|
768
|
-
return RowEvaluationResult(
|
|
769
|
-
row_id=str(kwargs.get("row_id") or "CHK-0:row_0"),
|
|
770
|
-
check_id=str(kwargs.get("check").id if kwargs.get("check") else "CHK-0"),
|
|
771
|
-
status=RowStatus.PASS,
|
|
772
|
-
score=85.0,
|
|
773
|
-
score_breakdown=ScoreBreakdown.compute(85.0),
|
|
774
|
-
reason="slow result",
|
|
775
|
-
finding="slow",
|
|
776
|
-
evidence_anchors=[],
|
|
777
|
-
provenance=RowProvenance(
|
|
778
|
-
row_llm_mode="test",
|
|
779
|
-
protocol=None,
|
|
780
|
-
model=None,
|
|
781
|
-
template_hash="hash",
|
|
782
|
-
rubric_version="1",
|
|
783
|
-
evidence_hash="hash",
|
|
784
|
-
evaluated_at=datetime.now(UTC),
|
|
785
|
-
),
|
|
786
|
-
)
|
|
787
|
-
|
|
788
|
-
mock_evaluator.aevaluate_row.side_effect = _slow_eval
|
|
789
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
790
|
-
"effective_progress": False,
|
|
791
|
-
"termination_reason": "timeout",
|
|
792
|
-
"steps_executed": 2,
|
|
793
|
-
"steps_unique_tools": 2,
|
|
794
|
-
"step_repetition_rate": 0.5,
|
|
795
|
-
"evidence_refs_count": 1,
|
|
796
|
-
"prompt_tool_telemetry": {
|
|
797
|
-
"event_tool_calls_completed": 2,
|
|
798
|
-
"event_skill_tool_calls": 1,
|
|
799
|
-
"event_skill_execution_tool_calls": 0,
|
|
800
|
-
},
|
|
801
|
-
"prompt_tool_telemetry_summary": {
|
|
802
|
-
"tool_calls": 2,
|
|
803
|
-
"skill_calls": 1,
|
|
804
|
-
"skill_execution_calls": 0,
|
|
805
|
-
"skill_effective_calls": 0,
|
|
806
|
-
},
|
|
807
|
-
"requirement_interpretation": {
|
|
808
|
-
"skills_needed": True,
|
|
809
|
-
"skills_needed_reason": "requirement_keyword:script",
|
|
810
|
-
"skill_objectives": ["analyze_tooling_automation_guidance"],
|
|
811
|
-
},
|
|
812
|
-
"skill_policy_preview": {
|
|
813
|
-
"source": "timeout_progress_snapshot",
|
|
814
|
-
"required": True,
|
|
815
|
-
"policy_mode": "advisory",
|
|
816
|
-
"strict_require_effective_skill": False,
|
|
817
|
-
"enforcement_enabled": False,
|
|
818
|
-
"skills_toolset_enabled": True,
|
|
819
|
-
"available_skill_count": 2,
|
|
820
|
-
"observed_skill_calls": 0,
|
|
821
|
-
"observed_skill_execution_calls": 0,
|
|
822
|
-
"observed_skill_effective_calls": 0,
|
|
823
|
-
},
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
results = await processor.process_all(thread_id="test-batch-timeout-fallback")
|
|
827
|
-
|
|
828
|
-
assert len(results) == 1
|
|
829
|
-
assert results[0].status == RowStatus.ERROR
|
|
830
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
831
|
-
assert results[0].retrieval_trace.get("batch_timeout_exceeded") is True
|
|
832
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_absolute_cap"
|
|
833
|
-
assert results[0].retrieval_trace.get("timeout_terminal_status") == RowStatus.ERROR.value
|
|
834
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_skill_tool_calls") == 1
|
|
835
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry_summary", {}).get("tool_calls") == 2
|
|
836
|
-
assert (
|
|
837
|
-
results[0]
|
|
838
|
-
.retrieval_trace.get("timeout_progress_snapshot", {})
|
|
839
|
-
.get("prompt_tool_telemetry_summary", {})
|
|
840
|
-
.get("skill_calls")
|
|
841
|
-
== 1
|
|
842
|
-
)
|
|
843
|
-
assert results[0].retrieval_trace.get("requirement_interpretation", {}).get("skills_needed") is True
|
|
844
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("incomplete_due_to_timeout") is True
|
|
845
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_calls") == 1
|
|
846
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_execution_calls") == 0
|
|
847
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_effective_calls") == 0
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
def test_effective_batch_timeout_includes_progress_extension_headroom(
|
|
851
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
852
|
-
):
|
|
853
|
-
"""Derived batch timeout should account for cumulative row retry timeout envelope."""
|
|
854
|
-
config = BatchConfig(
|
|
855
|
-
batch_size=5,
|
|
856
|
-
row_timeout_ms=45_000,
|
|
857
|
-
row_timeout_progress_extension_enabled=True,
|
|
858
|
-
row_timeout_progress_retry_attempts=1,
|
|
859
|
-
row_timeout_progress_extension_ms=30_000,
|
|
860
|
-
row_timeout_progress_max_ms=120_000,
|
|
861
|
-
batch_timeout_ms=None,
|
|
862
|
-
batch_overhead_ms=15_000,
|
|
863
|
-
)
|
|
864
|
-
processor = BatchRowProcessor(
|
|
865
|
-
template=mock_template,
|
|
866
|
-
evaluator=mock_evaluator,
|
|
867
|
-
evidence_matcher=mock_evidence_matcher,
|
|
868
|
-
config=config,
|
|
869
|
-
)
|
|
870
|
-
|
|
871
|
-
assert processor.effective_row_timeout_ceiling_ms() == 120_000
|
|
872
|
-
assert processor.effective_row_timeout_envelope_ms() == 345_000
|
|
873
|
-
assert processor.effective_batch_timeout_ms() == 1_740_000
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
def test_effective_batch_timeout_uses_explicit_override(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
877
|
-
"""Explicit batch timeout should override derived timeout calculations."""
|
|
878
|
-
config = BatchConfig(
|
|
879
|
-
batch_size=5,
|
|
880
|
-
row_timeout_ms=45_000,
|
|
881
|
-
row_timeout_progress_extension_enabled=True,
|
|
882
|
-
row_timeout_progress_retry_attempts=3,
|
|
883
|
-
row_timeout_progress_extension_ms=30_000,
|
|
884
|
-
row_timeout_progress_max_ms=180_000,
|
|
885
|
-
batch_timeout_ms=240_000,
|
|
886
|
-
batch_overhead_ms=15_000,
|
|
887
|
-
)
|
|
888
|
-
processor = BatchRowProcessor(
|
|
889
|
-
template=mock_template,
|
|
890
|
-
evaluator=mock_evaluator,
|
|
891
|
-
evidence_matcher=mock_evidence_matcher,
|
|
892
|
-
config=config,
|
|
893
|
-
)
|
|
894
|
-
|
|
895
|
-
assert processor.effective_row_timeout_ceiling_ms() == 180_000
|
|
896
|
-
assert processor.effective_row_timeout_envelope_ms() == 705_000
|
|
897
|
-
assert processor.effective_batch_timeout_ms() == 240_000
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
def test_adaptive_row_concurrency_increases_on_healthy_batch(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
901
|
-
config = BatchConfig(
|
|
902
|
-
batch_size=2,
|
|
903
|
-
row_concurrency=2,
|
|
904
|
-
adaptive_row_concurrency=True,
|
|
905
|
-
adaptive_row_concurrency_min=1,
|
|
906
|
-
adaptive_row_concurrency_max=4,
|
|
907
|
-
adaptive_row_concurrency_increase_threshold_ms=1000,
|
|
908
|
-
adaptive_row_concurrency_decrease_threshold_ms=5000,
|
|
909
|
-
)
|
|
910
|
-
processor = BatchRowProcessor(
|
|
911
|
-
template=mock_template,
|
|
912
|
-
evaluator=mock_evaluator,
|
|
913
|
-
evidence_matcher=mock_evidence_matcher,
|
|
914
|
-
config=config,
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
assert processor._effective_row_concurrency() == 2
|
|
918
|
-
processor._update_adaptive_row_concurrency(
|
|
919
|
-
BatchResult(
|
|
920
|
-
batch_index=0,
|
|
921
|
-
start_row=0,
|
|
922
|
-
end_row=2,
|
|
923
|
-
results=[],
|
|
924
|
-
duration_ms=400,
|
|
925
|
-
success_count=2,
|
|
926
|
-
error_count=0,
|
|
927
|
-
skipped_count=0,
|
|
928
|
-
timed_out=False,
|
|
929
|
-
)
|
|
930
|
-
)
|
|
931
|
-
assert processor._effective_row_concurrency() == 3
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
def test_adaptive_row_concurrency_decreases_on_batch_pressure(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
935
|
-
config = BatchConfig(
|
|
936
|
-
batch_size=2,
|
|
937
|
-
row_concurrency=3,
|
|
938
|
-
adaptive_row_concurrency=True,
|
|
939
|
-
adaptive_row_concurrency_min=1,
|
|
940
|
-
adaptive_row_concurrency_max=4,
|
|
941
|
-
adaptive_row_concurrency_increase_threshold_ms=1000,
|
|
942
|
-
adaptive_row_concurrency_decrease_threshold_ms=5000,
|
|
943
|
-
)
|
|
944
|
-
processor = BatchRowProcessor(
|
|
945
|
-
template=mock_template,
|
|
946
|
-
evaluator=mock_evaluator,
|
|
947
|
-
evidence_matcher=mock_evidence_matcher,
|
|
948
|
-
config=config,
|
|
949
|
-
)
|
|
950
|
-
|
|
951
|
-
assert processor._effective_row_concurrency() == 3
|
|
952
|
-
processor._update_adaptive_row_concurrency(
|
|
953
|
-
BatchResult(
|
|
954
|
-
batch_index=0,
|
|
955
|
-
start_row=0,
|
|
956
|
-
end_row=2,
|
|
957
|
-
results=[],
|
|
958
|
-
duration_ms=6000,
|
|
959
|
-
success_count=1,
|
|
960
|
-
error_count=1,
|
|
961
|
-
skipped_count=0,
|
|
962
|
-
timed_out=False,
|
|
963
|
-
)
|
|
964
|
-
)
|
|
965
|
-
assert processor._effective_row_concurrency() == 2
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
def test_adaptive_row_concurrency_respects_bounds(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
969
|
-
config = BatchConfig(
|
|
970
|
-
batch_size=2,
|
|
971
|
-
row_concurrency=2,
|
|
972
|
-
adaptive_row_concurrency=True,
|
|
973
|
-
adaptive_row_concurrency_min=2,
|
|
974
|
-
adaptive_row_concurrency_max=3,
|
|
975
|
-
adaptive_row_concurrency_increase_threshold_ms=1000,
|
|
976
|
-
adaptive_row_concurrency_decrease_threshold_ms=5000,
|
|
977
|
-
)
|
|
978
|
-
processor = BatchRowProcessor(
|
|
979
|
-
template=mock_template,
|
|
980
|
-
evaluator=mock_evaluator,
|
|
981
|
-
evidence_matcher=mock_evidence_matcher,
|
|
982
|
-
config=config,
|
|
983
|
-
)
|
|
984
|
-
|
|
985
|
-
processor._update_adaptive_row_concurrency(
|
|
986
|
-
BatchResult(
|
|
987
|
-
batch_index=0,
|
|
988
|
-
start_row=0,
|
|
989
|
-
end_row=2,
|
|
990
|
-
results=[],
|
|
991
|
-
duration_ms=300,
|
|
992
|
-
success_count=2,
|
|
993
|
-
error_count=0,
|
|
994
|
-
skipped_count=0,
|
|
995
|
-
timed_out=False,
|
|
996
|
-
)
|
|
997
|
-
)
|
|
998
|
-
assert processor._effective_row_concurrency() == 3
|
|
999
|
-
|
|
1000
|
-
processor._update_adaptive_row_concurrency(
|
|
1001
|
-
BatchResult(
|
|
1002
|
-
batch_index=1,
|
|
1003
|
-
start_row=0,
|
|
1004
|
-
end_row=2,
|
|
1005
|
-
results=[],
|
|
1006
|
-
duration_ms=200,
|
|
1007
|
-
success_count=2,
|
|
1008
|
-
error_count=0,
|
|
1009
|
-
skipped_count=0,
|
|
1010
|
-
timed_out=False,
|
|
1011
|
-
)
|
|
1012
|
-
)
|
|
1013
|
-
assert processor._effective_row_concurrency() == 3
|
|
1014
|
-
|
|
1015
|
-
processor._update_adaptive_row_concurrency(
|
|
1016
|
-
BatchResult(
|
|
1017
|
-
batch_index=2,
|
|
1018
|
-
start_row=0,
|
|
1019
|
-
end_row=2,
|
|
1020
|
-
results=[],
|
|
1021
|
-
duration_ms=7000,
|
|
1022
|
-
success_count=0,
|
|
1023
|
-
error_count=1,
|
|
1024
|
-
skipped_count=0,
|
|
1025
|
-
timed_out=True,
|
|
1026
|
-
)
|
|
1027
|
-
)
|
|
1028
|
-
assert processor._effective_row_concurrency() == 2
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
def test_effective_batch_timeout_uses_absolute_cap_when_lease_mode_enabled(
|
|
1032
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1033
|
-
):
|
|
1034
|
-
"""Lease mode should budget rows against the configured absolute timeout cap."""
|
|
1035
|
-
config = BatchConfig(
|
|
1036
|
-
batch_size=3,
|
|
1037
|
-
row_timeout_ms=45_000,
|
|
1038
|
-
row_progress_lease_seconds=60,
|
|
1039
|
-
row_stall_detection_seconds=30,
|
|
1040
|
-
row_absolute_timeout_ms=600_000,
|
|
1041
|
-
batch_timeout_ms=None,
|
|
1042
|
-
batch_overhead_ms=15_000,
|
|
1043
|
-
)
|
|
1044
|
-
processor = BatchRowProcessor(
|
|
1045
|
-
template=mock_template,
|
|
1046
|
-
evaluator=mock_evaluator,
|
|
1047
|
-
evidence_matcher=mock_evidence_matcher,
|
|
1048
|
-
config=config,
|
|
1049
|
-
)
|
|
1050
|
-
|
|
1051
|
-
assert processor.effective_row_timeout_ceiling_ms() == 600_000
|
|
1052
|
-
assert processor.effective_row_timeout_envelope_ms() == 600_000
|
|
1053
|
-
assert processor.effective_batch_timeout_ms() == 1_815_000
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
@pytest.mark.asyncio
|
|
1057
|
-
async def test_timeout_retries_once_when_effective_timeout_progress_detected(
|
|
1058
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1059
|
-
):
|
|
1060
|
-
"""Row timeout should retry once with extended budget on timeout-based progress snapshot."""
|
|
1061
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1062
|
-
|
|
1063
|
-
config = BatchConfig(
|
|
1064
|
-
batch_size=1,
|
|
1065
|
-
row_timeout_ms=100,
|
|
1066
|
-
row_timeout_progress_extension_enabled=True,
|
|
1067
|
-
row_timeout_progress_retry_attempts=1,
|
|
1068
|
-
row_timeout_progress_extension_ms=100,
|
|
1069
|
-
row_timeout_progress_max_ms=300,
|
|
1070
|
-
)
|
|
1071
|
-
processor = BatchRowProcessor(
|
|
1072
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1073
|
-
)
|
|
1074
|
-
|
|
1075
|
-
call_count = 0
|
|
1076
|
-
|
|
1077
|
-
async def _side_effect(*args, **kwargs):
|
|
1078
|
-
nonlocal call_count
|
|
1079
|
-
call_count += 1
|
|
1080
|
-
if call_count == 1:
|
|
1081
|
-
raise TimeoutError("Simulated timeout")
|
|
1082
|
-
row_id = kwargs.get("row_id", "CHK-0:row_0")
|
|
1083
|
-
check = kwargs.get("check")
|
|
1084
|
-
check_id = check.id if check else "CHK-0"
|
|
1085
|
-
return RowEvaluationResult(
|
|
1086
|
-
row_id=row_id,
|
|
1087
|
-
check_id=check_id,
|
|
1088
|
-
status=RowStatus.PASS,
|
|
1089
|
-
score=85.0,
|
|
1090
|
-
score_breakdown=ScoreBreakdown.compute(85.0),
|
|
1091
|
-
reason="Recovered after timeout extension",
|
|
1092
|
-
finding="Recovered",
|
|
1093
|
-
evidence_anchors=[],
|
|
1094
|
-
provenance=RowProvenance(
|
|
1095
|
-
row_llm_mode="test",
|
|
1096
|
-
protocol=None,
|
|
1097
|
-
model=None,
|
|
1098
|
-
template_hash="hash",
|
|
1099
|
-
rubric_version="1",
|
|
1100
|
-
evidence_hash="hash",
|
|
1101
|
-
evaluated_at=datetime.now(UTC),
|
|
1102
|
-
),
|
|
1103
|
-
)
|
|
1104
|
-
|
|
1105
|
-
mock_evaluator.aevaluate_row.side_effect = _side_effect
|
|
1106
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1107
|
-
"effective_progress": True,
|
|
1108
|
-
"termination_reason": "timeout",
|
|
1109
|
-
"steps_executed": 4,
|
|
1110
|
-
"steps_unique_tools": 3,
|
|
1111
|
-
"step_repetition_rate": 0.25,
|
|
1112
|
-
"evidence_refs_count": 5,
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
results = await processor.process_all(thread_id="test-timeout-retry")
|
|
1116
|
-
|
|
1117
|
-
assert len(results) == 1
|
|
1118
|
-
assert results[0].status == RowStatus.PASS
|
|
1119
|
-
assert call_count == 2
|
|
1120
|
-
assert mock_evaluator.get_row_runtime_progress.call_count == 1
|
|
1121
|
-
assert mock_evaluator.clear_row_runtime_progress.call_count == 1
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
@pytest.mark.asyncio
|
|
1125
|
-
async def test_timeout_does_not_retry_when_effective_progress_snapshot_is_completed(
|
|
1126
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1127
|
-
):
|
|
1128
|
-
"""Completed fallback-only progress must not degrade into a grounded FAIL."""
|
|
1129
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1130
|
-
|
|
1131
|
-
config = BatchConfig(
|
|
1132
|
-
batch_size=1,
|
|
1133
|
-
row_timeout_ms=100,
|
|
1134
|
-
row_timeout_progress_extension_enabled=True,
|
|
1135
|
-
row_timeout_progress_retry_attempts=1,
|
|
1136
|
-
row_timeout_progress_extension_ms=100,
|
|
1137
|
-
row_timeout_progress_max_ms=300,
|
|
1138
|
-
)
|
|
1139
|
-
processor = BatchRowProcessor(
|
|
1140
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1141
|
-
)
|
|
1142
|
-
|
|
1143
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1144
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1145
|
-
"effective_progress": True,
|
|
1146
|
-
"termination_reason": "completed",
|
|
1147
|
-
"steps_executed": 4,
|
|
1148
|
-
"steps_unique_tools": 3,
|
|
1149
|
-
"step_repetition_rate": 0.25,
|
|
1150
|
-
"evidence_refs_count": 5,
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
results = await processor.process_all(thread_id="test-timeout-completed-no-retry")
|
|
1154
|
-
|
|
1155
|
-
assert len(results) == 1
|
|
1156
|
-
assert results[0].status == RowStatus.ERROR
|
|
1157
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
1158
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1159
|
-
assert results[0].retrieval_trace.get("timeout_extended") is False
|
|
1160
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == "termination_reason_not_timeout"
|
|
1161
|
-
assert results[0].retrieval_trace.get("timeout_degraded_finalize") is False
|
|
1162
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_no_progress"
|
|
1163
|
-
assert results[0].retrieval_trace.get("timeout_terminal_status") == RowStatus.ERROR.value
|
|
1164
|
-
assert mock_evaluator.get_row_runtime_progress.call_count == 1
|
|
1165
|
-
assert mock_evaluator.clear_row_runtime_progress.call_count == 1
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
@pytest.mark.asyncio
|
|
1169
|
-
async def test_timeout_completed_snapshot_can_still_degrade_when_verified_grounding_exists(
|
|
1170
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1171
|
-
):
|
|
1172
|
-
"""Completed snapshots may degrade only when recorded/verified grounding is present."""
|
|
1173
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1174
|
-
|
|
1175
|
-
config = BatchConfig(
|
|
1176
|
-
batch_size=1,
|
|
1177
|
-
row_timeout_ms=100,
|
|
1178
|
-
row_timeout_progress_extension_enabled=True,
|
|
1179
|
-
row_timeout_progress_retry_attempts=1,
|
|
1180
|
-
row_timeout_progress_extension_ms=100,
|
|
1181
|
-
row_timeout_progress_max_ms=300,
|
|
1182
|
-
)
|
|
1183
|
-
processor = BatchRowProcessor(
|
|
1184
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1185
|
-
)
|
|
1186
|
-
|
|
1187
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1188
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1189
|
-
"effective_progress": True,
|
|
1190
|
-
"termination_reason": "completed",
|
|
1191
|
-
"steps_executed": 4,
|
|
1192
|
-
"steps_unique_tools": 3,
|
|
1193
|
-
"step_repetition_rate": 0.25,
|
|
1194
|
-
"evidence_refs_count": 1,
|
|
1195
|
-
"evidence_refs": ["src/main/security.py"],
|
|
1196
|
-
"evidence_ref_verifications": [
|
|
1197
|
-
{
|
|
1198
|
-
"ref_value": "src/main/security.py",
|
|
1199
|
-
"verified": True,
|
|
1200
|
-
"excerpt": "def validate_token(token: str) -> bool:",
|
|
1201
|
-
"verification_reason": VERIFICATION_REASON_EXCERPT_VERIFIED_IN_CONTEXT,
|
|
1202
|
-
}
|
|
1203
|
-
],
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
results = await processor.process_all(thread_id="test-timeout-completed-verified-grounding")
|
|
1207
|
-
|
|
1208
|
-
assert len(results) == 1
|
|
1209
|
-
assert results[0].status == RowStatus.FAIL
|
|
1210
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1211
|
-
assert results[0].retrieval_trace.get("timeout_degraded_finalize") is True
|
|
1212
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_with_grounding"
|
|
1213
|
-
assert results[0].retrieval_trace.get("timeout_terminal_status") == RowStatus.FAIL.value
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
@pytest.mark.asyncio
|
|
1217
|
-
async def test_timeout_app_config_snapshot_with_decisive_trace_recovers_to_pass(
|
|
1218
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1219
|
-
):
|
|
1220
|
-
"""App-config timeout rows should recover to PASS when trace-backed pool evidence is already complete."""
|
|
1221
|
-
mock_template.sections[0].checks = [
|
|
1222
|
-
AuditCheck(
|
|
1223
|
-
id="CL-006",
|
|
1224
|
-
name="Connection pooling riêng biệt",
|
|
1225
|
-
description=(
|
|
1226
|
-
"Kiểm tra repo app-config theo đúng tên service và môi trường production. "
|
|
1227
|
-
"Mở file application.properties hoặc application.yml của service để xác nhận datasource.url, "
|
|
1228
|
-
"minimum-idle, maximum-pool-size, max-lifetime."
|
|
1229
|
-
),
|
|
1230
|
-
section_id="1. Decoupling",
|
|
1231
|
-
)
|
|
1232
|
-
]
|
|
1233
|
-
|
|
1234
|
-
config = BatchConfig(
|
|
1235
|
-
batch_size=1,
|
|
1236
|
-
row_timeout_ms=100,
|
|
1237
|
-
row_timeout_progress_extension_enabled=True,
|
|
1238
|
-
row_timeout_progress_retry_attempts=1,
|
|
1239
|
-
row_timeout_progress_extension_ms=100,
|
|
1240
|
-
row_timeout_progress_max_ms=300,
|
|
1241
|
-
)
|
|
1242
|
-
processor = BatchRowProcessor(
|
|
1243
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1244
|
-
)
|
|
1245
|
-
|
|
1246
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1247
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1248
|
-
"effective_progress": True,
|
|
1249
|
-
"termination_reason": "completed",
|
|
1250
|
-
"steps_executed": 4,
|
|
1251
|
-
"steps_unique_tools": 3,
|
|
1252
|
-
"step_repetition_rate": 0.25,
|
|
1253
|
-
"evidence_refs_count": 2,
|
|
1254
|
-
"evidence_refs": ["production/application.properties", "production/bootstrap.properties"],
|
|
1255
|
-
"requirement_interpretation": {
|
|
1256
|
-
"intent": "2. Sử dụng Connection Pooling riêng biệt và có giới hạn (Limit).",
|
|
1257
|
-
"detailed_guidance": (
|
|
1258
|
-
"Kiểm tra repo app-config theo đúng tên service và môi trường production. "
|
|
1259
|
-
"Mở file application.properties hoặc application.yml của service để xác nhận datasource.url, "
|
|
1260
|
-
"minimum-idle, maximum-pool-size, max-lifetime."
|
|
1261
|
-
),
|
|
1262
|
-
"app_config_only": True,
|
|
1263
|
-
"required_config_environments": ["production"],
|
|
1264
|
-
},
|
|
1265
|
-
"config_repo_companion_refs": [
|
|
1266
|
-
{
|
|
1267
|
-
"ref_value": "production/application.properties",
|
|
1268
|
-
"ref": "production/application.properties",
|
|
1269
|
-
"source_repo": "app-config",
|
|
1270
|
-
"metadata": {
|
|
1271
|
-
"env": "production",
|
|
1272
|
-
"source_repo_slug": "app-config",
|
|
1273
|
-
"config_root": "app-config",
|
|
1274
|
-
},
|
|
1275
|
-
}
|
|
1276
|
-
],
|
|
1277
|
-
"tool_first_loop": {
|
|
1278
|
-
"trace_steps": [
|
|
1279
|
-
{
|
|
1280
|
-
"step": 5,
|
|
1281
|
-
"tool": "read_code_file",
|
|
1282
|
-
"budget_cost": 1,
|
|
1283
|
-
"budget_remaining": 95,
|
|
1284
|
-
"output": {
|
|
1285
|
-
"path": "production/application.properties",
|
|
1286
|
-
"file_path": "production/application.properties",
|
|
1287
|
-
"content": (
|
|
1288
|
-
"spring.datasource.url=jdbc:postgresql://merchant-transaction\n"
|
|
1289
|
-
"spring.datasource.hikari.minimum-idle=10\n"
|
|
1290
|
-
"spring.datasource.hikari.maximum-pool-size=50\n"
|
|
1291
|
-
"spring.datasource.hikari.max-lifetime=1800000\n"
|
|
1292
|
-
),
|
|
1293
|
-
"start_line": 1,
|
|
1294
|
-
"end_line": 220,
|
|
1295
|
-
},
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
"step": 6,
|
|
1299
|
-
"tool": "record_evidence_refs",
|
|
1300
|
-
"budget_cost": 1,
|
|
1301
|
-
"budget_remaining": 94,
|
|
1302
|
-
"output": {
|
|
1303
|
-
"row_id": "CL-006:row_0",
|
|
1304
|
-
"refs": [
|
|
1305
|
-
{
|
|
1306
|
-
"ref_type": "code_path",
|
|
1307
|
-
"ref_value": "production/application.properties",
|
|
1308
|
-
"verified": True,
|
|
1309
|
-
"line_range": [1, 220],
|
|
1310
|
-
}
|
|
1311
|
-
],
|
|
1312
|
-
},
|
|
1313
|
-
},
|
|
1314
|
-
]
|
|
1315
|
-
},
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
results = await processor.process_all(thread_id="test-timeout-app-config-pass-recovery")
|
|
1319
|
-
|
|
1320
|
-
assert len(results) == 1
|
|
1321
|
-
assert results[0].status == RowStatus.PASS
|
|
1322
|
-
assert results[0].score == 80.0
|
|
1323
|
-
assert [anchor.ref_value for anchor in results[0].evidence_anchors] == ["production/application.properties"]
|
|
1324
|
-
assert "minimum-idle" in results[0].evidence_anchors[0].excerpt
|
|
1325
|
-
assert "maximum-pool-size" in results[0].evidence_anchors[0].excerpt
|
|
1326
|
-
assert "max-lifetime" in results[0].evidence_anchors[0].excerpt
|
|
1327
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1328
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_no_progress"
|
|
1329
|
-
assert (
|
|
1330
|
-
results[0].retrieval_trace.get("app_config_complete_pool_guard", {}).get("trigger")
|
|
1331
|
-
== "timeout_trace_decisive_pool_anchor"
|
|
1332
|
-
)
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
@pytest.mark.asyncio
|
|
1336
|
-
async def test_timeout_does_not_retry_when_progress_not_effective(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
1337
|
-
"""Row timeout should not extend when progress snapshot is not effective."""
|
|
1338
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1339
|
-
|
|
1340
|
-
config = BatchConfig(
|
|
1341
|
-
batch_size=1,
|
|
1342
|
-
row_timeout_ms=100,
|
|
1343
|
-
row_timeout_progress_extension_enabled=True,
|
|
1344
|
-
row_timeout_progress_retry_attempts=1,
|
|
1345
|
-
row_timeout_progress_extension_ms=100,
|
|
1346
|
-
row_timeout_progress_max_ms=300,
|
|
1347
|
-
)
|
|
1348
|
-
processor = BatchRowProcessor(
|
|
1349
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1350
|
-
)
|
|
1351
|
-
|
|
1352
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1353
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1354
|
-
"effective_progress": False,
|
|
1355
|
-
"termination_reason": "max_steps",
|
|
1356
|
-
"steps_executed": 1,
|
|
1357
|
-
"steps_unique_tools": 1,
|
|
1358
|
-
"step_repetition_rate": 1.0,
|
|
1359
|
-
"evidence_refs_count": 2,
|
|
1360
|
-
"prompt_tool_telemetry_summary": {
|
|
1361
|
-
"tool_calls": 3,
|
|
1362
|
-
"skill_calls": 2,
|
|
1363
|
-
"skill_execution_calls": 0,
|
|
1364
|
-
"skill_effective_calls": 0,
|
|
1365
|
-
},
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
results = await processor.process_all(thread_id="test-timeout-no-retry")
|
|
1369
|
-
|
|
1370
|
-
assert len(results) == 1
|
|
1371
|
-
assert results[0].status == RowStatus.ERROR
|
|
1372
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
1373
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1374
|
-
assert results[0].retrieval_trace.get("timeout_extended") is False
|
|
1375
|
-
assert results[0].retrieval_trace.get("timeout_degraded_finalize") is False
|
|
1376
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_no_progress"
|
|
1377
|
-
assert results[0].retrieval_trace.get("timeout_terminal_status") == RowStatus.ERROR.value
|
|
1378
|
-
assert results[0].retrieval_trace.get("timeout_progress_snapshot", {}).get("effective_progress") is False
|
|
1379
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry_summary", {}).get("tool_calls") == 3
|
|
1380
|
-
assert results[0].retrieval_trace.get("mode") == "lexical"
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
@pytest.mark.asyncio
|
|
1384
|
-
async def test_timeout_trace_reconciles_stale_prompt_telemetry_with_progress_snapshot(
|
|
1385
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1386
|
-
):
|
|
1387
|
-
"""Timeout trace should merge stale prompt telemetry with observed skill/tool progress."""
|
|
1388
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1389
|
-
|
|
1390
|
-
config = BatchConfig(
|
|
1391
|
-
batch_size=1,
|
|
1392
|
-
row_timeout_ms=100,
|
|
1393
|
-
row_timeout_progress_extension_enabled=True,
|
|
1394
|
-
row_timeout_progress_retry_attempts=0,
|
|
1395
|
-
row_timeout_progress_extension_ms=100,
|
|
1396
|
-
row_timeout_progress_max_ms=300,
|
|
1397
|
-
)
|
|
1398
|
-
processor = BatchRowProcessor(
|
|
1399
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1400
|
-
)
|
|
1401
|
-
|
|
1402
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1403
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1404
|
-
"effective_progress": True,
|
|
1405
|
-
"termination_reason": "completed",
|
|
1406
|
-
"steps_executed": 5,
|
|
1407
|
-
"steps_unique_tools": 4,
|
|
1408
|
-
"step_repetition_rate": 0.1,
|
|
1409
|
-
"evidence_refs_count": 3,
|
|
1410
|
-
"prompt_tool_telemetry": {
|
|
1411
|
-
"event_tool_calls_completed": 0,
|
|
1412
|
-
"event_skill_tool_calls": 0,
|
|
1413
|
-
"event_skill_execution_tool_calls": 0,
|
|
1414
|
-
"event_skill_effective_tool_calls": 0,
|
|
1415
|
-
"event_skill_execution_effective_tool_calls": 0,
|
|
1416
|
-
},
|
|
1417
|
-
"prompt_tool_telemetry_summary": {
|
|
1418
|
-
"tool_calls": 0,
|
|
1419
|
-
"skill_calls": 0,
|
|
1420
|
-
"skill_execution_calls": 0,
|
|
1421
|
-
"skill_effective_calls": 0,
|
|
1422
|
-
},
|
|
1423
|
-
"skill_policy_preview": {
|
|
1424
|
-
"source": "timeout_progress_snapshot",
|
|
1425
|
-
"required": True,
|
|
1426
|
-
"policy_mode": "advisory",
|
|
1427
|
-
"strict_require_effective_skill": False,
|
|
1428
|
-
"enforcement_enabled": False,
|
|
1429
|
-
"skills_toolset_enabled": True,
|
|
1430
|
-
"available_skill_count": 2,
|
|
1431
|
-
"observed_skill_calls": 2,
|
|
1432
|
-
"observed_skill_execution_calls": 1,
|
|
1433
|
-
"observed_skill_effective_calls": 1,
|
|
1434
|
-
},
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
results = await processor.process_all(thread_id="test-timeout-reconcile-progress")
|
|
1438
|
-
|
|
1439
|
-
assert len(results) == 1
|
|
1440
|
-
assert results[0].status == RowStatus.FAIL
|
|
1441
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
1442
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1443
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry_summary", {}).get("tool_calls") == 5
|
|
1444
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry_summary", {}).get("skill_calls") == 2
|
|
1445
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_tool_calls_completed") == 5
|
|
1446
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_skill_tool_calls") == 2
|
|
1447
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_skill_execution_tool_calls") == 1
|
|
1448
|
-
assert results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_skill_effective_tool_calls") == 1
|
|
1449
|
-
assert (
|
|
1450
|
-
results[0].retrieval_trace.get("prompt_tool_telemetry", {}).get("event_skill_execution_effective_tool_calls")
|
|
1451
|
-
== 1
|
|
1452
|
-
)
|
|
1453
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_calls") == 2
|
|
1454
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_execution_calls") == 1
|
|
1455
|
-
assert results[0].retrieval_trace.get("skill_policy_retry", {}).get("observed_skill_effective_calls") == 1
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
@pytest.mark.asyncio
|
|
1459
|
-
async def test_timeout_retry_exhausted_with_effective_progress_degrades_to_fail(
|
|
1460
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1461
|
-
):
|
|
1462
|
-
"""Timeout retry exhaustion should degrade to FAIL when progress is effective and grounded."""
|
|
1463
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1464
|
-
|
|
1465
|
-
config = BatchConfig(
|
|
1466
|
-
batch_size=1,
|
|
1467
|
-
row_timeout_ms=100,
|
|
1468
|
-
row_timeout_progress_extension_enabled=True,
|
|
1469
|
-
row_timeout_progress_retry_attempts=1,
|
|
1470
|
-
row_timeout_progress_extension_ms=100,
|
|
1471
|
-
row_timeout_progress_max_ms=300,
|
|
1472
|
-
)
|
|
1473
|
-
processor = BatchRowProcessor(
|
|
1474
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1475
|
-
)
|
|
1476
|
-
|
|
1477
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1478
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1479
|
-
"effective_progress": True,
|
|
1480
|
-
"termination_reason": "timeout",
|
|
1481
|
-
"steps_executed": 4,
|
|
1482
|
-
"steps_unique_tools": 3,
|
|
1483
|
-
"step_repetition_rate": 0.25,
|
|
1484
|
-
"evidence_refs_count": 2,
|
|
1485
|
-
"evidence_refs": ["confluence://doc-a", "src/vds_hooks/core/framework.py"],
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
results = await processor.process_all(thread_id="test-timeout-degraded-finalize")
|
|
1489
|
-
|
|
1490
|
-
assert len(results) == 1
|
|
1491
|
-
assert results[0].status == RowStatus.FAIL
|
|
1492
|
-
assert results[0].status != RowStatus.ERROR
|
|
1493
|
-
assert mock_evaluator.aevaluate_row.call_count == 3
|
|
1494
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1495
|
-
assert results[0].retrieval_trace.get("timeout_retry_attempts") == 2
|
|
1496
|
-
assert results[0].retrieval_trace.get("timeout_extended") is True
|
|
1497
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == "max_timeout_reached"
|
|
1498
|
-
assert results[0].retrieval_trace.get("timeout_degraded_finalize") is True
|
|
1499
|
-
assert results[0].retrieval_trace.get("timeout_kind") == "timeout_with_grounding"
|
|
1500
|
-
assert results[0].retrieval_trace.get("timeout_terminal_status") == RowStatus.FAIL.value
|
|
1501
|
-
assert results[0].retrieval_trace.get("timeout_progress_snapshot", {}).get("evidence_refs_count") == 2
|
|
1502
|
-
assert [anchor.ref_value for anchor in results[0].evidence_anchors] == [
|
|
1503
|
-
"confluence://doc-a",
|
|
1504
|
-
"src/vds_hooks/core/framework.py",
|
|
1505
|
-
]
|
|
1506
|
-
assert [anchor.verified for anchor in results[0].evidence_anchors] == [False, False]
|
|
1507
|
-
assert [anchor.verification_reason for anchor in results[0].evidence_anchors] == [
|
|
1508
|
-
"fallback_ref_inherited",
|
|
1509
|
-
"fallback_ref_inherited",
|
|
1510
|
-
]
|
|
1511
|
-
assert results[0].retrieval_trace.get("mode") == "lexical"
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
@pytest.mark.asyncio
|
|
1515
|
-
async def test_timeout_degraded_finalize_preserves_phase124_route_and_artifact_diagnostics(
|
|
1516
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1517
|
-
):
|
|
1518
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1519
|
-
|
|
1520
|
-
config = BatchConfig(
|
|
1521
|
-
batch_size=1,
|
|
1522
|
-
row_timeout_ms=100,
|
|
1523
|
-
row_timeout_progress_extension_enabled=True,
|
|
1524
|
-
row_timeout_progress_retry_attempts=0,
|
|
1525
|
-
row_timeout_progress_extension_ms=100,
|
|
1526
|
-
row_timeout_progress_max_ms=300,
|
|
1527
|
-
)
|
|
1528
|
-
processor = BatchRowProcessor(
|
|
1529
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1530
|
-
)
|
|
1531
|
-
|
|
1532
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1533
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1534
|
-
"effective_progress": True,
|
|
1535
|
-
"termination_reason": "timeout",
|
|
1536
|
-
"steps_executed": 4,
|
|
1537
|
-
"steps_unique_tools": 3,
|
|
1538
|
-
"step_repetition_rate": 0.25,
|
|
1539
|
-
"evidence_refs_count": 2,
|
|
1540
|
-
"evidence_refs": ["pom.xml", "src/main/java/com/example/config/AppConfig.java"],
|
|
1541
|
-
"route_id": "code_search_read_verify_synthesize",
|
|
1542
|
-
"route_mode": "code_only",
|
|
1543
|
-
"route_reason": "project_scope_required=true",
|
|
1544
|
-
"requirement_interpretation": {
|
|
1545
|
-
"project_scope_required": True,
|
|
1546
|
-
"control_objective": "1. Decoupling",
|
|
1547
|
-
},
|
|
1548
|
-
"project_artifact_readiness": {
|
|
1549
|
-
"readiness_status": "partial",
|
|
1550
|
-
"authoritative_artifact_ready": False,
|
|
1551
|
-
"missing_artifact_types": ["dependency_graph"],
|
|
1552
|
-
},
|
|
1553
|
-
"project_artifact_provenance_summary": [
|
|
1554
|
-
{
|
|
1555
|
-
"artifact_type": "dependency_graph",
|
|
1556
|
-
"source": "knowledge_store",
|
|
1557
|
-
}
|
|
1558
|
-
],
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
results = await processor.process_all(thread_id="test-timeout-phase124-diagnostics")
|
|
1562
|
-
|
|
1563
|
-
assert len(results) == 1
|
|
1564
|
-
assert results[0].status == RowStatus.FAIL
|
|
1565
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1566
|
-
assert results[0].retrieval_trace.get("route_mode") == "code_only"
|
|
1567
|
-
assert results[0].retrieval_trace.get("route_id") == "code_search_read_verify_synthesize"
|
|
1568
|
-
assert results[0].retrieval_trace.get("project_artifact_readiness", {}).get("readiness_status") == "partial"
|
|
1569
|
-
assert results[0].retrieval_trace.get("project_artifact_provenance_summary") == [
|
|
1570
|
-
{"artifact_type": "dependency_graph", "source": "knowledge_store"}
|
|
1571
|
-
]
|
|
1572
|
-
assert results[0].retrieval_trace.get("grounding_validation", {}).get("timeout_incomplete") is True
|
|
1573
|
-
assert results[0].retrieval_trace.get("evidence_gap_diagnostics", {}).get("classification") == "confirmed_gap"
|
|
1574
|
-
assert (
|
|
1575
|
-
results[0].retrieval_trace.get("evidence_gap_diagnostics", {}).get("gap_type")
|
|
1576
|
-
== "authoritative_project_scope_artifact_missing"
|
|
1577
|
-
)
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
@pytest.mark.asyncio
|
|
1581
|
-
async def test_timeout_degraded_finalize_promotes_verified_excerpt_only(
|
|
1582
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1583
|
-
):
|
|
1584
|
-
"""Fallback refs remain provisional unless explicit excerpt verification is present."""
|
|
1585
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1586
|
-
|
|
1587
|
-
config = BatchConfig(
|
|
1588
|
-
batch_size=1,
|
|
1589
|
-
row_timeout_ms=100,
|
|
1590
|
-
row_timeout_progress_extension_enabled=True,
|
|
1591
|
-
row_timeout_progress_retry_attempts=0,
|
|
1592
|
-
row_timeout_progress_extension_ms=100,
|
|
1593
|
-
row_timeout_progress_max_ms=300,
|
|
1594
|
-
)
|
|
1595
|
-
processor = BatchRowProcessor(
|
|
1596
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1597
|
-
)
|
|
1598
|
-
|
|
1599
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1600
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1601
|
-
"effective_progress": True,
|
|
1602
|
-
"termination_reason": "timeout",
|
|
1603
|
-
"evidence_refs_count": 2,
|
|
1604
|
-
"evidence_refs": ["confluence://doc-a", "src/main/security.py"],
|
|
1605
|
-
"evidence_ref_verifications": [
|
|
1606
|
-
{
|
|
1607
|
-
"ref_value": "src/main/security.py",
|
|
1608
|
-
"verified": True,
|
|
1609
|
-
"excerpt": "def validate_token(token: str) -> bool:",
|
|
1610
|
-
"verification_reason": VERIFICATION_REASON_EXCERPT_VERIFIED_IN_CONTEXT,
|
|
1611
|
-
}
|
|
1612
|
-
],
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
results = await processor.process_all(thread_id="test-timeout-fallback-verification-promote")
|
|
1616
|
-
|
|
1617
|
-
assert len(results) == 1
|
|
1618
|
-
assert results[0].status == RowStatus.FAIL
|
|
1619
|
-
anchors_by_ref = {anchor.ref_value: anchor for anchor in results[0].evidence_anchors}
|
|
1620
|
-
assert anchors_by_ref["confluence://doc-a"].verified is False
|
|
1621
|
-
assert anchors_by_ref["confluence://doc-a"].verification_reason == VERIFICATION_REASON_FALLBACK_REF_INHERITED
|
|
1622
|
-
assert anchors_by_ref["src/main/security.py"].verified is True
|
|
1623
|
-
assert anchors_by_ref["src/main/security.py"].excerpt == "def validate_token(token: str) -> bool:"
|
|
1624
|
-
assert anchors_by_ref["src/main/security.py"].verification_reason == VERIFICATION_REASON_EXCERPT_VERIFIED_IN_CONTEXT
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
@pytest.mark.asyncio
|
|
1628
|
-
async def test_timeout_degraded_finalize_rejects_verified_anchor_without_excerpt(
|
|
1629
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1630
|
-
):
|
|
1631
|
-
"""Verified fallback refs with empty excerpts must downgrade to provisional anchors."""
|
|
1632
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1633
|
-
|
|
1634
|
-
config = BatchConfig(
|
|
1635
|
-
batch_size=1,
|
|
1636
|
-
row_timeout_ms=100,
|
|
1637
|
-
row_timeout_progress_extension_enabled=True,
|
|
1638
|
-
row_timeout_progress_retry_attempts=0,
|
|
1639
|
-
row_timeout_progress_extension_ms=100,
|
|
1640
|
-
row_timeout_progress_max_ms=300,
|
|
1641
|
-
)
|
|
1642
|
-
processor = BatchRowProcessor(
|
|
1643
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1644
|
-
)
|
|
1645
|
-
|
|
1646
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1647
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1648
|
-
"effective_progress": True,
|
|
1649
|
-
"termination_reason": "timeout",
|
|
1650
|
-
"evidence_refs_count": 1,
|
|
1651
|
-
"evidence_refs": ["src/main/security.py"],
|
|
1652
|
-
"evidence_ref_verifications": [
|
|
1653
|
-
{
|
|
1654
|
-
"ref_value": "src/main/security.py",
|
|
1655
|
-
"verified": True,
|
|
1656
|
-
"excerpt": "",
|
|
1657
|
-
"verification_reason": VERIFICATION_REASON_EXCERPT_VERIFIED_IN_CONTEXT,
|
|
1658
|
-
}
|
|
1659
|
-
],
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
results = await processor.process_all(thread_id="test-timeout-fallback-verification-empty-excerpt")
|
|
1663
|
-
|
|
1664
|
-
assert len(results) == 1
|
|
1665
|
-
assert results[0].status == RowStatus.FAIL
|
|
1666
|
-
assert len(results[0].evidence_anchors) == 1
|
|
1667
|
-
anchor = results[0].evidence_anchors[0]
|
|
1668
|
-
assert anchor.ref_value == "src/main/security.py"
|
|
1669
|
-
assert anchor.verified is False
|
|
1670
|
-
assert anchor.excerpt == ""
|
|
1671
|
-
assert anchor.verification_reason == VERIFICATION_REASON_FALLBACK_REF_INHERITED
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
@pytest.mark.asyncio
|
|
1675
|
-
async def test_second_extension_denied_without_progress_delta(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
1676
|
-
"""Repeat extension must be denied when telemetry counters do not progress."""
|
|
1677
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1678
|
-
|
|
1679
|
-
config = BatchConfig(
|
|
1680
|
-
batch_size=1,
|
|
1681
|
-
row_timeout_ms=100,
|
|
1682
|
-
row_timeout_progress_extension_enabled=True,
|
|
1683
|
-
row_timeout_progress_retry_attempts=2,
|
|
1684
|
-
row_timeout_progress_extension_ms=100,
|
|
1685
|
-
row_timeout_progress_max_ms=400,
|
|
1686
|
-
)
|
|
1687
|
-
processor = BatchRowProcessor(
|
|
1688
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1689
|
-
)
|
|
1690
|
-
|
|
1691
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1692
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1693
|
-
"effective_progress": True,
|
|
1694
|
-
"step_repetition_rate": 0.1,
|
|
1695
|
-
"evidence_refs_count": 3,
|
|
1696
|
-
"prompt_tool_telemetry_summary": {
|
|
1697
|
-
"tool_calls": 1,
|
|
1698
|
-
"skill_calls": 1,
|
|
1699
|
-
"skill_execution_calls": 0,
|
|
1700
|
-
"skill_effective_calls": 0,
|
|
1701
|
-
},
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
results = await processor.process_all(thread_id="test-timeout-no-delta")
|
|
1705
|
-
|
|
1706
|
-
assert len(results) == 1
|
|
1707
|
-
assert results[0].status == RowStatus.FAIL
|
|
1708
|
-
assert mock_evaluator.aevaluate_row.call_count == 2
|
|
1709
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1710
|
-
assert results[0].retrieval_trace.get("timeout_retry_attempts") == 1
|
|
1711
|
-
assert results[0].retrieval_trace.get("timeout_extended") is True
|
|
1712
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == "no_delta_since_last_timeout"
|
|
1713
|
-
assert results[0].retrieval_trace.get("timeout_extension_progress_delta", {}).get("tool_calls") == 0
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
@pytest.mark.asyncio
|
|
1717
|
-
async def test_second_extension_allowed_with_progress_delta(mock_template, mock_evaluator, mock_evidence_matcher):
|
|
1718
|
-
"""Repeat extension should proceed when telemetry counters advance between timeouts."""
|
|
1719
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1720
|
-
|
|
1721
|
-
config = BatchConfig(
|
|
1722
|
-
batch_size=1,
|
|
1723
|
-
row_timeout_ms=100,
|
|
1724
|
-
row_timeout_progress_extension_enabled=True,
|
|
1725
|
-
row_timeout_progress_retry_attempts=2,
|
|
1726
|
-
row_timeout_progress_extension_ms=100,
|
|
1727
|
-
row_timeout_progress_max_ms=500,
|
|
1728
|
-
)
|
|
1729
|
-
processor = BatchRowProcessor(
|
|
1730
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1731
|
-
)
|
|
1732
|
-
|
|
1733
|
-
call_count = 0
|
|
1734
|
-
|
|
1735
|
-
async def _side_effect(*args, **kwargs):
|
|
1736
|
-
nonlocal call_count
|
|
1737
|
-
call_count += 1
|
|
1738
|
-
if call_count <= 2:
|
|
1739
|
-
raise TimeoutError("Simulated timeout")
|
|
1740
|
-
row_id = kwargs.get("row_id", "CHK-0:row_0")
|
|
1741
|
-
check = kwargs.get("check")
|
|
1742
|
-
check_id = check.id if check else "CHK-0"
|
|
1743
|
-
return RowEvaluationResult(
|
|
1744
|
-
row_id=row_id,
|
|
1745
|
-
check_id=check_id,
|
|
1746
|
-
status=RowStatus.PASS,
|
|
1747
|
-
score=90.0,
|
|
1748
|
-
score_breakdown=ScoreBreakdown.compute(90.0),
|
|
1749
|
-
reason="Recovered after second extension",
|
|
1750
|
-
finding="Recovered",
|
|
1751
|
-
evidence_anchors=[],
|
|
1752
|
-
provenance=RowProvenance(
|
|
1753
|
-
row_llm_mode="test",
|
|
1754
|
-
protocol=None,
|
|
1755
|
-
model=None,
|
|
1756
|
-
template_hash="hash",
|
|
1757
|
-
rubric_version="1",
|
|
1758
|
-
evidence_hash="hash",
|
|
1759
|
-
evaluated_at=datetime.now(UTC),
|
|
1760
|
-
),
|
|
1761
|
-
)
|
|
1762
|
-
|
|
1763
|
-
mock_evaluator.aevaluate_row.side_effect = _side_effect
|
|
1764
|
-
mock_evaluator.get_row_runtime_progress.side_effect = [
|
|
1765
|
-
{
|
|
1766
|
-
"effective_progress": True,
|
|
1767
|
-
"step_repetition_rate": 0.1,
|
|
1768
|
-
"evidence_refs_count": 2,
|
|
1769
|
-
"prompt_tool_telemetry_summary": {
|
|
1770
|
-
"tool_calls": 1,
|
|
1771
|
-
"skill_calls": 1,
|
|
1772
|
-
"skill_execution_calls": 0,
|
|
1773
|
-
"skill_effective_calls": 0,
|
|
1774
|
-
},
|
|
1775
|
-
},
|
|
1776
|
-
{
|
|
1777
|
-
"effective_progress": True,
|
|
1778
|
-
"step_repetition_rate": 0.1,
|
|
1779
|
-
"evidence_refs_count": 2,
|
|
1780
|
-
"prompt_tool_telemetry_summary": {
|
|
1781
|
-
"tool_calls": 2,
|
|
1782
|
-
"skill_calls": 1,
|
|
1783
|
-
"skill_execution_calls": 0,
|
|
1784
|
-
"skill_effective_calls": 0,
|
|
1785
|
-
},
|
|
1786
|
-
},
|
|
1787
|
-
]
|
|
1788
|
-
|
|
1789
|
-
results = await processor.process_all(thread_id="test-timeout-with-delta")
|
|
1790
|
-
|
|
1791
|
-
assert len(results) == 1
|
|
1792
|
-
assert results[0].status == RowStatus.PASS
|
|
1793
|
-
assert call_count == 3
|
|
1794
|
-
assert mock_evaluator.get_row_runtime_progress.call_count == 2
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
@pytest.mark.asyncio
|
|
1798
|
-
async def test_repeat_extension_continues_with_stationary_strong_progress_until_timeout_cap(
|
|
1799
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1800
|
-
):
|
|
1801
|
-
"""Strong grounded progress should continue extensions until timeout ceiling."""
|
|
1802
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1803
|
-
|
|
1804
|
-
config = BatchConfig(
|
|
1805
|
-
batch_size=1,
|
|
1806
|
-
row_timeout_ms=100,
|
|
1807
|
-
row_timeout_progress_extension_enabled=True,
|
|
1808
|
-
row_timeout_progress_retry_attempts=2,
|
|
1809
|
-
row_timeout_progress_extension_ms=100,
|
|
1810
|
-
row_timeout_progress_max_ms=500,
|
|
1811
|
-
)
|
|
1812
|
-
processor = BatchRowProcessor(
|
|
1813
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1814
|
-
)
|
|
1815
|
-
|
|
1816
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1817
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1818
|
-
"effective_progress": True,
|
|
1819
|
-
"steps_executed": 5,
|
|
1820
|
-
"steps_unique_tools": 5,
|
|
1821
|
-
"step_repetition_rate": 0.0,
|
|
1822
|
-
"evidence_refs_count": 3,
|
|
1823
|
-
"prompt_tool_telemetry_summary": {
|
|
1824
|
-
"tool_calls": 5,
|
|
1825
|
-
"skill_calls": 1,
|
|
1826
|
-
"skill_execution_calls": 1,
|
|
1827
|
-
"skill_effective_calls": 1,
|
|
1828
|
-
},
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
results = await processor.process_all(thread_id="test-timeout-no-delta-strong-progress")
|
|
1832
|
-
|
|
1833
|
-
assert len(results) == 1
|
|
1834
|
-
assert results[0].status == RowStatus.FAIL
|
|
1835
|
-
assert mock_evaluator.aevaluate_row.call_count == 5
|
|
1836
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1837
|
-
assert results[0].retrieval_trace.get("timeout_retry_attempts") == 4
|
|
1838
|
-
assert results[0].retrieval_trace.get("timeout_extended") is True
|
|
1839
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == "max_timeout_reached"
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
@pytest.mark.asyncio
|
|
1843
|
-
async def test_extension_can_continue_beyond_retry_cap_when_progress_continues(
|
|
1844
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1845
|
-
):
|
|
1846
|
-
"""Progressive telemetry should allow extension past retry cap until max timeout."""
|
|
1847
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1848
|
-
|
|
1849
|
-
config = BatchConfig(
|
|
1850
|
-
batch_size=1,
|
|
1851
|
-
row_timeout_ms=100,
|
|
1852
|
-
row_timeout_progress_extension_enabled=True,
|
|
1853
|
-
row_timeout_progress_retry_attempts=1,
|
|
1854
|
-
row_timeout_progress_extension_ms=100,
|
|
1855
|
-
row_timeout_progress_max_ms=500,
|
|
1856
|
-
)
|
|
1857
|
-
processor = BatchRowProcessor(
|
|
1858
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1859
|
-
)
|
|
1860
|
-
|
|
1861
|
-
call_count = 0
|
|
1862
|
-
|
|
1863
|
-
async def _side_effect(*args, **kwargs):
|
|
1864
|
-
nonlocal call_count
|
|
1865
|
-
call_count += 1
|
|
1866
|
-
if call_count <= 2:
|
|
1867
|
-
raise TimeoutError("Simulated timeout")
|
|
1868
|
-
row_id = kwargs.get("row_id", "CHK-0:row_0")
|
|
1869
|
-
check = kwargs.get("check")
|
|
1870
|
-
check_id = check.id if check else "CHK-0"
|
|
1871
|
-
return RowEvaluationResult(
|
|
1872
|
-
row_id=row_id,
|
|
1873
|
-
check_id=check_id,
|
|
1874
|
-
status=RowStatus.PASS,
|
|
1875
|
-
score=88.0,
|
|
1876
|
-
score_breakdown=ScoreBreakdown.compute(88.0),
|
|
1877
|
-
reason="Recovered after beyond-cap extension",
|
|
1878
|
-
finding="Recovered",
|
|
1879
|
-
evidence_anchors=[],
|
|
1880
|
-
provenance=RowProvenance(
|
|
1881
|
-
row_llm_mode="test",
|
|
1882
|
-
protocol=None,
|
|
1883
|
-
model=None,
|
|
1884
|
-
template_hash="hash",
|
|
1885
|
-
rubric_version="1",
|
|
1886
|
-
evidence_hash="hash",
|
|
1887
|
-
evaluated_at=datetime.now(UTC),
|
|
1888
|
-
),
|
|
1889
|
-
)
|
|
1890
|
-
|
|
1891
|
-
mock_evaluator.aevaluate_row.side_effect = _side_effect
|
|
1892
|
-
mock_evaluator.get_row_runtime_progress.side_effect = [
|
|
1893
|
-
{
|
|
1894
|
-
"effective_progress": True,
|
|
1895
|
-
"step_repetition_rate": 0.1,
|
|
1896
|
-
"evidence_refs_count": 2,
|
|
1897
|
-
"prompt_tool_telemetry_summary": {
|
|
1898
|
-
"tool_calls": 1,
|
|
1899
|
-
"skill_calls": 0,
|
|
1900
|
-
"skill_execution_calls": 0,
|
|
1901
|
-
"skill_effective_calls": 0,
|
|
1902
|
-
},
|
|
1903
|
-
},
|
|
1904
|
-
{
|
|
1905
|
-
"effective_progress": True,
|
|
1906
|
-
"step_repetition_rate": 0.1,
|
|
1907
|
-
"evidence_refs_count": 2,
|
|
1908
|
-
"prompt_tool_telemetry_summary": {
|
|
1909
|
-
"tool_calls": 2,
|
|
1910
|
-
"skill_calls": 0,
|
|
1911
|
-
"skill_execution_calls": 0,
|
|
1912
|
-
"skill_effective_calls": 0,
|
|
1913
|
-
},
|
|
1914
|
-
},
|
|
1915
|
-
]
|
|
1916
|
-
|
|
1917
|
-
results = await processor.process_all(thread_id="test-timeout-beyond-cap")
|
|
1918
|
-
|
|
1919
|
-
assert len(results) == 1
|
|
1920
|
-
assert results[0].status == RowStatus.PASS
|
|
1921
|
-
assert call_count == 3
|
|
1922
|
-
assert mock_evaluator.get_row_runtime_progress.call_count == 2
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
@pytest.mark.asyncio
|
|
1926
|
-
async def test_repeat_extension_denied_when_prompt_summary_missing(
|
|
1927
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1928
|
-
):
|
|
1929
|
-
"""Second extension should be denied when prompt telemetry summary is unavailable."""
|
|
1930
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1931
|
-
|
|
1932
|
-
config = BatchConfig(
|
|
1933
|
-
batch_size=1,
|
|
1934
|
-
row_timeout_ms=100,
|
|
1935
|
-
row_timeout_progress_extension_enabled=True,
|
|
1936
|
-
row_timeout_progress_retry_attempts=2,
|
|
1937
|
-
row_timeout_progress_extension_ms=100,
|
|
1938
|
-
row_timeout_progress_max_ms=400,
|
|
1939
|
-
)
|
|
1940
|
-
processor = BatchRowProcessor(
|
|
1941
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1942
|
-
)
|
|
1943
|
-
|
|
1944
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
1945
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
1946
|
-
"effective_progress": True,
|
|
1947
|
-
"step_repetition_rate": 0.1,
|
|
1948
|
-
"evidence_refs_count": 3,
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
results = await processor.process_all(thread_id="test-timeout-missing-summary")
|
|
1952
|
-
|
|
1953
|
-
assert len(results) == 1
|
|
1954
|
-
assert results[0].status == RowStatus.FAIL
|
|
1955
|
-
assert mock_evaluator.aevaluate_row.call_count == 2
|
|
1956
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
1957
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == (
|
|
1958
|
-
"missing_prompt_telemetry_for_repeat_extension"
|
|
1959
|
-
)
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
@pytest.mark.asyncio
|
|
1963
|
-
async def test_repeat_extension_allowed_with_strong_progress_without_prompt_summary_when_tool_loop_timed_out(
|
|
1964
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
1965
|
-
):
|
|
1966
|
-
"""Second extension should proceed when strong grounded progress comes from tool-loop timeout."""
|
|
1967
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
1968
|
-
|
|
1969
|
-
config = BatchConfig(
|
|
1970
|
-
batch_size=1,
|
|
1971
|
-
row_timeout_ms=100,
|
|
1972
|
-
row_timeout_progress_extension_enabled=True,
|
|
1973
|
-
row_timeout_progress_retry_attempts=2,
|
|
1974
|
-
row_timeout_progress_extension_ms=100,
|
|
1975
|
-
row_timeout_progress_max_ms=500,
|
|
1976
|
-
)
|
|
1977
|
-
processor = BatchRowProcessor(
|
|
1978
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
1979
|
-
)
|
|
1980
|
-
|
|
1981
|
-
call_count = 0
|
|
1982
|
-
|
|
1983
|
-
async def _side_effect(*args, **kwargs):
|
|
1984
|
-
nonlocal call_count
|
|
1985
|
-
call_count += 1
|
|
1986
|
-
if call_count <= 2:
|
|
1987
|
-
raise TimeoutError("Simulated timeout")
|
|
1988
|
-
row_id = kwargs.get("row_id", "CHK-0:row_0")
|
|
1989
|
-
check = kwargs.get("check")
|
|
1990
|
-
check_id = check.id if check else "CHK-0"
|
|
1991
|
-
return RowEvaluationResult(
|
|
1992
|
-
row_id=row_id,
|
|
1993
|
-
check_id=check_id,
|
|
1994
|
-
status=RowStatus.PASS,
|
|
1995
|
-
score=91.0,
|
|
1996
|
-
score_breakdown=ScoreBreakdown.compute(91.0),
|
|
1997
|
-
reason="Recovered after strong-repeat extension",
|
|
1998
|
-
finding="Recovered",
|
|
1999
|
-
evidence_anchors=[],
|
|
2000
|
-
provenance=RowProvenance(
|
|
2001
|
-
row_llm_mode="test",
|
|
2002
|
-
protocol=None,
|
|
2003
|
-
model=None,
|
|
2004
|
-
template_hash="hash",
|
|
2005
|
-
rubric_version="1",
|
|
2006
|
-
evidence_hash="hash",
|
|
2007
|
-
evaluated_at=datetime.now(UTC),
|
|
2008
|
-
),
|
|
2009
|
-
)
|
|
2010
|
-
|
|
2011
|
-
mock_evaluator.aevaluate_row.side_effect = _side_effect
|
|
2012
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
2013
|
-
"effective_progress": True,
|
|
2014
|
-
"termination_reason": "timeout",
|
|
2015
|
-
"steps_executed": 4,
|
|
2016
|
-
"steps_unique_tools": 3,
|
|
2017
|
-
"step_repetition_rate": 0.0,
|
|
2018
|
-
"evidence_refs_count": 2,
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
results = await processor.process_all(thread_id="test-timeout-strong-repeat")
|
|
2022
|
-
|
|
2023
|
-
assert len(results) == 1
|
|
2024
|
-
assert results[0].status == RowStatus.PASS
|
|
2025
|
-
assert call_count == 3
|
|
2026
|
-
assert mock_evaluator.get_row_runtime_progress.call_count == 2
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
@pytest.mark.asyncio
|
|
2030
|
-
async def test_extension_denied_with_completed_tool_loop_snapshot_even_with_retry_budget(
|
|
2031
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
2032
|
-
):
|
|
2033
|
-
"""Timeout extension should be denied immediately for completed tool-loop snapshots."""
|
|
2034
|
-
mock_template.sections[0].checks = [mock_template.sections[0].checks[0]]
|
|
2035
|
-
|
|
2036
|
-
config = BatchConfig(
|
|
2037
|
-
batch_size=1,
|
|
2038
|
-
row_timeout_ms=100,
|
|
2039
|
-
row_timeout_progress_extension_enabled=True,
|
|
2040
|
-
row_timeout_progress_retry_attempts=2,
|
|
2041
|
-
row_timeout_progress_extension_ms=100,
|
|
2042
|
-
row_timeout_progress_max_ms=500,
|
|
2043
|
-
)
|
|
2044
|
-
processor = BatchRowProcessor(
|
|
2045
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
2046
|
-
)
|
|
2047
|
-
|
|
2048
|
-
mock_evaluator.aevaluate_row.side_effect = TimeoutError("Simulated timeout")
|
|
2049
|
-
mock_evaluator.get_row_runtime_progress.return_value = {
|
|
2050
|
-
"effective_progress": True,
|
|
2051
|
-
"termination_reason": "completed",
|
|
2052
|
-
"steps_executed": 4,
|
|
2053
|
-
"steps_unique_tools": 3,
|
|
2054
|
-
"step_repetition_rate": 0.0,
|
|
2055
|
-
"evidence_refs_count": 2,
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
results = await processor.process_all(thread_id="test-timeout-completed-snapshot")
|
|
2059
|
-
|
|
2060
|
-
assert len(results) == 1
|
|
2061
|
-
assert results[0].status == RowStatus.FAIL
|
|
2062
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
2063
|
-
assert isinstance(results[0].retrieval_trace, dict)
|
|
2064
|
-
assert results[0].retrieval_trace.get("timeout_extension_denial_reason") == ("termination_reason_not_timeout")
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
@pytest.mark.asyncio
|
|
2068
|
-
async def test_batch_timeout_fallback_handles_remaining_targeted_rows_after_checkpoint_preserve(
|
|
2069
|
-
mock_template, mock_evaluator, mock_evidence_matcher
|
|
2070
|
-
):
|
|
2071
|
-
"""Batch-timeout fallback must include all remaining targeted rows after skipped checkpoint rows."""
|
|
2072
|
-
mock_template.sections[0].checks = mock_template.sections[0].checks[:5]
|
|
2073
|
-
|
|
2074
|
-
target_selection = TargetSelection(
|
|
2075
|
-
target_type=TargetType.ROW_IDS,
|
|
2076
|
-
raw_value="3-5",
|
|
2077
|
-
row_indices=frozenset({2, 3, 4}),
|
|
2078
|
-
)
|
|
2079
|
-
config = BatchConfig(
|
|
2080
|
-
batch_size=5,
|
|
2081
|
-
row_timeout_ms=60_000,
|
|
2082
|
-
batch_timeout_ms=100,
|
|
2083
|
-
target_selection=target_selection,
|
|
2084
|
-
force_refresh_targets=True,
|
|
2085
|
-
)
|
|
2086
|
-
processor = BatchRowProcessor(
|
|
2087
|
-
template=mock_template,
|
|
2088
|
-
evaluator=mock_evaluator,
|
|
2089
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2090
|
-
config=config,
|
|
2091
|
-
)
|
|
2092
|
-
|
|
2093
|
-
async def _slow_eval(*args, **kwargs):
|
|
2094
|
-
await asyncio.sleep(1.0)
|
|
2095
|
-
row_id = kwargs.get("row_id", "CHK-2:row_2")
|
|
2096
|
-
check = kwargs.get("check")
|
|
2097
|
-
check_id = check.id if check else "CHK-2"
|
|
2098
|
-
return RowEvaluationResult(
|
|
2099
|
-
row_id=row_id,
|
|
2100
|
-
check_id=check_id,
|
|
2101
|
-
status=RowStatus.PASS,
|
|
2102
|
-
score=100.0,
|
|
2103
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2104
|
-
reason="slow",
|
|
2105
|
-
finding="slow",
|
|
2106
|
-
evidence_anchors=[],
|
|
2107
|
-
provenance=RowProvenance(
|
|
2108
|
-
row_llm_mode="test",
|
|
2109
|
-
protocol=None,
|
|
2110
|
-
model=None,
|
|
2111
|
-
template_hash="hash",
|
|
2112
|
-
rubric_version="1",
|
|
2113
|
-
evidence_hash="hash",
|
|
2114
|
-
evaluated_at=datetime.now(UTC),
|
|
2115
|
-
),
|
|
2116
|
-
)
|
|
2117
|
-
|
|
2118
|
-
mock_evaluator.aevaluate_row.side_effect = _slow_eval
|
|
2119
|
-
|
|
2120
|
-
preserved_results: dict[str, dict[str, Any]] = {}
|
|
2121
|
-
for idx in (0, 1):
|
|
2122
|
-
row_id = f"CHK-{idx}:row_{idx}"
|
|
2123
|
-
preserved_results[row_id] = BatchCheckpoint.serialize_row_result(
|
|
2124
|
-
RowEvaluationResult(
|
|
2125
|
-
row_id=row_id,
|
|
2126
|
-
check_id=f"CHK-{idx}",
|
|
2127
|
-
status=RowStatus.PASS,
|
|
2128
|
-
score=100.0,
|
|
2129
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2130
|
-
reason="checkpoint preserved",
|
|
2131
|
-
finding="checkpoint preserved",
|
|
2132
|
-
evidence_anchors=[],
|
|
2133
|
-
provenance=RowProvenance(
|
|
2134
|
-
row_llm_mode="test",
|
|
2135
|
-
protocol=None,
|
|
2136
|
-
model=None,
|
|
2137
|
-
template_hash="hash",
|
|
2138
|
-
rubric_version="1",
|
|
2139
|
-
evidence_hash="hash",
|
|
2140
|
-
evaluated_at=datetime.now(UTC),
|
|
2141
|
-
),
|
|
2142
|
-
)
|
|
2143
|
-
)
|
|
2144
|
-
|
|
2145
|
-
checkpoint = BatchCheckpoint(
|
|
2146
|
-
thread_id="batch-timeout-preserve",
|
|
2147
|
-
total_rows=5,
|
|
2148
|
-
template_hash=mock_evaluator.template_hash,
|
|
2149
|
-
evidence_hash=mock_evaluator.evidence_hash,
|
|
2150
|
-
completed_batches=[],
|
|
2151
|
-
results_by_row_id=preserved_results,
|
|
2152
|
-
)
|
|
2153
|
-
|
|
2154
|
-
batch_result = await processor._process_batch(
|
|
2155
|
-
batch_idx=0,
|
|
2156
|
-
start_idx=0,
|
|
2157
|
-
end_idx=5,
|
|
2158
|
-
project_profile=None,
|
|
2159
|
-
checkpoint=checkpoint,
|
|
2160
|
-
thread_id=checkpoint.thread_id,
|
|
2161
|
-
)
|
|
2162
|
-
|
|
2163
|
-
assert batch_result.timed_out is True
|
|
2164
|
-
assert batch_result.skipped_count == 2
|
|
2165
|
-
assert batch_result.error_count == 3
|
|
2166
|
-
assert len(batch_result.results) == 5
|
|
2167
|
-
row_ids = {result.row_id for result in batch_result.results}
|
|
2168
|
-
assert row_ids == {
|
|
2169
|
-
"CHK-0:row_0",
|
|
2170
|
-
"CHK-1:row_1",
|
|
2171
|
-
"CHK-2:row_2",
|
|
2172
|
-
"CHK-3:row_3",
|
|
2173
|
-
"CHK-4:row_4",
|
|
2174
|
-
}
|
|
2175
|
-
timeout_rows = [
|
|
2176
|
-
result for result in batch_result.results if result.row_id in {"CHK-2:row_2", "CHK-3:row_3", "CHK-4:row_4"}
|
|
2177
|
-
]
|
|
2178
|
-
assert all(result.status == RowStatus.ERROR for result in timeout_rows)
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
@pytest.mark.asyncio
|
|
2182
|
-
async def test_checkpoint_save_and_resume(mock_template, mock_evaluator, mock_evidence_matcher, tmp_path):
|
|
2183
|
-
"""Test that checkpoints are saved and can be resumed (FR-3.3)."""
|
|
2184
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2185
|
-
config = BatchConfig(batch_size=2, checkpoint_dir=checkpoint_dir, resume_from_checkpoint=True)
|
|
2186
|
-
|
|
2187
|
-
processor = BatchRowProcessor(
|
|
2188
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
2189
|
-
)
|
|
2190
|
-
|
|
2191
|
-
# 1. Simulate failure after first batch (rows 0,1 succeeded)
|
|
2192
|
-
call_count = 0
|
|
2193
|
-
|
|
2194
|
-
async def side_effect(*args, **kwargs):
|
|
2195
|
-
nonlocal call_count
|
|
2196
|
-
call_count += 1
|
|
2197
|
-
if call_count > 2:
|
|
2198
|
-
raise RuntimeError("Simulated Crash")
|
|
2199
|
-
# Create a NEW result object for each call with unique row_id
|
|
2200
|
-
row_id = kwargs.get("row_id", f"unknown_{call_count}")
|
|
2201
|
-
return RowEvaluationResult(
|
|
2202
|
-
row_id=row_id,
|
|
2203
|
-
check_id="test_check",
|
|
2204
|
-
status=RowStatus.PASS,
|
|
2205
|
-
score=100.0,
|
|
2206
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2207
|
-
reason="Test reason",
|
|
2208
|
-
finding="Test finding",
|
|
2209
|
-
evidence_anchors=[],
|
|
2210
|
-
provenance=RowProvenance(
|
|
2211
|
-
row_llm_mode="test",
|
|
2212
|
-
protocol=None,
|
|
2213
|
-
model=None,
|
|
2214
|
-
template_hash="hash",
|
|
2215
|
-
rubric_version="1",
|
|
2216
|
-
evidence_hash="hash",
|
|
2217
|
-
evaluated_at=datetime.now(UTC),
|
|
2218
|
-
),
|
|
2219
|
-
)
|
|
2220
|
-
|
|
2221
|
-
mock_evaluator.aevaluate_row.side_effect = side_effect
|
|
2222
|
-
|
|
2223
|
-
# _guarded_row catches exceptions and returns error results instead of propagating
|
|
2224
|
-
results = await processor.process_all(thread_id="test-thread")
|
|
2225
|
-
|
|
2226
|
-
# Checkpoint should exist (saved after first batch completed before crash)
|
|
2227
|
-
checkpoint_file = processor._get_checkpoint_path("test-thread")
|
|
2228
|
-
assert checkpoint_file.exists()
|
|
2229
|
-
|
|
2230
|
-
# Verify checkpoint content - processor continues all batches even with errors
|
|
2231
|
-
# Result: 2 PASS (rows 0,1 from first batch) + 8 ERROR (crashed rows)
|
|
2232
|
-
data = json.loads(checkpoint_file.read_text())
|
|
2233
|
-
assert 0 in data["completed_batches"]
|
|
2234
|
-
# All 10 rows are in checkpoint (processor doesn't stop on non-BudgetExceededError)
|
|
2235
|
-
assert len(data["results_by_row_id"]) == 10
|
|
2236
|
-
# Verify first batch rows are PASS
|
|
2237
|
-
pass_count = sum(1 for r in data["results_by_row_id"].values() if r["status"] == "PASS")
|
|
2238
|
-
assert pass_count == 2, f"Expected 2 PASS results, got {pass_count}"
|
|
2239
|
-
|
|
2240
|
-
# 2. Resume operation
|
|
2241
|
-
mock_evaluator.aevaluate_row.side_effect = None
|
|
2242
|
-
# Create unique results for resumed calls
|
|
2243
|
-
resume_call_count = 0
|
|
2244
|
-
|
|
2245
|
-
async def create_resume_result(*args, **kwargs):
|
|
2246
|
-
nonlocal resume_call_count
|
|
2247
|
-
resume_call_count += 1
|
|
2248
|
-
row_id = kwargs.get("row_id", f"resumed_row_{resume_call_count}")
|
|
2249
|
-
return RowEvaluationResult(
|
|
2250
|
-
row_id=row_id,
|
|
2251
|
-
check_id="test_check",
|
|
2252
|
-
status=RowStatus.PASS,
|
|
2253
|
-
score=100.0,
|
|
2254
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2255
|
-
reason="Test reason",
|
|
2256
|
-
finding="Test finding",
|
|
2257
|
-
evidence_anchors=[],
|
|
2258
|
-
provenance=RowProvenance(
|
|
2259
|
-
row_llm_mode="test",
|
|
2260
|
-
protocol=None,
|
|
2261
|
-
model=None,
|
|
2262
|
-
template_hash="hash",
|
|
2263
|
-
rubric_version="1",
|
|
2264
|
-
evidence_hash="hash",
|
|
2265
|
-
evaluated_at=datetime.now(UTC),
|
|
2266
|
-
),
|
|
2267
|
-
)
|
|
2268
|
-
|
|
2269
|
-
mock_evaluator.aevaluate_row.side_effect = create_resume_result
|
|
2270
|
-
mock_evaluator.aevaluate_row.reset_mock()
|
|
2271
|
-
|
|
2272
|
-
# Re-init processor
|
|
2273
|
-
processor2 = BatchRowProcessor(
|
|
2274
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
2275
|
-
)
|
|
2276
|
-
|
|
2277
|
-
results = await processor2.process_all(thread_id="test-thread")
|
|
2278
|
-
|
|
2279
|
-
# All 10 rows are in checkpoint from first run, so resume skips all
|
|
2280
|
-
# Only checkpoint lookup happens, no new evaluations
|
|
2281
|
-
assert len(results) == 10
|
|
2282
|
-
assert mock_evaluator.aevaluate_row.call_count == 0
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
@pytest.mark.asyncio
|
|
2286
|
-
async def test_checkpoint_hash_mismatch(mock_template, mock_evaluator, mock_evidence_matcher, default_result, tmp_path):
|
|
2287
|
-
"""Test that checkpoint is ignored if hashes mismatch."""
|
|
2288
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2289
|
-
config = BatchConfig(batch_size=2, checkpoint_dir=checkpoint_dir, resume_from_checkpoint=True)
|
|
2290
|
-
|
|
2291
|
-
# Create a fake checkpoint with different hash
|
|
2292
|
-
checkpoint_file = checkpoint_dir / "batch-checkpoint-test-thread.json"
|
|
2293
|
-
checkpoint_file.parent.mkdir(parents=True, exist_ok=True)
|
|
2294
|
-
|
|
2295
|
-
fake_checkpoint = {
|
|
2296
|
-
"thread_id": "test-thread",
|
|
2297
|
-
"total_rows": 10,
|
|
2298
|
-
"template_hash": "OLD_HASH", # Mismatch
|
|
2299
|
-
"evidence_hash": "ev_hash_456",
|
|
2300
|
-
"completed_batches": [0],
|
|
2301
|
-
"results_by_row_id": {},
|
|
2302
|
-
"last_updated": "2024-01-01T00:00:00+00:00",
|
|
2303
|
-
}
|
|
2304
|
-
checkpoint_file.write_text(json.dumps(fake_checkpoint))
|
|
2305
|
-
|
|
2306
|
-
processor = BatchRowProcessor(
|
|
2307
|
-
template=mock_template, evaluator=mock_evaluator, evidence_matcher=mock_evidence_matcher, config=config
|
|
2308
|
-
)
|
|
2309
|
-
|
|
2310
|
-
# Create unique results for each row to avoid deduplication
|
|
2311
|
-
call_count = 0
|
|
2312
|
-
|
|
2313
|
-
async def create_unique_result(*args, **kwargs):
|
|
2314
|
-
nonlocal call_count
|
|
2315
|
-
call_count += 1
|
|
2316
|
-
row_id = kwargs.get("row_id", f"row_{call_count}")
|
|
2317
|
-
return RowEvaluationResult(
|
|
2318
|
-
row_id=row_id,
|
|
2319
|
-
check_id="test_check",
|
|
2320
|
-
status=RowStatus.PASS,
|
|
2321
|
-
score=100.0,
|
|
2322
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2323
|
-
reason="Test reason",
|
|
2324
|
-
finding="Test finding",
|
|
2325
|
-
evidence_anchors=[],
|
|
2326
|
-
provenance=RowProvenance(
|
|
2327
|
-
row_llm_mode="test",
|
|
2328
|
-
protocol=None,
|
|
2329
|
-
model=None,
|
|
2330
|
-
template_hash="hash",
|
|
2331
|
-
rubric_version="1",
|
|
2332
|
-
evidence_hash="hash",
|
|
2333
|
-
evaluated_at=datetime.now(UTC),
|
|
2334
|
-
),
|
|
2335
|
-
)
|
|
2336
|
-
|
|
2337
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
2338
|
-
|
|
2339
|
-
# Should ignore checkpoint and process all 10 rows
|
|
2340
|
-
results = await processor.process_all(thread_id="test-thread")
|
|
2341
|
-
|
|
2342
|
-
assert len(results) == 10
|
|
2343
|
-
assert mock_evaluator.aevaluate_row.call_count == 10
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
def test_checkpoint_serialization(default_result):
|
|
2347
|
-
"""Test serialization and deserialization of row results."""
|
|
2348
|
-
default_result.evidence_anchors = [EvidenceAnchor(ref_type="url", ref_value="http://example.com", verified=True)]
|
|
2349
|
-
default_result.retrieval_trace = {"mode": "hybrid", "docs": [{"source_path": "README.md"}]}
|
|
2350
|
-
|
|
2351
|
-
serialized = BatchCheckpoint.serialize_row_result(default_result)
|
|
2352
|
-
assert serialized["row_id"] == default_result.row_id
|
|
2353
|
-
assert serialized["evidence_anchors"][0]["ref_value"] == "http://example.com"
|
|
2354
|
-
assert serialized["retrieval_trace"]["mode"] == "hybrid"
|
|
2355
|
-
|
|
2356
|
-
deserialized = BatchCheckpoint.deserialize_row_result(serialized)
|
|
2357
|
-
assert deserialized.row_id == default_result.row_id
|
|
2358
|
-
assert deserialized.score == default_result.score
|
|
2359
|
-
assert len(deserialized.evidence_anchors) == 1
|
|
2360
|
-
assert deserialized.evidence_anchors[0].ref_value == "http://example.com"
|
|
2361
|
-
assert deserialized.retrieval_trace == default_result.retrieval_trace
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
@pytest.mark.asyncio
|
|
2365
|
-
async def test_row_retrieval_trace_persisted_to_checkpoint(
|
|
2366
|
-
mock_template, mock_evaluator, mock_evidence_matcher, default_result, tmp_path
|
|
2367
|
-
):
|
|
2368
|
-
"""Row retrieval trace should round-trip through checkpoint persistence."""
|
|
2369
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2370
|
-
config = BatchConfig(batch_size=2, checkpoint_dir=checkpoint_dir, resume_from_checkpoint=False)
|
|
2371
|
-
processor = BatchRowProcessor(
|
|
2372
|
-
template=mock_template,
|
|
2373
|
-
evaluator=mock_evaluator,
|
|
2374
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2375
|
-
config=config,
|
|
2376
|
-
)
|
|
2377
|
-
|
|
2378
|
-
async def create_result(*args, **kwargs):
|
|
2379
|
-
row_id = kwargs.get("row_id", "missing")
|
|
2380
|
-
return RowEvaluationResult(
|
|
2381
|
-
row_id=row_id,
|
|
2382
|
-
check_id="test_check",
|
|
2383
|
-
status=default_result.status,
|
|
2384
|
-
score=default_result.score,
|
|
2385
|
-
score_breakdown=default_result.score_breakdown,
|
|
2386
|
-
reason=default_result.reason,
|
|
2387
|
-
finding=default_result.finding,
|
|
2388
|
-
evidence_anchors=default_result.evidence_anchors,
|
|
2389
|
-
provenance=default_result.provenance,
|
|
2390
|
-
)
|
|
2391
|
-
|
|
2392
|
-
mock_evaluator.aevaluate_row.side_effect = create_result
|
|
2393
|
-
|
|
2394
|
-
results = await processor.process_all(thread_id="trace-checkpoint")
|
|
2395
|
-
|
|
2396
|
-
assert results[0].retrieval_trace == mock_evidence_matcher.match_row.return_value.retrieval_trace
|
|
2397
|
-
checkpoint_data = json.loads(processor._get_checkpoint_path("trace-checkpoint").read_text())
|
|
2398
|
-
first_row = checkpoint_data["results_by_row_id"]["CHK-0:row_0"]
|
|
2399
|
-
assert first_row["retrieval_trace"] == mock_evidence_matcher.match_row.return_value.retrieval_trace
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
@pytest.mark.asyncio
|
|
2403
|
-
async def test_strict_budget_abort_persists_partial_results(
|
|
2404
|
-
mock_template, mock_evaluator, mock_evidence_matcher, tmp_path
|
|
2405
|
-
):
|
|
2406
|
-
"""Strict budget abort should persist completed rows before failing."""
|
|
2407
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2408
|
-
config = BatchConfig(batch_size=5, checkpoint_dir=checkpoint_dir, resume_from_checkpoint=False)
|
|
2409
|
-
processor = BatchRowProcessor(
|
|
2410
|
-
template=mock_template,
|
|
2411
|
-
evaluator=mock_evaluator,
|
|
2412
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2413
|
-
config=config,
|
|
2414
|
-
)
|
|
2415
|
-
|
|
2416
|
-
call_count = 0
|
|
2417
|
-
|
|
2418
|
-
async def _side_effect(*args, **kwargs):
|
|
2419
|
-
nonlocal call_count
|
|
2420
|
-
call_count += 1
|
|
2421
|
-
row_id = kwargs.get("row_id", f"row_{call_count}")
|
|
2422
|
-
check = kwargs.get("check")
|
|
2423
|
-
check_id = check.id if check is not None else "unknown"
|
|
2424
|
-
if call_count == 3:
|
|
2425
|
-
raise BudgetExceededError(
|
|
2426
|
-
BudgetUsage(
|
|
2427
|
-
scope=BudgetScope.AUDIT,
|
|
2428
|
-
scope_id=row_id,
|
|
2429
|
-
used_dollars=9.0,
|
|
2430
|
-
limit_dollars=8.0,
|
|
2431
|
-
status=BudgetStatus.EXCEEDED,
|
|
2432
|
-
)
|
|
2433
|
-
)
|
|
2434
|
-
return RowEvaluationResult(
|
|
2435
|
-
row_id=row_id,
|
|
2436
|
-
check_id=check_id,
|
|
2437
|
-
status=RowStatus.PASS,
|
|
2438
|
-
score=100.0,
|
|
2439
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2440
|
-
reason=f"Result for {row_id}",
|
|
2441
|
-
finding="ok",
|
|
2442
|
-
evidence_anchors=[],
|
|
2443
|
-
provenance=RowProvenance(
|
|
2444
|
-
row_llm_mode="test",
|
|
2445
|
-
protocol=None,
|
|
2446
|
-
model=None,
|
|
2447
|
-
template_hash="hash",
|
|
2448
|
-
rubric_version="1",
|
|
2449
|
-
evidence_hash="hash",
|
|
2450
|
-
evaluated_at=datetime.now(UTC),
|
|
2451
|
-
),
|
|
2452
|
-
)
|
|
2453
|
-
|
|
2454
|
-
mock_evaluator.aevaluate_row.side_effect = _side_effect
|
|
2455
|
-
|
|
2456
|
-
with pytest.raises(BatchBudgetExceededError) as exc_info:
|
|
2457
|
-
await processor.process_all(thread_id="strict-budget-thread")
|
|
2458
|
-
|
|
2459
|
-
exc = exc_info.value
|
|
2460
|
-
assert exc.context["kind"] == "strict_budget_exceeded"
|
|
2461
|
-
assert exc.context["audit_error_key"] == "LLM_BUDGET_EXCEEDED"
|
|
2462
|
-
assert exc.context["audit_error_code"] == AUDIT_ERROR_CODES["LLM_BUDGET_EXCEEDED"].code
|
|
2463
|
-
assert exc.context["row_index"] == 3
|
|
2464
|
-
assert exc.context["check_id"] == "CHK-2"
|
|
2465
|
-
assert exc.context["status"] == "exceeded"
|
|
2466
|
-
assert exc.context["completed_rows_persisted"] >= 2
|
|
2467
|
-
assert "checkpoint_path" in exc.context
|
|
2468
|
-
assert len(exc.partial_results) >= 2
|
|
2469
|
-
assert any(result.row_id == "CHK-0:row_0" for result in exc.partial_results)
|
|
2470
|
-
assert any(result.row_id == "CHK-1:row_1" for result in exc.partial_results)
|
|
2471
|
-
|
|
2472
|
-
checkpoint_file = processor._get_checkpoint_path("strict-budget-thread")
|
|
2473
|
-
assert checkpoint_file.exists()
|
|
2474
|
-
data = json.loads(checkpoint_file.read_text())
|
|
2475
|
-
assert len(data["results_by_row_id"]) >= 2
|
|
2476
|
-
assert "CHK-0:row_0" in data["results_by_row_id"]
|
|
2477
|
-
assert "CHK-1:row_1" in data["results_by_row_id"]
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
# -----------------------------------------------------------------------------
|
|
2481
|
-
# Tests: Target Filtering (FR-25)
|
|
2482
|
-
# -----------------------------------------------------------------------------
|
|
2483
|
-
# Tests
|
|
2484
|
-
# -----------------------------------------------------------------------------
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
@pytest.fixture
|
|
2488
|
-
def target_selection_rows_1_3():
|
|
2489
|
-
"""Create a TargetSelection for rows 1 and 3 (0-indexed: 0 and 2)."""
|
|
2490
|
-
return TargetSelection(
|
|
2491
|
-
target_type=TargetType.ROW_IDS,
|
|
2492
|
-
raw_value="1,3",
|
|
2493
|
-
row_indices=frozenset({0, 2}),
|
|
2494
|
-
)
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
@pytest.fixture
|
|
2498
|
-
def target_selection_check_ids():
|
|
2499
|
-
"""Create a TargetSelection for specific check IDs."""
|
|
2500
|
-
return TargetSelection(
|
|
2501
|
-
target_type=TargetType.CHECK_IDS,
|
|
2502
|
-
raw_value="CHK-0,CHK-5",
|
|
2503
|
-
row_indices=frozenset({0, 5}),
|
|
2504
|
-
check_ids=frozenset({"CHK-0", "CHK-5"}),
|
|
2505
|
-
)
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
class TestTargetFiltering:
|
|
2509
|
-
"""Tests for FR-25: Dynamic Analysis Support - Target Filtering."""
|
|
2510
|
-
|
|
2511
|
-
@pytest.mark.asyncio
|
|
2512
|
-
async def test_targeted_rows_only_processed(
|
|
2513
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, default_result, target_selection_rows_1_3
|
|
2514
|
-
):
|
|
2515
|
-
"""Test that only targeted rows are processed (FR-25.1)."""
|
|
2516
|
-
config = BatchConfig(
|
|
2517
|
-
batch_size=5,
|
|
2518
|
-
row_timeout_ms=1000,
|
|
2519
|
-
target_selection=target_selection_rows_1_3,
|
|
2520
|
-
force_refresh_targets=True,
|
|
2521
|
-
)
|
|
2522
|
-
processor = BatchRowProcessor(
|
|
2523
|
-
template=mock_template,
|
|
2524
|
-
evaluator=mock_evaluator,
|
|
2525
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2526
|
-
config=config,
|
|
2527
|
-
)
|
|
2528
|
-
|
|
2529
|
-
mock_evaluator.aevaluate_row.return_value = default_result
|
|
2530
|
-
|
|
2531
|
-
await processor.process_all(thread_id="test-targeted")
|
|
2532
|
-
|
|
2533
|
-
# Only rows 0 and 2 should be evaluated (targeted)
|
|
2534
|
-
assert mock_evaluator.aevaluate_row.call_count == 2
|
|
2535
|
-
|
|
2536
|
-
@pytest.mark.asyncio
|
|
2537
|
-
async def test_skip_batch_with_no_targets(
|
|
2538
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, default_result
|
|
2539
|
-
):
|
|
2540
|
-
"""Test that batches with no targeted rows are skipped (FR-25.2)."""
|
|
2541
|
-
# Target only row 8 (0-indexed: 7), which is in batch 2 (rows 4-7) or batch 3 (rows 8-9)
|
|
2542
|
-
# With batch_size=4: batch 0 (0-3), batch 1 (4-7), batch 2 (8-9)
|
|
2543
|
-
target_selection = TargetSelection(
|
|
2544
|
-
target_type=TargetType.ROW_IDS,
|
|
2545
|
-
raw_value="9",
|
|
2546
|
-
row_indices=frozenset({8}), # 0-indexed
|
|
2547
|
-
)
|
|
2548
|
-
config = BatchConfig(
|
|
2549
|
-
batch_size=4,
|
|
2550
|
-
row_timeout_ms=1000,
|
|
2551
|
-
target_selection=target_selection,
|
|
2552
|
-
force_refresh_targets=True,
|
|
2553
|
-
)
|
|
2554
|
-
processor = BatchRowProcessor(
|
|
2555
|
-
template=mock_template,
|
|
2556
|
-
evaluator=mock_evaluator,
|
|
2557
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2558
|
-
config=config,
|
|
2559
|
-
)
|
|
2560
|
-
|
|
2561
|
-
mock_evaluator.aevaluate_row.return_value = default_result
|
|
2562
|
-
|
|
2563
|
-
await processor.process_all(thread_id="test-skip-batch")
|
|
2564
|
-
|
|
2565
|
-
# Only 1 row should be evaluated (row 8)
|
|
2566
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
2567
|
-
|
|
2568
|
-
@pytest.mark.asyncio
|
|
2569
|
-
async def test_mixed_batch_preserves_checkpoint(
|
|
2570
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, default_result, tmp_path
|
|
2571
|
-
):
|
|
2572
|
-
"""Test that non-targeted rows preserve checkpoint state in mixed batches (FR-25.3)."""
|
|
2573
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2574
|
-
|
|
2575
|
-
# First run: process all rows
|
|
2576
|
-
config_full = BatchConfig(
|
|
2577
|
-
batch_size=5,
|
|
2578
|
-
row_timeout_ms=1000,
|
|
2579
|
-
checkpoint_dir=checkpoint_dir,
|
|
2580
|
-
resume_from_checkpoint=False,
|
|
2581
|
-
)
|
|
2582
|
-
processor_full = BatchRowProcessor(
|
|
2583
|
-
template=mock_template,
|
|
2584
|
-
evaluator=mock_evaluator,
|
|
2585
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2586
|
-
config=config_full,
|
|
2587
|
-
)
|
|
2588
|
-
|
|
2589
|
-
# Create unique results for each row
|
|
2590
|
-
call_count = 0
|
|
2591
|
-
|
|
2592
|
-
async def create_unique_result(*args, **kwargs):
|
|
2593
|
-
nonlocal call_count
|
|
2594
|
-
call_count += 1
|
|
2595
|
-
row_id = kwargs.get("row_id", f"row_{call_count}")
|
|
2596
|
-
return RowEvaluationResult(
|
|
2597
|
-
row_id=row_id,
|
|
2598
|
-
check_id="test_check",
|
|
2599
|
-
status=RowStatus.PASS,
|
|
2600
|
-
score=100.0,
|
|
2601
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2602
|
-
reason=f"Result for {row_id}",
|
|
2603
|
-
finding="Test finding",
|
|
2604
|
-
evidence_anchors=[],
|
|
2605
|
-
provenance=RowProvenance(
|
|
2606
|
-
row_llm_mode="test",
|
|
2607
|
-
protocol=None,
|
|
2608
|
-
model=None,
|
|
2609
|
-
template_hash="hash",
|
|
2610
|
-
rubric_version="1",
|
|
2611
|
-
evidence_hash="hash",
|
|
2612
|
-
evaluated_at=datetime.now(UTC),
|
|
2613
|
-
),
|
|
2614
|
-
)
|
|
2615
|
-
|
|
2616
|
-
mock_evaluator.aevaluate_row.side_effect = create_unique_result
|
|
2617
|
-
|
|
2618
|
-
# Run full processing
|
|
2619
|
-
await processor_full.process_all(thread_id="test-mixed")
|
|
2620
|
-
assert call_count == 10 # All 10 rows processed
|
|
2621
|
-
|
|
2622
|
-
# Second run: target only row 3 (0-indexed: 2)
|
|
2623
|
-
target_selection = TargetSelection(
|
|
2624
|
-
target_type=TargetType.ROW_IDS,
|
|
2625
|
-
raw_value="3",
|
|
2626
|
-
row_indices=frozenset({2}),
|
|
2627
|
-
)
|
|
2628
|
-
config_targeted = BatchConfig(
|
|
2629
|
-
batch_size=5,
|
|
2630
|
-
row_timeout_ms=1000,
|
|
2631
|
-
checkpoint_dir=checkpoint_dir,
|
|
2632
|
-
resume_from_checkpoint=True,
|
|
2633
|
-
target_selection=target_selection,
|
|
2634
|
-
force_refresh_targets=True,
|
|
2635
|
-
)
|
|
2636
|
-
processor_targeted = BatchRowProcessor(
|
|
2637
|
-
template=mock_template,
|
|
2638
|
-
evaluator=mock_evaluator,
|
|
2639
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2640
|
-
config=config_targeted,
|
|
2641
|
-
)
|
|
2642
|
-
|
|
2643
|
-
# Reset mock
|
|
2644
|
-
mock_evaluator.aevaluate_row.reset_mock()
|
|
2645
|
-
call_count = 0
|
|
2646
|
-
|
|
2647
|
-
results = await processor_targeted.process_all(thread_id="test-mixed")
|
|
2648
|
-
|
|
2649
|
-
# Only 1 row should be re-evaluated (the targeted one)
|
|
2650
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
2651
|
-
# But we should still have results for all 10 rows (9 from checkpoint + 1 new)
|
|
2652
|
-
assert len(results) == 10
|
|
2653
|
-
|
|
2654
|
-
@pytest.mark.asyncio
|
|
2655
|
-
async def test_force_refresh_targets_reevaluates(
|
|
2656
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, default_result, tmp_path
|
|
2657
|
-
):
|
|
2658
|
-
"""Test that force_refresh_targets re-evaluates targeted rows even if checkpointed (FR-25.4)."""
|
|
2659
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2660
|
-
|
|
2661
|
-
# Create a checkpoint with existing results
|
|
2662
|
-
checkpoint_file = checkpoint_dir / "batch-checkpoint-test-force.json"
|
|
2663
|
-
checkpoint_file.parent.mkdir(parents=True, exist_ok=True)
|
|
2664
|
-
|
|
2665
|
-
# Pre-populate checkpoint with results for rows 0-4
|
|
2666
|
-
existing_results = {}
|
|
2667
|
-
for i in range(5):
|
|
2668
|
-
row_id = f"CHK-{i}:row_{i}"
|
|
2669
|
-
existing_results[row_id] = {
|
|
2670
|
-
"row_id": row_id,
|
|
2671
|
-
"check_id": f"CHK-{i}",
|
|
2672
|
-
"status": "PASS",
|
|
2673
|
-
"score": 50.0, # Old score
|
|
2674
|
-
"score_breakdown": {
|
|
2675
|
-
"raw_score": 50.0,
|
|
2676
|
-
"coverage": 1.0,
|
|
2677
|
-
"confidence": 1.0,
|
|
2678
|
-
"capped": False,
|
|
2679
|
-
"final_score": 50.0,
|
|
2680
|
-
},
|
|
2681
|
-
"reason": "Old result",
|
|
2682
|
-
"finding": "Old finding",
|
|
2683
|
-
"evidence_anchors": [],
|
|
2684
|
-
"provenance": {
|
|
2685
|
-
"row_llm_mode": "test",
|
|
2686
|
-
"protocol": None,
|
|
2687
|
-
"model": None,
|
|
2688
|
-
"template_hash": "hash_123",
|
|
2689
|
-
"rubric_version": "1",
|
|
2690
|
-
"evidence_hash": "ev_hash_456",
|
|
2691
|
-
"evaluated_at": datetime.now(UTC).isoformat(),
|
|
2692
|
-
},
|
|
2693
|
-
}
|
|
2694
|
-
|
|
2695
|
-
checkpoint_data = {
|
|
2696
|
-
"thread_id": "test-force",
|
|
2697
|
-
"total_rows": 10,
|
|
2698
|
-
"template_hash": "hash_123",
|
|
2699
|
-
"evidence_hash": "ev_hash_456",
|
|
2700
|
-
"completed_batches": [0],
|
|
2701
|
-
"results_by_row_id": existing_results,
|
|
2702
|
-
"last_updated": datetime.now(UTC).isoformat(),
|
|
2703
|
-
}
|
|
2704
|
-
checkpoint_file.write_text(json.dumps(checkpoint_data))
|
|
2705
|
-
|
|
2706
|
-
# Target row 1 (0-indexed: 0) with force_refresh
|
|
2707
|
-
target_selection = TargetSelection(
|
|
2708
|
-
target_type=TargetType.ROW_IDS,
|
|
2709
|
-
raw_value="1",
|
|
2710
|
-
row_indices=frozenset({0}),
|
|
2711
|
-
)
|
|
2712
|
-
config = BatchConfig(
|
|
2713
|
-
batch_size=5,
|
|
2714
|
-
row_timeout_ms=1000,
|
|
2715
|
-
checkpoint_dir=checkpoint_dir,
|
|
2716
|
-
resume_from_checkpoint=True,
|
|
2717
|
-
target_selection=target_selection,
|
|
2718
|
-
force_refresh_targets=True,
|
|
2719
|
-
)
|
|
2720
|
-
processor = BatchRowProcessor(
|
|
2721
|
-
template=mock_template,
|
|
2722
|
-
evaluator=mock_evaluator,
|
|
2723
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2724
|
-
config=config,
|
|
2725
|
-
)
|
|
2726
|
-
|
|
2727
|
-
# Return a new result with different score
|
|
2728
|
-
new_result = RowEvaluationResult(
|
|
2729
|
-
row_id="CHK-0:row_0",
|
|
2730
|
-
check_id="CHK-0",
|
|
2731
|
-
status=RowStatus.PASS,
|
|
2732
|
-
score=100.0, # New score
|
|
2733
|
-
score_breakdown=ScoreBreakdown.compute(100.0),
|
|
2734
|
-
reason="New result",
|
|
2735
|
-
finding="New finding",
|
|
2736
|
-
evidence_anchors=[],
|
|
2737
|
-
provenance=RowProvenance(
|
|
2738
|
-
row_llm_mode="test",
|
|
2739
|
-
protocol=None,
|
|
2740
|
-
model=None,
|
|
2741
|
-
template_hash="hash_123",
|
|
2742
|
-
rubric_version="1",
|
|
2743
|
-
evidence_hash="ev_hash_456",
|
|
2744
|
-
evaluated_at=datetime.now(UTC),
|
|
2745
|
-
),
|
|
2746
|
-
)
|
|
2747
|
-
mock_evaluator.aevaluate_row.return_value = new_result
|
|
2748
|
-
|
|
2749
|
-
results = await processor.process_all(thread_id="test-force")
|
|
2750
|
-
|
|
2751
|
-
# Should have called evaluator for the targeted row
|
|
2752
|
-
assert mock_evaluator.aevaluate_row.call_count == 1
|
|
2753
|
-
|
|
2754
|
-
# Find the result for row 0
|
|
2755
|
-
row_0_result = next((r for r in results if r.row_id == "CHK-0:row_0"), None)
|
|
2756
|
-
assert row_0_result is not None
|
|
2757
|
-
assert row_0_result.score == 100.0 # New score, not old 50.0
|
|
2758
|
-
assert row_0_result.reason == "New result"
|
|
2759
|
-
|
|
2760
|
-
@pytest.mark.asyncio
|
|
2761
|
-
async def test_no_force_refresh_uses_checkpoint(
|
|
2762
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, default_result, tmp_path
|
|
2763
|
-
):
|
|
2764
|
-
"""Test that without force_refresh, checkpointed targeted rows are not re-evaluated."""
|
|
2765
|
-
checkpoint_dir = tmp_path / "checkpoints"
|
|
2766
|
-
|
|
2767
|
-
# Create a checkpoint with existing results
|
|
2768
|
-
checkpoint_file = checkpoint_dir / "batch-checkpoint-test-no-force.json"
|
|
2769
|
-
checkpoint_file.parent.mkdir(parents=True, exist_ok=True)
|
|
2770
|
-
|
|
2771
|
-
# Pre-populate checkpoint with result for row 0
|
|
2772
|
-
existing_results = {
|
|
2773
|
-
"CHK-0:row_0": {
|
|
2774
|
-
"row_id": "CHK-0:row_0",
|
|
2775
|
-
"check_id": "CHK-0",
|
|
2776
|
-
"status": "PASS",
|
|
2777
|
-
"score": 50.0,
|
|
2778
|
-
"score_breakdown": {
|
|
2779
|
-
"raw_score": 50.0,
|
|
2780
|
-
"coverage": 1.0,
|
|
2781
|
-
"confidence": 1.0,
|
|
2782
|
-
"capped": False,
|
|
2783
|
-
"final_score": 50.0,
|
|
2784
|
-
},
|
|
2785
|
-
"reason": "Checkpointed result",
|
|
2786
|
-
"finding": "Checkpointed finding",
|
|
2787
|
-
"evidence_anchors": [],
|
|
2788
|
-
"provenance": {
|
|
2789
|
-
"row_llm_mode": "test",
|
|
2790
|
-
"protocol": None,
|
|
2791
|
-
"model": None,
|
|
2792
|
-
"template_hash": "hash_123",
|
|
2793
|
-
"rubric_version": "1",
|
|
2794
|
-
"evidence_hash": "ev_hash_456",
|
|
2795
|
-
"evaluated_at": datetime.now(UTC).isoformat(),
|
|
2796
|
-
},
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
|
|
2800
|
-
checkpoint_data = {
|
|
2801
|
-
"thread_id": "test-no-force",
|
|
2802
|
-
"total_rows": 10,
|
|
2803
|
-
"template_hash": "hash_123",
|
|
2804
|
-
"evidence_hash": "ev_hash_456",
|
|
2805
|
-
"completed_batches": [], # Not marked as complete
|
|
2806
|
-
"results_by_row_id": existing_results,
|
|
2807
|
-
"last_updated": datetime.now(UTC).isoformat(),
|
|
2808
|
-
}
|
|
2809
|
-
checkpoint_file.write_text(json.dumps(checkpoint_data))
|
|
2810
|
-
|
|
2811
|
-
# Target row 1 (0-indexed: 0) WITHOUT force_refresh
|
|
2812
|
-
target_selection = TargetSelection(
|
|
2813
|
-
target_type=TargetType.ROW_IDS,
|
|
2814
|
-
raw_value="1",
|
|
2815
|
-
row_indices=frozenset({0}),
|
|
2816
|
-
)
|
|
2817
|
-
config = BatchConfig(
|
|
2818
|
-
batch_size=5,
|
|
2819
|
-
row_timeout_ms=1000,
|
|
2820
|
-
checkpoint_dir=checkpoint_dir,
|
|
2821
|
-
resume_from_checkpoint=True,
|
|
2822
|
-
target_selection=target_selection,
|
|
2823
|
-
force_refresh_targets=False, # Don't force refresh
|
|
2824
|
-
)
|
|
2825
|
-
processor = BatchRowProcessor(
|
|
2826
|
-
template=mock_template,
|
|
2827
|
-
evaluator=mock_evaluator,
|
|
2828
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2829
|
-
config=config,
|
|
2830
|
-
)
|
|
2831
|
-
|
|
2832
|
-
mock_evaluator.aevaluate_row.return_value = default_result
|
|
2833
|
-
|
|
2834
|
-
results = await processor.process_all(thread_id="test-no-force")
|
|
2835
|
-
|
|
2836
|
-
# Should NOT have called evaluator for the targeted row (it's checkpointed)
|
|
2837
|
-
assert mock_evaluator.aevaluate_row.call_count == 0
|
|
2838
|
-
|
|
2839
|
-
# Result should be from checkpoint
|
|
2840
|
-
row_0_result = next((r for r in results if r.row_id == "CHK-0:row_0"), None)
|
|
2841
|
-
assert row_0_result is not None
|
|
2842
|
-
assert row_0_result.score == 50.0 # Checkpointed score
|
|
2843
|
-
assert row_0_result.reason == "Checkpointed result"
|
|
2844
|
-
|
|
2845
|
-
def test_is_row_targeted_no_selection(self, mock_template, mock_evaluator, mock_evidence_matcher):
|
|
2846
|
-
"""Test that all rows are targeted when no selection is configured."""
|
|
2847
|
-
config = BatchConfig(batch_size=5, target_selection=None)
|
|
2848
|
-
processor = BatchRowProcessor(
|
|
2849
|
-
template=mock_template,
|
|
2850
|
-
evaluator=mock_evaluator,
|
|
2851
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2852
|
-
config=config,
|
|
2853
|
-
)
|
|
2854
|
-
|
|
2855
|
-
# All rows should be targeted
|
|
2856
|
-
for i in range(10):
|
|
2857
|
-
assert processor._is_row_targeted(i, f"CHK-{i}") is True
|
|
2858
|
-
|
|
2859
|
-
def test_is_row_targeted_with_row_ids(
|
|
2860
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, target_selection_rows_1_3
|
|
2861
|
-
):
|
|
2862
|
-
"""Test row targeting with row ID selection."""
|
|
2863
|
-
config = BatchConfig(batch_size=5, target_selection=target_selection_rows_1_3)
|
|
2864
|
-
processor = BatchRowProcessor(
|
|
2865
|
-
template=mock_template,
|
|
2866
|
-
evaluator=mock_evaluator,
|
|
2867
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2868
|
-
config=config,
|
|
2869
|
-
)
|
|
2870
|
-
|
|
2871
|
-
# Only rows 0 and 2 should be targeted
|
|
2872
|
-
assert processor._is_row_targeted(0, "CHK-0") is True
|
|
2873
|
-
assert processor._is_row_targeted(1, "CHK-1") is False
|
|
2874
|
-
assert processor._is_row_targeted(2, "CHK-2") is True
|
|
2875
|
-
assert processor._is_row_targeted(3, "CHK-3") is False
|
|
2876
|
-
|
|
2877
|
-
def test_is_row_targeted_with_check_ids(
|
|
2878
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, target_selection_check_ids
|
|
2879
|
-
):
|
|
2880
|
-
"""Test row targeting with check ID selection."""
|
|
2881
|
-
config = BatchConfig(batch_size=5, target_selection=target_selection_check_ids)
|
|
2882
|
-
processor = BatchRowProcessor(
|
|
2883
|
-
template=mock_template,
|
|
2884
|
-
evaluator=mock_evaluator,
|
|
2885
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2886
|
-
config=config,
|
|
2887
|
-
)
|
|
2888
|
-
|
|
2889
|
-
# CHK-0 and CHK-5 should be targeted
|
|
2890
|
-
assert processor._is_row_targeted(0, "CHK-0") is True
|
|
2891
|
-
assert processor._is_row_targeted(1, "CHK-1") is False
|
|
2892
|
-
assert processor._is_row_targeted(5, "CHK-5") is True
|
|
2893
|
-
assert processor._is_row_targeted(9, "CHK-9") is False
|
|
2894
|
-
|
|
2895
|
-
def test_batch_has_targeted_rows_no_selection(self, mock_template, mock_evaluator, mock_evidence_matcher):
|
|
2896
|
-
"""Test that all batches have targets when no selection is configured."""
|
|
2897
|
-
config = BatchConfig(batch_size=5, target_selection=None)
|
|
2898
|
-
processor = BatchRowProcessor(
|
|
2899
|
-
template=mock_template,
|
|
2900
|
-
evaluator=mock_evaluator,
|
|
2901
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2902
|
-
config=config,
|
|
2903
|
-
)
|
|
2904
|
-
|
|
2905
|
-
assert processor._batch_has_targeted_rows(0, 5) is True
|
|
2906
|
-
assert processor._batch_has_targeted_rows(5, 10) is True
|
|
2907
|
-
|
|
2908
|
-
def test_batch_has_targeted_rows_with_selection(
|
|
2909
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher, target_selection_rows_1_3
|
|
2910
|
-
):
|
|
2911
|
-
"""Test batch targeting detection with row selection."""
|
|
2912
|
-
config = BatchConfig(batch_size=5, target_selection=target_selection_rows_1_3)
|
|
2913
|
-
processor = BatchRowProcessor(
|
|
2914
|
-
template=mock_template,
|
|
2915
|
-
evaluator=mock_evaluator,
|
|
2916
|
-
evidence_matcher=mock_evidence_matcher,
|
|
2917
|
-
config=config,
|
|
2918
|
-
)
|
|
2919
|
-
|
|
2920
|
-
# Batch 0 (rows 0-4) has targets (rows 0 and 2)
|
|
2921
|
-
assert processor._batch_has_targeted_rows(0, 5) is True
|
|
2922
|
-
# Batch 1 (rows 5-9) has no targets
|
|
2923
|
-
assert processor._batch_has_targeted_rows(5, 10) is False
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
# =============================================================================
|
|
2927
|
-
# Phase 145a: Resilience Budget, BatchConfig.batch_error_retry_limit,
|
|
2928
|
-
# and _retry_error_rows tests
|
|
2929
|
-
# =============================================================================
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
class TestResilienceBudget:
|
|
2933
|
-
"""Tests for ResilienceBudget formula and consume() semantics (FR-145.2)."""
|
|
2934
|
-
|
|
2935
|
-
def test_total_formula_error_driven(self) -> None:
|
|
2936
|
-
"""Formula: max(error_count * 3, max(15, ceil(total_rows * 0.35)))."""
|
|
2937
|
-
import math
|
|
2938
|
-
|
|
2939
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2940
|
-
|
|
2941
|
-
b = ResilienceBudget(total_rows=55, error_count=12)
|
|
2942
|
-
expected = max(12 * 3, 15, math.ceil(55 * 0.35))
|
|
2943
|
-
assert b.total == expected == 36
|
|
2944
|
-
|
|
2945
|
-
def test_total_formula_floor_dominates_when_no_errors(self) -> None:
|
|
2946
|
-
"""Floor of max(15, ceil(total_rows * 0.35)) when error_count=0."""
|
|
2947
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2948
|
-
|
|
2949
|
-
b = ResilienceBudget(total_rows=4, error_count=0)
|
|
2950
|
-
assert b.total == 15 # floor=15, pct=ceil(4*0.35)=2 → max(0, 15)=15
|
|
2951
|
-
|
|
2952
|
-
def test_total_formula_pct_dominates_for_large_batch(self) -> None:
|
|
2953
|
-
"""35% of rows dominates for large batches with few errors."""
|
|
2954
|
-
import math
|
|
2955
|
-
|
|
2956
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2957
|
-
|
|
2958
|
-
b = ResilienceBudget(total_rows=200, error_count=5)
|
|
2959
|
-
assert b.total == max(15, math.ceil(200 * 0.35)) # = 70
|
|
2960
|
-
|
|
2961
|
-
def test_consume_decrements_remaining(self) -> None:
|
|
2962
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2963
|
-
|
|
2964
|
-
b = ResilienceBudget(total_rows=10, error_count=1)
|
|
2965
|
-
initial = b.total
|
|
2966
|
-
assert b.remaining == initial
|
|
2967
|
-
assert b.consume() is True
|
|
2968
|
-
assert b.calls_used == 1
|
|
2969
|
-
assert b.remaining == initial - 1
|
|
2970
|
-
|
|
2971
|
-
def test_consume_returns_false_when_exhausted(self) -> None:
|
|
2972
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2973
|
-
|
|
2974
|
-
b = ResilienceBudget(total_rows=5, error_count=0)
|
|
2975
|
-
assert b.total == 15 # floor=15 with generous formula
|
|
2976
|
-
for _ in range(15):
|
|
2977
|
-
assert b.consume() is True
|
|
2978
|
-
assert b.consume() is False
|
|
2979
|
-
assert b.calls_used == 15
|
|
2980
|
-
|
|
2981
|
-
def test_remaining_never_negative(self) -> None:
|
|
2982
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
2983
|
-
|
|
2984
|
-
b = ResilienceBudget(total_rows=2, error_count=0)
|
|
2985
|
-
for _ in range(20): # exhaust well past limit
|
|
2986
|
-
b.consume()
|
|
2987
|
-
assert b.remaining == 0
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
class TestBatchConfigBatchErrorRetryLimit:
|
|
2991
|
-
"""Tests for batch_error_retry_limit field (FR-145.2, TSK-145.6)."""
|
|
2992
|
-
|
|
2993
|
-
def test_default_is_two(self) -> None:
|
|
2994
|
-
"""Default batch_error_retry_limit=2 (generous budget)."""
|
|
2995
|
-
cfg = BatchConfig()
|
|
2996
|
-
assert cfg.batch_error_retry_limit == 2
|
|
2997
|
-
|
|
2998
|
-
def test_explicit_override(self) -> None:
|
|
2999
|
-
cfg = BatchConfig(batch_error_retry_limit=3)
|
|
3000
|
-
assert cfg.batch_error_retry_limit == 3
|
|
3001
|
-
|
|
3002
|
-
def test_zero_disables_retry(self) -> None:
|
|
3003
|
-
cfg = BatchConfig(batch_error_retry_limit=0)
|
|
3004
|
-
assert cfg.batch_error_retry_limit == 0
|
|
3005
|
-
|
|
3006
|
-
def test_env_var_override(self, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
3007
|
-
"""VDS_AUDIT_BATCH_ERROR_RETRY_LIMIT env var controls default."""
|
|
3008
|
-
import vds_audit_orchestrator.engine.batch_processor as mod
|
|
3009
|
-
|
|
3010
|
-
monkeypatch.setenv("VDS_AUDIT_BATCH_ERROR_RETRY_LIMIT", "5")
|
|
3011
|
-
result = mod._default_batch_error_retry_limit()
|
|
3012
|
-
assert result == 5
|
|
3013
|
-
|
|
3014
|
-
def test_env_var_invalid_falls_back_to_default(self, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
3015
|
-
import vds_audit_orchestrator.engine.batch_processor as mod
|
|
3016
|
-
|
|
3017
|
-
monkeypatch.setenv("VDS_AUDIT_BATCH_ERROR_RETRY_LIMIT", "not_a_number")
|
|
3018
|
-
result = mod._default_batch_error_retry_limit()
|
|
3019
|
-
assert result == 1
|
|
3020
|
-
|
|
3021
|
-
def test_no_max_retries_field(self) -> None:
|
|
3022
|
-
"""Old max_retries field is replaced — callers use batch_error_retry_limit."""
|
|
3023
|
-
cfg = BatchConfig()
|
|
3024
|
-
assert hasattr(cfg, "batch_error_retry_limit")
|
|
3025
|
-
# max_retries was removed from BatchConfig
|
|
3026
|
-
assert not hasattr(cfg, "max_retries") or "max_retries" not in BatchConfig.__dataclass_fields__
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
class TestNonFailoverableReasons:
|
|
3030
|
-
"""Tests for _NON_FAILOVERABLE_REASONS constant."""
|
|
3031
|
-
|
|
3032
|
-
def test_terminal_auth_is_non_failoverable(self) -> None:
|
|
3033
|
-
from vds_audit_orchestrator.engine.batch_processor import _NON_FAILOVERABLE_REASONS
|
|
3034
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderFailureClass
|
|
3035
|
-
|
|
3036
|
-
assert ProviderFailureClass.TERMINAL_AUTH.value in _NON_FAILOVERABLE_REASONS
|
|
3037
|
-
|
|
3038
|
-
def test_non_provider_bug_is_non_failoverable(self) -> None:
|
|
3039
|
-
from vds_audit_orchestrator.engine.batch_processor import _NON_FAILOVERABLE_REASONS
|
|
3040
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderFailureClass
|
|
3041
|
-
|
|
3042
|
-
assert ProviderFailureClass.NON_PROVIDER_BUG.value in _NON_FAILOVERABLE_REASONS
|
|
3043
|
-
|
|
3044
|
-
def test_transient_errors_are_not_in_set(self) -> None:
|
|
3045
|
-
from vds_audit_orchestrator.engine.batch_processor import _NON_FAILOVERABLE_REASONS
|
|
3046
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderFailureClass
|
|
3047
|
-
|
|
3048
|
-
assert ProviderFailureClass.RETRYABLE_TRANSIENT.value not in _NON_FAILOVERABLE_REASONS
|
|
3049
|
-
assert ProviderFailureClass.QUOTA_OR_CAPACITY.value not in _NON_FAILOVERABLE_REASONS
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
def _make_error_result(
|
|
3053
|
-
row_id: str = "CHK-0:row_0",
|
|
3054
|
-
check_id: str = "CHK-0",
|
|
3055
|
-
reason_code: str = "",
|
|
3056
|
-
original_provider: str = "profile-a",
|
|
3057
|
-
) -> RowEvaluationResult:
|
|
3058
|
-
"""Helper: create an ERROR RowEvaluationResult for retry sweep tests."""
|
|
3059
|
-
return RowEvaluationResult(
|
|
3060
|
-
row_id=row_id,
|
|
3061
|
-
check_id=check_id,
|
|
3062
|
-
status=RowStatus.ERROR,
|
|
3063
|
-
score=0.0,
|
|
3064
|
-
score_breakdown=ScoreBreakdown.compute(0.0),
|
|
3065
|
-
reason="error",
|
|
3066
|
-
finding="error",
|
|
3067
|
-
evidence_anchors=[],
|
|
3068
|
-
provenance=RowProvenance(
|
|
3069
|
-
row_llm_mode="test",
|
|
3070
|
-
protocol=None,
|
|
3071
|
-
model=None,
|
|
3072
|
-
template_hash="h",
|
|
3073
|
-
rubric_version="1",
|
|
3074
|
-
evidence_hash="h",
|
|
3075
|
-
evaluated_at=datetime.now(UTC),
|
|
3076
|
-
original_provider=original_provider,
|
|
3077
|
-
final_provider=original_provider,
|
|
3078
|
-
failover_chain=[original_provider],
|
|
3079
|
-
),
|
|
3080
|
-
error_message="evaluation failed",
|
|
3081
|
-
retry_metadata={"reason_code": reason_code} if reason_code else {},
|
|
3082
|
-
)
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
def _make_pass_result(
|
|
3086
|
-
row_id: str = "CHK-0:row_0",
|
|
3087
|
-
check_id: str = "CHK-0",
|
|
3088
|
-
provider: str = "profile-b",
|
|
3089
|
-
) -> RowEvaluationResult:
|
|
3090
|
-
"""Helper: create a PASS RowEvaluationResult."""
|
|
3091
|
-
return RowEvaluationResult(
|
|
3092
|
-
row_id=row_id,
|
|
3093
|
-
check_id=check_id,
|
|
3094
|
-
status=RowStatus.PASS,
|
|
3095
|
-
score=80.0,
|
|
3096
|
-
score_breakdown=ScoreBreakdown.compute(80.0),
|
|
3097
|
-
reason="pass",
|
|
3098
|
-
finding="pass",
|
|
3099
|
-
evidence_anchors=[],
|
|
3100
|
-
provenance=RowProvenance(
|
|
3101
|
-
row_llm_mode="test",
|
|
3102
|
-
protocol=None,
|
|
3103
|
-
model=None,
|
|
3104
|
-
template_hash="h",
|
|
3105
|
-
rubric_version="1",
|
|
3106
|
-
evidence_hash="h",
|
|
3107
|
-
evaluated_at=datetime.now(UTC),
|
|
3108
|
-
original_provider=provider,
|
|
3109
|
-
final_provider=provider,
|
|
3110
|
-
failover_chain=[provider],
|
|
3111
|
-
),
|
|
3112
|
-
retry_metadata={},
|
|
3113
|
-
)
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
class TestRetryErrorRows:
|
|
3117
|
-
"""Tests for _retry_error_rows post-pass sweep (FR-145.2)."""
|
|
3118
|
-
|
|
3119
|
-
def _make_processor(self, mock_template, mock_evaluator, mock_evidence_matcher):
|
|
3120
|
-
cfg = BatchConfig(batch_size=5, row_timeout_ms=5000)
|
|
3121
|
-
return BatchRowProcessor(
|
|
3122
|
-
template=mock_template,
|
|
3123
|
-
evaluator=mock_evaluator,
|
|
3124
|
-
evidence_matcher=mock_evidence_matcher,
|
|
3125
|
-
config=cfg,
|
|
3126
|
-
)
|
|
3127
|
-
|
|
3128
|
-
@pytest.mark.asyncio
|
|
3129
|
-
async def test_no_failover_profiles_returns_unchanged(
|
|
3130
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3131
|
-
) -> None:
|
|
3132
|
-
"""If failover_profiles is empty, skip sweep entirely."""
|
|
3133
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3134
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3135
|
-
|
|
3136
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3137
|
-
results = [_make_error_result()]
|
|
3138
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3139
|
-
health_memory = ProviderHealthMemory()
|
|
3140
|
-
|
|
3141
|
-
updated = await processor._retry_error_rows(
|
|
3142
|
-
results=results,
|
|
3143
|
-
health_memory=health_memory,
|
|
3144
|
-
budget=budget,
|
|
3145
|
-
failover_profiles=[],
|
|
3146
|
-
project_profile=None,
|
|
3147
|
-
)
|
|
3148
|
-
|
|
3149
|
-
assert updated == results
|
|
3150
|
-
assert budget.calls_used == 0
|
|
3151
|
-
|
|
3152
|
-
@pytest.mark.asyncio
|
|
3153
|
-
async def test_non_failoverable_reason_skipped(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3154
|
-
"""Rows with non-failoverable reason_code are not retried."""
|
|
3155
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3156
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3157
|
-
|
|
3158
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3159
|
-
results = [_make_error_result(reason_code="terminal_auth")]
|
|
3160
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3161
|
-
health_memory = ProviderHealthMemory()
|
|
3162
|
-
|
|
3163
|
-
updated = await processor._retry_error_rows(
|
|
3164
|
-
results=results,
|
|
3165
|
-
health_memory=health_memory,
|
|
3166
|
-
budget=budget,
|
|
3167
|
-
failover_profiles=["profile-b"],
|
|
3168
|
-
project_profile=None,
|
|
3169
|
-
)
|
|
3170
|
-
|
|
3171
|
-
assert updated[0].status == RowStatus.ERROR
|
|
3172
|
-
assert budget.calls_used == 0 # never consumed
|
|
3173
|
-
|
|
3174
|
-
@pytest.mark.asyncio
|
|
3175
|
-
async def test_successful_retry_replaces_result(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3176
|
-
"""When retry succeeds (non-ERROR), the original ERROR is replaced."""
|
|
3177
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3178
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3179
|
-
|
|
3180
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3181
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3182
|
-
|
|
3183
|
-
pass_result = _make_pass_result(row_id="CHK-0:row_0", check_id="CHK-0", provider="profile-b")
|
|
3184
|
-
mock_evaluator.aevaluate_row.return_value = pass_result
|
|
3185
|
-
# Patch _build_retry_evaluator to return mock_evaluator directly
|
|
3186
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3187
|
-
|
|
3188
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3189
|
-
health_memory = ProviderHealthMemory()
|
|
3190
|
-
|
|
3191
|
-
updated = await processor._retry_error_rows(
|
|
3192
|
-
results=[original_error],
|
|
3193
|
-
health_memory=health_memory,
|
|
3194
|
-
budget=budget,
|
|
3195
|
-
failover_profiles=["profile-b"],
|
|
3196
|
-
project_profile=None,
|
|
3197
|
-
)
|
|
3198
|
-
|
|
3199
|
-
assert updated[0].status == RowStatus.PASS
|
|
3200
|
-
assert updated[0].retry_count == 1
|
|
3201
|
-
assert updated[0].retry_metadata.get("resilience_retry_pass") is True
|
|
3202
|
-
assert updated[0].retry_metadata.get("resilience_retry_provider") == "profile-b"
|
|
3203
|
-
assert budget.calls_used == 1
|
|
3204
|
-
|
|
3205
|
-
@pytest.mark.asyncio
|
|
3206
|
-
async def test_retry_still_error_keeps_original(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3207
|
-
"""If retry also returns ERROR, keep the original result."""
|
|
3208
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3209
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3210
|
-
|
|
3211
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3212
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3213
|
-
|
|
3214
|
-
retry_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0", original_provider="profile-b")
|
|
3215
|
-
mock_evaluator.aevaluate_row.return_value = retry_error
|
|
3216
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3217
|
-
|
|
3218
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3219
|
-
health_memory = ProviderHealthMemory()
|
|
3220
|
-
|
|
3221
|
-
updated = await processor._retry_error_rows(
|
|
3222
|
-
results=[original_error],
|
|
3223
|
-
health_memory=health_memory,
|
|
3224
|
-
budget=budget,
|
|
3225
|
-
failover_profiles=["profile-b"],
|
|
3226
|
-
project_profile=None,
|
|
3227
|
-
)
|
|
3228
|
-
|
|
3229
|
-
assert updated[0].status == RowStatus.ERROR
|
|
3230
|
-
assert updated[0].retry_metadata.get("resilience_retry_pass") is not True
|
|
3231
|
-
assert budget.calls_used == 1
|
|
3232
|
-
|
|
3233
|
-
@pytest.mark.asyncio
|
|
3234
|
-
async def test_budget_exhaustion_stops_sweep(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3235
|
-
"""Budget exhaustion prevents retrying remaining ERROR rows."""
|
|
3236
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3237
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3238
|
-
|
|
3239
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3240
|
-
|
|
3241
|
-
# Create 5 ERROR rows
|
|
3242
|
-
results = [_make_error_result(row_id=f"CHK-{i}:row_{i}", check_id=f"CHK-{i}") for i in range(5)]
|
|
3243
|
-
|
|
3244
|
-
pass_result = _make_pass_result(provider="profile-b")
|
|
3245
|
-
mock_evaluator.aevaluate_row.return_value = pass_result
|
|
3246
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3247
|
-
|
|
3248
|
-
# Budget only allows 2 retries
|
|
3249
|
-
budget = ResilienceBudget(total_rows=5, error_count=5)
|
|
3250
|
-
budget.calls_used = budget.total - 2 # exhaust all but 2
|
|
3251
|
-
|
|
3252
|
-
health_memory = ProviderHealthMemory()
|
|
3253
|
-
|
|
3254
|
-
updated = await processor._retry_error_rows(
|
|
3255
|
-
results=results,
|
|
3256
|
-
health_memory=health_memory,
|
|
3257
|
-
budget=budget,
|
|
3258
|
-
failover_profiles=["profile-b"],
|
|
3259
|
-
project_profile=None,
|
|
3260
|
-
)
|
|
3261
|
-
|
|
3262
|
-
# Only 2 rows should have been retried
|
|
3263
|
-
recovered = [r for r in updated if r.status == RowStatus.PASS]
|
|
3264
|
-
assert len(recovered) == 2
|
|
3265
|
-
assert budget.calls_used == budget.total
|
|
3266
|
-
|
|
3267
|
-
@pytest.mark.asyncio
|
|
3268
|
-
async def test_retry_exception_keeps_original(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3269
|
-
"""If retry raises, keep the original ERROR result."""
|
|
3270
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3271
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3272
|
-
|
|
3273
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3274
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3275
|
-
|
|
3276
|
-
mock_evaluator.aevaluate_row.side_effect = RuntimeError("provider unavailable")
|
|
3277
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3278
|
-
|
|
3279
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3280
|
-
health_memory = ProviderHealthMemory()
|
|
3281
|
-
|
|
3282
|
-
updated = await processor._retry_error_rows(
|
|
3283
|
-
results=[original_error],
|
|
3284
|
-
health_memory=health_memory,
|
|
3285
|
-
budget=budget,
|
|
3286
|
-
failover_profiles=["profile-b"],
|
|
3287
|
-
project_profile=None,
|
|
3288
|
-
)
|
|
3289
|
-
|
|
3290
|
-
assert updated[0].status == RowStatus.ERROR
|
|
3291
|
-
assert budget.calls_used == 1
|
|
3292
|
-
|
|
3293
|
-
@pytest.mark.asyncio
|
|
3294
|
-
async def test_cooled_down_provider_is_skipped(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3295
|
-
"""Providers with active cooldown are not selected for retry."""
|
|
3296
|
-
import time
|
|
3297
|
-
|
|
3298
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget
|
|
3299
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3300
|
-
|
|
3301
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3302
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0", original_provider="profile-a")
|
|
3303
|
-
# _build_retry_evaluator should not be called when provider is cooled down
|
|
3304
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3305
|
-
|
|
3306
|
-
health_memory = ProviderHealthMemory()
|
|
3307
|
-
health_memory.cooldown_until["profile-b"] = time.monotonic() + 9999.0 # far future
|
|
3308
|
-
|
|
3309
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3310
|
-
|
|
3311
|
-
updated = await processor._retry_error_rows(
|
|
3312
|
-
results=[original_error],
|
|
3313
|
-
health_memory=health_memory,
|
|
3314
|
-
budget=budget,
|
|
3315
|
-
failover_profiles=["profile-b"], # only candidate but cooled down
|
|
3316
|
-
project_profile=None,
|
|
3317
|
-
)
|
|
3318
|
-
|
|
3319
|
-
assert updated[0].status == RowStatus.ERROR
|
|
3320
|
-
# Budget consumed (we tried to find a provider) but no provider was healthy
|
|
3321
|
-
assert budget.calls_used == 1
|
|
3322
|
-
|
|
3323
|
-
def test_select_healthy_provider_skips_excluded(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3324
|
-
"""_select_healthy_provider excludes explicitly blocked providers."""
|
|
3325
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3326
|
-
|
|
3327
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3328
|
-
health_memory = ProviderHealthMemory()
|
|
3329
|
-
|
|
3330
|
-
result = processor._select_healthy_provider(
|
|
3331
|
-
failover_profiles=["profile-a", "profile-b", "profile-c"],
|
|
3332
|
-
health_memory=health_memory,
|
|
3333
|
-
exclude={"profile-a", "profile-b"},
|
|
3334
|
-
)
|
|
3335
|
-
assert result == "profile-c"
|
|
3336
|
-
|
|
3337
|
-
def test_select_healthy_provider_returns_none_when_all_blocked(
|
|
3338
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3339
|
-
) -> None:
|
|
3340
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3341
|
-
|
|
3342
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3343
|
-
health_memory = ProviderHealthMemory()
|
|
3344
|
-
|
|
3345
|
-
result = processor._select_healthy_provider(
|
|
3346
|
-
failover_profiles=["profile-a"],
|
|
3347
|
-
health_memory=health_memory,
|
|
3348
|
-
exclude={"profile-a"},
|
|
3349
|
-
)
|
|
3350
|
-
assert result is None
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
# ---------------------------------------------------------------------------
|
|
3354
|
-
# Tests for _ResilienceRetryStats accumulator and last_resilience_summary
|
|
3355
|
-
# (FR-145.7 telemetry)
|
|
3356
|
-
# ---------------------------------------------------------------------------
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
class TestResilienceRetryStats:
|
|
3360
|
-
"""Unit tests for the _ResilienceRetryStats dataclass."""
|
|
3361
|
-
|
|
3362
|
-
def test_initial_state(self) -> None:
|
|
3363
|
-
from vds_audit_orchestrator.engine.batch_processor import _ResilienceRetryStats
|
|
3364
|
-
|
|
3365
|
-
stats = _ResilienceRetryStats()
|
|
3366
|
-
assert stats.error_rows_before_retry == 0
|
|
3367
|
-
assert stats.retry_attempts == 0
|
|
3368
|
-
assert stats.retry_successes == 0
|
|
3369
|
-
assert stats.budget_used == 0
|
|
3370
|
-
assert stats.budget_total == 0
|
|
3371
|
-
assert stats.failover_hops == 0
|
|
3372
|
-
assert stats.providers_used == []
|
|
3373
|
-
|
|
3374
|
-
def test_stats_accumulate_correctly(self) -> None:
|
|
3375
|
-
from vds_audit_orchestrator.engine.batch_processor import _ResilienceRetryStats
|
|
3376
|
-
|
|
3377
|
-
stats = _ResilienceRetryStats()
|
|
3378
|
-
stats.error_rows_before_retry = 3
|
|
3379
|
-
stats.retry_attempts = 2
|
|
3380
|
-
stats.retry_successes = 1
|
|
3381
|
-
stats.budget_used = 2
|
|
3382
|
-
stats.budget_total = 6
|
|
3383
|
-
stats.failover_hops = 2
|
|
3384
|
-
stats.providers_used = ["profile-b", "profile-c"]
|
|
3385
|
-
|
|
3386
|
-
assert stats.retry_attempts == 2
|
|
3387
|
-
assert stats.retry_successes == 1
|
|
3388
|
-
assert len(stats.providers_used) == 2
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
class TestResilienceRetryStatsPopulation:
|
|
3392
|
-
"""Tests verifying _retry_error_rows populates stats correctly."""
|
|
3393
|
-
|
|
3394
|
-
def _make_processor(self, mock_template, mock_evaluator, mock_evidence_matcher):
|
|
3395
|
-
cfg = BatchConfig(batch_size=5, row_timeout_ms=5000)
|
|
3396
|
-
return BatchRowProcessor(
|
|
3397
|
-
template=mock_template,
|
|
3398
|
-
evaluator=mock_evaluator,
|
|
3399
|
-
evidence_matcher=mock_evidence_matcher,
|
|
3400
|
-
config=cfg,
|
|
3401
|
-
)
|
|
3402
|
-
|
|
3403
|
-
@pytest.mark.asyncio
|
|
3404
|
-
async def test_stats_populated_on_successful_retry(
|
|
3405
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3406
|
-
) -> None:
|
|
3407
|
-
"""Stats accumulator should record attempt, success, hop, and provider."""
|
|
3408
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget, _ResilienceRetryStats
|
|
3409
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3410
|
-
|
|
3411
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3412
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3413
|
-
pass_result = _make_pass_result(row_id="CHK-0:row_0", check_id="CHK-0", provider="profile-b")
|
|
3414
|
-
|
|
3415
|
-
mock_evaluator.aevaluate_row.return_value = pass_result
|
|
3416
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3417
|
-
|
|
3418
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3419
|
-
health_memory = ProviderHealthMemory()
|
|
3420
|
-
stats = _ResilienceRetryStats()
|
|
3421
|
-
|
|
3422
|
-
await processor._retry_error_rows(
|
|
3423
|
-
results=[original_error],
|
|
3424
|
-
health_memory=health_memory,
|
|
3425
|
-
budget=budget,
|
|
3426
|
-
failover_profiles=["profile-b"],
|
|
3427
|
-
project_profile=None,
|
|
3428
|
-
stats=stats,
|
|
3429
|
-
)
|
|
3430
|
-
|
|
3431
|
-
assert stats.error_rows_before_retry == 1
|
|
3432
|
-
assert stats.retry_attempts == 1
|
|
3433
|
-
assert stats.retry_successes == 1
|
|
3434
|
-
assert stats.budget_used == 1
|
|
3435
|
-
assert stats.budget_total == budget.total
|
|
3436
|
-
assert stats.failover_hops == 1
|
|
3437
|
-
assert "profile-b" in stats.providers_used
|
|
3438
|
-
|
|
3439
|
-
@pytest.mark.asyncio
|
|
3440
|
-
async def test_stats_retry_fails_no_success(self, mock_template, mock_evaluator, mock_evidence_matcher) -> None:
|
|
3441
|
-
"""Stats should record attempt but no success when retry also errors."""
|
|
3442
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget, _ResilienceRetryStats
|
|
3443
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3444
|
-
|
|
3445
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3446
|
-
original_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3447
|
-
retry_error = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0", original_provider="profile-b")
|
|
3448
|
-
|
|
3449
|
-
mock_evaluator.aevaluate_row.return_value = retry_error
|
|
3450
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3451
|
-
|
|
3452
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3453
|
-
health_memory = ProviderHealthMemory()
|
|
3454
|
-
stats = _ResilienceRetryStats()
|
|
3455
|
-
|
|
3456
|
-
await processor._retry_error_rows(
|
|
3457
|
-
results=[original_error],
|
|
3458
|
-
health_memory=health_memory,
|
|
3459
|
-
budget=budget,
|
|
3460
|
-
failover_profiles=["profile-b"],
|
|
3461
|
-
project_profile=None,
|
|
3462
|
-
stats=stats,
|
|
3463
|
-
)
|
|
3464
|
-
|
|
3465
|
-
assert stats.retry_attempts == 1
|
|
3466
|
-
assert stats.retry_successes == 0
|
|
3467
|
-
assert stats.failover_hops == 1
|
|
3468
|
-
|
|
3469
|
-
@pytest.mark.asyncio
|
|
3470
|
-
async def test_stats_not_populated_when_no_failover_profiles(
|
|
3471
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3472
|
-
) -> None:
|
|
3473
|
-
"""Empty failover list means sweep skips entirely — stats remain zeroed."""
|
|
3474
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget, _ResilienceRetryStats
|
|
3475
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3476
|
-
|
|
3477
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3478
|
-
original_error = _make_error_result()
|
|
3479
|
-
|
|
3480
|
-
budget = ResilienceBudget(total_rows=1, error_count=1)
|
|
3481
|
-
health_memory = ProviderHealthMemory()
|
|
3482
|
-
stats = _ResilienceRetryStats()
|
|
3483
|
-
|
|
3484
|
-
await processor._retry_error_rows(
|
|
3485
|
-
results=[original_error],
|
|
3486
|
-
health_memory=health_memory,
|
|
3487
|
-
budget=budget,
|
|
3488
|
-
failover_profiles=[],
|
|
3489
|
-
project_profile=None,
|
|
3490
|
-
stats=stats,
|
|
3491
|
-
)
|
|
3492
|
-
|
|
3493
|
-
assert stats.retry_attempts == 0
|
|
3494
|
-
assert stats.retry_successes == 0
|
|
3495
|
-
assert stats.providers_used == []
|
|
3496
|
-
|
|
3497
|
-
@pytest.mark.asyncio
|
|
3498
|
-
async def test_providers_deduplicated_across_retries(
|
|
3499
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3500
|
-
) -> None:
|
|
3501
|
-
"""The same retry provider should appear only once in stats.providers_used."""
|
|
3502
|
-
from vds_audit_orchestrator.engine.batch_processor import ResilienceBudget, _ResilienceRetryStats
|
|
3503
|
-
from vds_audit_orchestrator.engine.provider_failure_classifier import ProviderHealthMemory
|
|
3504
|
-
|
|
3505
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3506
|
-
|
|
3507
|
-
# Two error rows that both retry to profile-b
|
|
3508
|
-
err1 = _make_error_result(row_id="CHK-0:row_0", check_id="CHK-0")
|
|
3509
|
-
err2 = _make_error_result(row_id="CHK-1:row_1", check_id="CHK-1")
|
|
3510
|
-
pass1 = _make_pass_result(row_id="CHK-0:row_0", check_id="CHK-0", provider="profile-b")
|
|
3511
|
-
pass2 = _make_pass_result(row_id="CHK-1:row_1", check_id="CHK-1", provider="profile-b")
|
|
3512
|
-
|
|
3513
|
-
mock_evaluator.aevaluate_row.side_effect = [pass1, pass2]
|
|
3514
|
-
processor._build_retry_evaluator = MagicMock(return_value=mock_evaluator)
|
|
3515
|
-
|
|
3516
|
-
budget = ResilienceBudget(total_rows=2, error_count=2)
|
|
3517
|
-
health_memory = ProviderHealthMemory()
|
|
3518
|
-
stats = _ResilienceRetryStats()
|
|
3519
|
-
|
|
3520
|
-
await processor._retry_error_rows(
|
|
3521
|
-
results=[err1, err2],
|
|
3522
|
-
health_memory=health_memory,
|
|
3523
|
-
budget=budget,
|
|
3524
|
-
failover_profiles=["profile-b"],
|
|
3525
|
-
project_profile=None,
|
|
3526
|
-
stats=stats,
|
|
3527
|
-
)
|
|
3528
|
-
|
|
3529
|
-
# profile-b should appear exactly once even though it was used twice
|
|
3530
|
-
assert stats.providers_used.count("profile-b") == 1
|
|
3531
|
-
assert stats.retry_successes == 2
|
|
3532
|
-
assert stats.failover_hops == 2
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
class TestLastResilienceSummary:
|
|
3536
|
-
"""Tests for last_resilience_summary on BatchRowProcessor (FR-145.7)."""
|
|
3537
|
-
|
|
3538
|
-
def _make_processor(self, mock_template, mock_evaluator, mock_evidence_matcher):
|
|
3539
|
-
cfg = BatchConfig(batch_size=5, row_timeout_ms=5000, batch_error_retry_limit=0)
|
|
3540
|
-
return BatchRowProcessor(
|
|
3541
|
-
template=mock_template,
|
|
3542
|
-
evaluator=mock_evaluator,
|
|
3543
|
-
evidence_matcher=mock_evidence_matcher,
|
|
3544
|
-
config=cfg,
|
|
3545
|
-
)
|
|
3546
|
-
|
|
3547
|
-
def test_last_resilience_summary_initialized_to_none(
|
|
3548
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3549
|
-
) -> None:
|
|
3550
|
-
"""Processor starts with last_resilience_summary as None."""
|
|
3551
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3552
|
-
assert processor.last_resilience_summary is None
|
|
3553
|
-
|
|
3554
|
-
@pytest.mark.asyncio
|
|
3555
|
-
async def test_last_resilience_summary_set_after_process_all(
|
|
3556
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3557
|
-
) -> None:
|
|
3558
|
-
"""process_all always sets last_resilience_summary with correct keys."""
|
|
3559
|
-
mock_evaluator.aevaluate_row.return_value = _make_pass_result()
|
|
3560
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3561
|
-
|
|
3562
|
-
await processor.process_all(thread_id="test-summary-set")
|
|
3563
|
-
|
|
3564
|
-
summary = processor.last_resilience_summary
|
|
3565
|
-
assert summary is not None
|
|
3566
|
-
assert "total_rows" in summary
|
|
3567
|
-
assert "error_rows_before_retry" in summary
|
|
3568
|
-
assert "error_rows_after_retry" in summary
|
|
3569
|
-
assert "retry_attempts" in summary
|
|
3570
|
-
assert "retry_successes" in summary
|
|
3571
|
-
assert "retry_budget_used" in summary
|
|
3572
|
-
assert "retry_budget_total" in summary
|
|
3573
|
-
assert "failover_hops_total" in summary
|
|
3574
|
-
assert "providers_used" in summary
|
|
3575
|
-
assert "provider_health_summary" in summary
|
|
3576
|
-
|
|
3577
|
-
@pytest.mark.asyncio
|
|
3578
|
-
async def test_last_resilience_summary_reset_on_each_process_all(
|
|
3579
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3580
|
-
) -> None:
|
|
3581
|
-
"""Calling process_all twice should reset accumulator between runs."""
|
|
3582
|
-
mock_evaluator.aevaluate_row.return_value = _make_pass_result()
|
|
3583
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3584
|
-
|
|
3585
|
-
await processor.process_all(thread_id="run-1")
|
|
3586
|
-
summary_1 = dict(processor.last_resilience_summary or {})
|
|
3587
|
-
|
|
3588
|
-
await processor.process_all(thread_id="run-2")
|
|
3589
|
-
summary_2 = dict(processor.last_resilience_summary or {})
|
|
3590
|
-
|
|
3591
|
-
# Both runs had 0 retries, counts should be identical and not doubled.
|
|
3592
|
-
assert summary_1["retry_attempts"] == summary_2["retry_attempts"] == 0
|
|
3593
|
-
assert summary_1["retry_successes"] == summary_2["retry_successes"] == 0
|
|
3594
|
-
|
|
3595
|
-
@pytest.mark.asyncio
|
|
3596
|
-
async def test_last_resilience_summary_correct_row_counts(
|
|
3597
|
-
self, mock_template, mock_evaluator, mock_evidence_matcher
|
|
3598
|
-
) -> None:
|
|
3599
|
-
"""total_rows should equal the number of checks in the template."""
|
|
3600
|
-
mock_evaluator.aevaluate_row.return_value = _make_pass_result()
|
|
3601
|
-
processor = self._make_processor(mock_template, mock_evaluator, mock_evidence_matcher)
|
|
3602
|
-
|
|
3603
|
-
await processor.process_all(thread_id="test-row-counts")
|
|
3604
|
-
|
|
3605
|
-
summary = processor.last_resilience_summary
|
|
3606
|
-
assert summary is not None
|
|
3607
|
-
total_checks = sum(len(s.checks) for s in mock_template.sections)
|
|
3608
|
-
assert summary["total_rows"] == total_checks
|