@ngocsangairvds/vsaf 3.2.13 → 3.2.15
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 +13 -0
- package/package.json +1 -1
- package/src/config.js +167 -0
- package/src/global.js +34 -51
- 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,3295 +0,0 @@
|
|
|
1
|
-
"""Doctor commands for vds-audit CLI."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import asyncio
|
|
6
|
-
import contextlib
|
|
7
|
-
import dataclasses
|
|
8
|
-
import json
|
|
9
|
-
import os
|
|
10
|
-
import re
|
|
11
|
-
import shlex
|
|
12
|
-
import subprocess
|
|
13
|
-
from collections import deque
|
|
14
|
-
from datetime import UTC, datetime, timedelta
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
from time import perf_counter, sleep
|
|
17
|
-
from typing import Any, cast
|
|
18
|
-
|
|
19
|
-
import typer
|
|
20
|
-
from rich.table import Table
|
|
21
|
-
from vds_agent_core.profiles import list_runtime_profile_names
|
|
22
|
-
from vds_cli_common.env import load_shared_env
|
|
23
|
-
from vds_cli_common.paths import get_shared_env_path, get_vds_log_root
|
|
24
|
-
|
|
25
|
-
from vds_audit_orchestrator.config import get_config
|
|
26
|
-
from vds_audit_orchestrator.confluence_connectivity import collect_confluence_connectivity_payload
|
|
27
|
-
from vds_audit_orchestrator.state.store import PostgresStateStore
|
|
28
|
-
|
|
29
|
-
from .cli_common import _PRIMARY_SHARED_ENV_PATH, _STATE_DSN_ENV_VAR, _cli_state, console, doctor_app, logger
|
|
30
|
-
from .cli_impl import (
|
|
31
|
-
_VDS_CLI_PROJECT_DIR,
|
|
32
|
-
_collect_credentials_status,
|
|
33
|
-
_emit_json,
|
|
34
|
-
_invoke_state_api,
|
|
35
|
-
_load_state_api,
|
|
36
|
-
_probe_runtime_profiles_availability,
|
|
37
|
-
_resolve_project_key,
|
|
38
|
-
_resolve_runtime_log_file,
|
|
39
|
-
_resolve_state_dsn,
|
|
40
|
-
_state_command_candidates,
|
|
41
|
-
_state_connection_kwargs,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@doctor_app.command(name="credentials")
|
|
46
|
-
def doctor_credentials(
|
|
47
|
-
require_state_dsn: bool = typer.Option(
|
|
48
|
-
False,
|
|
49
|
-
"--require-state-dsn",
|
|
50
|
-
help=f"Fail if {_STATE_DSN_ENV_VAR} is not set.",
|
|
51
|
-
),
|
|
52
|
-
require_langgraph_dsn: bool = typer.Option(
|
|
53
|
-
False,
|
|
54
|
-
"--require-langgraph-dsn",
|
|
55
|
-
help="Fail if no LangGraph Postgres DSN env is set.",
|
|
56
|
-
),
|
|
57
|
-
) -> None:
|
|
58
|
-
"""Validate credential and DSN readiness from the shared VDS env file plus shell env."""
|
|
59
|
-
status = _collect_credentials_status()
|
|
60
|
-
errors: list[str] = []
|
|
61
|
-
warnings_list: list[str] = []
|
|
62
|
-
if not bool(status.get("confluence_ready")):
|
|
63
|
-
errors.append("Confluence credentials missing")
|
|
64
|
-
if not bool(status.get("bitbucket_ready")):
|
|
65
|
-
errors.append("Bitbucket credentials missing")
|
|
66
|
-
if require_state_dsn and not bool(status.get("state_dsn_set")):
|
|
67
|
-
errors.append(f"{_STATE_DSN_ENV_VAR} not set")
|
|
68
|
-
if require_langgraph_dsn and not bool(status.get("langgraph_postgres_dsn_set")):
|
|
69
|
-
errors.append("LangGraph Postgres DSN not set")
|
|
70
|
-
|
|
71
|
-
codex_enabled = bool(status.get("codex_diagnostics_enabled"))
|
|
72
|
-
if codex_enabled:
|
|
73
|
-
codex_jwt_status = str(status.get("codex_jwt_status") or "").strip().upper()
|
|
74
|
-
codex_message = str(status.get("codex_jwt_message") or "").strip()
|
|
75
|
-
codex_remediation = str(status.get("codex_remediation") or "").strip()
|
|
76
|
-
codex_auth_mode = str(status.get("codex_auth_mode") or "").strip().lower()
|
|
77
|
-
if codex_jwt_status == "FAIL":
|
|
78
|
-
errors.append(codex_message or "Codex OAuth diagnostics failed.")
|
|
79
|
-
elif codex_jwt_status == "WARN":
|
|
80
|
-
warnings_list.append(codex_message or "Codex OAuth diagnostics reported warnings.")
|
|
81
|
-
if codex_auth_mode == "api_key":
|
|
82
|
-
warnings_list.append(
|
|
83
|
-
codex_remediation
|
|
84
|
-
or (
|
|
85
|
-
"Run 'codex --login' to authenticate with your ChatGPT plan, "
|
|
86
|
-
"or switch to model.llm.type: openai for API-key billing."
|
|
87
|
-
)
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
unique_warnings: list[str] = []
|
|
91
|
-
for item in warnings_list:
|
|
92
|
-
text = str(item).strip()
|
|
93
|
-
if text and text not in unique_warnings:
|
|
94
|
-
unique_warnings.append(text)
|
|
95
|
-
|
|
96
|
-
payload = {
|
|
97
|
-
"status": "error" if errors else ("warning" if unique_warnings else "ok"),
|
|
98
|
-
"checks": status,
|
|
99
|
-
"warnings": unique_warnings,
|
|
100
|
-
"errors": errors,
|
|
101
|
-
}
|
|
102
|
-
if _cli_state.get("json_only"):
|
|
103
|
-
_emit_json(payload)
|
|
104
|
-
if errors:
|
|
105
|
-
raise typer.Exit(1)
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
table = Table(title="Credential Readiness")
|
|
109
|
-
table.add_column("Check")
|
|
110
|
-
table.add_column("Value")
|
|
111
|
-
table.add_row("Env path", str(status["env_path"]))
|
|
112
|
-
table.add_row("Basic auth", "yes" if status["basic_auth_ready"] else "no")
|
|
113
|
-
table.add_row("Confluence ready", "yes" if status["confluence_ready"] else "no")
|
|
114
|
-
table.add_row("Bitbucket ready", "yes" if status["bitbucket_ready"] else "no")
|
|
115
|
-
table.add_row(_STATE_DSN_ENV_VAR, "set" if status["state_dsn_set"] else "missing")
|
|
116
|
-
table.add_row(
|
|
117
|
-
"LangGraph DSN",
|
|
118
|
-
"set" if status["langgraph_postgres_dsn_set"] else "missing",
|
|
119
|
-
)
|
|
120
|
-
if codex_enabled:
|
|
121
|
-
codex_jwt_status = str(status.get("codex_jwt_status") or "").strip().upper() or "FAIL"
|
|
122
|
-
codex_marker = {"PASS": "PASS", "WARN": "WARN", "FAIL": "FAIL"}.get(codex_jwt_status, codex_jwt_status)
|
|
123
|
-
table.add_row("LLM protocol", str(status.get("llm_protocol") or "-"))
|
|
124
|
-
table.add_row("Codex auth file", "yes" if status.get("codex_auth_file_exists") else "no")
|
|
125
|
-
table.add_row("Codex auth mode", str(status.get("codex_auth_mode") or "-"))
|
|
126
|
-
table.add_row("Codex access token", "present" if status.get("codex_access_token_present") else "missing")
|
|
127
|
-
table.add_row("Codex account_id", str(status.get("codex_account_id_masked") or "missing"))
|
|
128
|
-
table.add_row("Codex JWT status", codex_marker)
|
|
129
|
-
table.add_row("Codex plan type", str(status.get("codex_plan_type") or "unknown"))
|
|
130
|
-
console.print(table)
|
|
131
|
-
|
|
132
|
-
for warning in unique_warnings:
|
|
133
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
134
|
-
if errors:
|
|
135
|
-
for err in errors:
|
|
136
|
-
console.print(f"[red]- {err}[/red]")
|
|
137
|
-
raise typer.Exit(1)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@doctor_app.command(name="profile-availability")
|
|
141
|
-
def doctor_profile_availability(
|
|
142
|
-
profiles: str | None = typer.Option(
|
|
143
|
-
None,
|
|
144
|
-
"--profiles",
|
|
145
|
-
help="Comma-separated runtime profile names to inspect. Defaults to all configured runtime profiles when omitted.",
|
|
146
|
-
),
|
|
147
|
-
mode: str = typer.Option(
|
|
148
|
-
"active",
|
|
149
|
-
"--mode",
|
|
150
|
-
help="Availability depth: credentials or active.",
|
|
151
|
-
),
|
|
152
|
-
parallel_check: bool = typer.Option(
|
|
153
|
-
False,
|
|
154
|
-
"--parallel-check/--no-parallel-check",
|
|
155
|
-
help="Run profile availability checks in parallel using isolated worker processes.",
|
|
156
|
-
),
|
|
157
|
-
parallel_workers: int = typer.Option(
|
|
158
|
-
4,
|
|
159
|
-
"--parallel-workers",
|
|
160
|
-
min=1,
|
|
161
|
-
help="Maximum worker processes used when --parallel-check is enabled.",
|
|
162
|
-
),
|
|
163
|
-
probe_timeout_seconds: float = typer.Option(
|
|
164
|
-
30.0,
|
|
165
|
-
"--probe-timeout-seconds",
|
|
166
|
-
min=1.0,
|
|
167
|
-
help="Per-profile timeout budget when --parallel-check is enabled.",
|
|
168
|
-
),
|
|
169
|
-
) -> None:
|
|
170
|
-
"""Inspect launch readiness for one or more runtime profiles."""
|
|
171
|
-
normalized_mode = str(mode or "").strip().lower()
|
|
172
|
-
if normalized_mode not in {"credentials", "active"}:
|
|
173
|
-
raise typer.BadParameter("--mode must be one of: credentials, active")
|
|
174
|
-
|
|
175
|
-
profile_list = [item.strip() for item in str(profiles or "").split(",") if item.strip()]
|
|
176
|
-
if not profile_list:
|
|
177
|
-
profile_list = list_runtime_profile_names()
|
|
178
|
-
if not profile_list:
|
|
179
|
-
raise typer.BadParameter(
|
|
180
|
-
"No runtime profiles are configured. Provide --profiles or configure ~/.vds/audit.profiles.yaml."
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
checks = _probe_runtime_profiles_availability(
|
|
184
|
-
profile_list,
|
|
185
|
-
mode=cast("Any", normalized_mode),
|
|
186
|
-
parallel=parallel_check,
|
|
187
|
-
max_workers=parallel_workers,
|
|
188
|
-
timeout_seconds=probe_timeout_seconds,
|
|
189
|
-
)
|
|
190
|
-
available_profiles = [item["profile"] for item in checks if item.get("availability_status") != "unavailable"]
|
|
191
|
-
unavailable_profiles = [item["profile"] for item in checks if item.get("availability_status") == "unavailable"]
|
|
192
|
-
degraded_profiles = [item["profile"] for item in checks if item.get("availability_status") == "degraded"]
|
|
193
|
-
payload = {
|
|
194
|
-
"status": "error" if unavailable_profiles else ("warning" if degraded_profiles else "ok"),
|
|
195
|
-
"mode": normalized_mode,
|
|
196
|
-
"parallel_check": parallel_check,
|
|
197
|
-
"parallel_workers": parallel_workers,
|
|
198
|
-
"probe_timeout_seconds": probe_timeout_seconds,
|
|
199
|
-
"requested_profiles": profile_list,
|
|
200
|
-
"checks": checks,
|
|
201
|
-
"available_profiles": available_profiles,
|
|
202
|
-
"unavailable_profiles": unavailable_profiles,
|
|
203
|
-
"degraded_profiles": degraded_profiles,
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if _cli_state.get("json_only"):
|
|
207
|
-
_emit_json(payload)
|
|
208
|
-
if unavailable_profiles:
|
|
209
|
-
raise typer.Exit(1)
|
|
210
|
-
return
|
|
211
|
-
|
|
212
|
-
table = Table(title="Profile Availability")
|
|
213
|
-
table.add_column("Profile")
|
|
214
|
-
table.add_column("Availability")
|
|
215
|
-
table.add_column("Credentials")
|
|
216
|
-
table.add_column("Probe")
|
|
217
|
-
table.add_column("Reasons")
|
|
218
|
-
for item in checks:
|
|
219
|
-
reasons = ", ".join(str(code) for code in item.get("reason_codes") or [])
|
|
220
|
-
table.add_row(
|
|
221
|
-
str(item.get("profile") or "-"),
|
|
222
|
-
str(item.get("availability_status") or "-"),
|
|
223
|
-
str(item.get("credential_status") or "-"),
|
|
224
|
-
str(item.get("probe_status") or "-"),
|
|
225
|
-
reasons or "-",
|
|
226
|
-
)
|
|
227
|
-
console.print(table)
|
|
228
|
-
if unavailable_profiles:
|
|
229
|
-
raise typer.Exit(1)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def _resolve_strict_require_effective_skill_flag() -> bool:
|
|
233
|
-
raw_value = os.getenv("VDS_AUDIT_AGENTIC_STRICT_REQUIRE_EFFECTIVE_SKILL")
|
|
234
|
-
if raw_value is None:
|
|
235
|
-
return True
|
|
236
|
-
return raw_value.strip().lower() in {"1", "true", "yes", "on"}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
def _collect_skill_policy_doctor_payload() -> dict[str, Any]:
|
|
240
|
-
config = get_config()
|
|
241
|
-
llm = config.llm
|
|
242
|
-
payload: dict[str, Any] = {
|
|
243
|
-
"status": "ok",
|
|
244
|
-
"skills_toolset_enabled": bool(llm.skills_toolset_enabled),
|
|
245
|
-
"skills_directories": [str(item) for item in llm.skills_directories],
|
|
246
|
-
"skills_allowlist": [str(item) for item in llm.skills_allowlist],
|
|
247
|
-
"allow_script_execution": bool(llm.skills_allow_script_execution),
|
|
248
|
-
"allowed_trust_tiers": [str(item) for item in llm.skills_allowed_trust_tiers],
|
|
249
|
-
"default_trust_tier": str(llm.skills_default_trust_tier),
|
|
250
|
-
"strict_require_effective_skill": _resolve_strict_require_effective_skill_flag(),
|
|
251
|
-
"runtime_skill_names": [],
|
|
252
|
-
"diagnostics": None,
|
|
253
|
-
"errors": [],
|
|
254
|
-
"warnings": [],
|
|
255
|
-
}
|
|
256
|
-
if not payload["skills_toolset_enabled"]:
|
|
257
|
-
payload["status"] = "disabled"
|
|
258
|
-
payload["message"] = "skills_toolset_disabled"
|
|
259
|
-
return payload
|
|
260
|
-
if not payload["skills_directories"]:
|
|
261
|
-
payload["status"] = "error"
|
|
262
|
-
payload["errors"] = ["skills_toolset_enabled=true but skills_directories is empty"]
|
|
263
|
-
return payload
|
|
264
|
-
|
|
265
|
-
try:
|
|
266
|
-
from vds_audit_orchestrator.agents.toolsets import (
|
|
267
|
-
SkillsToolsetConfig,
|
|
268
|
-
create_skills_toolset_from_config,
|
|
269
|
-
)
|
|
270
|
-
from vds_audit_orchestrator.agents.toolsets.skills_toolset import (
|
|
271
|
-
get_toolset_policy_diagnostics,
|
|
272
|
-
get_toolset_skill_metadata,
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
toolset = create_skills_toolset_from_config(
|
|
276
|
-
SkillsToolsetConfig(
|
|
277
|
-
directories=[str(item) for item in llm.skills_directories],
|
|
278
|
-
allowlist=[str(item) for item in llm.skills_allowlist],
|
|
279
|
-
allow_script_execution=bool(llm.skills_allow_script_execution),
|
|
280
|
-
allowed_trust_tiers=[str(item) for item in llm.skills_allowed_trust_tiers],
|
|
281
|
-
default_trust_tier=str(llm.skills_default_trust_tier),
|
|
282
|
-
trust_tiers={str(key): str(value) for key, value in llm.skills_trust_tiers.items()},
|
|
283
|
-
)
|
|
284
|
-
)
|
|
285
|
-
diagnostics = get_toolset_policy_diagnostics(toolset)
|
|
286
|
-
metadata = get_toolset_skill_metadata(toolset) or []
|
|
287
|
-
runtime_skills = getattr(toolset, "skills", None)
|
|
288
|
-
runtime_skill_names = sorted(str(name) for name in runtime_skills) if isinstance(runtime_skills, dict) else []
|
|
289
|
-
drop_reasons: list[dict[str, Any]] = []
|
|
290
|
-
blocked_tools: list[str] = []
|
|
291
|
-
if diagnostics is not None:
|
|
292
|
-
blocked_tools = [str(tool_name) for tool_name in list(getattr(diagnostics, "blocked_tools", []))]
|
|
293
|
-
for item in list(getattr(diagnostics, "dropped", [])):
|
|
294
|
-
if dataclasses.is_dataclass(item):
|
|
295
|
-
drop_reasons.append(cast("dict[str, Any]", dataclasses.asdict(item)))
|
|
296
|
-
elif isinstance(item, dict):
|
|
297
|
-
drop_reasons.append(dict(item))
|
|
298
|
-
|
|
299
|
-
payload["runtime_skill_names"] = runtime_skill_names
|
|
300
|
-
payload["diagnostics"] = {
|
|
301
|
-
"metadata_count": int(
|
|
302
|
-
getattr(diagnostics, "metadata_count", len(metadata)) if diagnostics is not None else len(metadata)
|
|
303
|
-
),
|
|
304
|
-
"policy_eligible_count": int(
|
|
305
|
-
getattr(diagnostics, "policy_eligible_count", len(metadata))
|
|
306
|
-
if diagnostics is not None
|
|
307
|
-
else len(metadata)
|
|
308
|
-
),
|
|
309
|
-
"runtime_loaded_count": int(
|
|
310
|
-
getattr(diagnostics, "runtime_loaded_count", len(runtime_skill_names))
|
|
311
|
-
if diagnostics is not None
|
|
312
|
-
else len(runtime_skill_names)
|
|
313
|
-
),
|
|
314
|
-
"blocked_tools": blocked_tools,
|
|
315
|
-
"drop_reasons": drop_reasons,
|
|
316
|
-
# Backward-compatible alias for older consumers.
|
|
317
|
-
"dropped": list(drop_reasons),
|
|
318
|
-
}
|
|
319
|
-
diagnostics_payload = payload["diagnostics"] if isinstance(payload.get("diagnostics"), dict) else {}
|
|
320
|
-
metadata_count = int(diagnostics_payload.get("metadata_count", 0) or 0)
|
|
321
|
-
policy_eligible_count = int(diagnostics_payload.get("policy_eligible_count", 0) or 0)
|
|
322
|
-
runtime_loaded_count = int(diagnostics_payload.get("runtime_loaded_count", 0) or 0)
|
|
323
|
-
warnings_list: list[str] = []
|
|
324
|
-
if metadata_count == 0 and policy_eligible_count > 0:
|
|
325
|
-
warnings_list.append("skills_policy_counter_mismatch: policy_eligible_count>0 while metadata_count=0")
|
|
326
|
-
if metadata_count >= 0 and policy_eligible_count > metadata_count:
|
|
327
|
-
warnings_list.append("skills_policy_counter_mismatch: policy_eligible_count exceeds metadata_count")
|
|
328
|
-
if policy_eligible_count >= 0 and runtime_loaded_count > policy_eligible_count:
|
|
329
|
-
warnings_list.append("skills_policy_counter_mismatch: runtime_loaded_count exceeds policy_eligible_count")
|
|
330
|
-
if warnings_list:
|
|
331
|
-
payload["warnings"] = warnings_list
|
|
332
|
-
if payload.get("status") == "ok":
|
|
333
|
-
payload["status"] = "warning"
|
|
334
|
-
except Exception as exc:
|
|
335
|
-
payload["status"] = "error"
|
|
336
|
-
payload["errors"] = [str(exc)]
|
|
337
|
-
return payload
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
@doctor_app.command(name="skills-policy")
|
|
341
|
-
def doctor_skills_policy(
|
|
342
|
-
json_output: bool = typer.Option(False, "--json", help="Emit skill policy diagnostics as JSON."),
|
|
343
|
-
) -> None:
|
|
344
|
-
"""Show skill policy diagnostics (metadata/policy/runtime counts and drop reasons)."""
|
|
345
|
-
payload = _collect_skill_policy_doctor_payload()
|
|
346
|
-
errors_raw = payload.get("errors", [])
|
|
347
|
-
errors = [str(item) for item in errors_raw if str(item).strip()] if isinstance(errors_raw, list) else []
|
|
348
|
-
warnings_raw = payload.get("warnings", [])
|
|
349
|
-
warnings = [str(item) for item in warnings_raw if str(item).strip()] if isinstance(warnings_raw, list) else []
|
|
350
|
-
if _cli_state.get("json_only") or json_output:
|
|
351
|
-
_emit_json(payload)
|
|
352
|
-
if payload.get("status") == "error" or errors:
|
|
353
|
-
raise typer.Exit(1)
|
|
354
|
-
return
|
|
355
|
-
|
|
356
|
-
diagnostics = payload.get("diagnostics") if isinstance(payload.get("diagnostics"), dict) else {}
|
|
357
|
-
table = Table(title="Skill Policy Diagnostics")
|
|
358
|
-
table.add_column("Check")
|
|
359
|
-
table.add_column("Value")
|
|
360
|
-
table.add_row("Status", str(payload.get("status")))
|
|
361
|
-
table.add_row("Skills toolset enabled", "yes" if payload.get("skills_toolset_enabled") else "no")
|
|
362
|
-
table.add_row("Allow script execution", "yes" if payload.get("allow_script_execution") else "no")
|
|
363
|
-
table.add_row(
|
|
364
|
-
"Strict require effective skill",
|
|
365
|
-
"yes" if payload.get("strict_require_effective_skill") else "no",
|
|
366
|
-
)
|
|
367
|
-
table.add_row("Skills directories", ", ".join(cast("list[str]", payload.get("skills_directories") or [])) or "-")
|
|
368
|
-
table.add_row("Allowed trust tiers", ", ".join(cast("list[str]", payload.get("allowed_trust_tiers") or [])) or "-")
|
|
369
|
-
table.add_row("Default trust tier", str(payload.get("default_trust_tier") or "-"))
|
|
370
|
-
if diagnostics:
|
|
371
|
-
table.add_row("Metadata count", str(diagnostics.get("metadata_count")))
|
|
372
|
-
table.add_row("Policy eligible count", str(diagnostics.get("policy_eligible_count")))
|
|
373
|
-
table.add_row("Runtime loaded count", str(diagnostics.get("runtime_loaded_count")))
|
|
374
|
-
blocked = diagnostics.get("blocked_tools") if isinstance(diagnostics.get("blocked_tools"), list) else []
|
|
375
|
-
table.add_row("Blocked tools", ", ".join(str(item) for item in blocked) or "-")
|
|
376
|
-
runtime_skill_names = (
|
|
377
|
-
payload.get("runtime_skill_names") if isinstance(payload.get("runtime_skill_names"), list) else []
|
|
378
|
-
)
|
|
379
|
-
table.add_row("Runtime skill names", ", ".join(str(item) for item in runtime_skill_names) or "-")
|
|
380
|
-
console.print(table)
|
|
381
|
-
|
|
382
|
-
drop_reasons = diagnostics.get("drop_reasons") if isinstance(diagnostics.get("drop_reasons"), list) else []
|
|
383
|
-
if not drop_reasons and isinstance(diagnostics.get("dropped"), list):
|
|
384
|
-
drop_reasons = diagnostics.get("dropped")
|
|
385
|
-
if drop_reasons:
|
|
386
|
-
drops_table = Table(title="Dropped Skills")
|
|
387
|
-
drops_table.add_column("Skill")
|
|
388
|
-
drops_table.add_column("Reason")
|
|
389
|
-
drops_table.add_column("Runtime")
|
|
390
|
-
for item in drop_reasons:
|
|
391
|
-
if not isinstance(item, dict):
|
|
392
|
-
continue
|
|
393
|
-
drops_table.add_row(
|
|
394
|
-
str(item.get("skill_name") or "-"),
|
|
395
|
-
str(item.get("reason") or "-"),
|
|
396
|
-
str(item.get("runtime_name") or "-"),
|
|
397
|
-
)
|
|
398
|
-
console.print(drops_table)
|
|
399
|
-
|
|
400
|
-
if errors:
|
|
401
|
-
for err in errors:
|
|
402
|
-
console.print(f"[red]- {err}[/red]")
|
|
403
|
-
raise typer.Exit(1)
|
|
404
|
-
if warnings:
|
|
405
|
-
for warning in warnings:
|
|
406
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
def _coerce_hierarchy_count(value: Any) -> int:
|
|
410
|
-
if isinstance(value, bool):
|
|
411
|
-
return int(value)
|
|
412
|
-
if isinstance(value, int):
|
|
413
|
-
return max(0, value)
|
|
414
|
-
if isinstance(value, float):
|
|
415
|
-
return max(0, int(value))
|
|
416
|
-
if isinstance(value, str):
|
|
417
|
-
text = value.strip()
|
|
418
|
-
if text.isdigit():
|
|
419
|
-
return int(text)
|
|
420
|
-
return 0
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
def _select_project_for_hierarchy_readiness(manifest_payload: dict[str, Any]) -> str | None:
|
|
424
|
-
projects = manifest_payload.get("projects")
|
|
425
|
-
if not isinstance(projects, list):
|
|
426
|
-
return None
|
|
427
|
-
for entry in projects:
|
|
428
|
-
if not isinstance(entry, dict):
|
|
429
|
-
continue
|
|
430
|
-
for field_name in ("project_storage_key", "page_id", "project_name_en", "project_name"):
|
|
431
|
-
value = str(entry.get(field_name) or "").strip()
|
|
432
|
-
if value:
|
|
433
|
-
return value
|
|
434
|
-
return None
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
def _bounded_hierarchy_anomalies(*, anomalies: dict[str, Any], sample_limit: int) -> dict[str, dict[str, Any]]:
|
|
438
|
-
bounded: dict[str, dict[str, Any]] = {}
|
|
439
|
-
for key in sorted(anomalies):
|
|
440
|
-
entry = anomalies.get(key)
|
|
441
|
-
if not isinstance(entry, dict):
|
|
442
|
-
continue
|
|
443
|
-
samples = entry.get("samples")
|
|
444
|
-
sample_list = samples if isinstance(samples, list) else []
|
|
445
|
-
bounded_samples = sample_list[:sample_limit]
|
|
446
|
-
bounded[key] = {
|
|
447
|
-
"count": _coerce_hierarchy_count(entry.get("count")),
|
|
448
|
-
"sample_count": len(bounded_samples),
|
|
449
|
-
"samples": bounded_samples,
|
|
450
|
-
}
|
|
451
|
-
return bounded
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
def _collect_hierarchy_status_doctor_payload(
|
|
455
|
-
*,
|
|
456
|
-
state_dsn: str,
|
|
457
|
-
project: str | None,
|
|
458
|
-
sample_limit: int,
|
|
459
|
-
) -> dict[str, Any]:
|
|
460
|
-
state_api = _load_state_api(required=True)
|
|
461
|
-
assert state_api is not None
|
|
462
|
-
|
|
463
|
-
project_selector = str(project or "").strip()
|
|
464
|
-
if not project_selector:
|
|
465
|
-
manifest_payload = _invoke_state_api(
|
|
466
|
-
state_api,
|
|
467
|
-
candidates=("load_manifest_payload",),
|
|
468
|
-
kwargs=_state_connection_kwargs(state_dsn),
|
|
469
|
-
required=True,
|
|
470
|
-
)
|
|
471
|
-
if not isinstance(manifest_payload, dict):
|
|
472
|
-
raise RuntimeError("State manifest payload is invalid (expected JSON object).")
|
|
473
|
-
project_selector = _select_project_for_hierarchy_readiness(manifest_payload)
|
|
474
|
-
if not project_selector:
|
|
475
|
-
raise RuntimeError("State manifest has no project selectors for hierarchy diagnostics.")
|
|
476
|
-
|
|
477
|
-
readiness_payload = _invoke_state_api(
|
|
478
|
-
state_api,
|
|
479
|
-
candidates=_state_command_candidates("readiness"),
|
|
480
|
-
kwargs={
|
|
481
|
-
"state_dsn": state_dsn,
|
|
482
|
-
"project": project_selector,
|
|
483
|
-
"project_identifier": project_selector,
|
|
484
|
-
"repo": None,
|
|
485
|
-
"repo_identifier": None,
|
|
486
|
-
},
|
|
487
|
-
required=True,
|
|
488
|
-
)
|
|
489
|
-
if not isinstance(readiness_payload, dict):
|
|
490
|
-
raise RuntimeError("State readiness returned invalid payload (expected JSON object).")
|
|
491
|
-
|
|
492
|
-
hierarchy_payload = readiness_payload.get("hierarchy")
|
|
493
|
-
if not isinstance(hierarchy_payload, dict):
|
|
494
|
-
raise RuntimeError("State readiness payload missing hierarchy diagnostics.")
|
|
495
|
-
|
|
496
|
-
anomalies_raw = hierarchy_payload.get("anomalies")
|
|
497
|
-
anomalies = anomalies_raw if isinstance(anomalies_raw, dict) else {}
|
|
498
|
-
bounded_anomalies = _bounded_hierarchy_anomalies(anomalies=anomalies, sample_limit=sample_limit)
|
|
499
|
-
|
|
500
|
-
anomaly_count = _coerce_hierarchy_count(hierarchy_payload.get("anomaly_count"))
|
|
501
|
-
if anomaly_count == 0:
|
|
502
|
-
anomaly_count = sum(_coerce_hierarchy_count(item.get("count")) for item in bounded_anomalies.values())
|
|
503
|
-
hierarchy_ready = bool(hierarchy_payload.get("hierarchy_ready")) and anomaly_count == 0
|
|
504
|
-
|
|
505
|
-
status = "pass" if hierarchy_ready else "warn"
|
|
506
|
-
warnings_list: list[str] = []
|
|
507
|
-
if status == "warn":
|
|
508
|
-
warnings_list.append("Hierarchy anomalies detected in centralized state metadata.")
|
|
509
|
-
|
|
510
|
-
return {
|
|
511
|
-
"status": status,
|
|
512
|
-
"operation": "doctor_hierarchy_status",
|
|
513
|
-
"project_selector_used": project_selector,
|
|
514
|
-
"sample_limit": sample_limit,
|
|
515
|
-
"hierarchy": {
|
|
516
|
-
"hierarchy_ready": hierarchy_ready,
|
|
517
|
-
"anomaly_count": anomaly_count,
|
|
518
|
-
"department_count": _coerce_hierarchy_count(hierarchy_payload.get("department_count")),
|
|
519
|
-
"project_count": _coerce_hierarchy_count(hierarchy_payload.get("project_count")),
|
|
520
|
-
"bitbucket_project_count": _coerce_hierarchy_count(hierarchy_payload.get("bitbucket_project_count")),
|
|
521
|
-
"repo_count": _coerce_hierarchy_count(hierarchy_payload.get("repo_count")),
|
|
522
|
-
"anomalies": bounded_anomalies,
|
|
523
|
-
},
|
|
524
|
-
"warnings": warnings_list,
|
|
525
|
-
"errors": [],
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
@doctor_app.command(name="hierarchy-status")
|
|
530
|
-
def doctor_hierarchy_status(
|
|
531
|
-
state_dsn: str | None = typer.Option(
|
|
532
|
-
None,
|
|
533
|
-
"--state-dsn",
|
|
534
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
535
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
536
|
-
),
|
|
537
|
-
project: str | None = typer.Option(
|
|
538
|
-
None,
|
|
539
|
-
"--project",
|
|
540
|
-
help="Optional project selector (numeric Confluence page_id or URL containing pageId=<ID>).",
|
|
541
|
-
),
|
|
542
|
-
sample_limit: int = typer.Option(
|
|
543
|
-
5,
|
|
544
|
-
"--sample-limit",
|
|
545
|
-
min=1,
|
|
546
|
-
max=20,
|
|
547
|
-
help="Maximum anomaly samples to return per anomaly type.",
|
|
548
|
-
),
|
|
549
|
-
json_output: bool = typer.Option(False, "--json", help="Emit hierarchy diagnostics as JSON."),
|
|
550
|
-
) -> None:
|
|
551
|
-
"""Summarize hierarchy anomalies using centralized state readiness diagnostics."""
|
|
552
|
-
try:
|
|
553
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
554
|
-
assert resolved_state_dsn is not None
|
|
555
|
-
# FR-268 (AC-268.4): resolve --project through select_project() with junction table
|
|
556
|
-
resolved_project = (
|
|
557
|
-
_resolve_project_key(project_identifier=project, state_dsn=resolved_state_dsn) if project else project
|
|
558
|
-
)
|
|
559
|
-
payload = _collect_hierarchy_status_doctor_payload(
|
|
560
|
-
state_dsn=resolved_state_dsn,
|
|
561
|
-
project=resolved_project,
|
|
562
|
-
sample_limit=sample_limit,
|
|
563
|
-
)
|
|
564
|
-
except Exception as exc:
|
|
565
|
-
payload = {
|
|
566
|
-
"status": "fail",
|
|
567
|
-
"operation": "doctor_hierarchy_status",
|
|
568
|
-
"project_selector_used": str(project or "").strip() or None,
|
|
569
|
-
"sample_limit": sample_limit,
|
|
570
|
-
"hierarchy": None,
|
|
571
|
-
"warnings": [],
|
|
572
|
-
"errors": [str(exc)],
|
|
573
|
-
}
|
|
574
|
-
if _cli_state.get("json_only") or json_output:
|
|
575
|
-
_emit_json(payload)
|
|
576
|
-
else:
|
|
577
|
-
console.print("[red]Hierarchy diagnostics failed.[/red]")
|
|
578
|
-
console.print(f"[red]- {exc}[/red]")
|
|
579
|
-
raise typer.Exit(1) from exc
|
|
580
|
-
|
|
581
|
-
if _cli_state.get("json_only") or json_output:
|
|
582
|
-
_emit_json(payload)
|
|
583
|
-
return
|
|
584
|
-
|
|
585
|
-
hierarchy = payload.get("hierarchy") if isinstance(payload.get("hierarchy"), dict) else {}
|
|
586
|
-
status = str(payload.get("status") or "warn")
|
|
587
|
-
marker = {"pass": "[green]PASS[/green]", "warn": "[yellow]WARN[/yellow]", "fail": "[red]FAIL[/red]"}
|
|
588
|
-
table = Table(title="Hierarchy Status")
|
|
589
|
-
table.add_column("Check")
|
|
590
|
-
table.add_column("Value")
|
|
591
|
-
table.add_row("Status", marker.get(status, status.upper()))
|
|
592
|
-
table.add_row("Hierarchy ready", "yes" if bool(hierarchy.get("hierarchy_ready")) else "no")
|
|
593
|
-
table.add_row("Project selector used", str(payload.get("project_selector_used") or "-"))
|
|
594
|
-
table.add_row("Anomaly count", str(hierarchy.get("anomaly_count", 0)))
|
|
595
|
-
table.add_row("Departments", str(hierarchy.get("department_count", 0)))
|
|
596
|
-
table.add_row("Projects", str(hierarchy.get("project_count", 0)))
|
|
597
|
-
table.add_row("Bitbucket projects", str(hierarchy.get("bitbucket_project_count", 0)))
|
|
598
|
-
table.add_row("Repos", str(hierarchy.get("repo_count", 0)))
|
|
599
|
-
console.print(table)
|
|
600
|
-
|
|
601
|
-
anomalies = hierarchy.get("anomalies") if isinstance(hierarchy.get("anomalies"), dict) else {}
|
|
602
|
-
if anomalies:
|
|
603
|
-
anomalies_table = Table(title="Hierarchy Anomalies")
|
|
604
|
-
anomalies_table.add_column("Type")
|
|
605
|
-
anomalies_table.add_column("Count")
|
|
606
|
-
anomalies_table.add_column("Sample Count")
|
|
607
|
-
for key in sorted(anomalies):
|
|
608
|
-
item = anomalies.get(key)
|
|
609
|
-
if not isinstance(item, dict):
|
|
610
|
-
continue
|
|
611
|
-
anomalies_table.add_row(
|
|
612
|
-
key,
|
|
613
|
-
str(item.get("count", 0)),
|
|
614
|
-
str(item.get("sample_count", 0)),
|
|
615
|
-
)
|
|
616
|
-
console.print(anomalies_table)
|
|
617
|
-
|
|
618
|
-
for warning in payload.get("warnings", []) if isinstance(payload.get("warnings"), list) else []:
|
|
619
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
def _collect_locks_doctor_payload(
|
|
623
|
-
*,
|
|
624
|
-
state_dsn: str,
|
|
625
|
-
stale_threshold_minutes: int,
|
|
626
|
-
) -> dict[str, Any]:
|
|
627
|
-
stale_seconds = max(1, int(stale_threshold_minutes)) * 60
|
|
628
|
-
store = PostgresStateStore(state_dsn)
|
|
629
|
-
try:
|
|
630
|
-
raw_locks = store.list_advisory_locks()
|
|
631
|
-
finally:
|
|
632
|
-
store.close()
|
|
633
|
-
|
|
634
|
-
locks: list[dict[str, Any]] = []
|
|
635
|
-
stale_lock_count = 0
|
|
636
|
-
for entry in raw_locks:
|
|
637
|
-
if not isinstance(entry, dict):
|
|
638
|
-
continue
|
|
639
|
-
idle_seconds = float(entry.get("idle_seconds") or 0.0)
|
|
640
|
-
is_stale = idle_seconds >= stale_seconds
|
|
641
|
-
if is_stale:
|
|
642
|
-
stale_lock_count += 1
|
|
643
|
-
locks.append(
|
|
644
|
-
{
|
|
645
|
-
"pid": int(entry.get("pid") or 0),
|
|
646
|
-
"objid": int(entry.get("objid") or 0),
|
|
647
|
-
"granted": bool(entry.get("granted")),
|
|
648
|
-
"state": str(entry.get("state") or ""),
|
|
649
|
-
"idle_seconds": round(idle_seconds, 3),
|
|
650
|
-
"state_change": entry.get("state_change"),
|
|
651
|
-
"backend_start": entry.get("backend_start"),
|
|
652
|
-
"current_query": str(entry.get("current_query") or ""),
|
|
653
|
-
"stale": is_stale,
|
|
654
|
-
}
|
|
655
|
-
)
|
|
656
|
-
|
|
657
|
-
return {
|
|
658
|
-
"status": "warn" if stale_lock_count > 0 else "pass",
|
|
659
|
-
"operation": "doctor_locks",
|
|
660
|
-
"stale_threshold_minutes": stale_threshold_minutes,
|
|
661
|
-
"lock_count": len(locks),
|
|
662
|
-
"stale_lock_count": stale_lock_count,
|
|
663
|
-
"locks": locks,
|
|
664
|
-
"warnings": ["Stale advisory locks detected."] if stale_lock_count > 0 else [],
|
|
665
|
-
"errors": [],
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
@doctor_app.command(name="locks")
|
|
670
|
-
def doctor_locks(
|
|
671
|
-
state_dsn: str | None = typer.Option(
|
|
672
|
-
None,
|
|
673
|
-
"--state-dsn",
|
|
674
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
675
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
676
|
-
),
|
|
677
|
-
stale_threshold_minutes: int = typer.Option(
|
|
678
|
-
10,
|
|
679
|
-
"--stale-threshold-minutes",
|
|
680
|
-
min=1,
|
|
681
|
-
max=240,
|
|
682
|
-
help="Threshold in minutes to classify advisory locks as stale.",
|
|
683
|
-
),
|
|
684
|
-
json_output: bool = typer.Option(False, "--json", help="Emit lock diagnostics as JSON."),
|
|
685
|
-
) -> None:
|
|
686
|
-
"""Inspect active Postgres advisory locks and stale lock candidates."""
|
|
687
|
-
try:
|
|
688
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
689
|
-
assert resolved_state_dsn is not None
|
|
690
|
-
payload = _collect_locks_doctor_payload(
|
|
691
|
-
state_dsn=resolved_state_dsn,
|
|
692
|
-
stale_threshold_minutes=stale_threshold_minutes,
|
|
693
|
-
)
|
|
694
|
-
except Exception as exc:
|
|
695
|
-
payload = {
|
|
696
|
-
"status": "fail",
|
|
697
|
-
"operation": "doctor_locks",
|
|
698
|
-
"stale_threshold_minutes": stale_threshold_minutes,
|
|
699
|
-
"lock_count": 0,
|
|
700
|
-
"stale_lock_count": 0,
|
|
701
|
-
"locks": [],
|
|
702
|
-
"warnings": [],
|
|
703
|
-
"errors": [str(exc)],
|
|
704
|
-
}
|
|
705
|
-
if _cli_state.get("json_only") or json_output:
|
|
706
|
-
_emit_json(payload)
|
|
707
|
-
else:
|
|
708
|
-
console.print("[red]Lock diagnostics failed.[/red]")
|
|
709
|
-
console.print(f"[red]- {exc}[/red]")
|
|
710
|
-
raise typer.Exit(1) from exc
|
|
711
|
-
|
|
712
|
-
if _cli_state.get("json_only") or json_output:
|
|
713
|
-
_emit_json(payload)
|
|
714
|
-
return
|
|
715
|
-
|
|
716
|
-
status = str(payload.get("status") or "warn")
|
|
717
|
-
marker = {"pass": "[green]PASS[/green]", "warn": "[yellow]WARN[/yellow]", "fail": "[red]FAIL[/red]"}
|
|
718
|
-
table = Table(title="Advisory Locks")
|
|
719
|
-
table.add_column("Check")
|
|
720
|
-
table.add_column("Value")
|
|
721
|
-
table.add_row("Status", marker.get(status, status.upper()))
|
|
722
|
-
table.add_row("Stale threshold (minutes)", str(payload.get("stale_threshold_minutes", 10)))
|
|
723
|
-
table.add_row("Active lock count", str(payload.get("lock_count", 0)))
|
|
724
|
-
table.add_row("Stale lock count", str(payload.get("stale_lock_count", 0)))
|
|
725
|
-
console.print(table)
|
|
726
|
-
|
|
727
|
-
locks = payload.get("locks") if isinstance(payload.get("locks"), list) else []
|
|
728
|
-
if locks:
|
|
729
|
-
locks_table = Table(title="Lock Entries")
|
|
730
|
-
locks_table.add_column("PID")
|
|
731
|
-
locks_table.add_column("ObjID")
|
|
732
|
-
locks_table.add_column("State")
|
|
733
|
-
locks_table.add_column("Idle (s)")
|
|
734
|
-
locks_table.add_column("Granted")
|
|
735
|
-
locks_table.add_column("Stale")
|
|
736
|
-
for entry in locks:
|
|
737
|
-
if not isinstance(entry, dict):
|
|
738
|
-
continue
|
|
739
|
-
locks_table.add_row(
|
|
740
|
-
str(entry.get("pid", 0)),
|
|
741
|
-
str(entry.get("objid", 0)),
|
|
742
|
-
str(entry.get("state", "")),
|
|
743
|
-
str(entry.get("idle_seconds", 0)),
|
|
744
|
-
"yes" if bool(entry.get("granted")) else "no",
|
|
745
|
-
"yes" if bool(entry.get("stale")) else "no",
|
|
746
|
-
)
|
|
747
|
-
console.print(locks_table)
|
|
748
|
-
|
|
749
|
-
for warning in payload.get("warnings", []) if isinstance(payload.get("warnings"), list) else []:
|
|
750
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
def _runtime_log_event_matches(
|
|
754
|
-
entry: dict[str, Any],
|
|
755
|
-
*,
|
|
756
|
-
level: str | None,
|
|
757
|
-
event: str | None,
|
|
758
|
-
audit_id: str | None,
|
|
759
|
-
agent: str | None,
|
|
760
|
-
) -> bool:
|
|
761
|
-
if level and str(entry.get("level", "")).lower() != level.lower():
|
|
762
|
-
return False
|
|
763
|
-
if event and event.lower() not in str(entry.get("event", "")).lower():
|
|
764
|
-
return False
|
|
765
|
-
if audit_id and str(entry.get("audit_id", "")) != audit_id:
|
|
766
|
-
return False
|
|
767
|
-
return not (agent and str(entry.get("agent", "")) != agent)
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
def _emit_runtime_log_event(entry: dict[str, Any], *, json_output: bool) -> None:
|
|
771
|
-
if _cli_state.get("json_only") or json_output:
|
|
772
|
-
typer.echo(json.dumps(entry, ensure_ascii=False))
|
|
773
|
-
return
|
|
774
|
-
timestamp = str(entry.get("timestamp", "-"))
|
|
775
|
-
level = str(entry.get("level", "info")).upper()
|
|
776
|
-
event = str(entry.get("event", "-"))
|
|
777
|
-
audit_id = str(entry.get("audit_id", "-"))
|
|
778
|
-
agent = str(entry.get("agent", "-"))
|
|
779
|
-
phase = str(entry.get("phase", "-"))
|
|
780
|
-
context_parts = [
|
|
781
|
-
f"audit_id={audit_id}",
|
|
782
|
-
f"agent={agent}",
|
|
783
|
-
f"phase={phase}",
|
|
784
|
-
]
|
|
785
|
-
|
|
786
|
-
for key in ("repo", "check_id", "row_id", "task_id"):
|
|
787
|
-
value = entry.get(key)
|
|
788
|
-
if value is None:
|
|
789
|
-
continue
|
|
790
|
-
value_text = str(value).strip()
|
|
791
|
-
if value_text:
|
|
792
|
-
context_parts.append(f"{key}={value_text}")
|
|
793
|
-
|
|
794
|
-
error_context = entry.get("error_context")
|
|
795
|
-
error_code = None
|
|
796
|
-
if isinstance(error_context, dict):
|
|
797
|
-
raw_error_code = error_context.get("audit_error_code")
|
|
798
|
-
if raw_error_code is not None:
|
|
799
|
-
error_code = str(raw_error_code).strip() or None
|
|
800
|
-
if error_code is None:
|
|
801
|
-
raw_error_code = entry.get("audit_error_code")
|
|
802
|
-
if raw_error_code is not None:
|
|
803
|
-
error_code = str(raw_error_code).strip() or None
|
|
804
|
-
if error_code:
|
|
805
|
-
context_parts.append(f"audit_error_code={error_code}")
|
|
806
|
-
|
|
807
|
-
console.print(f"{timestamp} {level:<8} {event} {' '.join(context_parts)}")
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
_CRAWL_STATUS_THROTTLE_EVENT_HINTS: tuple[str, ...] = (
|
|
811
|
-
"throttle",
|
|
812
|
-
"rate_limit",
|
|
813
|
-
"retry",
|
|
814
|
-
"timeout",
|
|
815
|
-
"http_429",
|
|
816
|
-
)
|
|
817
|
-
|
|
818
|
-
_MIGRATION_TELEMETRY_EVENT = "checklist_profile_migration_synthesized"
|
|
819
|
-
_MIGRATION_LEGACY_FIELDS: tuple[str, ...] = (
|
|
820
|
-
"checklist_page_id",
|
|
821
|
-
"checklist_title",
|
|
822
|
-
"checklist_page_url",
|
|
823
|
-
)
|
|
824
|
-
_MIGRATION_PARSE_TIMESTAMP_FIELDS: tuple[str, ...] = (
|
|
825
|
-
"last_parse_registry_at",
|
|
826
|
-
"parse_registry_at",
|
|
827
|
-
"registry_parsed_at",
|
|
828
|
-
"last_registry_parse_at",
|
|
829
|
-
)
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
def _value_present(value: Any) -> bool:
|
|
833
|
-
if value is None:
|
|
834
|
-
return False
|
|
835
|
-
if isinstance(value, str):
|
|
836
|
-
return bool(value.strip())
|
|
837
|
-
if isinstance(value, list | dict | tuple | set):
|
|
838
|
-
return bool(value)
|
|
839
|
-
return True
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
def _extract_parse_registry_timestamp(project_payload: dict[str, Any]) -> str | None:
|
|
843
|
-
for field_name in _MIGRATION_PARSE_TIMESTAMP_FIELDS:
|
|
844
|
-
raw_value = project_payload.get(field_name)
|
|
845
|
-
if _value_present(raw_value):
|
|
846
|
-
return str(raw_value).strip()
|
|
847
|
-
sync_metadata = project_payload.get("sync_metadata")
|
|
848
|
-
if isinstance(sync_metadata, dict):
|
|
849
|
-
for field_name in _MIGRATION_PARSE_TIMESTAMP_FIELDS:
|
|
850
|
-
raw_value = sync_metadata.get(field_name)
|
|
851
|
-
if _value_present(raw_value):
|
|
852
|
-
return str(raw_value).strip()
|
|
853
|
-
return None
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
def _build_migration_project_entry(project_payload: dict[str, Any]) -> dict[str, Any]:
|
|
857
|
-
raw_profiles = project_payload.get("checklist_profiles")
|
|
858
|
-
profile_entries = (
|
|
859
|
-
[item for item in raw_profiles if isinstance(item, dict)] if isinstance(raw_profiles, list) else []
|
|
860
|
-
)
|
|
861
|
-
legacy_field_values = {field_name: project_payload.get(field_name) for field_name in _MIGRATION_LEGACY_FIELDS}
|
|
862
|
-
has_legacy_singular_fields = any(_value_present(value) for value in legacy_field_values.values())
|
|
863
|
-
has_checklist_profiles = len(profile_entries) > 0
|
|
864
|
-
has_project_checklist_page_id = _value_present(project_payload.get("checklist_page_id"))
|
|
865
|
-
return {
|
|
866
|
-
"project_page_id": str(project_payload.get("page_id") or "").strip() or None,
|
|
867
|
-
"project_storage_key": str(project_payload.get("project_storage_key") or "").strip() or None,
|
|
868
|
-
"project_name": str(project_payload.get("project_name") or project_payload.get("project_name_en") or "").strip()
|
|
869
|
-
or None,
|
|
870
|
-
"has_checklist_profiles": has_checklist_profiles,
|
|
871
|
-
"has_project_checklist_page_id": has_project_checklist_page_id,
|
|
872
|
-
"has_legacy_singular_fields": has_legacy_singular_fields,
|
|
873
|
-
"last_parse_registry_at": _extract_parse_registry_timestamp(project_payload),
|
|
874
|
-
"migration_ready": has_checklist_profiles or has_project_checklist_page_id,
|
|
875
|
-
"legacy_field_values": legacy_field_values,
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
def _migration_pending_project_remediation(project_entry: dict[str, Any]) -> list[str]:
|
|
880
|
-
project_selector = str(
|
|
881
|
-
project_entry.get("project_page_id")
|
|
882
|
-
or project_entry.get("project_storage_key")
|
|
883
|
-
or project_entry.get("project_name")
|
|
884
|
-
or "unknown-project"
|
|
885
|
-
)
|
|
886
|
-
return [
|
|
887
|
-
(
|
|
888
|
-
f"Run parse-registry and refresh centralized state for project {project_selector}: "
|
|
889
|
-
"parse-registry -> sync repos -> extract-docs."
|
|
890
|
-
),
|
|
891
|
-
(
|
|
892
|
-
"Populate project checklist_profiles[] in centralized state (profiles with page_ids[]) and rerun "
|
|
893
|
-
"doctor migration-readiness."
|
|
894
|
-
),
|
|
895
|
-
]
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
def _collect_migration_readiness_doctor_payload(
|
|
899
|
-
*,
|
|
900
|
-
state_dsn: str,
|
|
901
|
-
project: str | None,
|
|
902
|
-
) -> dict[str, Any]:
|
|
903
|
-
state_api = _load_state_api(required=True)
|
|
904
|
-
assert state_api is not None
|
|
905
|
-
manifest_payload = _invoke_state_api(
|
|
906
|
-
state_api,
|
|
907
|
-
candidates=("load_manifest_payload",),
|
|
908
|
-
kwargs=_state_connection_kwargs(state_dsn),
|
|
909
|
-
required=True,
|
|
910
|
-
)
|
|
911
|
-
if not isinstance(manifest_payload, dict):
|
|
912
|
-
raise RuntimeError("State manifest payload is invalid (expected JSON object).")
|
|
913
|
-
|
|
914
|
-
raw_projects = manifest_payload.get("projects")
|
|
915
|
-
projects = [entry for entry in raw_projects if isinstance(entry, dict)] if isinstance(raw_projects, list) else []
|
|
916
|
-
if not projects:
|
|
917
|
-
raise RuntimeError("Centralized state payload does not contain project entries.")
|
|
918
|
-
|
|
919
|
-
project_entries = [_build_migration_project_entry(project_payload) for project_payload in projects]
|
|
920
|
-
project_entries.sort(
|
|
921
|
-
key=lambda item: (
|
|
922
|
-
str(item.get("project_page_id") or ""),
|
|
923
|
-
str(item.get("project_storage_key") or ""),
|
|
924
|
-
str(item.get("project_name") or ""),
|
|
925
|
-
)
|
|
926
|
-
)
|
|
927
|
-
|
|
928
|
-
if project:
|
|
929
|
-
selected_entry = next(
|
|
930
|
-
(item for item in project_entries if str(item.get("project_page_id") or "") == project), None
|
|
931
|
-
)
|
|
932
|
-
if selected_entry is None:
|
|
933
|
-
raise RuntimeError(f"Project '{project}' not found in centralized state manifest.")
|
|
934
|
-
is_ready = bool(selected_entry.get("migration_ready"))
|
|
935
|
-
remediation = [] if is_ready else _migration_pending_project_remediation(selected_entry)
|
|
936
|
-
warnings_list: list[str] = []
|
|
937
|
-
if not is_ready:
|
|
938
|
-
warnings_list.append("Project migration is pending: checklist_profiles[] is missing.")
|
|
939
|
-
return {
|
|
940
|
-
"status": "pass" if is_ready else "warn",
|
|
941
|
-
"operation": "doctor_migration_readiness",
|
|
942
|
-
"scope": "project",
|
|
943
|
-
"project_selector_used": project,
|
|
944
|
-
"project": selected_entry,
|
|
945
|
-
"migration_ready": is_ready,
|
|
946
|
-
"remediation": remediation,
|
|
947
|
-
"warnings": warnings_list,
|
|
948
|
-
"errors": [],
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
total_projects = len(project_entries)
|
|
952
|
-
ready_projects = [item for item in project_entries if bool(item.get("migration_ready"))]
|
|
953
|
-
pending_projects = [item for item in project_entries if not bool(item.get("migration_ready"))]
|
|
954
|
-
warnings_list = ["Some projects are still pending checklist profile migration."] if pending_projects else []
|
|
955
|
-
remediation: list[str] = []
|
|
956
|
-
if pending_projects:
|
|
957
|
-
remediation = [
|
|
958
|
-
"Run parse-registry -> sync repos -> extract-docs for pending projects to refresh state metadata.",
|
|
959
|
-
"Ensure each pending project includes checklist_profiles[] with page_ids[] in centralized state.",
|
|
960
|
-
"Re-run doctor migration-readiness until migration_pending_count is zero.",
|
|
961
|
-
]
|
|
962
|
-
return {
|
|
963
|
-
"status": "pass" if not pending_projects else "warn",
|
|
964
|
-
"operation": "doctor_migration_readiness",
|
|
965
|
-
"scope": "aggregate",
|
|
966
|
-
"total_projects": total_projects,
|
|
967
|
-
"migration_ready_count": len(ready_projects),
|
|
968
|
-
"migration_pending_count": len(pending_projects),
|
|
969
|
-
"migration_pending_projects": pending_projects,
|
|
970
|
-
"projects": project_entries,
|
|
971
|
-
"remediation": remediation,
|
|
972
|
-
"warnings": warnings_list,
|
|
973
|
-
"errors": [],
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
@doctor_app.command(name="migration-readiness")
|
|
978
|
-
def doctor_migration_readiness(
|
|
979
|
-
state_dsn: str | None = typer.Option(
|
|
980
|
-
None,
|
|
981
|
-
"--state-dsn",
|
|
982
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
983
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
984
|
-
),
|
|
985
|
-
project: str | None = typer.Option(
|
|
986
|
-
None,
|
|
987
|
-
"--project",
|
|
988
|
-
help="Optional project selector (numeric Confluence page_id or URL containing pageId=<ID>).",
|
|
989
|
-
),
|
|
990
|
-
json_output: bool = typer.Option(False, "--json", help="Emit migration readiness diagnostics as JSON."),
|
|
991
|
-
) -> None:
|
|
992
|
-
"""Report checklist profile migration readiness across centralized state projects."""
|
|
993
|
-
try:
|
|
994
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
995
|
-
assert resolved_state_dsn is not None
|
|
996
|
-
resolved_project = (
|
|
997
|
-
_resolve_project_key(project_identifier=project, state_dsn=resolved_state_dsn) if project else None
|
|
998
|
-
)
|
|
999
|
-
payload = _collect_migration_readiness_doctor_payload(
|
|
1000
|
-
state_dsn=resolved_state_dsn,
|
|
1001
|
-
project=resolved_project,
|
|
1002
|
-
)
|
|
1003
|
-
except Exception as exc:
|
|
1004
|
-
payload = {
|
|
1005
|
-
"status": "fail",
|
|
1006
|
-
"operation": "doctor_migration_readiness",
|
|
1007
|
-
"scope": "project" if project else "aggregate",
|
|
1008
|
-
"project_selector_used": str(project or "").strip() or None,
|
|
1009
|
-
"warnings": [],
|
|
1010
|
-
"errors": [str(exc)],
|
|
1011
|
-
}
|
|
1012
|
-
if _cli_state.get("json_only") or json_output:
|
|
1013
|
-
_emit_json(payload)
|
|
1014
|
-
else:
|
|
1015
|
-
console.print("[red]Migration readiness diagnostics failed.[/red]")
|
|
1016
|
-
console.print(f"[red]- {exc}[/red]")
|
|
1017
|
-
raise typer.Exit(1) from exc
|
|
1018
|
-
|
|
1019
|
-
if _cli_state.get("json_only") or json_output:
|
|
1020
|
-
_emit_json(payload)
|
|
1021
|
-
return
|
|
1022
|
-
|
|
1023
|
-
status = str(payload.get("status") or "warn")
|
|
1024
|
-
marker = {"pass": "[green]PASS[/green]", "warn": "[yellow]WARN[/yellow]", "fail": "[red]FAIL[/red]"}
|
|
1025
|
-
table = Table(title="Migration Readiness")
|
|
1026
|
-
table.add_column("Check")
|
|
1027
|
-
table.add_column("Value")
|
|
1028
|
-
table.add_row("Status", marker.get(status, status.upper()))
|
|
1029
|
-
table.add_row("Scope", str(payload.get("scope") or "aggregate"))
|
|
1030
|
-
if str(payload.get("scope")) == "project":
|
|
1031
|
-
project_payload = payload.get("project") if isinstance(payload.get("project"), dict) else {}
|
|
1032
|
-
table.add_row("Project page_id", str(project_payload.get("project_page_id") or "-"))
|
|
1033
|
-
table.add_row("Project key", str(project_payload.get("project_storage_key") or "-"))
|
|
1034
|
-
table.add_row("Project name", str(project_payload.get("project_name") or "-"))
|
|
1035
|
-
table.add_row("has_checklist_profiles", "yes" if project_payload.get("has_checklist_profiles") else "no")
|
|
1036
|
-
table.add_row(
|
|
1037
|
-
"has_legacy_singular_fields",
|
|
1038
|
-
"yes" if project_payload.get("has_legacy_singular_fields") else "no",
|
|
1039
|
-
)
|
|
1040
|
-
table.add_row(
|
|
1041
|
-
"last_parse_registry_at",
|
|
1042
|
-
str(project_payload.get("last_parse_registry_at") or "-"),
|
|
1043
|
-
)
|
|
1044
|
-
table.add_row("migration_ready", "yes" if project_payload.get("migration_ready") else "no")
|
|
1045
|
-
else:
|
|
1046
|
-
table.add_row("Total projects", str(payload.get("total_projects", 0)))
|
|
1047
|
-
table.add_row("Migration ready", str(payload.get("migration_ready_count", 0)))
|
|
1048
|
-
table.add_row("Migration pending", str(payload.get("migration_pending_count", 0)))
|
|
1049
|
-
console.print(table)
|
|
1050
|
-
|
|
1051
|
-
pending = (
|
|
1052
|
-
payload.get("migration_pending_projects") if isinstance(payload.get("migration_pending_projects"), list) else []
|
|
1053
|
-
)
|
|
1054
|
-
if pending:
|
|
1055
|
-
pending_table = Table(title="Pending Migration Projects")
|
|
1056
|
-
pending_table.add_column("Project page_id")
|
|
1057
|
-
pending_table.add_column("Project key")
|
|
1058
|
-
pending_table.add_column("Project name")
|
|
1059
|
-
pending_table.add_column("Legacy singular fields")
|
|
1060
|
-
for entry in pending:
|
|
1061
|
-
if not isinstance(entry, dict):
|
|
1062
|
-
continue
|
|
1063
|
-
pending_table.add_row(
|
|
1064
|
-
str(entry.get("project_page_id") or "-"),
|
|
1065
|
-
str(entry.get("project_storage_key") or "-"),
|
|
1066
|
-
str(entry.get("project_name") or "-"),
|
|
1067
|
-
"yes" if bool(entry.get("has_legacy_singular_fields")) else "no",
|
|
1068
|
-
)
|
|
1069
|
-
console.print(pending_table)
|
|
1070
|
-
|
|
1071
|
-
for warning in payload.get("warnings", []) if isinstance(payload.get("warnings"), list) else []:
|
|
1072
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
1073
|
-
for remediation_line in payload.get("remediation", []) if isinstance(payload.get("remediation"), list) else []:
|
|
1074
|
-
console.print(f"[cyan]- {remediation_line}[/cyan]")
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
def _parse_optional_since_datetime(since: str | None) -> datetime | None:
|
|
1078
|
-
text = str(since or "").strip()
|
|
1079
|
-
if not text:
|
|
1080
|
-
return None
|
|
1081
|
-
normalized = f"{text[:-1]}+00:00" if text.endswith("Z") else text
|
|
1082
|
-
parsed = datetime.fromisoformat(normalized)
|
|
1083
|
-
if parsed.tzinfo is None:
|
|
1084
|
-
parsed = parsed.replace(tzinfo=UTC)
|
|
1085
|
-
return parsed.astimezone(UTC)
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
def _parse_log_timestamp(value: Any) -> datetime | None:
|
|
1089
|
-
text = str(value or "").strip()
|
|
1090
|
-
if not text:
|
|
1091
|
-
return None
|
|
1092
|
-
normalized = f"{text[:-1]}+00:00" if text.endswith("Z") else text
|
|
1093
|
-
try:
|
|
1094
|
-
parsed = datetime.fromisoformat(normalized)
|
|
1095
|
-
except ValueError:
|
|
1096
|
-
return None
|
|
1097
|
-
if parsed.tzinfo is None:
|
|
1098
|
-
parsed = parsed.replace(tzinfo=UTC)
|
|
1099
|
-
return parsed.astimezone(UTC)
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
def _resolve_project_event_filters(*, project: str | None) -> tuple[str | None, set[str], list[str]]:
|
|
1103
|
-
if not project:
|
|
1104
|
-
return None, set(), []
|
|
1105
|
-
normalized_project = _resolve_project_key(project_identifier=project, state_dsn="")
|
|
1106
|
-
filter_values: set[str] = {normalized_project}
|
|
1107
|
-
warnings_list: list[str] = []
|
|
1108
|
-
resolved_state_dsn = _resolve_state_dsn(None, required=False)
|
|
1109
|
-
if not resolved_state_dsn:
|
|
1110
|
-
warnings_list.append("State DSN not set; telemetry --project filtering uses direct log fields only.")
|
|
1111
|
-
return normalized_project, filter_values, warnings_list
|
|
1112
|
-
|
|
1113
|
-
try:
|
|
1114
|
-
state_api = _load_state_api(required=True)
|
|
1115
|
-
assert state_api is not None
|
|
1116
|
-
manifest_payload = _invoke_state_api(
|
|
1117
|
-
state_api,
|
|
1118
|
-
candidates=("load_manifest_payload",),
|
|
1119
|
-
kwargs=_state_connection_kwargs(resolved_state_dsn),
|
|
1120
|
-
required=True,
|
|
1121
|
-
)
|
|
1122
|
-
if not isinstance(manifest_payload, dict):
|
|
1123
|
-
warnings_list.append("State manifest payload is invalid; project telemetry filter may be incomplete.")
|
|
1124
|
-
return normalized_project, filter_values, warnings_list
|
|
1125
|
-
raw_projects = manifest_payload.get("projects")
|
|
1126
|
-
projects = [item for item in raw_projects if isinstance(item, dict)] if isinstance(raw_projects, list) else []
|
|
1127
|
-
selected_project = next(
|
|
1128
|
-
(item for item in projects if str(item.get("page_id") or "").strip() == normalized_project),
|
|
1129
|
-
None,
|
|
1130
|
-
)
|
|
1131
|
-
if selected_project is None:
|
|
1132
|
-
warnings_list.append(
|
|
1133
|
-
f"Project '{normalized_project}' not found in state manifest for telemetry enrichment."
|
|
1134
|
-
)
|
|
1135
|
-
return normalized_project, filter_values, warnings_list
|
|
1136
|
-
|
|
1137
|
-
for field_name in ("checklist_page_id",):
|
|
1138
|
-
raw_value = selected_project.get(field_name)
|
|
1139
|
-
if _value_present(raw_value):
|
|
1140
|
-
filter_values.add(str(raw_value).strip())
|
|
1141
|
-
raw_profiles = selected_project.get("checklist_profiles")
|
|
1142
|
-
if isinstance(raw_profiles, list):
|
|
1143
|
-
for profile in raw_profiles:
|
|
1144
|
-
if not isinstance(profile, dict):
|
|
1145
|
-
continue
|
|
1146
|
-
raw_page_ids = profile.get("page_ids")
|
|
1147
|
-
if not isinstance(raw_page_ids, list):
|
|
1148
|
-
continue
|
|
1149
|
-
for page_id in raw_page_ids:
|
|
1150
|
-
page_text = str(page_id or "").strip()
|
|
1151
|
-
if page_text:
|
|
1152
|
-
filter_values.add(page_text)
|
|
1153
|
-
except Exception as exc:
|
|
1154
|
-
warnings_list.append(f"State enrichment for telemetry --project filter failed: {exc}")
|
|
1155
|
-
return normalized_project, filter_values, warnings_list
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
def _entry_matches_project_filters(entry: dict[str, Any], *, filter_values: set[str]) -> bool:
|
|
1159
|
-
if not filter_values:
|
|
1160
|
-
return True
|
|
1161
|
-
candidates: set[str] = set()
|
|
1162
|
-
for field_name in ("project_page_id", "project_id", "project", "project_storage_key", "page_id"):
|
|
1163
|
-
raw_value = entry.get(field_name)
|
|
1164
|
-
text = str(raw_value or "").strip()
|
|
1165
|
-
if text:
|
|
1166
|
-
candidates.add(text)
|
|
1167
|
-
raw_page_ids = entry.get("page_ids")
|
|
1168
|
-
if isinstance(raw_page_ids, list):
|
|
1169
|
-
for page_id in raw_page_ids:
|
|
1170
|
-
text = str(page_id or "").strip()
|
|
1171
|
-
if text:
|
|
1172
|
-
candidates.add(text)
|
|
1173
|
-
return len(candidates.intersection(filter_values)) > 0
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
def _collect_migration_telemetry_payload(
|
|
1177
|
-
*,
|
|
1178
|
-
since: datetime | None,
|
|
1179
|
-
project: str | None,
|
|
1180
|
-
) -> dict[str, Any]:
|
|
1181
|
-
normalized_project, filter_values, filter_warnings = _resolve_project_event_filters(project=project)
|
|
1182
|
-
log_dir = get_vds_log_root()
|
|
1183
|
-
log_files = sorted(log_dir.glob("vds-audit-runtime-*.jsonl"))
|
|
1184
|
-
|
|
1185
|
-
parse_errors = 0
|
|
1186
|
-
entries_scanned = 0
|
|
1187
|
-
event_count = 0
|
|
1188
|
-
migration_source_counts: dict[str, int] = {}
|
|
1189
|
-
latest_timestamp: datetime | None = None
|
|
1190
|
-
latest_timestamp_text: str | None = None
|
|
1191
|
-
|
|
1192
|
-
for log_path in log_files:
|
|
1193
|
-
if not log_path.is_file():
|
|
1194
|
-
continue
|
|
1195
|
-
with log_path.open("r", encoding="utf-8") as handle:
|
|
1196
|
-
for raw_line in handle:
|
|
1197
|
-
entries_scanned += 1
|
|
1198
|
-
line = raw_line.strip()
|
|
1199
|
-
if not line:
|
|
1200
|
-
continue
|
|
1201
|
-
try:
|
|
1202
|
-
entry = json.loads(line)
|
|
1203
|
-
except json.JSONDecodeError:
|
|
1204
|
-
parse_errors += 1
|
|
1205
|
-
continue
|
|
1206
|
-
if not isinstance(entry, dict):
|
|
1207
|
-
continue
|
|
1208
|
-
if str(entry.get("event") or "").strip() != _MIGRATION_TELEMETRY_EVENT:
|
|
1209
|
-
continue
|
|
1210
|
-
if not _entry_matches_project_filters(entry, filter_values=filter_values):
|
|
1211
|
-
continue
|
|
1212
|
-
event_timestamp = _parse_log_timestamp(entry.get("timestamp"))
|
|
1213
|
-
if since is not None and (event_timestamp is None or event_timestamp < since):
|
|
1214
|
-
continue
|
|
1215
|
-
event_count += 1
|
|
1216
|
-
source = str(entry.get("migration_source") or "unknown").strip() or "unknown"
|
|
1217
|
-
migration_source_counts[source] = migration_source_counts.get(source, 0) + 1
|
|
1218
|
-
if event_timestamp is not None and (latest_timestamp is None or event_timestamp > latest_timestamp):
|
|
1219
|
-
latest_timestamp = event_timestamp
|
|
1220
|
-
latest_timestamp_text = event_timestamp.isoformat().replace("+00:00", "Z")
|
|
1221
|
-
|
|
1222
|
-
warnings_list = list(filter_warnings)
|
|
1223
|
-
if not log_files:
|
|
1224
|
-
warnings_list.append(f"No runtime logs found under {log_dir}.")
|
|
1225
|
-
if parse_errors > 0:
|
|
1226
|
-
warnings_list.append("Runtime logs contain malformed JSON lines; telemetry uses parsed entries only.")
|
|
1227
|
-
|
|
1228
|
-
safe_to_proceed = event_count == 0
|
|
1229
|
-
advisory = (
|
|
1230
|
-
"Safe to proceed: no checklist profile migration synthesis events detected in selected scope."
|
|
1231
|
-
if safe_to_proceed
|
|
1232
|
-
else (
|
|
1233
|
-
"Migration synthesis events detected. Refresh project state and re-check before removing legacy fallback paths."
|
|
1234
|
-
)
|
|
1235
|
-
)
|
|
1236
|
-
return {
|
|
1237
|
-
"status": "pass" if safe_to_proceed else "warn",
|
|
1238
|
-
"operation": "doctor_migration_telemetry",
|
|
1239
|
-
"project_selector_used": normalized_project,
|
|
1240
|
-
"since": since.isoformat().replace("+00:00", "Z") if since else None,
|
|
1241
|
-
"event_name": _MIGRATION_TELEMETRY_EVENT,
|
|
1242
|
-
"log_dir": str(log_dir),
|
|
1243
|
-
"log_file_count": len(log_files),
|
|
1244
|
-
"entries_scanned": entries_scanned,
|
|
1245
|
-
"parse_errors": parse_errors,
|
|
1246
|
-
"event_count": event_count,
|
|
1247
|
-
"migration_source_counts": migration_source_counts,
|
|
1248
|
-
"latest_timestamp": latest_timestamp_text,
|
|
1249
|
-
"safe_to_proceed": safe_to_proceed,
|
|
1250
|
-
"advisory": advisory,
|
|
1251
|
-
"warnings": warnings_list,
|
|
1252
|
-
"errors": [],
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
@doctor_app.command(name="migration-telemetry")
|
|
1257
|
-
def doctor_migration_telemetry(
|
|
1258
|
-
since: str | None = typer.Option(
|
|
1259
|
-
None,
|
|
1260
|
-
"--since",
|
|
1261
|
-
help="Optional lower bound timestamp (ISO-8601, example: 2026-03-01T00:00:00Z).",
|
|
1262
|
-
),
|
|
1263
|
-
project: str | None = typer.Option(
|
|
1264
|
-
None,
|
|
1265
|
-
"--project",
|
|
1266
|
-
help="Optional project selector (numeric Confluence page_id or URL containing pageId=<ID>).",
|
|
1267
|
-
),
|
|
1268
|
-
json_output: bool = typer.Option(False, "--json", help="Emit migration telemetry diagnostics as JSON."),
|
|
1269
|
-
) -> None:
|
|
1270
|
-
"""Summarize checklist profile migration synthesis telemetry from runtime logs."""
|
|
1271
|
-
try:
|
|
1272
|
-
since_dt = _parse_optional_since_datetime(since)
|
|
1273
|
-
except ValueError as exc:
|
|
1274
|
-
raise typer.BadParameter(
|
|
1275
|
-
"--since must be ISO-8601 (for example: 2026-03-01T00:00:00Z).",
|
|
1276
|
-
param_hint="--since",
|
|
1277
|
-
) from exc
|
|
1278
|
-
|
|
1279
|
-
try:
|
|
1280
|
-
payload = _collect_migration_telemetry_payload(
|
|
1281
|
-
since=since_dt,
|
|
1282
|
-
project=project,
|
|
1283
|
-
)
|
|
1284
|
-
except Exception as exc:
|
|
1285
|
-
payload = {
|
|
1286
|
-
"status": "fail",
|
|
1287
|
-
"operation": "doctor_migration_telemetry",
|
|
1288
|
-
"project_selector_used": str(project or "").strip() or None,
|
|
1289
|
-
"since": str(since or "").strip() or None,
|
|
1290
|
-
"warnings": [],
|
|
1291
|
-
"errors": [str(exc)],
|
|
1292
|
-
}
|
|
1293
|
-
if _cli_state.get("json_only") or json_output:
|
|
1294
|
-
_emit_json(payload)
|
|
1295
|
-
else:
|
|
1296
|
-
console.print("[red]Migration telemetry diagnostics failed.[/red]")
|
|
1297
|
-
console.print(f"[red]- {exc}[/red]")
|
|
1298
|
-
raise typer.Exit(1) from exc
|
|
1299
|
-
|
|
1300
|
-
if _cli_state.get("json_only") or json_output:
|
|
1301
|
-
_emit_json(payload)
|
|
1302
|
-
return
|
|
1303
|
-
|
|
1304
|
-
status = str(payload.get("status") or "warn")
|
|
1305
|
-
marker = {"pass": "[green]PASS[/green]", "warn": "[yellow]WARN[/yellow]", "fail": "[red]FAIL[/red]"}
|
|
1306
|
-
table = Table(title="Migration Telemetry")
|
|
1307
|
-
table.add_column("Check")
|
|
1308
|
-
table.add_column("Value")
|
|
1309
|
-
table.add_row("Status", marker.get(status, status.upper()))
|
|
1310
|
-
table.add_row("Event", str(payload.get("event_name") or _MIGRATION_TELEMETRY_EVENT))
|
|
1311
|
-
table.add_row("Since", str(payload.get("since") or "-"))
|
|
1312
|
-
table.add_row("Project selector", str(payload.get("project_selector_used") or "-"))
|
|
1313
|
-
table.add_row("Runtime log dir", str(payload.get("log_dir") or "-"))
|
|
1314
|
-
table.add_row("Log files", str(payload.get("log_file_count", 0)))
|
|
1315
|
-
table.add_row("Entries scanned", str(payload.get("entries_scanned", 0)))
|
|
1316
|
-
table.add_row("Events detected", str(payload.get("event_count", 0)))
|
|
1317
|
-
table.add_row("Latest event timestamp", str(payload.get("latest_timestamp") or "-"))
|
|
1318
|
-
table.add_row("Safe to proceed", "yes" if payload.get("safe_to_proceed") else "no")
|
|
1319
|
-
console.print(table)
|
|
1320
|
-
|
|
1321
|
-
source_counts = (
|
|
1322
|
-
payload.get("migration_source_counts") if isinstance(payload.get("migration_source_counts"), dict) else {}
|
|
1323
|
-
)
|
|
1324
|
-
if source_counts:
|
|
1325
|
-
source_table = Table(title="Migration Source Breakdown")
|
|
1326
|
-
source_table.add_column("migration_source")
|
|
1327
|
-
source_table.add_column("count")
|
|
1328
|
-
for source in sorted(source_counts):
|
|
1329
|
-
source_table.add_row(source, str(source_counts[source]))
|
|
1330
|
-
console.print(source_table)
|
|
1331
|
-
|
|
1332
|
-
advisory = str(payload.get("advisory") or "").strip()
|
|
1333
|
-
if advisory:
|
|
1334
|
-
console.print(f"[cyan]{advisory}[/cyan]")
|
|
1335
|
-
for warning in payload.get("warnings", []) if isinstance(payload.get("warnings"), list) else []:
|
|
1336
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
def _safe_int(value: Any) -> int:
|
|
1340
|
-
if isinstance(value, bool):
|
|
1341
|
-
return int(value)
|
|
1342
|
-
if isinstance(value, int):
|
|
1343
|
-
return value
|
|
1344
|
-
if isinstance(value, float):
|
|
1345
|
-
return int(value)
|
|
1346
|
-
if isinstance(value, str):
|
|
1347
|
-
text = value.strip()
|
|
1348
|
-
if not text:
|
|
1349
|
-
return 0
|
|
1350
|
-
try:
|
|
1351
|
-
return int(float(text))
|
|
1352
|
-
except ValueError:
|
|
1353
|
-
return 0
|
|
1354
|
-
return 0
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
def _collect_entry_error_total(entries: Any) -> int:
|
|
1358
|
-
if not isinstance(entries, list):
|
|
1359
|
-
return 0
|
|
1360
|
-
total = 0
|
|
1361
|
-
for entry in entries:
|
|
1362
|
-
if not isinstance(entry, dict):
|
|
1363
|
-
continue
|
|
1364
|
-
status = str(entry.get("status") or "").strip().lower()
|
|
1365
|
-
if status in {"error", "failed"}:
|
|
1366
|
-
total += 1
|
|
1367
|
-
return total
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
_PERMISSION_DENIED_PATTERNS = (
|
|
1371
|
-
"403",
|
|
1372
|
-
"forbidden",
|
|
1373
|
-
"unauthorized",
|
|
1374
|
-
"not permitted",
|
|
1375
|
-
"does not have permission",
|
|
1376
|
-
"permission to view",
|
|
1377
|
-
)
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
def _collect_permission_denied_pages(entries: Any) -> list[dict[str, Any]]:
|
|
1381
|
-
"""Extract pages whose error text matches permission-denied patterns (FR-192)."""
|
|
1382
|
-
if not isinstance(entries, list):
|
|
1383
|
-
return []
|
|
1384
|
-
result: list[dict[str, Any]] = []
|
|
1385
|
-
for entry in entries:
|
|
1386
|
-
if not isinstance(entry, dict):
|
|
1387
|
-
continue
|
|
1388
|
-
status = str(entry.get("status") or "").strip().lower()
|
|
1389
|
-
if status not in {"error", "failed"}:
|
|
1390
|
-
continue
|
|
1391
|
-
error_text = str(entry.get("error") or entry.get("error_message") or "").lower()
|
|
1392
|
-
page_id = entry.get("page_id") or entry.get("id") or entry.get("content_id")
|
|
1393
|
-
title = entry.get("title") or entry.get("name") or ""
|
|
1394
|
-
if any(pat in error_text for pat in _PERMISSION_DENIED_PATTERNS):
|
|
1395
|
-
result.append(
|
|
1396
|
-
{
|
|
1397
|
-
"page_id": str(page_id or ""),
|
|
1398
|
-
"title": str(title),
|
|
1399
|
-
"error": str(entry.get("error") or entry.get("error_message") or ""),
|
|
1400
|
-
}
|
|
1401
|
-
)
|
|
1402
|
-
return result
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
def _discover_latest_crawl_manifest(root_dir: Path) -> Path | None:
|
|
1406
|
-
if not root_dir.exists() or not root_dir.is_dir():
|
|
1407
|
-
return None
|
|
1408
|
-
candidates: list[Path] = []
|
|
1409
|
-
for candidate in root_dir.rglob("crawl_manifest.json"):
|
|
1410
|
-
if candidate.is_file():
|
|
1411
|
-
candidates.append(candidate)
|
|
1412
|
-
if not candidates:
|
|
1413
|
-
return None
|
|
1414
|
-
return max(candidates, key=lambda path: path.stat().st_mtime)
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
def _load_json_dict(path: Path) -> dict[str, Any]:
|
|
1418
|
-
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
1419
|
-
if not isinstance(payload, dict):
|
|
1420
|
-
raise ValueError(f"Expected JSON object in {path}")
|
|
1421
|
-
return payload
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
def _runtime_entry_has_throttle_signal(entry: dict[str, Any]) -> bool:
|
|
1425
|
-
event = str(entry.get("event") or "").strip().lower()
|
|
1426
|
-
if any(token in event for token in _CRAWL_STATUS_THROTTLE_EVENT_HINTS):
|
|
1427
|
-
return True
|
|
1428
|
-
if entry.get("rate_limited") is True:
|
|
1429
|
-
return True
|
|
1430
|
-
status_code = entry.get("status_code")
|
|
1431
|
-
if _safe_int(status_code) == 429:
|
|
1432
|
-
return True
|
|
1433
|
-
reason = str(entry.get("reason") or "").strip().lower()
|
|
1434
|
-
return reason in {"http_429", "timeout"}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
def _summarize_runtime_logs_for_crawl_status(*, log_file: Path, tail: int) -> dict[str, Any]:
|
|
1438
|
-
payload: dict[str, Any] = {
|
|
1439
|
-
"log_file": str(log_file),
|
|
1440
|
-
"exists": log_file.exists(),
|
|
1441
|
-
"entries_scanned": 0,
|
|
1442
|
-
"entries_considered": 0,
|
|
1443
|
-
"parse_errors": 0,
|
|
1444
|
-
"warning_total": 0,
|
|
1445
|
-
"error_total": 0,
|
|
1446
|
-
"throttle_total": 0,
|
|
1447
|
-
}
|
|
1448
|
-
if not log_file.exists():
|
|
1449
|
-
return payload
|
|
1450
|
-
|
|
1451
|
-
recent_entries: deque[dict[str, Any]] = deque(maxlen=max(1, tail))
|
|
1452
|
-
with log_file.open("r", encoding="utf-8") as handle:
|
|
1453
|
-
for raw_line in handle:
|
|
1454
|
-
payload["entries_scanned"] = int(payload["entries_scanned"]) + 1
|
|
1455
|
-
line = raw_line.strip()
|
|
1456
|
-
if not line:
|
|
1457
|
-
continue
|
|
1458
|
-
try:
|
|
1459
|
-
entry = json.loads(line)
|
|
1460
|
-
except json.JSONDecodeError:
|
|
1461
|
-
payload["parse_errors"] = int(payload["parse_errors"]) + 1
|
|
1462
|
-
continue
|
|
1463
|
-
if isinstance(entry, dict):
|
|
1464
|
-
recent_entries.append(entry)
|
|
1465
|
-
|
|
1466
|
-
payload["entries_considered"] = len(recent_entries)
|
|
1467
|
-
for entry in recent_entries:
|
|
1468
|
-
level = str(entry.get("level") or "").strip().lower()
|
|
1469
|
-
if level == "warning":
|
|
1470
|
-
payload["warning_total"] = int(payload["warning_total"]) + 1
|
|
1471
|
-
if level in {"error", "critical"}:
|
|
1472
|
-
payload["error_total"] = int(payload["error_total"]) + 1
|
|
1473
|
-
if _runtime_entry_has_throttle_signal(entry):
|
|
1474
|
-
payload["throttle_total"] = int(payload["throttle_total"]) + 1
|
|
1475
|
-
return payload
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
def _collect_crawl_manifest_status(*, manifest_payload: dict[str, Any], manifest_path: Path) -> dict[str, Any]:
|
|
1479
|
-
crawl_section = manifest_payload.get("crawl")
|
|
1480
|
-
if isinstance(crawl_section, dict):
|
|
1481
|
-
resume_state = crawl_section.get("resume_state") if isinstance(crawl_section.get("resume_state"), dict) else {}
|
|
1482
|
-
crawl_mode = crawl_section.get("crawl_mode") if isinstance(crawl_section.get("crawl_mode"), dict) else {}
|
|
1483
|
-
if not crawl_mode:
|
|
1484
|
-
crawl_mode = {
|
|
1485
|
-
"page_concurrency": crawl_section.get("page_concurrency") or crawl_section.get("crawl_concurrency"),
|
|
1486
|
-
"staged_mode": crawl_section.get("staged_mode") or crawl_section.get("staged_crawl_mode"),
|
|
1487
|
-
}
|
|
1488
|
-
if not resume_state:
|
|
1489
|
-
resume_state = {
|
|
1490
|
-
"nodes_processed": crawl_section.get("nodes_processed"),
|
|
1491
|
-
"pending_queue_size": crawl_section.get("pending_queue_size"),
|
|
1492
|
-
"skipped_unchanged": crawl_section.get("skipped_unchanged"),
|
|
1493
|
-
"skipped_already_visited": crawl_section.get("skipped_already_visited"),
|
|
1494
|
-
"completed": crawl_section.get("completed"),
|
|
1495
|
-
"termination_reason": crawl_section.get("termination_reason"),
|
|
1496
|
-
}
|
|
1497
|
-
child_pages = (
|
|
1498
|
-
manifest_payload.get("child_pages") if isinstance(manifest_payload.get("child_pages"), list) else []
|
|
1499
|
-
)
|
|
1500
|
-
attachments = (
|
|
1501
|
-
manifest_payload.get("attachments") if isinstance(manifest_payload.get("attachments"), list) else []
|
|
1502
|
-
)
|
|
1503
|
-
root_page = manifest_payload.get("page") if isinstance(manifest_payload.get("page"), dict) else {}
|
|
1504
|
-
root_page_id = (
|
|
1505
|
-
str(
|
|
1506
|
-
root_page.get("page_id")
|
|
1507
|
-
or manifest_payload.get("page_id")
|
|
1508
|
-
or manifest_payload.get("root_page_id")
|
|
1509
|
-
or ""
|
|
1510
|
-
).strip()
|
|
1511
|
-
or None
|
|
1512
|
-
)
|
|
1513
|
-
generated_at = manifest_payload.get("generated_at")
|
|
1514
|
-
else:
|
|
1515
|
-
resume_state = (
|
|
1516
|
-
manifest_payload.get("resume_state") if isinstance(manifest_payload.get("resume_state"), dict) else {}
|
|
1517
|
-
)
|
|
1518
|
-
crawl_mode = manifest_payload.get("crawl_mode") if isinstance(manifest_payload.get("crawl_mode"), dict) else {}
|
|
1519
|
-
child_pages = (
|
|
1520
|
-
manifest_payload.get("child_pages") if isinstance(manifest_payload.get("child_pages"), list) else []
|
|
1521
|
-
)
|
|
1522
|
-
attachments = (
|
|
1523
|
-
manifest_payload.get("attachments") if isinstance(manifest_payload.get("attachments"), list) else []
|
|
1524
|
-
)
|
|
1525
|
-
root_page = manifest_payload.get("page") if isinstance(manifest_payload.get("page"), dict) else {}
|
|
1526
|
-
root_page_id = str(manifest_payload.get("root_page_id") or root_page.get("page_id") or "").strip() or None
|
|
1527
|
-
generated_at = manifest_payload.get("generated_at")
|
|
1528
|
-
|
|
1529
|
-
root_status = str(root_page.get("status") or "").strip().lower()
|
|
1530
|
-
page_error_total = 1 if root_status in {"error", "failed"} else 0
|
|
1531
|
-
child_error_total = _collect_entry_error_total(child_pages)
|
|
1532
|
-
attachment_error_total = _collect_entry_error_total(attachments)
|
|
1533
|
-
permission_denied_pages = _collect_permission_denied_pages(child_pages)
|
|
1534
|
-
return {
|
|
1535
|
-
"manifest_path": str(manifest_path),
|
|
1536
|
-
"root_page_id": root_page_id,
|
|
1537
|
-
"generated_at": generated_at,
|
|
1538
|
-
"crawl_mode": {
|
|
1539
|
-
"page_concurrency": crawl_mode.get("page_concurrency"),
|
|
1540
|
-
"staged_mode": crawl_mode.get("staged_mode"),
|
|
1541
|
-
},
|
|
1542
|
-
"progress": {
|
|
1543
|
-
"nodes_processed": _safe_int(resume_state.get("nodes_processed")),
|
|
1544
|
-
"pending_queue_size": _safe_int(resume_state.get("pending_queue_size")),
|
|
1545
|
-
"skipped_unchanged": _safe_int(resume_state.get("skipped_unchanged")),
|
|
1546
|
-
"skipped_already_visited": _safe_int(resume_state.get("skipped_already_visited")),
|
|
1547
|
-
"completed": bool(resume_state.get("completed")) if "completed" in resume_state else None,
|
|
1548
|
-
"termination_reason": resume_state.get("termination_reason"),
|
|
1549
|
-
"child_pages_total": len(child_pages),
|
|
1550
|
-
"attachments_total": len(attachments),
|
|
1551
|
-
},
|
|
1552
|
-
"errors": {
|
|
1553
|
-
"page_error_total": page_error_total,
|
|
1554
|
-
"child_page_error_total": child_error_total,
|
|
1555
|
-
"attachment_error_total": attachment_error_total,
|
|
1556
|
-
"total": page_error_total + child_error_total + attachment_error_total,
|
|
1557
|
-
},
|
|
1558
|
-
"permission_denied_pages": permission_denied_pages,
|
|
1559
|
-
"permission_denied_count": len(permission_denied_pages),
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
_CORRELATION_SINCE_PATTERN = re.compile(r"^(?P<value>\d+)(?P<unit>[smhdw])$", re.IGNORECASE)
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
def _format_shell_command(command: list[str]) -> str:
|
|
1567
|
-
return " ".join(shlex.quote(part) for part in command)
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
def _resolve_correlation_window(*, since: str) -> tuple[str, str]:
|
|
1571
|
-
raw_since = since.strip()
|
|
1572
|
-
match = _CORRELATION_SINCE_PATTERN.fullmatch(raw_since)
|
|
1573
|
-
if not match:
|
|
1574
|
-
raise ValueError("--since must use <number><unit> where unit is one of: s, m, h, d, w.")
|
|
1575
|
-
|
|
1576
|
-
value = int(match.group("value"))
|
|
1577
|
-
unit = match.group("unit").lower()
|
|
1578
|
-
multiplier = {
|
|
1579
|
-
"s": 1,
|
|
1580
|
-
"m": 60,
|
|
1581
|
-
"h": 3600,
|
|
1582
|
-
"d": 86400,
|
|
1583
|
-
"w": 604800,
|
|
1584
|
-
}[unit]
|
|
1585
|
-
window_seconds = value * multiplier
|
|
1586
|
-
|
|
1587
|
-
end_ts = datetime.now(UTC).replace(microsecond=0)
|
|
1588
|
-
start_ts = (end_ts - timedelta(seconds=window_seconds)).replace(microsecond=0)
|
|
1589
|
-
return (
|
|
1590
|
-
start_ts.isoformat().replace("+00:00", "Z"),
|
|
1591
|
-
end_ts.isoformat().replace("+00:00", "Z"),
|
|
1592
|
-
)
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
def _quote_query_value(value: str) -> str:
|
|
1596
|
-
escaped = value.replace("\\", "\\\\").replace('"', '\\"')
|
|
1597
|
-
return f'"{escaped}"'
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
def _build_grafana_correlation_query(*, service: str | None, audit_id: str | None) -> str:
|
|
1601
|
-
clauses = ["(severity_text:ERROR OR severity_text:FATAL OR severity_text:CRITICAL)"]
|
|
1602
|
-
service_token = (service or "").strip()
|
|
1603
|
-
audit_token = (audit_id or "").strip()
|
|
1604
|
-
if service_token:
|
|
1605
|
-
quoted = _quote_query_value(service_token)
|
|
1606
|
-
clauses.insert(0, f"(service_name:{quoted} OR service.name:{quoted})")
|
|
1607
|
-
if audit_token:
|
|
1608
|
-
quoted = _quote_query_value(audit_token)
|
|
1609
|
-
clauses.append(f"(audit_id:{quoted} OR request_id:{quoted} OR trace_id:{quoted})")
|
|
1610
|
-
return " AND ".join(clauses)
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
def _build_elastic_correlation_query(*, service: str | None, audit_id: str | None) -> str:
|
|
1614
|
-
clauses = ["(level:ERROR OR log.level:ERROR OR severity_text:ERROR)"]
|
|
1615
|
-
service_token = (service or "").strip()
|
|
1616
|
-
audit_token = (audit_id or "").strip()
|
|
1617
|
-
if service_token:
|
|
1618
|
-
quoted = _quote_query_value(service_token)
|
|
1619
|
-
clauses.insert(0, f"(service_name:{quoted} OR service.name:{quoted})")
|
|
1620
|
-
if audit_token:
|
|
1621
|
-
quoted = _quote_query_value(audit_token)
|
|
1622
|
-
clauses.append(f"(audit_id:{quoted} OR request_id:{quoted} OR trace_id:{quoted} OR trace.id:{quoted})")
|
|
1623
|
-
return " AND ".join(clauses)
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
def _collect_external_observability_status() -> dict[str, Any]:
|
|
1627
|
-
load_shared_env()
|
|
1628
|
-
has_grafana_url = bool((os.getenv("VDS_GRAFANA_URL") or "").strip())
|
|
1629
|
-
has_grafana_user = bool((os.getenv("VDS_GRAFANA_USER") or "").strip())
|
|
1630
|
-
has_grafana_password = bool((os.getenv("VDS_GRAFANA_PASSWORD") or "").strip())
|
|
1631
|
-
has_grafana_token = bool((os.getenv("VDS_GRAFANA_TOKEN") or "").strip())
|
|
1632
|
-
grafana_auth_ready = has_grafana_token or (has_grafana_user and has_grafana_password)
|
|
1633
|
-
grafana_ready = has_grafana_url and grafana_auth_ready
|
|
1634
|
-
|
|
1635
|
-
has_elastic_kibana_url = bool((os.getenv("VDS_ELASTIC_KIBANA_URL") or "").strip())
|
|
1636
|
-
has_elastic_kibana_ip = bool((os.getenv("VDS_ELASTIC_KIBANA_IP") or "").strip())
|
|
1637
|
-
has_elastic_user = bool((os.getenv("VDS_ELASTIC_USER") or "").strip())
|
|
1638
|
-
has_elastic_password = bool((os.getenv("VDS_ELASTIC_PASSWORD") or "").strip())
|
|
1639
|
-
elastic_ready = has_elastic_kibana_url and has_elastic_kibana_ip and has_elastic_user and has_elastic_password
|
|
1640
|
-
|
|
1641
|
-
return {
|
|
1642
|
-
"env_path": _PRIMARY_SHARED_ENV_PATH,
|
|
1643
|
-
"grafana": {
|
|
1644
|
-
"url_set": has_grafana_url,
|
|
1645
|
-
"user_set": has_grafana_user,
|
|
1646
|
-
"password_set": has_grafana_password,
|
|
1647
|
-
"token_set": has_grafana_token,
|
|
1648
|
-
"auth_ready": grafana_auth_ready,
|
|
1649
|
-
"ready": grafana_ready,
|
|
1650
|
-
},
|
|
1651
|
-
"elastic": {
|
|
1652
|
-
"kibana_url_set": has_elastic_kibana_url,
|
|
1653
|
-
"kibana_ip_set": has_elastic_kibana_ip,
|
|
1654
|
-
"user_set": has_elastic_user,
|
|
1655
|
-
"password_set": has_elastic_password,
|
|
1656
|
-
"ready": elastic_ready,
|
|
1657
|
-
},
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
def _build_correlation_command_templates(
|
|
1662
|
-
*,
|
|
1663
|
-
runtime_log_file: Path,
|
|
1664
|
-
since: str,
|
|
1665
|
-
service: str | None,
|
|
1666
|
-
audit_id: str | None,
|
|
1667
|
-
grafana_index: str | None,
|
|
1668
|
-
elastic_index: str,
|
|
1669
|
-
limit: int,
|
|
1670
|
-
tail: int,
|
|
1671
|
-
start_iso: str,
|
|
1672
|
-
end_iso: str,
|
|
1673
|
-
) -> dict[str, str]:
|
|
1674
|
-
runtime_command = [
|
|
1675
|
-
"uv",
|
|
1676
|
-
"run",
|
|
1677
|
-
"--project",
|
|
1678
|
-
str(_VDS_CLI_PROJECT_DIR),
|
|
1679
|
-
"vds-cli",
|
|
1680
|
-
"audit",
|
|
1681
|
-
"--json-only",
|
|
1682
|
-
"doctor",
|
|
1683
|
-
"logs-follow",
|
|
1684
|
-
"--log-file",
|
|
1685
|
-
str(runtime_log_file),
|
|
1686
|
-
"--no-follow",
|
|
1687
|
-
"--tail",
|
|
1688
|
-
str(tail),
|
|
1689
|
-
"--json",
|
|
1690
|
-
]
|
|
1691
|
-
|
|
1692
|
-
grafana_query = _build_grafana_correlation_query(service=service, audit_id=audit_id)
|
|
1693
|
-
grafana_command = [
|
|
1694
|
-
"uv",
|
|
1695
|
-
"run",
|
|
1696
|
-
"--project",
|
|
1697
|
-
str(_VDS_CLI_PROJECT_DIR),
|
|
1698
|
-
"vds-cli",
|
|
1699
|
-
"grafana",
|
|
1700
|
-
"--json-only",
|
|
1701
|
-
"search",
|
|
1702
|
-
"--query",
|
|
1703
|
-
grafana_query,
|
|
1704
|
-
"--since",
|
|
1705
|
-
since,
|
|
1706
|
-
"--limit",
|
|
1707
|
-
str(limit),
|
|
1708
|
-
]
|
|
1709
|
-
if grafana_index:
|
|
1710
|
-
grafana_command.extend(["--index", grafana_index])
|
|
1711
|
-
|
|
1712
|
-
elastic_query = _build_elastic_correlation_query(service=service, audit_id=audit_id)
|
|
1713
|
-
elastic_command = [
|
|
1714
|
-
"uv",
|
|
1715
|
-
"run",
|
|
1716
|
-
"--project",
|
|
1717
|
-
str(_VDS_CLI_PROJECT_DIR),
|
|
1718
|
-
"vds-cli",
|
|
1719
|
-
"elastic",
|
|
1720
|
-
"--json-only",
|
|
1721
|
-
"search",
|
|
1722
|
-
"--index",
|
|
1723
|
-
elastic_index,
|
|
1724
|
-
"--qs",
|
|
1725
|
-
elastic_query,
|
|
1726
|
-
"--start",
|
|
1727
|
-
start_iso,
|
|
1728
|
-
"--end",
|
|
1729
|
-
end_iso,
|
|
1730
|
-
"--size",
|
|
1731
|
-
str(limit),
|
|
1732
|
-
"--sort",
|
|
1733
|
-
"@timestamp:desc",
|
|
1734
|
-
]
|
|
1735
|
-
|
|
1736
|
-
return {
|
|
1737
|
-
"runtime_log_command": _format_shell_command(runtime_command),
|
|
1738
|
-
"grafana_correlation_command": _format_shell_command(grafana_command),
|
|
1739
|
-
"elastic_correlation_command": _format_shell_command(elastic_command),
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
def _run_external_json_command(*, command: list[str], timeout_seconds: float) -> dict[str, Any]:
|
|
1744
|
-
rendered_command = _format_shell_command(command)
|
|
1745
|
-
try:
|
|
1746
|
-
result = subprocess.run(
|
|
1747
|
-
command,
|
|
1748
|
-
capture_output=True,
|
|
1749
|
-
text=True,
|
|
1750
|
-
check=False,
|
|
1751
|
-
timeout=timeout_seconds,
|
|
1752
|
-
)
|
|
1753
|
-
except Exception as exc:
|
|
1754
|
-
return {
|
|
1755
|
-
"command": rendered_command,
|
|
1756
|
-
"exit_code": None,
|
|
1757
|
-
"ok": False,
|
|
1758
|
-
"error": str(exc),
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
payload: dict[str, Any] = {
|
|
1762
|
-
"command": rendered_command,
|
|
1763
|
-
"exit_code": result.returncode,
|
|
1764
|
-
"ok": result.returncode == 0,
|
|
1765
|
-
}
|
|
1766
|
-
stdout_text = result.stdout.strip()
|
|
1767
|
-
stderr_text = result.stderr.strip()
|
|
1768
|
-
if stdout_text:
|
|
1769
|
-
payload["stdout"] = stdout_text
|
|
1770
|
-
try:
|
|
1771
|
-
payload["json"] = json.loads(stdout_text)
|
|
1772
|
-
except json.JSONDecodeError:
|
|
1773
|
-
payload["json_parse_error"] = "stdout is not valid JSON"
|
|
1774
|
-
if stderr_text:
|
|
1775
|
-
payload["stderr"] = stderr_text
|
|
1776
|
-
return payload
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
@doctor_app.command(name="correlation")
|
|
1780
|
-
def doctor_correlation(
|
|
1781
|
-
since: str = typer.Option(
|
|
1782
|
-
"30m",
|
|
1783
|
-
"--since",
|
|
1784
|
-
help="Correlation lookback window (<number><unit>, units: s|m|h|d|w).",
|
|
1785
|
-
),
|
|
1786
|
-
service: str | None = typer.Option(
|
|
1787
|
-
None,
|
|
1788
|
-
"--service",
|
|
1789
|
-
help="Optional service selector for generated Grafana/Elastic queries.",
|
|
1790
|
-
),
|
|
1791
|
-
audit_id: str | None = typer.Option(
|
|
1792
|
-
None,
|
|
1793
|
-
"--audit-id",
|
|
1794
|
-
help="Optional audit/request correlation token for generated queries.",
|
|
1795
|
-
),
|
|
1796
|
-
grafana_index: str | None = typer.Option(
|
|
1797
|
-
None,
|
|
1798
|
-
"--grafana-index",
|
|
1799
|
-
help="Optional Quickwit index override for generated Grafana command.",
|
|
1800
|
-
),
|
|
1801
|
-
elastic_index: str = typer.Option(
|
|
1802
|
-
"*",
|
|
1803
|
-
"--elastic-index",
|
|
1804
|
-
help="Elasticsearch index pattern for generated Elastic command.",
|
|
1805
|
-
),
|
|
1806
|
-
tail: int = typer.Option(
|
|
1807
|
-
200,
|
|
1808
|
-
"--tail",
|
|
1809
|
-
min=1,
|
|
1810
|
-
help="Tail size for runtime-log capture template.",
|
|
1811
|
-
),
|
|
1812
|
-
limit: int = typer.Option(
|
|
1813
|
-
200,
|
|
1814
|
-
"--limit",
|
|
1815
|
-
min=1,
|
|
1816
|
-
max=1000,
|
|
1817
|
-
help="Result size for generated Grafana/Elastic commands.",
|
|
1818
|
-
),
|
|
1819
|
-
log_file: Path | None = typer.Option(
|
|
1820
|
-
None,
|
|
1821
|
-
"--log-file",
|
|
1822
|
-
envvar="VDS_AUDIT_RUNTIME_LOG_FILE",
|
|
1823
|
-
help="Runtime JSONL log file (default: effective VDS log root / vds-audit-runtime-YYYYMMDD.jsonl).",
|
|
1824
|
-
),
|
|
1825
|
-
run_health: bool = typer.Option(
|
|
1826
|
-
False,
|
|
1827
|
-
"--run-health/--no-run-health",
|
|
1828
|
-
help="Execute vds-grafana health and vds-elastic ping preflight checks.",
|
|
1829
|
-
),
|
|
1830
|
-
timeout_seconds: float = typer.Option(
|
|
1831
|
-
20.0,
|
|
1832
|
-
"--timeout-seconds",
|
|
1833
|
-
min=1.0,
|
|
1834
|
-
help="Timeout for each external health command.",
|
|
1835
|
-
),
|
|
1836
|
-
) -> None:
|
|
1837
|
-
"""Build deterministic Grafana/Elastic correlation runbook commands for one audit run."""
|
|
1838
|
-
try:
|
|
1839
|
-
start_iso, end_iso = _resolve_correlation_window(since=since)
|
|
1840
|
-
except ValueError as exc:
|
|
1841
|
-
raise typer.BadParameter(str(exc), param_hint="--since") from exc
|
|
1842
|
-
|
|
1843
|
-
runtime_log_file = _resolve_runtime_log_file(realtime_logs=True, log_file=log_file)
|
|
1844
|
-
assert runtime_log_file is not None
|
|
1845
|
-
|
|
1846
|
-
credentials_status = _collect_credentials_status()
|
|
1847
|
-
external_status = _collect_external_observability_status()
|
|
1848
|
-
commands = _build_correlation_command_templates(
|
|
1849
|
-
runtime_log_file=runtime_log_file,
|
|
1850
|
-
since=since,
|
|
1851
|
-
service=service,
|
|
1852
|
-
audit_id=audit_id,
|
|
1853
|
-
grafana_index=grafana_index,
|
|
1854
|
-
elastic_index=elastic_index,
|
|
1855
|
-
limit=limit,
|
|
1856
|
-
tail=tail,
|
|
1857
|
-
start_iso=start_iso,
|
|
1858
|
-
end_iso=end_iso,
|
|
1859
|
-
)
|
|
1860
|
-
|
|
1861
|
-
errors: list[str] = []
|
|
1862
|
-
shared_env_path = get_shared_env_path()
|
|
1863
|
-
if not bool(external_status["grafana"]["ready"]):
|
|
1864
|
-
errors.append(f"Grafana correlation env is not ready (check VDS_GRAFANA_* in {shared_env_path}).")
|
|
1865
|
-
if not bool(external_status["elastic"]["ready"]):
|
|
1866
|
-
errors.append(f"Elastic correlation env is not ready (check VDS_ELASTIC_* in {shared_env_path}).")
|
|
1867
|
-
|
|
1868
|
-
health_checks: dict[str, Any] = {}
|
|
1869
|
-
if run_health:
|
|
1870
|
-
grafana_health = _run_external_json_command(
|
|
1871
|
-
command=[
|
|
1872
|
-
"uv",
|
|
1873
|
-
"run",
|
|
1874
|
-
"--project",
|
|
1875
|
-
str(_VDS_CLI_PROJECT_DIR),
|
|
1876
|
-
"vds-cli",
|
|
1877
|
-
"grafana",
|
|
1878
|
-
"--json-only",
|
|
1879
|
-
"health",
|
|
1880
|
-
],
|
|
1881
|
-
timeout_seconds=timeout_seconds,
|
|
1882
|
-
)
|
|
1883
|
-
grafana_json = grafana_health.get("json")
|
|
1884
|
-
grafana_ok = bool(grafana_health.get("ok"))
|
|
1885
|
-
if isinstance(grafana_json, dict):
|
|
1886
|
-
grafana_ok = grafana_ok and bool(grafana_json.get("grafana_ok")) and bool(grafana_json.get("datasource_ok"))
|
|
1887
|
-
grafana_health["ok"] = grafana_ok
|
|
1888
|
-
health_checks["grafana_health"] = grafana_health
|
|
1889
|
-
if not grafana_ok:
|
|
1890
|
-
errors.append("Grafana health check failed.")
|
|
1891
|
-
|
|
1892
|
-
elastic_ping = _run_external_json_command(
|
|
1893
|
-
command=[
|
|
1894
|
-
"uv",
|
|
1895
|
-
"run",
|
|
1896
|
-
"--project",
|
|
1897
|
-
str(_VDS_CLI_PROJECT_DIR),
|
|
1898
|
-
"vds-cli",
|
|
1899
|
-
"elastic",
|
|
1900
|
-
"--json-only",
|
|
1901
|
-
"ping",
|
|
1902
|
-
],
|
|
1903
|
-
timeout_seconds=timeout_seconds,
|
|
1904
|
-
)
|
|
1905
|
-
elastic_json = elastic_ping.get("json")
|
|
1906
|
-
elastic_ok = bool(elastic_ping.get("ok"))
|
|
1907
|
-
if isinstance(elastic_json, dict):
|
|
1908
|
-
elastic_ok = elastic_ok and bool(elastic_json.get("success"))
|
|
1909
|
-
elastic_ping["ok"] = elastic_ok
|
|
1910
|
-
health_checks["elastic_ping"] = elastic_ping
|
|
1911
|
-
if not elastic_ok:
|
|
1912
|
-
errors.append("Elastic ping check failed.")
|
|
1913
|
-
|
|
1914
|
-
payload: dict[str, Any] = {
|
|
1915
|
-
"status": "ok" if not errors else "error",
|
|
1916
|
-
"operation": "doctor_correlation",
|
|
1917
|
-
"env_path": credentials_status.get("env_path"),
|
|
1918
|
-
"inputs": {
|
|
1919
|
-
"since": since,
|
|
1920
|
-
"service": service,
|
|
1921
|
-
"audit_id": audit_id,
|
|
1922
|
-
"grafana_index": grafana_index,
|
|
1923
|
-
"elastic_index": elastic_index,
|
|
1924
|
-
"tail": tail,
|
|
1925
|
-
"limit": limit,
|
|
1926
|
-
"runtime_log_file": str(runtime_log_file),
|
|
1927
|
-
"run_health": run_health,
|
|
1928
|
-
},
|
|
1929
|
-
"time_window": {
|
|
1930
|
-
"start": start_iso,
|
|
1931
|
-
"end": end_iso,
|
|
1932
|
-
},
|
|
1933
|
-
"checks": {
|
|
1934
|
-
"runtime_log_exists": runtime_log_file.exists(),
|
|
1935
|
-
"grafana_env": external_status["grafana"],
|
|
1936
|
-
"elastic_env": external_status["elastic"],
|
|
1937
|
-
},
|
|
1938
|
-
"commands": commands,
|
|
1939
|
-
"errors": errors,
|
|
1940
|
-
}
|
|
1941
|
-
if run_health:
|
|
1942
|
-
payload["health_checks"] = health_checks
|
|
1943
|
-
|
|
1944
|
-
if _cli_state.get("json_only"):
|
|
1945
|
-
_emit_json(payload)
|
|
1946
|
-
if errors:
|
|
1947
|
-
raise typer.Exit(1)
|
|
1948
|
-
return
|
|
1949
|
-
|
|
1950
|
-
table = Table(title="Correlation Doctor")
|
|
1951
|
-
table.add_column("Check")
|
|
1952
|
-
table.add_column("Value")
|
|
1953
|
-
table.add_row("Env path", str(payload["env_path"]))
|
|
1954
|
-
table.add_row("Runtime log file", str(runtime_log_file))
|
|
1955
|
-
table.add_row("Runtime log exists", "yes" if payload["checks"]["runtime_log_exists"] else "no")
|
|
1956
|
-
table.add_row("Grafana env ready", "yes" if payload["checks"]["grafana_env"]["ready"] else "no")
|
|
1957
|
-
table.add_row("Elastic env ready", "yes" if payload["checks"]["elastic_env"]["ready"] else "no")
|
|
1958
|
-
table.add_row("Window start", start_iso)
|
|
1959
|
-
table.add_row("Window end", end_iso)
|
|
1960
|
-
console.print(table)
|
|
1961
|
-
|
|
1962
|
-
console.print("\n[bold]Correlation Commands[/bold]")
|
|
1963
|
-
console.print(f"1. Runtime logs: {commands['runtime_log_command']}")
|
|
1964
|
-
console.print(f"2. Grafana: {commands['grafana_correlation_command']}")
|
|
1965
|
-
console.print(f"3. Elastic: {commands['elastic_correlation_command']}")
|
|
1966
|
-
|
|
1967
|
-
if run_health:
|
|
1968
|
-
console.print("\n[bold]Health Checks[/bold]")
|
|
1969
|
-
for name, details in health_checks.items():
|
|
1970
|
-
marker = "[green]ok[/green]" if details.get("ok") else "[red]failed[/red]"
|
|
1971
|
-
console.print(f"- {name}: {marker} ({details.get('command')})")
|
|
1972
|
-
|
|
1973
|
-
if errors:
|
|
1974
|
-
for err in errors:
|
|
1975
|
-
console.print(f"[red]- {err}[/red]")
|
|
1976
|
-
raise typer.Exit(1)
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
@doctor_app.command(name="crawl-status")
|
|
1980
|
-
def doctor_crawl_status(
|
|
1981
|
-
manifest_path: Path | None = typer.Option(
|
|
1982
|
-
None,
|
|
1983
|
-
"--manifest-path",
|
|
1984
|
-
help="Path to crawl manifest JSON (crawl_manifest.json or extract-docs project manifest).",
|
|
1985
|
-
),
|
|
1986
|
-
crawl_dir: Path | None = typer.Option(
|
|
1987
|
-
None,
|
|
1988
|
-
"--crawl-dir",
|
|
1989
|
-
help="Directory to discover the newest crawl_manifest.json when --manifest-path is omitted.",
|
|
1990
|
-
),
|
|
1991
|
-
log_file: Path | None = typer.Option(
|
|
1992
|
-
None,
|
|
1993
|
-
"--log-file",
|
|
1994
|
-
envvar="VDS_AUDIT_RUNTIME_LOG_FILE",
|
|
1995
|
-
help="Runtime JSONL log file (default: effective VDS log root / vds-audit-runtime-YYYYMMDD.jsonl).",
|
|
1996
|
-
),
|
|
1997
|
-
tail: int = typer.Option(
|
|
1998
|
-
300,
|
|
1999
|
-
"--tail",
|
|
2000
|
-
min=1,
|
|
2001
|
-
help="Number of latest runtime log events to evaluate for crawl diagnostics.",
|
|
2002
|
-
),
|
|
2003
|
-
json_output: bool = typer.Option(False, "--json", help="Emit crawl diagnostics as JSON."),
|
|
2004
|
-
) -> None:
|
|
2005
|
-
"""Summarize crawl manifest progress and error diagnostics."""
|
|
2006
|
-
errors: list[str] = []
|
|
2007
|
-
warnings_list: list[str] = []
|
|
2008
|
-
|
|
2009
|
-
resolved_manifest_path: Path | None = None
|
|
2010
|
-
if manifest_path is not None:
|
|
2011
|
-
resolved_manifest_path = manifest_path.expanduser().resolve()
|
|
2012
|
-
if not resolved_manifest_path.exists():
|
|
2013
|
-
errors.append(f"Crawl manifest not found: {resolved_manifest_path}")
|
|
2014
|
-
elif crawl_dir is not None:
|
|
2015
|
-
resolved_crawl_dir = crawl_dir.expanduser().resolve()
|
|
2016
|
-
resolved_manifest_path = _discover_latest_crawl_manifest(resolved_crawl_dir)
|
|
2017
|
-
if resolved_manifest_path is None:
|
|
2018
|
-
errors.append(f"No crawl_manifest.json found under: {resolved_crawl_dir}")
|
|
2019
|
-
else:
|
|
2020
|
-
errors.append("Provide --manifest-path or --crawl-dir.")
|
|
2021
|
-
|
|
2022
|
-
crawl_status: dict[str, Any] | None = None
|
|
2023
|
-
if not errors and resolved_manifest_path is not None:
|
|
2024
|
-
try:
|
|
2025
|
-
manifest_payload = _load_json_dict(resolved_manifest_path)
|
|
2026
|
-
crawl_status = _collect_crawl_manifest_status(
|
|
2027
|
-
manifest_payload=manifest_payload,
|
|
2028
|
-
manifest_path=resolved_manifest_path,
|
|
2029
|
-
)
|
|
2030
|
-
except Exception as exc:
|
|
2031
|
-
errors.append(f"Failed to parse crawl manifest '{resolved_manifest_path}': {exc}")
|
|
2032
|
-
|
|
2033
|
-
resolved_log_file = _resolve_runtime_log_file(realtime_logs=True, log_file=log_file)
|
|
2034
|
-
assert resolved_log_file is not None
|
|
2035
|
-
runtime_logs = _summarize_runtime_logs_for_crawl_status(log_file=resolved_log_file, tail=tail)
|
|
2036
|
-
if not bool(runtime_logs.get("exists")):
|
|
2037
|
-
warnings_list.append(f"Runtime log file not found: {resolved_log_file}")
|
|
2038
|
-
if _safe_int(runtime_logs.get("parse_errors")) > 0:
|
|
2039
|
-
warnings_list.append("Runtime log contains malformed JSON lines; diagnostics use parsed entries only.")
|
|
2040
|
-
|
|
2041
|
-
status = "ok"
|
|
2042
|
-
if errors:
|
|
2043
|
-
status = "error"
|
|
2044
|
-
elif crawl_status is not None:
|
|
2045
|
-
crawl_errors = _safe_int(crawl_status.get("errors", {}).get("total"))
|
|
2046
|
-
pending_queue = _safe_int(crawl_status.get("progress", {}).get("pending_queue_size"))
|
|
2047
|
-
crawl_completed = crawl_status.get("progress", {}).get("completed")
|
|
2048
|
-
runtime_error_total = _safe_int(runtime_logs.get("error_total"))
|
|
2049
|
-
if crawl_errors > 0 or pending_queue > 0 or crawl_completed is False or runtime_error_total > 0:
|
|
2050
|
-
status = "warning"
|
|
2051
|
-
|
|
2052
|
-
payload: dict[str, Any] = {
|
|
2053
|
-
"status": status,
|
|
2054
|
-
"operation": "doctor_crawl_status",
|
|
2055
|
-
"crawl": crawl_status,
|
|
2056
|
-
"runtime_logs": runtime_logs,
|
|
2057
|
-
"errors": errors,
|
|
2058
|
-
"warnings": warnings_list,
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
if _cli_state.get("json_only") or json_output:
|
|
2062
|
-
_emit_json(payload)
|
|
2063
|
-
if status == "error":
|
|
2064
|
-
raise typer.Exit(1)
|
|
2065
|
-
return
|
|
2066
|
-
|
|
2067
|
-
table = Table(title="Crawl Status")
|
|
2068
|
-
table.add_column("Check")
|
|
2069
|
-
table.add_column("Value")
|
|
2070
|
-
table.add_row("Status", status)
|
|
2071
|
-
if crawl_status is not None:
|
|
2072
|
-
table.add_row("Manifest", str(crawl_status.get("manifest_path") or "-"))
|
|
2073
|
-
table.add_row("Root page", str(crawl_status.get("root_page_id") or "-"))
|
|
2074
|
-
table.add_row("Nodes processed", str(crawl_status.get("progress", {}).get("nodes_processed", 0)))
|
|
2075
|
-
table.add_row("Pending queue", str(crawl_status.get("progress", {}).get("pending_queue_size", 0)))
|
|
2076
|
-
table.add_row("Errors", str(crawl_status.get("errors", {}).get("total", 0)))
|
|
2077
|
-
table.add_row("Permission denied", str(crawl_status.get("permission_denied_count", 0)))
|
|
2078
|
-
table.add_row("Runtime log", str(runtime_logs.get("log_file")))
|
|
2079
|
-
table.add_row("Log entries considered", str(runtime_logs.get("entries_considered", 0)))
|
|
2080
|
-
table.add_row("Log warnings", str(runtime_logs.get("warning_total", 0)))
|
|
2081
|
-
table.add_row("Log errors", str(runtime_logs.get("error_total", 0)))
|
|
2082
|
-
table.add_row("Log throttle signals", str(runtime_logs.get("throttle_total", 0)))
|
|
2083
|
-
console.print(table)
|
|
2084
|
-
|
|
2085
|
-
for warning in warnings_list:
|
|
2086
|
-
console.print(f"[yellow]- {warning}[/yellow]")
|
|
2087
|
-
if errors:
|
|
2088
|
-
for err in errors:
|
|
2089
|
-
console.print(f"[red]- {err}[/red]")
|
|
2090
|
-
raise typer.Exit(1)
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
@doctor_app.command(name="logs-follow")
|
|
2094
|
-
def doctor_logs_follow(
|
|
2095
|
-
log_file: Path | None = typer.Option(
|
|
2096
|
-
None,
|
|
2097
|
-
"--log-file",
|
|
2098
|
-
envvar="VDS_AUDIT_RUNTIME_LOG_FILE",
|
|
2099
|
-
help="Runtime JSONL log file (default: effective VDS log root / vds-audit-runtime-YYYYMMDD.jsonl).",
|
|
2100
|
-
),
|
|
2101
|
-
tail: int = typer.Option(100, "--tail", min=0, help="Print last N matching events before follow."),
|
|
2102
|
-
follow: bool = typer.Option(True, "--follow/--no-follow", help="Follow appended events in realtime."),
|
|
2103
|
-
poll_interval: float = typer.Option(1.0, "--poll-interval", min=0.2, help="Polling interval in seconds."),
|
|
2104
|
-
timeout_seconds: float | None = typer.Option(
|
|
2105
|
-
None,
|
|
2106
|
-
"--timeout-seconds",
|
|
2107
|
-
min=1.0,
|
|
2108
|
-
help="Optional timeout for follow mode.",
|
|
2109
|
-
),
|
|
2110
|
-
level: str | None = typer.Option(None, "--level", help="Filter level (debug|info|warning|error|critical)."),
|
|
2111
|
-
event: str | None = typer.Option(None, "--event", help="Filter by event name substring."),
|
|
2112
|
-
audit_id: str | None = typer.Option(None, "--audit-id", help="Filter by exact audit_id."),
|
|
2113
|
-
agent: str | None = typer.Option(None, "--agent", help="Filter by exact agent name."),
|
|
2114
|
-
json_output: bool = typer.Option(False, "--json", help="Emit matched events as JSON lines."),
|
|
2115
|
-
) -> None:
|
|
2116
|
-
"""Tail and follow runtime structured logs for realtime monitoring."""
|
|
2117
|
-
resolved = _resolve_runtime_log_file(realtime_logs=True, log_file=log_file)
|
|
2118
|
-
if resolved is None:
|
|
2119
|
-
raise typer.BadParameter("Unable to resolve runtime log path.")
|
|
2120
|
-
|
|
2121
|
-
start_at = perf_counter()
|
|
2122
|
-
position = 0
|
|
2123
|
-
|
|
2124
|
-
if resolved.exists():
|
|
2125
|
-
if tail > 0:
|
|
2126
|
-
recent = deque(maxlen=tail)
|
|
2127
|
-
with resolved.open("r", encoding="utf-8") as handle:
|
|
2128
|
-
for raw in handle:
|
|
2129
|
-
raw_line = raw.strip()
|
|
2130
|
-
if not raw_line:
|
|
2131
|
-
continue
|
|
2132
|
-
try:
|
|
2133
|
-
entry = cast("dict[str, Any]", json.loads(raw_line))
|
|
2134
|
-
except json.JSONDecodeError:
|
|
2135
|
-
continue
|
|
2136
|
-
if _runtime_log_event_matches(
|
|
2137
|
-
entry,
|
|
2138
|
-
level=level,
|
|
2139
|
-
event=event,
|
|
2140
|
-
audit_id=audit_id,
|
|
2141
|
-
agent=agent,
|
|
2142
|
-
):
|
|
2143
|
-
recent.append(entry)
|
|
2144
|
-
position = handle.tell()
|
|
2145
|
-
for entry in recent:
|
|
2146
|
-
_emit_runtime_log_event(entry, json_output=json_output)
|
|
2147
|
-
else:
|
|
2148
|
-
position = resolved.stat().st_size
|
|
2149
|
-
elif not follow:
|
|
2150
|
-
message = f"Runtime log file not found: {resolved}"
|
|
2151
|
-
if _cli_state.get("json_only") or json_output:
|
|
2152
|
-
_emit_json({"error": message})
|
|
2153
|
-
else:
|
|
2154
|
-
console.print(f"[yellow]{message}[/yellow]")
|
|
2155
|
-
raise typer.Exit(1)
|
|
2156
|
-
|
|
2157
|
-
if not follow:
|
|
2158
|
-
return
|
|
2159
|
-
|
|
2160
|
-
while True:
|
|
2161
|
-
if timeout_seconds is not None and (perf_counter() - start_at) >= timeout_seconds:
|
|
2162
|
-
return
|
|
2163
|
-
|
|
2164
|
-
if not resolved.exists():
|
|
2165
|
-
sleep(poll_interval)
|
|
2166
|
-
continue
|
|
2167
|
-
|
|
2168
|
-
try:
|
|
2169
|
-
current_size = resolved.stat().st_size
|
|
2170
|
-
if current_size < position:
|
|
2171
|
-
position = 0
|
|
2172
|
-
if current_size == position:
|
|
2173
|
-
sleep(poll_interval)
|
|
2174
|
-
continue
|
|
2175
|
-
|
|
2176
|
-
with resolved.open("r", encoding="utf-8") as handle:
|
|
2177
|
-
handle.seek(position)
|
|
2178
|
-
new_data = handle.read()
|
|
2179
|
-
position = handle.tell()
|
|
2180
|
-
except OSError:
|
|
2181
|
-
sleep(poll_interval)
|
|
2182
|
-
continue
|
|
2183
|
-
|
|
2184
|
-
for raw_line in new_data.splitlines():
|
|
2185
|
-
line = raw_line.strip()
|
|
2186
|
-
if not line:
|
|
2187
|
-
continue
|
|
2188
|
-
try:
|
|
2189
|
-
entry = cast("dict[str, Any]", json.loads(line))
|
|
2190
|
-
except json.JSONDecodeError:
|
|
2191
|
-
continue
|
|
2192
|
-
if _runtime_log_event_matches(
|
|
2193
|
-
entry,
|
|
2194
|
-
level=level,
|
|
2195
|
-
event=event,
|
|
2196
|
-
audit_id=audit_id,
|
|
2197
|
-
agent=agent,
|
|
2198
|
-
):
|
|
2199
|
-
_emit_runtime_log_event(entry, json_output=json_output)
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
@doctor_app.command(name="corpus-status")
|
|
2203
|
-
def doctor_corpus_status(
|
|
2204
|
-
project: str = typer.Option(
|
|
2205
|
-
...,
|
|
2206
|
-
"--project",
|
|
2207
|
-
help="Project selector (numeric Confluence page_id or URL containing pageId=<ID>).",
|
|
2208
|
-
),
|
|
2209
|
-
) -> None:
|
|
2210
|
-
"""Report corpus health diagnostics for a project.
|
|
2211
|
-
|
|
2212
|
-
Shows snapshot metrics, chunk breakdowns by source_type and doc_class,
|
|
2213
|
-
contamination ratio, and health status (clean/warning/contaminated).
|
|
2214
|
-
|
|
2215
|
-
Examples:
|
|
2216
|
-
vds-audit doctor corpus-status --project 88718877
|
|
2217
|
-
vds-audit --json-only doctor corpus-status --project 88718877
|
|
2218
|
-
"""
|
|
2219
|
-
from .cli_impl import _resolve_state_dsn_from_env
|
|
2220
|
-
|
|
2221
|
-
dsn = _resolve_state_dsn_from_env()
|
|
2222
|
-
if not dsn:
|
|
2223
|
-
if _cli_state.get("json_only"):
|
|
2224
|
-
_emit_json({"status": "error", "error": "VDS_AUDIT_STATE_DSN not set."})
|
|
2225
|
-
else:
|
|
2226
|
-
console.print("[red]VDS_AUDIT_STATE_DSN not set.[/red]")
|
|
2227
|
-
raise typer.Exit(1)
|
|
2228
|
-
|
|
2229
|
-
# FR-268 (AC-268.3): resolve --project through select_project() with junction table
|
|
2230
|
-
project = _resolve_project_key(project_identifier=project, state_dsn=dsn)
|
|
2231
|
-
|
|
2232
|
-
store = PostgresStateStore(dsn)
|
|
2233
|
-
try:
|
|
2234
|
-
# Strict project_id resolution — no key-only fallback (DD-151)
|
|
2235
|
-
project_id = store.resolve_project_id(project)
|
|
2236
|
-
|
|
2237
|
-
result = store.corpus_status_diagnostics(project_key=project, project_id=project_id)
|
|
2238
|
-
payload = {"status": "ok", **result}
|
|
2239
|
-
if _cli_state.get("json_only"):
|
|
2240
|
-
_emit_json(payload)
|
|
2241
|
-
return
|
|
2242
|
-
|
|
2243
|
-
health = result.get("health_status", "unknown")
|
|
2244
|
-
health_color = {"clean": "green", "warning": "yellow", "contaminated": "red"}.get(health, "white")
|
|
2245
|
-
console.print(f"\n[bold]Corpus Status[/bold] — [{health_color}]{health.upper()}[/{health_color}]")
|
|
2246
|
-
console.print(f" Project: {project}")
|
|
2247
|
-
console.print(f" Snapshots: {result.get('snapshot_count', 0)}")
|
|
2248
|
-
console.print(f" Documents: {result.get('total_documents', 0)}")
|
|
2249
|
-
console.print(f" Chunks: {result.get('total_chunks', 0)}")
|
|
2250
|
-
console.print(f" Artifact: {result.get('artifact_chunks', 0)}")
|
|
2251
|
-
console.print(f" Contamination: {result.get('contamination_ratio', 0.0):.2%}")
|
|
2252
|
-
console.print(
|
|
2253
|
-
f" Orphan rate: {result.get('orphan_document_rate', 0.0):.2%} ({result.get('orphan_code_docs', 0)}/{result.get('total_code_docs', 0)} code docs)"
|
|
2254
|
-
)
|
|
2255
|
-
duplicate_total = int(result.get("duplicate_uri_count", 0) or 0)
|
|
2256
|
-
duplicate_latest = int(result.get("duplicate_uri_count_latest_snapshot", 0) or 0)
|
|
2257
|
-
duplicate_cross_snapshot = int(result.get("duplicate_uri_count_cross_snapshot", 0) or 0)
|
|
2258
|
-
console.print(
|
|
2259
|
-
f" Dup URIs: {duplicate_total} (latest={duplicate_latest}, cross_snapshot={duplicate_cross_snapshot})"
|
|
2260
|
-
)
|
|
2261
|
-
console.print(f" Truncated: {result.get('truncated_chunk_count', 0)}")
|
|
2262
|
-
console.print()
|
|
2263
|
-
|
|
2264
|
-
by_source = result.get("chunks_by_source_type") or {}
|
|
2265
|
-
if by_source:
|
|
2266
|
-
console.print(" [bold]By source_type:[/bold]")
|
|
2267
|
-
for st, count in sorted(by_source.items(), key=lambda x: -x[1]):
|
|
2268
|
-
console.print(f" {st}: {count}")
|
|
2269
|
-
|
|
2270
|
-
by_class = result.get("chunks_by_doc_class") or {}
|
|
2271
|
-
if by_class:
|
|
2272
|
-
console.print(" [bold]By doc_class:[/bold]")
|
|
2273
|
-
for dc, count in sorted(by_class.items(), key=lambda x: -x[1]):
|
|
2274
|
-
console.print(f" {dc}: {count}")
|
|
2275
|
-
|
|
2276
|
-
snapshots = result.get("snapshots") or []
|
|
2277
|
-
if snapshots:
|
|
2278
|
-
console.print()
|
|
2279
|
-
table = Table(title="Snapshots")
|
|
2280
|
-
table.add_column("Key")
|
|
2281
|
-
table.add_column("Created")
|
|
2282
|
-
table.add_column("Chunks", justify="right")
|
|
2283
|
-
table.add_column("Priority", justify="right")
|
|
2284
|
-
for snap in snapshots:
|
|
2285
|
-
table.add_row(
|
|
2286
|
-
str(snap.get("snapshot_key", "")),
|
|
2287
|
-
str(snap.get("created_at", ""))[:19],
|
|
2288
|
-
str(snap.get("chunk_count", 0)),
|
|
2289
|
-
str(snap.get("priority", 0)),
|
|
2290
|
-
)
|
|
2291
|
-
console.print(table)
|
|
2292
|
-
except Exception as exc:
|
|
2293
|
-
if _cli_state.get("json_only"):
|
|
2294
|
-
_emit_json({"status": "error", "error": str(exc)})
|
|
2295
|
-
else:
|
|
2296
|
-
console.print(f"[red]{exc}[/red]")
|
|
2297
|
-
raise typer.Exit(1) from exc
|
|
2298
|
-
finally:
|
|
2299
|
-
store.close()
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
@doctor_app.command(name="permissions")
|
|
2303
|
-
def doctor_permissions(
|
|
2304
|
-
page_id: str = typer.Option(
|
|
2305
|
-
...,
|
|
2306
|
-
"--page-id",
|
|
2307
|
-
help="Confluence page ID to test permissions on (required).",
|
|
2308
|
-
),
|
|
2309
|
-
) -> None:
|
|
2310
|
-
"""Validate Confluence permissions and report which operations are available.
|
|
2311
|
-
|
|
2312
|
-
Tests read, edit, and attachment permissions on the specified page.
|
|
2313
|
-
Provides guidance on which mode to use (full or --page-only) based on available permissions.
|
|
2314
|
-
"""
|
|
2315
|
-
import tempfile
|
|
2316
|
-
from pathlib import Path
|
|
2317
|
-
|
|
2318
|
-
from vds_audit_orchestrator.clients.confluence_cli_client import ConfluenceCliClient
|
|
2319
|
-
|
|
2320
|
-
logger.info("doctor_permissions_start", page_id=page_id)
|
|
2321
|
-
|
|
2322
|
-
permissions = {
|
|
2323
|
-
"read": {"available": False, "tested": False, "error": None},
|
|
2324
|
-
"edit": {"available": False, "tested": False, "error": None},
|
|
2325
|
-
"attachment": {"available": False, "tested": False, "error": None},
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
client = ConfluenceCliClient()
|
|
2329
|
-
errors: list[str] = []
|
|
2330
|
-
warnings: list[str] = []
|
|
2331
|
-
|
|
2332
|
-
# Test read permission
|
|
2333
|
-
try:
|
|
2334
|
-
logger.info("testing_read_permission", page_id=page_id)
|
|
2335
|
-
page = asyncio.run(client.get_page(page_id, expand="version"))
|
|
2336
|
-
if page and isinstance(page, dict):
|
|
2337
|
-
permissions["read"]["available"] = True
|
|
2338
|
-
permissions["read"]["tested"] = True
|
|
2339
|
-
logger.info("read_permission_confirmed", page_id=page_id)
|
|
2340
|
-
else:
|
|
2341
|
-
permissions["read"]["tested"] = True
|
|
2342
|
-
permissions["read"]["error"] = "Page not found or no access"
|
|
2343
|
-
errors.append("Read permission: Page not found or no access")
|
|
2344
|
-
logger.warning("read_permission_failed", page_id=page_id, reason="page_not_found")
|
|
2345
|
-
except Exception as exc:
|
|
2346
|
-
permissions["read"]["tested"] = True
|
|
2347
|
-
permissions["read"]["error"] = str(exc)
|
|
2348
|
-
errors.append(f"Read permission test failed: {exc}")
|
|
2349
|
-
logger.warning("read_permission_test_failed", page_id=page_id, error=str(exc))
|
|
2350
|
-
|
|
2351
|
-
# Test edit permission (only if read succeeded)
|
|
2352
|
-
if permissions["read"]["available"]:
|
|
2353
|
-
test_page_id = None
|
|
2354
|
-
try:
|
|
2355
|
-
logger.info("testing_edit_permission", parent_page_id=page_id)
|
|
2356
|
-
# Create a temporary test page
|
|
2357
|
-
with tempfile.NamedTemporaryFile(mode="w", suffix=".html", delete=False) as f:
|
|
2358
|
-
f.write("<p>Permission test - safe to delete</p>")
|
|
2359
|
-
test_body_path = Path(f.name)
|
|
2360
|
-
|
|
2361
|
-
# Extract space key from the parent page
|
|
2362
|
-
space_key = page.get("space", {}).get("key") if isinstance(page, dict) else None
|
|
2363
|
-
if not space_key:
|
|
2364
|
-
# Fallback: try to get space from the page structure
|
|
2365
|
-
space_key = page.get("spaceKey") if isinstance(page, dict) else None
|
|
2366
|
-
|
|
2367
|
-
if not space_key:
|
|
2368
|
-
warnings.append("Edit permission: Could not determine space key for test page creation")
|
|
2369
|
-
permissions["edit"]["tested"] = True
|
|
2370
|
-
permissions["edit"]["error"] = "Could not determine space key"
|
|
2371
|
-
logger.warning("edit_permission_test_skipped", reason="no_space_key")
|
|
2372
|
-
else:
|
|
2373
|
-
# Try to create a test page
|
|
2374
|
-
import uuid
|
|
2375
|
-
|
|
2376
|
-
test_title = f"VDS Permission Test {uuid.uuid4().hex[:8]}"
|
|
2377
|
-
logger.info("creating_test_page", space_key=space_key, title=test_title)
|
|
2378
|
-
|
|
2379
|
-
test_page = asyncio.run(
|
|
2380
|
-
client.create_page(
|
|
2381
|
-
space_key=space_key,
|
|
2382
|
-
title=test_title,
|
|
2383
|
-
body_file=test_body_path,
|
|
2384
|
-
parent_id=page_id,
|
|
2385
|
-
)
|
|
2386
|
-
)
|
|
2387
|
-
|
|
2388
|
-
if test_page and isinstance(test_page, dict):
|
|
2389
|
-
test_page_id = test_page.get("id")
|
|
2390
|
-
permissions["edit"]["available"] = True
|
|
2391
|
-
permissions["edit"]["tested"] = True
|
|
2392
|
-
logger.info("edit_permission_confirmed", test_page_id=test_page_id)
|
|
2393
|
-
|
|
2394
|
-
# Clean up: delete the test page
|
|
2395
|
-
if test_page_id:
|
|
2396
|
-
try:
|
|
2397
|
-
logger.info("deleting_test_page", test_page_id=test_page_id)
|
|
2398
|
-
asyncio.run(client.delete_page(test_page_id))
|
|
2399
|
-
logger.info("test_page_deleted", test_page_id=test_page_id)
|
|
2400
|
-
except Exception as cleanup_exc:
|
|
2401
|
-
warnings.append(f"Failed to delete test page {test_page_id}: {cleanup_exc}")
|
|
2402
|
-
logger.warning(
|
|
2403
|
-
"test_page_cleanup_failed", test_page_id=test_page_id, error=str(cleanup_exc)
|
|
2404
|
-
)
|
|
2405
|
-
else:
|
|
2406
|
-
permissions["edit"]["tested"] = True
|
|
2407
|
-
permissions["edit"]["error"] = "Failed to create test page"
|
|
2408
|
-
errors.append("Edit permission: Failed to create test page")
|
|
2409
|
-
logger.warning("edit_permission_failed", reason="test_page_creation_failed")
|
|
2410
|
-
|
|
2411
|
-
# Clean up temp file
|
|
2412
|
-
with contextlib.suppress(Exception):
|
|
2413
|
-
test_body_path.unlink()
|
|
2414
|
-
|
|
2415
|
-
except Exception as exc:
|
|
2416
|
-
permissions["edit"]["tested"] = True
|
|
2417
|
-
permissions["edit"]["error"] = str(exc)
|
|
2418
|
-
errors.append(f"Edit permission test failed: {exc}")
|
|
2419
|
-
logger.warning("edit_permission_test_failed", page_id=page_id, error=str(exc))
|
|
2420
|
-
|
|
2421
|
-
# Clean up temp file if it exists
|
|
2422
|
-
if "test_body_path" in locals():
|
|
2423
|
-
with contextlib.suppress(Exception):
|
|
2424
|
-
test_body_path.unlink()
|
|
2425
|
-
|
|
2426
|
-
# Try to clean up test page if it was created
|
|
2427
|
-
if test_page_id:
|
|
2428
|
-
with contextlib.suppress(Exception):
|
|
2429
|
-
asyncio.run(client.delete_page(test_page_id))
|
|
2430
|
-
|
|
2431
|
-
# Test attachment permission (only if read and edit succeeded)
|
|
2432
|
-
if permissions["read"]["available"] and permissions["edit"]["available"]:
|
|
2433
|
-
try:
|
|
2434
|
-
logger.info("testing_attachment_permission", page_id=page_id)
|
|
2435
|
-
# Create a small test attachment
|
|
2436
|
-
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
|
|
2437
|
-
f.write("VDS permission test attachment")
|
|
2438
|
-
test_attachment_path = Path(f.name)
|
|
2439
|
-
|
|
2440
|
-
# Try to upload the attachment
|
|
2441
|
-
logger.info("uploading_test_attachment", page_id=page_id)
|
|
2442
|
-
upload_result = asyncio.run(
|
|
2443
|
-
client.upload_attachment(
|
|
2444
|
-
page_id=page_id,
|
|
2445
|
-
file_path=test_attachment_path,
|
|
2446
|
-
)
|
|
2447
|
-
)
|
|
2448
|
-
|
|
2449
|
-
if upload_result and isinstance(upload_result, dict):
|
|
2450
|
-
# Attachment upload succeeded
|
|
2451
|
-
attachment_id = upload_result.get("id") or upload_result.get("results", {}).get("id")
|
|
2452
|
-
permissions["attachment"]["available"] = True
|
|
2453
|
-
permissions["attachment"]["tested"] = True
|
|
2454
|
-
logger.info("attachment_permission_confirmed", attachment_id=attachment_id)
|
|
2455
|
-
|
|
2456
|
-
# Try to delete the test attachment
|
|
2457
|
-
if attachment_id:
|
|
2458
|
-
try:
|
|
2459
|
-
# Note: The ConfluenceCliClient doesn't have a delete_attachment method,
|
|
2460
|
-
# but we can try to use the underlying client
|
|
2461
|
-
logger.info("deleting_test_attachment", attachment_id=attachment_id)
|
|
2462
|
-
# For now, we'll just leave the attachment (it's small and harmless)
|
|
2463
|
-
# In a production implementation, we'd want to delete it
|
|
2464
|
-
logger.info(
|
|
2465
|
-
"test_attachment_cleanup_skipped",
|
|
2466
|
-
attachment_id=attachment_id,
|
|
2467
|
-
reason="no_delete_method",
|
|
2468
|
-
)
|
|
2469
|
-
except Exception as cleanup_exc:
|
|
2470
|
-
warnings.append(f"Could not clean up test attachment {attachment_id}: {cleanup_exc}")
|
|
2471
|
-
logger.warning(
|
|
2472
|
-
"test_attachment_cleanup_failed", attachment_id=attachment_id, error=str(cleanup_exc)
|
|
2473
|
-
)
|
|
2474
|
-
else:
|
|
2475
|
-
permissions["attachment"]["tested"] = True
|
|
2476
|
-
permissions["attachment"]["error"] = "Failed to upload test attachment"
|
|
2477
|
-
errors.append("Attachment permission: Failed to upload test attachment")
|
|
2478
|
-
logger.warning("attachment_permission_failed", reason="upload_failed")
|
|
2479
|
-
|
|
2480
|
-
# Clean up temp file
|
|
2481
|
-
with contextlib.suppress(Exception):
|
|
2482
|
-
test_attachment_path.unlink()
|
|
2483
|
-
|
|
2484
|
-
except Exception as exc:
|
|
2485
|
-
permissions["attachment"]["tested"] = True
|
|
2486
|
-
permissions["attachment"]["error"] = str(exc)
|
|
2487
|
-
errors.append(f"Attachment permission test failed: {exc}")
|
|
2488
|
-
logger.warning("attachment_permission_test_failed", page_id=page_id, error=str(exc))
|
|
2489
|
-
|
|
2490
|
-
# Clean up temp file if it exists
|
|
2491
|
-
if "test_attachment_path" in locals():
|
|
2492
|
-
with contextlib.suppress(Exception):
|
|
2493
|
-
test_attachment_path.unlink()
|
|
2494
|
-
|
|
2495
|
-
# Determine overall status and recommended mode
|
|
2496
|
-
overall_status = "ok" if not errors else ("warning" if warnings else "error")
|
|
2497
|
-
|
|
2498
|
-
can_use_full_mode = all(permissions[p]["available"] for p in ["read", "edit", "attachment"])
|
|
2499
|
-
can_use_page_only_mode = all(permissions[p]["available"] for p in ["read", "edit"])
|
|
2500
|
-
|
|
2501
|
-
recommended_mode = None
|
|
2502
|
-
if can_use_full_mode:
|
|
2503
|
-
recommended_mode = "full"
|
|
2504
|
-
elif can_use_page_only_mode:
|
|
2505
|
-
recommended_mode = "--page-only"
|
|
2506
|
-
else:
|
|
2507
|
-
recommended_mode = "none (insufficient permissions)"
|
|
2508
|
-
|
|
2509
|
-
# Build payload for JSON output
|
|
2510
|
-
payload = {
|
|
2511
|
-
"status": overall_status,
|
|
2512
|
-
"page_id": page_id,
|
|
2513
|
-
"permissions": permissions,
|
|
2514
|
-
"recommended_mode": recommended_mode,
|
|
2515
|
-
"can_use_full_mode": can_use_full_mode,
|
|
2516
|
-
"can_use_page_only_mode": can_use_page_only_mode,
|
|
2517
|
-
"errors": errors,
|
|
2518
|
-
"warnings": warnings,
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
if _cli_state.get("json_only"):
|
|
2522
|
-
_emit_json(payload)
|
|
2523
|
-
return
|
|
2524
|
-
|
|
2525
|
-
# Human-readable output
|
|
2526
|
-
console.print()
|
|
2527
|
-
console.print("[bold]Confluence Permissions Check[/bold]")
|
|
2528
|
-
console.print(f" Page ID: {page_id}")
|
|
2529
|
-
console.print()
|
|
2530
|
-
|
|
2531
|
-
# Permissions table
|
|
2532
|
-
table = Table(title="Permission Status")
|
|
2533
|
-
table.add_column("Permission", style="cyan")
|
|
2534
|
-
table.add_column("Status", style="magenta")
|
|
2535
|
-
table.add_column("Details")
|
|
2536
|
-
|
|
2537
|
-
for perm_name, perm_data in permissions.items():
|
|
2538
|
-
status_str = "✓ Available" if perm_data["available"] else "✗ Unavailable"
|
|
2539
|
-
details = perm_data.get("error") or "Tested successfully"
|
|
2540
|
-
table.add_row(perm_name.capitalize(), status_str, details)
|
|
2541
|
-
|
|
2542
|
-
console.print(table)
|
|
2543
|
-
console.print()
|
|
2544
|
-
|
|
2545
|
-
# Recommended mode
|
|
2546
|
-
console.print("[bold]Recommended Mode:[/bold]")
|
|
2547
|
-
if can_use_full_mode:
|
|
2548
|
-
console.print(" ✓ Full mode (all permissions available)")
|
|
2549
|
-
console.print(" You can use the default workflow with attachments.")
|
|
2550
|
-
elif can_use_page_only_mode:
|
|
2551
|
-
console.print(" ⚠ Use --page-only mode (attachment permission missing)")
|
|
2552
|
-
console.print(" Run workflows with --page-only to skip attachment operations.")
|
|
2553
|
-
console.print(" Example: vds-audit workflow <repo> --thread-id <id> --page-only")
|
|
2554
|
-
else:
|
|
2555
|
-
console.print(" ✗ Insufficient permissions for any mode")
|
|
2556
|
-
console.print(" Check that you have read and edit permissions on the target page.")
|
|
2557
|
-
console.print()
|
|
2558
|
-
|
|
2559
|
-
# Errors and warnings
|
|
2560
|
-
if errors:
|
|
2561
|
-
console.print("[bold red]Errors:[/bold red]")
|
|
2562
|
-
for error in errors:
|
|
2563
|
-
console.print(f" • {error}")
|
|
2564
|
-
console.print()
|
|
2565
|
-
|
|
2566
|
-
if warnings:
|
|
2567
|
-
console.print("[bold yellow]Warnings:[/bold yellow]")
|
|
2568
|
-
for warning in warnings:
|
|
2569
|
-
console.print(f" • {warning}")
|
|
2570
|
-
console.print()
|
|
2571
|
-
|
|
2572
|
-
logger.info(
|
|
2573
|
-
"doctor_permissions_complete",
|
|
2574
|
-
page_id=page_id,
|
|
2575
|
-
overall_status=overall_status,
|
|
2576
|
-
recommended_mode=recommended_mode,
|
|
2577
|
-
error_count=len(errors),
|
|
2578
|
-
warning_count=len(warnings),
|
|
2579
|
-
)
|
|
2580
|
-
|
|
2581
|
-
if errors and not warnings:
|
|
2582
|
-
raise typer.Exit(1)
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
# ---------------------------------------------------------------------------
|
|
2586
|
-
# P153-B: Confluence connectivity verification
|
|
2587
|
-
# ---------------------------------------------------------------------------
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
def _collect_confluence_connectivity_payload() -> dict[str, Any]:
|
|
2591
|
-
"""Probe all configured Confluence endpoints and return a status dict."""
|
|
2592
|
-
return collect_confluence_connectivity_payload(timeout_seconds=30)
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
@doctor_app.command(name="check-confluence")
|
|
2596
|
-
def doctor_check_confluence(
|
|
2597
|
-
json_output: bool = typer.Option(False, "--json", help="Emit connectivity diagnostics as JSON."),
|
|
2598
|
-
) -> None:
|
|
2599
|
-
"""Probe all configured Confluence endpoints and report reachability status.
|
|
2600
|
-
|
|
2601
|
-
Tests each configured endpoint (internal, external, and any configured
|
|
2602
|
-
alternate URLs) with a lightweight probe. When multiple endpoint labels
|
|
2603
|
-
share the same exact base URL, the command reuses one exact-URL probe
|
|
2604
|
-
result for those labels. Reports per-endpoint status including auth
|
|
2605
|
-
mechanism, reachability, latency, and error details without emitting
|
|
2606
|
-
warning-level Confluence transport logs for probe-only failures.
|
|
2607
|
-
|
|
2608
|
-
Exit code 0 when at least the internal server is reachable.
|
|
2609
|
-
Exit code 1 when ALL endpoints are unreachable.
|
|
2610
|
-
"""
|
|
2611
|
-
payload = _collect_confluence_connectivity_payload()
|
|
2612
|
-
|
|
2613
|
-
settings_error = payload.get("settings_error")
|
|
2614
|
-
if settings_error:
|
|
2615
|
-
if _cli_state.get("json_only") or json_output:
|
|
2616
|
-
_emit_json(payload)
|
|
2617
|
-
else:
|
|
2618
|
-
console.print(f"[red]✗ Settings error: {settings_error}[/red]")
|
|
2619
|
-
raise typer.Exit(1)
|
|
2620
|
-
|
|
2621
|
-
endpoints = payload.get("endpoints", [])
|
|
2622
|
-
|
|
2623
|
-
if _cli_state.get("json_only") or json_output:
|
|
2624
|
-
_emit_json(payload)
|
|
2625
|
-
else:
|
|
2626
|
-
table = Table(title="Confluence Connectivity")
|
|
2627
|
-
table.add_column("Endpoint", style="cyan")
|
|
2628
|
-
table.add_column("URL", style="dim")
|
|
2629
|
-
table.add_column("Reachable", style="bold")
|
|
2630
|
-
table.add_column("Latency", style="magenta")
|
|
2631
|
-
table.add_column("Auth", style="green")
|
|
2632
|
-
table.add_column("Detail", style="dim")
|
|
2633
|
-
|
|
2634
|
-
for ep in endpoints:
|
|
2635
|
-
status_str = "[green]✓ YES[/green]" if ep.get("reachable") else "[red]✗ NO[/red]"
|
|
2636
|
-
latency_str = f"{ep.get('latency_ms', '?')}ms"
|
|
2637
|
-
table.add_row(
|
|
2638
|
-
ep.get("server", "?"),
|
|
2639
|
-
ep.get("url", "?"),
|
|
2640
|
-
status_str,
|
|
2641
|
-
latency_str,
|
|
2642
|
-
ep.get("auth", "?"),
|
|
2643
|
-
ep.get("detail", "")[:80],
|
|
2644
|
-
)
|
|
2645
|
-
|
|
2646
|
-
console.print(table)
|
|
2647
|
-
|
|
2648
|
-
if payload.get("any_reachable"):
|
|
2649
|
-
console.print("[green]At least one endpoint is reachable.[/green]")
|
|
2650
|
-
else:
|
|
2651
|
-
console.print("[red]No endpoints are reachable.[/red]")
|
|
2652
|
-
|
|
2653
|
-
logger.info(
|
|
2654
|
-
"doctor_check_confluence_complete",
|
|
2655
|
-
any_reachable=payload.get("any_reachable"),
|
|
2656
|
-
internal_reachable=payload.get("internal_reachable"),
|
|
2657
|
-
endpoint_count=len(endpoints),
|
|
2658
|
-
)
|
|
2659
|
-
|
|
2660
|
-
if not payload.get("any_reachable"):
|
|
2661
|
-
raise typer.Exit(1)
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
# ---------------------------------------------------------------------------
|
|
2665
|
-
# check-duplicate-pages (Phase 154, FR-154.6, TSK-154.23)
|
|
2666
|
-
# ---------------------------------------------------------------------------
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
@doctor_app.command(name="check-duplicate-pages")
|
|
2670
|
-
def check_duplicate_pages(
|
|
2671
|
-
project_storage_key: str = typer.Option(
|
|
2672
|
-
...,
|
|
2673
|
-
"--project-storage-key",
|
|
2674
|
-
help="Canonical project storage key to scan for duplicate pages.",
|
|
2675
|
-
),
|
|
2676
|
-
state_dsn: str | None = typer.Option(
|
|
2677
|
-
None,
|
|
2678
|
-
"--state-dsn",
|
|
2679
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
2680
|
-
help=f"Centralized state DSN (required; fallback: {_STATE_DSN_ENV_VAR}).",
|
|
2681
|
-
),
|
|
2682
|
-
) -> None:
|
|
2683
|
-
"""Detect duplicate Confluence pages under a project hierarchy.
|
|
2684
|
-
|
|
2685
|
-
Phase 154 (FR-154.6): Scans registry entries and Confluence hierarchy,
|
|
2686
|
-
classifying pages as 'canonical' (in registry), 'stale' (registry entry
|
|
2687
|
-
but page deleted), or 'duplicate' (found by CQL, not in registry).
|
|
2688
|
-
|
|
2689
|
-
Report-only — does NOT delete or modify pages.
|
|
2690
|
-
"""
|
|
2691
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
2692
|
-
assert resolved_state_dsn is not None
|
|
2693
|
-
|
|
2694
|
-
store = PostgresStateStore(resolved_state_dsn)
|
|
2695
|
-
|
|
2696
|
-
from vds_audit_orchestrator.clients.confluence_cli_client import ConfluenceCliClient
|
|
2697
|
-
|
|
2698
|
-
try:
|
|
2699
|
-
registry_entries = store.list_published_pages(project_key=project_storage_key)
|
|
2700
|
-
pages: list[dict[str, Any]] = []
|
|
2701
|
-
registry_page_ids: set[str] = set()
|
|
2702
|
-
|
|
2703
|
-
async def _verify_pages() -> None:
|
|
2704
|
-
client = ConfluenceCliClient()
|
|
2705
|
-
# Step 1: Check each registry entry against Confluence.
|
|
2706
|
-
for entry in registry_entries:
|
|
2707
|
-
page_id = str(entry.get("confluence_page_id") or "")
|
|
2708
|
-
if not page_id:
|
|
2709
|
-
continue
|
|
2710
|
-
registry_page_ids.add(page_id)
|
|
2711
|
-
page = await client.get_content_page(page_id)
|
|
2712
|
-
if page and page.get("id"):
|
|
2713
|
-
pages.append(
|
|
2714
|
-
{
|
|
2715
|
-
"page_id": page_id,
|
|
2716
|
-
"title": str(page.get("title") or entry.get("confluence_page_title") or ""),
|
|
2717
|
-
"parent_id": str(entry.get("parent_page_id") or ""),
|
|
2718
|
-
"hierarchy_role": str(entry.get("hierarchy_role") or ""),
|
|
2719
|
-
"status": "canonical",
|
|
2720
|
-
}
|
|
2721
|
-
)
|
|
2722
|
-
else:
|
|
2723
|
-
pages.append(
|
|
2724
|
-
{
|
|
2725
|
-
"page_id": page_id,
|
|
2726
|
-
"title": str(entry.get("confluence_page_title") or ""),
|
|
2727
|
-
"parent_id": str(entry.get("parent_page_id") or ""),
|
|
2728
|
-
"hierarchy_role": str(entry.get("hierarchy_role") or ""),
|
|
2729
|
-
"status": "stale",
|
|
2730
|
-
}
|
|
2731
|
-
)
|
|
2732
|
-
|
|
2733
|
-
# Step 2: Search Confluence for pages matching known title patterns.
|
|
2734
|
-
title_patterns = [
|
|
2735
|
-
"Audit Results - ",
|
|
2736
|
-
"Project Audit - ",
|
|
2737
|
-
"Project Analysis - ",
|
|
2738
|
-
]
|
|
2739
|
-
for pattern in title_patterns:
|
|
2740
|
-
try:
|
|
2741
|
-
cql = f'ancestor = "{project_storage_key}" AND title ~ "{pattern}" AND type = "page"'
|
|
2742
|
-
results = await client.search_cql(cql, limit=100)
|
|
2743
|
-
for result_page in results:
|
|
2744
|
-
cql_page_id = str(result_page.get("id") or "")
|
|
2745
|
-
if cql_page_id and cql_page_id not in registry_page_ids:
|
|
2746
|
-
registry_page_ids.add(cql_page_id)
|
|
2747
|
-
pages.append(
|
|
2748
|
-
{
|
|
2749
|
-
"page_id": cql_page_id,
|
|
2750
|
-
"title": str(result_page.get("title") or ""),
|
|
2751
|
-
"parent_id": "",
|
|
2752
|
-
"hierarchy_role": "",
|
|
2753
|
-
"status": "duplicate",
|
|
2754
|
-
}
|
|
2755
|
-
)
|
|
2756
|
-
except Exception as exc:
|
|
2757
|
-
logger.warning(
|
|
2758
|
-
"check_duplicate_pages_cql_search_failed",
|
|
2759
|
-
project_storage_key=project_storage_key,
|
|
2760
|
-
pattern=pattern,
|
|
2761
|
-
error=str(exc),
|
|
2762
|
-
)
|
|
2763
|
-
|
|
2764
|
-
asyncio.run(_verify_pages())
|
|
2765
|
-
|
|
2766
|
-
report = {
|
|
2767
|
-
"project_key": project_storage_key,
|
|
2768
|
-
"pages": pages,
|
|
2769
|
-
"summary": {
|
|
2770
|
-
"canonical": sum(1 for p in pages if p["status"] == "canonical"),
|
|
2771
|
-
"stale": sum(1 for p in pages if p["status"] == "stale"),
|
|
2772
|
-
"duplicate": sum(1 for p in pages if p["status"] == "duplicate"),
|
|
2773
|
-
"total": len(pages),
|
|
2774
|
-
},
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
_emit_json(report)
|
|
2778
|
-
|
|
2779
|
-
canonical_count = report["summary"]["canonical"]
|
|
2780
|
-
stale_count = report["summary"]["stale"]
|
|
2781
|
-
duplicate_count = report["summary"]["duplicate"]
|
|
2782
|
-
|
|
2783
|
-
if duplicate_count > 0 or stale_count > 0:
|
|
2784
|
-
console.print(
|
|
2785
|
-
f"[yellow]Found {duplicate_count} duplicate(s), {stale_count} stale, "
|
|
2786
|
-
f"{canonical_count} canonical.[/yellow]"
|
|
2787
|
-
)
|
|
2788
|
-
else:
|
|
2789
|
-
console.print(f"[green]No duplicates found. {canonical_count} canonical page(s).[/green]")
|
|
2790
|
-
|
|
2791
|
-
logger.info(
|
|
2792
|
-
"doctor_check_duplicate_pages_complete",
|
|
2793
|
-
project_storage_key=project_storage_key,
|
|
2794
|
-
canonical=canonical_count,
|
|
2795
|
-
stale=stale_count,
|
|
2796
|
-
duplicate=duplicate_count,
|
|
2797
|
-
)
|
|
2798
|
-
finally:
|
|
2799
|
-
store.close()
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
@doctor_app.command(name="dispatch-status")
|
|
2803
|
-
def doctor_dispatch_status(
|
|
2804
|
-
state_dsn: str | None = typer.Option(
|
|
2805
|
-
None,
|
|
2806
|
-
"--state-dsn",
|
|
2807
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
2808
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
2809
|
-
),
|
|
2810
|
-
run_id: str | None = typer.Option(
|
|
2811
|
-
None,
|
|
2812
|
-
"--run-id",
|
|
2813
|
-
help="Show status for a specific dispatch run ID.",
|
|
2814
|
-
),
|
|
2815
|
-
dead_threshold_seconds: int = typer.Option(
|
|
2816
|
-
300,
|
|
2817
|
-
"--dead-threshold-seconds",
|
|
2818
|
-
help=(
|
|
2819
|
-
"Phase 169: Flag running runs with no heartbeat update for longer than "
|
|
2820
|
-
"this many seconds as potentially_dead (default: 300)."
|
|
2821
|
-
),
|
|
2822
|
-
),
|
|
2823
|
-
json_output: bool = typer.Option(False, "--json", help="Emit dispatch status as JSON."),
|
|
2824
|
-
) -> None:
|
|
2825
|
-
"""Show dispatch run status from the dispatch_run_status VIEW."""
|
|
2826
|
-
try:
|
|
2827
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
2828
|
-
assert resolved_state_dsn is not None
|
|
2829
|
-
store = PostgresStateStore(resolved_state_dsn)
|
|
2830
|
-
try:
|
|
2831
|
-
if run_id:
|
|
2832
|
-
row = store.get_dispatch_run_status(run_id)
|
|
2833
|
-
runs = [row] if row is not None else []
|
|
2834
|
-
else:
|
|
2835
|
-
runs = store.list_active_dispatch_runs()
|
|
2836
|
-
finally:
|
|
2837
|
-
store.close()
|
|
2838
|
-
except Exception as exc:
|
|
2839
|
-
payload = {
|
|
2840
|
-
"status": "fail",
|
|
2841
|
-
"operation": "doctor_dispatch_status",
|
|
2842
|
-
"run_id": run_id,
|
|
2843
|
-
"runs": [],
|
|
2844
|
-
"errors": [str(exc)],
|
|
2845
|
-
}
|
|
2846
|
-
if _cli_state.get("json_only") or json_output:
|
|
2847
|
-
_emit_json(payload)
|
|
2848
|
-
else:
|
|
2849
|
-
console.print(f"[red]Dispatch status check failed: {exc}[/red]")
|
|
2850
|
-
raise typer.Exit(1) from exc
|
|
2851
|
-
|
|
2852
|
-
# Phase 169 (P169-E, TSK-169.8): Compute heartbeat age and dead-run flag per run.
|
|
2853
|
-
now = datetime.now(UTC)
|
|
2854
|
-
for r in runs:
|
|
2855
|
-
hb = r.get("heartbeat_at")
|
|
2856
|
-
age: float | None = (now - hb).total_seconds() if hb is not None else None
|
|
2857
|
-
r["heartbeat_age_seconds"] = round(age, 1) if age is not None else None
|
|
2858
|
-
r["potentially_dead"] = bool(
|
|
2859
|
-
r.get("run_status") == "running" and (hb is None or (age is not None and age > dead_threshold_seconds))
|
|
2860
|
-
)
|
|
2861
|
-
|
|
2862
|
-
payload = {
|
|
2863
|
-
"status": "pass" if runs else "warn",
|
|
2864
|
-
"operation": "doctor_dispatch_status",
|
|
2865
|
-
"run_id": run_id,
|
|
2866
|
-
"run_count": len(runs),
|
|
2867
|
-
"runs": runs,
|
|
2868
|
-
"errors": [],
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
if _cli_state.get("json_only") or json_output:
|
|
2872
|
-
_emit_json(payload)
|
|
2873
|
-
return
|
|
2874
|
-
|
|
2875
|
-
if not runs:
|
|
2876
|
-
console.print(
|
|
2877
|
-
"[yellow]No active dispatch runs found.[/yellow]"
|
|
2878
|
-
if not run_id
|
|
2879
|
-
else f"[yellow]No dispatch run found for run_id={run_id}.[/yellow]"
|
|
2880
|
-
)
|
|
2881
|
-
return
|
|
2882
|
-
|
|
2883
|
-
table = Table(title="Dispatch Run Status")
|
|
2884
|
-
table.add_column("Run ID")
|
|
2885
|
-
table.add_column("Project")
|
|
2886
|
-
table.add_column("Status")
|
|
2887
|
-
table.add_column("Heartbeat")
|
|
2888
|
-
table.add_column("Lanes")
|
|
2889
|
-
table.add_column("Completed")
|
|
2890
|
-
table.add_column("Failed")
|
|
2891
|
-
table.add_column("Active")
|
|
2892
|
-
table.add_column("Repos Done")
|
|
2893
|
-
table.add_column("Repos Failed")
|
|
2894
|
-
|
|
2895
|
-
for r in runs:
|
|
2896
|
-
hb_age = r.get("heartbeat_age_seconds")
|
|
2897
|
-
if hb_age is None:
|
|
2898
|
-
hb_display = "none"
|
|
2899
|
-
elif hb_age < 60:
|
|
2900
|
-
hb_display = f"{int(hb_age)}s ago"
|
|
2901
|
-
else:
|
|
2902
|
-
hb_display = f"{int(hb_age // 60)}m ago"
|
|
2903
|
-
status_display = str(r.get("run_status", ""))
|
|
2904
|
-
if r.get("potentially_dead"):
|
|
2905
|
-
status_display += " [DEAD?]"
|
|
2906
|
-
table.add_row(
|
|
2907
|
-
str(r.get("run_id", "")),
|
|
2908
|
-
str(r.get("project_key", "")),
|
|
2909
|
-
status_display,
|
|
2910
|
-
hb_display,
|
|
2911
|
-
str(r.get("total_lanes", 0)),
|
|
2912
|
-
str(r.get("completed_lanes", 0)),
|
|
2913
|
-
str(r.get("failed_lanes", 0)),
|
|
2914
|
-
str(r.get("active_lanes", 0)),
|
|
2915
|
-
str(r.get("total_repos_completed", 0)),
|
|
2916
|
-
str(r.get("total_repos_failed", 0)),
|
|
2917
|
-
)
|
|
2918
|
-
|
|
2919
|
-
console.print(table)
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
# P168-D (TSK-168.9): Doctor repair-dispatch command — force-close stuck dispatch runs.
|
|
2923
|
-
@doctor_app.command(name="repair-dispatch")
|
|
2924
|
-
def doctor_repair_dispatch(
|
|
2925
|
-
state_dsn: str | None = typer.Option(
|
|
2926
|
-
None,
|
|
2927
|
-
"--state-dsn",
|
|
2928
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
2929
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
2930
|
-
),
|
|
2931
|
-
stale_hours: int = typer.Option(
|
|
2932
|
-
2,
|
|
2933
|
-
"--stale-hours",
|
|
2934
|
-
help="Treat runs with started_at older than this many hours as stuck (default: 2).",
|
|
2935
|
-
),
|
|
2936
|
-
force: bool = typer.Option(
|
|
2937
|
-
False,
|
|
2938
|
-
"--force",
|
|
2939
|
-
help="Auto-close all stuck runs without interactive confirmation.",
|
|
2940
|
-
),
|
|
2941
|
-
json_output: bool = typer.Option(False, "--json", help="Emit repair summary as JSON."),
|
|
2942
|
-
) -> None:
|
|
2943
|
-
"""Force-close dispatch runs stuck in 'running' status past the staleness threshold.
|
|
2944
|
-
|
|
2945
|
-
NOTE: dispatch_runs has no updated_at column — staleness is measured from started_at.
|
|
2946
|
-
"""
|
|
2947
|
-
try:
|
|
2948
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
2949
|
-
assert resolved_state_dsn is not None
|
|
2950
|
-
store = PostgresStateStore(resolved_state_dsn)
|
|
2951
|
-
# TSK-170.13: Detect incompatible schema before attempting any repair operations.
|
|
2952
|
-
# A reachable but schema-incompatible DB must surface a clear diagnostic, not a
|
|
2953
|
-
# confusing downstream SQL failure (e.g. "column claimed_at does not exist").
|
|
2954
|
-
_compat = store._schema_compat_result
|
|
2955
|
-
if _compat.status in ("incompatible_blocking", "unreachable"):
|
|
2956
|
-
_blocking_reasons = [
|
|
2957
|
-
f"{v.table_name}{f'.{v.column_name}' if v.column_name else ''} [{v.kind.value}]"
|
|
2958
|
-
for v in _compat.violations
|
|
2959
|
-
if v.is_blocking and v.repair_succeeded is not True
|
|
2960
|
-
]
|
|
2961
|
-
_schema_payload: dict[str, Any] = {
|
|
2962
|
-
"status": "fail",
|
|
2963
|
-
"operation": "doctor_repair_dispatch",
|
|
2964
|
-
"schema_compatibility": {
|
|
2965
|
-
"status": _compat.status,
|
|
2966
|
-
"blocking_reasons": _blocking_reasons,
|
|
2967
|
-
},
|
|
2968
|
-
"errors": [
|
|
2969
|
-
f"Schema incompatible ({_compat.status}): cannot repair dispatch runs. "
|
|
2970
|
-
f"Run 'vds-audit doctor schema' for details and remediation guidance."
|
|
2971
|
-
],
|
|
2972
|
-
}
|
|
2973
|
-
store.close()
|
|
2974
|
-
if _cli_state.get("json_only") or json_output:
|
|
2975
|
-
_emit_json(_schema_payload)
|
|
2976
|
-
else:
|
|
2977
|
-
console.print(f"[red]Schema incompatible ({_compat.status}) — repair-dispatch aborted.[/red]")
|
|
2978
|
-
for reason in _blocking_reasons:
|
|
2979
|
-
console.print(f" ✗ {reason}")
|
|
2980
|
-
console.print("[yellow]Run: vds-audit doctor schema — for details and remediation guidance.[/yellow]")
|
|
2981
|
-
raise typer.Exit(2)
|
|
2982
|
-
try:
|
|
2983
|
-
# Query stuck runs directly from the dispatch_runs table via the status VIEW.
|
|
2984
|
-
# We use list_active_dispatch_runs() then filter by started_at staleness, since
|
|
2985
|
-
# the VIEW already surfaces started_at and there is no updated_at column.
|
|
2986
|
-
active_runs = store.list_active_dispatch_runs()
|
|
2987
|
-
cutoff = datetime.now(UTC) - timedelta(hours=stale_hours)
|
|
2988
|
-
stuck_runs = [
|
|
2989
|
-
r
|
|
2990
|
-
for r in active_runs
|
|
2991
|
-
if r.get("run_status") == "running" and r.get("started_at") is not None and r["started_at"] < cutoff
|
|
2992
|
-
]
|
|
2993
|
-
finally:
|
|
2994
|
-
store.close()
|
|
2995
|
-
except typer.Exit:
|
|
2996
|
-
# TSK-170.13: Schema incompatibility raises typer.Exit(2) — do not swallow.
|
|
2997
|
-
raise
|
|
2998
|
-
except Exception as exc:
|
|
2999
|
-
payload = {
|
|
3000
|
-
"status": "fail",
|
|
3001
|
-
"operation": "doctor_repair_dispatch",
|
|
3002
|
-
"errors": [str(exc)],
|
|
3003
|
-
}
|
|
3004
|
-
if _cli_state.get("json_only") or json_output:
|
|
3005
|
-
_emit_json(payload)
|
|
3006
|
-
else:
|
|
3007
|
-
console.print(f"[red]Repair-dispatch failed: {exc}[/red]")
|
|
3008
|
-
raise typer.Exit(1) from exc
|
|
3009
|
-
|
|
3010
|
-
if not stuck_runs:
|
|
3011
|
-
payload = {
|
|
3012
|
-
"status": "ok",
|
|
3013
|
-
"operation": "doctor_repair_dispatch",
|
|
3014
|
-
"message": f"No stuck runs found (threshold: {stale_hours}h).",
|
|
3015
|
-
"repaired_runs": 0,
|
|
3016
|
-
"lanes_closed": 0,
|
|
3017
|
-
"errors": [],
|
|
3018
|
-
}
|
|
3019
|
-
if _cli_state.get("json_only") or json_output:
|
|
3020
|
-
_emit_json(payload)
|
|
3021
|
-
else:
|
|
3022
|
-
console.print(f"[green]No stuck dispatch runs found (threshold: {stale_hours}h).[/green]")
|
|
3023
|
-
return
|
|
3024
|
-
|
|
3025
|
-
repaired: list[str] = []
|
|
3026
|
-
lanes_closed_total = 0
|
|
3027
|
-
repair_errors: list[str] = []
|
|
3028
|
-
|
|
3029
|
-
# Re-open store for repair operations
|
|
3030
|
-
resolved_state_dsn_repair = _resolve_state_dsn(state_dsn, required=True)
|
|
3031
|
-
assert resolved_state_dsn_repair is not None
|
|
3032
|
-
repair_store = PostgresStateStore(resolved_state_dsn_repair)
|
|
3033
|
-
try:
|
|
3034
|
-
for run in stuck_runs:
|
|
3035
|
-
run_id_str = str(run.get("run_id", ""))
|
|
3036
|
-
started_at = run.get("started_at")
|
|
3037
|
-
|
|
3038
|
-
if not force:
|
|
3039
|
-
answer = typer.confirm(
|
|
3040
|
-
f"Force-close stuck run '{run_id_str}' (started: {started_at}, status: {run.get('run_status')})?"
|
|
3041
|
-
)
|
|
3042
|
-
if not answer:
|
|
3043
|
-
continue
|
|
3044
|
-
|
|
3045
|
-
try:
|
|
3046
|
-
# Resolve the external run_id → integer PK (dispatch_runs.id)
|
|
3047
|
-
run_row = repair_store.get_dispatch_run(run_id=run_id_str)
|
|
3048
|
-
if run_row is None:
|
|
3049
|
-
repair_errors.append(f"run_id={run_id_str}: not found via get_dispatch_run()")
|
|
3050
|
-
continue
|
|
3051
|
-
run_db_id = int(run_row["id"])
|
|
3052
|
-
|
|
3053
|
-
# Fetch all lanes for this run
|
|
3054
|
-
lanes = repair_store.get_dispatch_lanes(dispatch_run_id=run_db_id)
|
|
3055
|
-
lane_finals: list[dict[str, Any]] = [
|
|
3056
|
-
{
|
|
3057
|
-
"lane_db_id": int(lane["id"]),
|
|
3058
|
-
"status": "failed",
|
|
3059
|
-
"repos_completed": int(lane.get("repos_completed") or 0),
|
|
3060
|
-
"repos_failed": int(lane.get("repos_failed") or 0),
|
|
3061
|
-
}
|
|
3062
|
-
for lane in lanes
|
|
3063
|
-
]
|
|
3064
|
-
events: list[dict[str, Any]] = [
|
|
3065
|
-
{
|
|
3066
|
-
"event_type": "lane_closed_by_doctor",
|
|
3067
|
-
"dispatch_lane_id": int(lane["id"]),
|
|
3068
|
-
"payload": {"profile": str(lane.get("profile", "")), "status": "failed"},
|
|
3069
|
-
}
|
|
3070
|
-
for lane in lanes
|
|
3071
|
-
]
|
|
3072
|
-
events.append(
|
|
3073
|
-
{
|
|
3074
|
-
"event_type": "run_failed",
|
|
3075
|
-
"dispatch_lane_id": None,
|
|
3076
|
-
"payload": {
|
|
3077
|
-
"termination_reason": "force_closed_by_doctor",
|
|
3078
|
-
"stale_hours": stale_hours,
|
|
3079
|
-
},
|
|
3080
|
-
}
|
|
3081
|
-
)
|
|
3082
|
-
repair_store.finalize_dispatch_run(
|
|
3083
|
-
run_db_id=run_db_id,
|
|
3084
|
-
run_status="failed",
|
|
3085
|
-
lane_finals=lane_finals,
|
|
3086
|
-
events=events,
|
|
3087
|
-
run_summary={
|
|
3088
|
-
"termination_reason": "force_closed_by_doctor",
|
|
3089
|
-
"stale_hours": stale_hours,
|
|
3090
|
-
"lanes_closed": len(lanes),
|
|
3091
|
-
},
|
|
3092
|
-
)
|
|
3093
|
-
logger.info(
|
|
3094
|
-
"dispatch_doctor_repair",
|
|
3095
|
-
run_id=run_id_str,
|
|
3096
|
-
run_db_id=run_db_id,
|
|
3097
|
-
lanes_closed=len(lanes),
|
|
3098
|
-
stale_hours=stale_hours,
|
|
3099
|
-
)
|
|
3100
|
-
repaired.append(run_id_str)
|
|
3101
|
-
lanes_closed_total += len(lanes)
|
|
3102
|
-
except Exception as exc:
|
|
3103
|
-
repair_errors.append(f"run_id={run_id_str}: {exc}")
|
|
3104
|
-
finally:
|
|
3105
|
-
repair_store.close()
|
|
3106
|
-
|
|
3107
|
-
payload = {
|
|
3108
|
-
"status": "ok" if not repair_errors else "partial",
|
|
3109
|
-
"operation": "doctor_repair_dispatch",
|
|
3110
|
-
"message": f"Repaired {len(repaired)} runs, {lanes_closed_total} lanes force-closed.",
|
|
3111
|
-
"repaired_runs": len(repaired),
|
|
3112
|
-
"lanes_closed": lanes_closed_total,
|
|
3113
|
-
"repaired_run_ids": repaired,
|
|
3114
|
-
"errors": repair_errors,
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
if _cli_state.get("json_only") or json_output:
|
|
3118
|
-
_emit_json(payload)
|
|
3119
|
-
return
|
|
3120
|
-
|
|
3121
|
-
if repair_errors:
|
|
3122
|
-
for err in repair_errors:
|
|
3123
|
-
console.print(f"[red]Error: {err}[/red]")
|
|
3124
|
-
console.print(f"[green]Repaired {len(repaired)} runs, {lanes_closed_total} lanes force-closed.[/green]")
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
# P170-D (TSK-170.11, TSK-170.12): Operator-facing schema inspection surface.
|
|
3128
|
-
@doctor_app.command(name="schema")
|
|
3129
|
-
def doctor_schema(
|
|
3130
|
-
state_dsn: str | None = typer.Option(
|
|
3131
|
-
None,
|
|
3132
|
-
"--state-dsn",
|
|
3133
|
-
envvar=_STATE_DSN_ENV_VAR,
|
|
3134
|
-
help=f"State backend DSN (fallback: {_STATE_DSN_ENV_VAR}).",
|
|
3135
|
-
),
|
|
3136
|
-
json_output: bool = typer.Option(False, "--json", help="Emit schema compatibility report as JSON."),
|
|
3137
|
-
) -> None:
|
|
3138
|
-
"""Inspect dispatch-critical schema compatibility against the Phase 170 contract.
|
|
3139
|
-
|
|
3140
|
-
TSK-170.11: Reports reachability, compliance classification, missing tables/columns,
|
|
3141
|
-
repair outcomes, and blocking items.
|
|
3142
|
-
|
|
3143
|
-
TSK-170.12: Provides explicit operator remediation guidance for each non-compliant state.
|
|
3144
|
-
|
|
3145
|
-
Exit codes:
|
|
3146
|
-
0 — compliant or repaired_now (dispatch safe to start)
|
|
3147
|
-
1 — unreachable (DB not reachable)
|
|
3148
|
-
2 — incompatible_blocking (schema issues prevent safe dispatch)
|
|
3149
|
-
"""
|
|
3150
|
-
try:
|
|
3151
|
-
resolved_state_dsn = _resolve_state_dsn(state_dsn, required=True)
|
|
3152
|
-
assert resolved_state_dsn is not None
|
|
3153
|
-
store = PostgresStateStore(resolved_state_dsn)
|
|
3154
|
-
except Exception as exc:
|
|
3155
|
-
payload: dict[str, Any] = {
|
|
3156
|
-
"operation": "doctor_schema",
|
|
3157
|
-
"status": "unreachable",
|
|
3158
|
-
"db_reachable": False,
|
|
3159
|
-
"dispatch_safe": False,
|
|
3160
|
-
"violations": [],
|
|
3161
|
-
"missing_tables": [],
|
|
3162
|
-
"missing_columns": [],
|
|
3163
|
-
"repaired_items": [],
|
|
3164
|
-
"blocking_items": [],
|
|
3165
|
-
"remediation": "Database is unreachable. Verify VDS_AUDIT_STATE_DSN and network access.",
|
|
3166
|
-
"errors": [str(exc)],
|
|
3167
|
-
}
|
|
3168
|
-
if _cli_state.get("json_only") or json_output:
|
|
3169
|
-
_emit_json(payload)
|
|
3170
|
-
else:
|
|
3171
|
-
console.print(f"[red]Schema check failed — DB unreachable: {exc}[/red]")
|
|
3172
|
-
console.print("[yellow]Remediation: Verify VDS_AUDIT_STATE_DSN and network access.[/yellow]")
|
|
3173
|
-
raise typer.Exit(1) from exc
|
|
3174
|
-
|
|
3175
|
-
try:
|
|
3176
|
-
result = store._schema_compat_result
|
|
3177
|
-
violations = result.violations
|
|
3178
|
-
|
|
3179
|
-
missing_tables = [
|
|
3180
|
-
v.table_name
|
|
3181
|
-
for v in violations
|
|
3182
|
-
if v.column_name is None and not v.repair_attempted and "missing_table" in v.kind.value
|
|
3183
|
-
]
|
|
3184
|
-
missing_columns = [
|
|
3185
|
-
f"{v.table_name}.{v.column_name}"
|
|
3186
|
-
for v in violations
|
|
3187
|
-
if v.column_name is not None and not v.repair_succeeded
|
|
3188
|
-
]
|
|
3189
|
-
repaired_items = [
|
|
3190
|
-
f"{v.table_name}.{v.column_name or '(table)'}" for v in violations if v.repair_succeeded is True
|
|
3191
|
-
]
|
|
3192
|
-
blocking_items = [
|
|
3193
|
-
{"table": v.table_name, "column": v.column_name, "kind": v.kind.value, "detail": v.detail}
|
|
3194
|
-
for v in violations
|
|
3195
|
-
if v.is_blocking and v.repair_succeeded is not True
|
|
3196
|
-
]
|
|
3197
|
-
|
|
3198
|
-
db_reachable = result.status != "unreachable"
|
|
3199
|
-
dispatch_safe = result.status in ("compliant", "repaired_now")
|
|
3200
|
-
|
|
3201
|
-
# TSK-170.12: Remediation guidance per status
|
|
3202
|
-
if result.status == "compliant":
|
|
3203
|
-
remediation = "Schema is fully compliant. Dispatch is safe to start."
|
|
3204
|
-
elif result.status == "repaired_now":
|
|
3205
|
-
remediation = (
|
|
3206
|
-
"Schema was repaired automatically (additive drift). "
|
|
3207
|
-
"Dispatch is safe to start. Verify repair with: vds-audit doctor schema."
|
|
3208
|
-
)
|
|
3209
|
-
elif result.status == "incompatible_blocking":
|
|
3210
|
-
if any(v.repair_succeeded is False for v in violations):
|
|
3211
|
-
remediation = (
|
|
3212
|
-
"Schema has blocking incompatibilities and auto-repair failed. "
|
|
3213
|
-
"Run: vds-audit state init (or apply DB migrations manually), "
|
|
3214
|
-
"then re-verify with: vds-audit doctor schema."
|
|
3215
|
-
)
|
|
3216
|
-
else:
|
|
3217
|
-
remediation = (
|
|
3218
|
-
"Schema has blocking incompatibilities (missing tables/columns). "
|
|
3219
|
-
"Run: vds-audit state init to initialize the audit-state schema, "
|
|
3220
|
-
"then re-verify with: vds-audit doctor schema. "
|
|
3221
|
-
"Do NOT start DB-native dispatch until schema is compliant."
|
|
3222
|
-
)
|
|
3223
|
-
else: # unreachable
|
|
3224
|
-
remediation = "Database is unreachable. Verify VDS_AUDIT_STATE_DSN and network access."
|
|
3225
|
-
|
|
3226
|
-
violations_serialized = [
|
|
3227
|
-
{
|
|
3228
|
-
"kind": v.kind.value,
|
|
3229
|
-
"table_name": v.table_name,
|
|
3230
|
-
"column_name": v.column_name,
|
|
3231
|
-
"is_blocking": v.is_blocking,
|
|
3232
|
-
"repair_eligible": v.repair_eligible,
|
|
3233
|
-
"repair_attempted": v.repair_attempted,
|
|
3234
|
-
"repair_succeeded": v.repair_succeeded,
|
|
3235
|
-
"detail": v.detail,
|
|
3236
|
-
}
|
|
3237
|
-
for v in violations
|
|
3238
|
-
]
|
|
3239
|
-
|
|
3240
|
-
payload = {
|
|
3241
|
-
"operation": "doctor_schema",
|
|
3242
|
-
"status": result.status,
|
|
3243
|
-
"db_reachable": db_reachable,
|
|
3244
|
-
"dispatch_safe": dispatch_safe,
|
|
3245
|
-
"violations": violations_serialized,
|
|
3246
|
-
"missing_tables": missing_tables,
|
|
3247
|
-
"missing_columns": missing_columns,
|
|
3248
|
-
"repaired_items": repaired_items,
|
|
3249
|
-
"blocking_items": blocking_items,
|
|
3250
|
-
"remediation": remediation,
|
|
3251
|
-
"errors": [],
|
|
3252
|
-
}
|
|
3253
|
-
finally:
|
|
3254
|
-
store.close()
|
|
3255
|
-
|
|
3256
|
-
if _cli_state.get("json_only") or json_output:
|
|
3257
|
-
_emit_json(payload)
|
|
3258
|
-
else:
|
|
3259
|
-
# Human-readable output
|
|
3260
|
-
status_color = {"compliant": "green", "repaired_now": "yellow", "incompatible_blocking": "red"}.get(
|
|
3261
|
-
result.status, "red"
|
|
3262
|
-
)
|
|
3263
|
-
console.print(f"[{status_color}]Schema status: {result.status}[/{status_color}]")
|
|
3264
|
-
console.print(f" DB reachable: {db_reachable}")
|
|
3265
|
-
console.print(f" Dispatch safe: {dispatch_safe}")
|
|
3266
|
-
|
|
3267
|
-
if missing_tables:
|
|
3268
|
-
console.print(f"\n[red]Missing tables ({len(missing_tables)}):[/red]")
|
|
3269
|
-
for t in missing_tables:
|
|
3270
|
-
console.print(f" • {t}")
|
|
3271
|
-
|
|
3272
|
-
if missing_columns:
|
|
3273
|
-
console.print(f"\n[red]Missing columns ({len(missing_columns)}):[/red]")
|
|
3274
|
-
for c in missing_columns:
|
|
3275
|
-
console.print(f" • {c}")
|
|
3276
|
-
|
|
3277
|
-
if repaired_items:
|
|
3278
|
-
console.print(f"\n[yellow]Repaired (additive, now present) ({len(repaired_items)}):[/yellow]")
|
|
3279
|
-
for r in repaired_items:
|
|
3280
|
-
console.print(f" ✓ {r}")
|
|
3281
|
-
|
|
3282
|
-
if blocking_items:
|
|
3283
|
-
console.print(f"\n[red]Blocking schema issues ({len(blocking_items)}):[/red]")
|
|
3284
|
-
for b in blocking_items:
|
|
3285
|
-
col_part = f".{b['column']}" if b["column"] else ""
|
|
3286
|
-
console.print(f" ✗ {b['table']}{col_part} [{b['kind']}]")
|
|
3287
|
-
if b.get("detail"):
|
|
3288
|
-
console.print(f" {b['detail']}")
|
|
3289
|
-
|
|
3290
|
-
console.print(f"\n[bold]Remediation:[/bold] {remediation}")
|
|
3291
|
-
|
|
3292
|
-
if result.status == "incompatible_blocking":
|
|
3293
|
-
raise typer.Exit(2)
|
|
3294
|
-
if result.status == "unreachable":
|
|
3295
|
-
raise typer.Exit(1)
|