xrefkit 0.7.11__tar.gz → 0.7.12__tar.gz

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.
Files changed (267) hide show
  1. {xrefkit-0.7.11/xrefkit.egg-info → xrefkit-0.7.12}/PKG-INFO +1 -1
  2. {xrefkit-0.7.11 → xrefkit-0.7.12}/pyproject.toml +1 -1
  3. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_ci_workflow_invariants.py +3 -1
  4. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_gateway_mcp.py +9 -0
  5. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_packaged_native_governance.py +5 -0
  6. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_project_management_materialization.py +18 -6
  7. xrefkit-0.7.12/tests/test_quality_issue_dashboard.py +189 -0
  8. xrefkit-0.7.12/tests/test_quality_issues.py +354 -0
  9. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/__init__.py +1 -1
  10. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/dashboard.py +432 -6
  11. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/contribution_returns.py +15 -3
  12. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/server.py +65 -1
  13. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/operations_cli.py +1 -1
  14. xrefkit-0.7.12/xrefkit/quality_issues.py +314 -0
  15. {xrefkit-0.7.11 → xrefkit-0.7.12/xrefkit.egg-info}/PKG-INFO +1 -1
  16. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit.egg-info/SOURCES.txt +3 -0
  17. {xrefkit-0.7.11 → xrefkit-0.7.12}/LICENSE +0 -0
  18. {xrefkit-0.7.11 → xrefkit-0.7.12}/README.md +0 -0
  19. {xrefkit-0.7.11 → xrefkit-0.7.12}/setup.cfg +0 -0
  20. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_artifact_selected_family.py +0 -0
  21. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_attention_pet.py +0 -0
  22. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_attention_pet_client_protocol.py +0 -0
  23. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_attention_pet_codex_session.py +0 -0
  24. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_attention_pet_fit.py +0 -0
  25. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_azure_connection.py +0 -0
  26. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_azure_import.py +0 -0
  27. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_azure_recovery.py +0 -0
  28. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_azure_update_candidate.py +0 -0
  29. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_azure_writer.py +0 -0
  30. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_boundary_analysis.py +0 -0
  31. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_brownfield_csharp_structure_definitions.py +0 -0
  32. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_brownfield_file_editing_protocol.py +0 -0
  33. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_business_intake_conversation_definitions.py +0 -0
  34. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_business_intake_definition.py +0 -0
  35. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_calibration_lint.py +0 -0
  36. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_catalog_preparation_definition.py +0 -0
  37. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_check_skill_knowledge_xids.py +0 -0
  38. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_cli.py +0 -0
  39. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_code_constraint_definition.py +0 -0
  40. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_collect_analyzer_sarif.py +0 -0
  41. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_compact_skill_logs.py +0 -0
  42. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_constraint_derivation_family_definition.py +0 -0
  43. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_constraint_derivation_selected_family.py +0 -0
  44. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_contribution_adoption_bytes.py +0 -0
  45. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_contribution_returns.py +0 -0
  46. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_convert_to_xrefkit_skill.py +0 -0
  47. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_cs_scope_probe.py +0 -0
  48. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_csharp_commonality.py +0 -0
  49. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_csharp_naming_profile.py +0 -0
  50. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_ctx.py +0 -0
  51. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_cutover_readiness.py +0 -0
  52. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_dashboard.py +0 -0
  53. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_database_batch_definition_migration.py +0 -0
  54. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_decision_trace.py +0 -0
  55. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_design_business_intake_selected_family.py +0 -0
  56. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_design_planning_definition_migration.py +0 -0
  57. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_dotnet_definition_candidate.py +0 -0
  58. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_editorial_family_definition.py +0 -0
  59. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_editorial_intake_definition.py +0 -0
  60. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_editorial_selected_family.py +0 -0
  61. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_embedded_startup_pack.py +0 -0
  62. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_error_policy_audit.py +0 -0
  63. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_error_policy_locator.py +0 -0
  64. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_execution_binding.py +0 -0
  65. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_existing_skill_definition_batch.py +0 -0
  66. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_final_skilldefinition_batch.py +0 -0
  67. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_flow_selected_family.py +0 -0
  68. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_fm_multiroot.py +0 -0
  69. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_gate.py +0 -0
  70. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_gateway.py +0 -0
  71. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_gateway_skill_adapter.py +0 -0
  72. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_gateway_work_items.py +0 -0
  73. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_goal_desired_state.py +0 -0
  74. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_governance_entry.py +0 -0
  75. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_governance_host.py +0 -0
  76. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_host_precheck.py +0 -0
  77. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_human_evaluation.py +0 -0
  78. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_implementation_flow_definition.py +0 -0
  79. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_implementation_review_selected_family.py +0 -0
  80. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_inbound_uploads.py +0 -0
  81. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_instruction_workflow.py +0 -0
  82. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_knowledge_relations_validator.py +0 -0
  83. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_language_review_definition.py +0 -0
  84. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_legacy_guidance.py +0 -0
  85. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_legacy_migration.py +0 -0
  86. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_legacy_resources.py +0 -0
  87. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_mcp_package_routing.py +0 -0
  88. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_mcp_setup.py +0 -0
  89. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_mcp_subagent_startup.py +0 -0
  90. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_mcp_subagent_startup_integration.py +0 -0
  91. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_ontology_assessment_validator.py +0 -0
  92. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_os_family_definition.py +0 -0
  93. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_os_knowledge_family_definition.py +0 -0
  94. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_os_selected_family.py +0 -0
  95. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_ownership.py +0 -0
  96. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_package_knowledge_resolution.py +0 -0
  97. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_package_skill_run.py +0 -0
  98. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_packmeta.py +0 -0
  99. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_plan_markdown.py +0 -0
  100. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_plan_observation.py +0 -0
  101. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_project_quality_baseline.py +0 -0
  102. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_qa_report_definition.py +0 -0
  103. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_reporting_profiles.py +0 -0
  104. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_reporting_quality.py +0 -0
  105. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_repository_skill_adoption.py +0 -0
  106. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_repository_startup_pack.py +0 -0
  107. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_resource_provider.py +0 -0
  108. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_runtime_contracts.py +0 -0
  109. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_sarif_to_locator.py +0 -0
  110. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_security_definition_migration.py +0 -0
  111. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_site_release_metadata.py +0 -0
  112. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_definition.py +0 -0
  113. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_definition_governance.py +0 -0
  114. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_definition_mcp.py +0 -0
  115. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_definition_runtime.py +0 -0
  116. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_edits.py +0 -0
  117. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_maturity_return.py +0 -0
  118. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_release_compatibility.py +0 -0
  119. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skill_runtime_audit.py +0 -0
  120. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skillmeta.py +0 -0
  121. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_skills_sync.py +0 -0
  122. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_source_analysis_fragments.py +0 -0
  123. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_structure_catalog.py +0 -0
  124. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_subagent_startup.py +0 -0
  125. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_subagent_startup_boundaries.py +0 -0
  126. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_wbs.py +0 -0
  127. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_work_management.py +0 -0
  128. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_work_packages.py +0 -0
  129. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_workflow_family_definition.py +0 -0
  130. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xref.py +0 -0
  131. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xrefkit_instance.py +0 -0
  132. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xrefkit_tools.py +0 -0
  133. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xrefkit_v2_discovery.py +0 -0
  134. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xrefkit_v2_models.py +0 -0
  135. {xrefkit-0.7.11 → xrefkit-0.7.12}/tests/test_xrefkit_v2_pipeline.py +0 -0
  136. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/__main__.py +0 -0
  137. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/__init__.py +0 -0
  138. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/__main__.py +0 -0
  139. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/client.py +0 -0
  140. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/client_protocol.py +0 -0
  141. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/codex_session.py +0 -0
  142. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/evaluator.py +0 -0
  143. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/model.py +0 -0
  144. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/presentation.py +0 -0
  145. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/profiles.py +0 -0
  146. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/scenarios.py +0 -0
  147. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/server.py +0 -0
  148. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/attention_pet/store.py +0 -0
  149. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/azure_connection.py +0 -0
  150. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/azure_import.py +0 -0
  151. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/azure_recovery.py +0 -0
  152. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/azure_update_candidate.py +0 -0
  153. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/azure_writer.py +0 -0
  154. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/boundary_analysis.py +0 -0
  155. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/catalog_cli.py +0 -0
  156. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/cli.py +0 -0
  157. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/contracts.py +0 -0
  158. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/ctx.py +0 -0
  159. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/decision_trace.py +0 -0
  160. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/discovery.py +0 -0
  161. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/execution_binding.py +0 -0
  162. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/execution_binding_cli.py +0 -0
  163. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/gate.py +0 -0
  164. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/gateway.py +0 -0
  165. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/goalstate.py +0 -0
  166. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/governance_entry.py +0 -0
  167. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/governance_entry_cli.py +0 -0
  168. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/governance_host.py +0 -0
  169. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/hashing.py +0 -0
  170. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/host_precheck.py +0 -0
  171. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/import_skill.py +0 -0
  172. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/instance.py +0 -0
  173. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/loaders.py +0 -0
  174. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/__init__.py +0 -0
  175. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/audit.py +0 -0
  176. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/bootstrap.py +0 -0
  177. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/catalog.py +0 -0
  178. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/cli.py +0 -0
  179. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/client_cache.py +0 -0
  180. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/client_flow.py +0 -0
  181. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/context_registry.py +0 -0
  182. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/context_token.py +0 -0
  183. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/contracts.py +0 -0
  184. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/contribution_adoption.py +0 -0
  185. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/dist.py +0 -0
  186. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/gateway.py +0 -0
  187. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/governed_overlays.py +0 -0
  188. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/inbound_uploads.py +0 -0
  189. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/knowledge_edits.py +0 -0
  190. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/legacy_guidance.py +0 -0
  191. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/legacy_migration.py +0 -0
  192. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/legacy_resources.py +0 -0
  193. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/ownership.py +0 -0
  194. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/repository.py +0 -0
  195. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/schemas.py +0 -0
  196. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/setup.py +0 -0
  197. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/skill_edits.py +0 -0
  198. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/skill_maturity.py +0 -0
  199. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/startup_contract_pack.py +0 -0
  200. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/subagent_startup.py +0 -0
  201. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp/update_gate_intake.py +0 -0
  202. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/mcp_tools.py +0 -0
  203. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/__init__.py +0 -0
  204. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/common.py +0 -0
  205. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/effective_bundle.py +0 -0
  206. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/human_evaluation.py +0 -0
  207. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/local_manifest.py +0 -0
  208. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/package_manifest.py +0 -0
  209. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/run_log.py +0 -0
  210. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/server_config.py +0 -0
  211. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/models/skill_definition.py +0 -0
  212. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/ownership.py +0 -0
  213. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/packmeta.py +0 -0
  214. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/plan_markdown.py +0 -0
  215. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/plan_observation.py +0 -0
  216. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/registry.py +0 -0
  217. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/reporting.py +0 -0
  218. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/reporting_profiles.py +0 -0
  219. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/repository_skills.py +0 -0
  220. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resolver.py +0 -0
  221. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resource_provider.py +0 -0
  222. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/attention_pet/client-state.schema.json +0 -0
  223. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/attention_pet/pet.css +0 -0
  224. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/attention_pet/pet.html +0 -0
  225. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/attention_pet/pet.js +0 -0
  226. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/contracts.json +0 -0
  227. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/current.json +0 -0
  228. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/generations/7a682a5272907354/contracts.json +0 -0
  229. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/generations/7a682a5272907354/model_body.md +0 -0
  230. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/generations/9929294385ccb7b0/contracts.json +0 -0
  231. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/generations/9929294385ccb7b0/model_body.md +0 -0
  232. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/model_body.md +0 -0
  233. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/000_agent_entry.md +0 -0
  234. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/011_startup_xref_routing.md +0 -0
  235. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/015_shared_memory_operations.md +0 -0
  236. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/016_uncertainty_protocol.md +0 -0
  237. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/017_base_and_xref_layering.md +0 -0
  238. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/053_context_direction_security_guard.md +0 -0
  239. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/base/startup_sources/yomiyasu_LICENSE.txt +0 -0
  240. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/docs/guides/062_legacy_flow_skill_migration_guide.md +0 -0
  241. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/knowledge/operations/130_legacy_flow_skill_migration_rules.md +0 -0
  242. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/knowledge/organization/160_context_direction_guard_rules.md +0 -0
  243. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/skills/os/legacy_flow_skill_migration/SKILL.v1.md +0 -0
  244. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/skills/os/legacy_flow_skill_migration/references/legacy_flow_skill_migration_template.md +0 -0
  245. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/skills/repository_adoption.json +0 -0
  246. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/resources/migration/tools/migrate_legacy_flow_skill.py +0 -0
  247. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/runlog.py +0 -0
  248. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skill_definition.py +0 -0
  249. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skill_definition_catalog.py +0 -0
  250. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skill_definition_governance.py +0 -0
  251. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skillmeta.py +0 -0
  252. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skillrun.py +0 -0
  253. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/skills_sync.py +0 -0
  254. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/structure_catalog.py +0 -0
  255. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/subagent_startup.py +0 -0
  256. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/tools/__init__.py +0 -0
  257. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/tools/__main__.py +0 -0
  258. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/v2_cli.py +0 -0
  259. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/wbs.py +0 -0
  260. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/work_management.py +0 -0
  261. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/work_management_view.py +0 -0
  262. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/workspace.py +0 -0
  263. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit/xref.py +0 -0
  264. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit.egg-info/dependency_links.txt +0 -0
  265. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit.egg-info/entry_points.txt +0 -0
  266. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit.egg-info/requires.txt +0 -0
  267. {xrefkit-0.7.11 → xrefkit-0.7.12}/xrefkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xrefkit
3
- Version: 0.7.11
3
+ Version: 0.7.12
4
4
  Summary: Portable XID, Skill, Knowledge, workflow, and MCP runtime for XRefKit
5
5
  Author: synthaicode
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xrefkit"
7
- version = "0.7.11"
7
+ version = "0.7.12"
8
8
  description = "Portable XID, Skill, Knowledge, workflow, and MCP runtime for XRefKit"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -11,7 +11,9 @@ WORKFLOWS = Path(__file__).resolve().parents[1] / ".github/workflows"
11
11
  PACKAGES = {
12
12
  "python-package.yml": ("Core", "v*.*.*", {"sdist-install-smoke", "skill-compatibility"}),
13
13
  "python-skill-brownfield-package.yml": (
14
- "Brownfield", "xrefkit-skills-brownfield-v*.*.*", {"sdist-install-smoke"}),
14
+ "Brownfield", "xrefkit-skills-brownfield-v*.*.*", {"sdist-install-smoke", "cross-package-integration"}),
15
+ "python-skill-project-management-package.yml": (
16
+ "Project Management", "xrefkit-skills-project-management-v*.*.*", {"sdist-install-smoke", "cross-package-integration"}),
15
17
  "python-skill-csharp-package.yml": ("CSharp", "xrefkit-skills-csharp-v*.*.*", set()),
16
18
  "python-skill-batch-regression-package.yml": (
17
19
  "Batch regression", "xrefkit-skills-batch-regression-v*.*.*", {"sdist-install-smoke"}),
@@ -231,6 +231,15 @@ def test_gateway_over_real_mcp_stdio_before_run_binding(request_and_policy, tmp_
231
231
  "route_ref": "route-1", "reason": "initial"}]}})
232
232
  assert not feedback.isError
233
233
  assert feedback.structuredContent["first_acceptance_rate"] is None
234
+ feedback = await session.call_tool("evaluate_instruction_feedback", {"feedback": {
235
+ "version": 1, "cost_unit": "unknown", "attempts": [
236
+ {"id": "a", "goal_id": "g", "scope_revision": 0, "model": "capable",
237
+ "route_ref": "route-1", "reason": "initial"},
238
+ {"id": "b", "goal_id": "g", "scope_revision": 0, "model": "capable",
239
+ "route_ref": "route-1", "reason": "instruction_miss", "retry_of": "a",
240
+ "reason_evidence": "Synthetic missing heading correction"}]}})
241
+ assert feedback.structuredContent["quality_retries"] == 1
242
+ assert "quality_issue_follow_up" not in feedback.structuredContent
234
243
 
235
244
  with tempfile.TemporaryFile(mode="w+", encoding="utf-8") as errlog:
236
245
  anyio.run(scenario, errlog)
@@ -17,6 +17,11 @@ def fixture(tmp_path):
17
17
  (tmp_path/'skill.md').write_bytes(source.read_bytes())
18
18
  gov=json.loads((root/'governance/skills/progress_rules_setup.json').read_text())
19
19
  gov['definition_content_hash']=hashlib.sha256(source.read_bytes()).hexdigest()
20
+ # This fixture tests draft refusal independently of the source's current
21
+ # maturity; the installed-package suite checks the real trial release.
22
+ gov.update(maturity='draft', observation_refs=[], governance_refs=[],
23
+ promotion={'decision':'not_requested','target_maturity':None,
24
+ 'authority':None,'decided_at':None,'basis_refs':[]})
20
25
  (tmp_path/'governance.json').write_text(json.dumps(gov))
21
26
  manifest={'package_id':'test.native','package_type':'skill_package','version':'0.1.0',
22
27
  'requires':{'xrefkit_core':'>=2.0.0 <3.0.0'},'contract':{},
@@ -9,15 +9,27 @@ from tools.materialize_project_management_package import generate, main, PACKAGE
9
9
 
10
10
  def test_approved_bytes_cannot_be_rebound_after_link_transform(tmp_path):
11
11
  root=Path(__file__).resolve().parents[1]
12
- for rel in ['skills','governance','docs']:
12
+ for rel in ['skills','governance','docs','observations']:
13
13
  # Source links resolve against the actual tree; copy only governed inputs,
14
14
  # then use the real remaining targets through a full temporary fixture.
15
15
  shutil.copytree(root/rel,tmp_path/rel)
16
- gp=tmp_path/'governance/skills/requirements_discovery_coordination.json'
17
- record=json.loads(gp.read_text())
18
- record['maturity']='trial'
19
- record['promotion']['decision']='approved'
20
- gp.write_text(json.dumps(record))
16
+ gp=tmp_path/'governance/packages/project-management/requirements_discovery_coordination.json'
17
+ gp.unlink()
18
+ with pytest.raises(ValueError,match='separate package governance'):
19
+ generate(tmp_path)
20
+
21
+
22
+ @pytest.mark.parametrize('damage',['hash','approval','identity'])
23
+ def test_transformed_trial_requires_exact_separate_approval(tmp_path,damage):
24
+ root=Path(__file__).resolve().parents[1]
25
+ for rel in ['skills','governance','docs','observations']:
26
+ shutil.copytree(root/rel,tmp_path/rel)
27
+ gp=tmp_path/'governance/packages/project-management/requirements_discovery_coordination.json'
28
+ record=json.loads(gp.read_text(encoding='utf-8'))
29
+ if damage=='hash':record['definition_content_hash']='0'*64
30
+ elif damage=='approval':record['promotion']['authority']='human:someone-else'
31
+ else:record['skill_id']='another_skill'
32
+ gp.write_text(json.dumps(record),encoding='utf-8')
21
33
  with pytest.raises(ValueError,match='separate package governance'):
22
34
  generate(tmp_path)
23
35
 
@@ -0,0 +1,189 @@
1
+ """Local HTTP tests with synthetic corrections and a test-only trusted issuer."""
2
+ from __future__ import annotations
3
+
4
+ import http.client
5
+ import json
6
+ import threading
7
+ import uuid
8
+ from contextlib import contextmanager
9
+
10
+ import pytest
11
+
12
+ from xrefkit.dashboard import DashboardHandler, DashboardServer, _html_page, build_payload
13
+ from xrefkit.mcp.contribution_adoption import HmacHumanApprovalVerifier, issue_hmac_approval_assertion
14
+ from test_quality_issues import SECRET, save, fixture_args
15
+
16
+
17
+ @contextmanager
18
+ def server(root, *, trusted=True):
19
+ instance = DashboardServer(("127.0.0.1", 0), DashboardHandler, root=root,
20
+ sessions_dir=root / "work/sessions", mcp_audit_log=root / "work/mcp/audit.jsonl",
21
+ approval_verifier=HmacHumanApprovalVerifier(SECRET) if trusted else None)
22
+ thread = threading.Thread(target=instance.serve_forever, daemon=True)
23
+ thread.start()
24
+ try:
25
+ yield instance
26
+ finally:
27
+ instance.shutdown()
28
+ instance.server_close()
29
+ thread.join(timeout=5)
30
+
31
+
32
+ def request(instance, path, body=None, headers=None):
33
+ conn = http.client.HTTPConnection("127.0.0.1", instance.server_port, timeout=10)
34
+ try:
35
+ base = {"Content-Type": "application/json", "X-XRefKit-CSRF": instance.csrf_token}
36
+ base.update(headers or {})
37
+ conn.request("GET" if body is None else "POST", path, json.dumps(body) if body is not None else None, base)
38
+ response = conn.getresponse()
39
+ data = response.read().decode("utf-8")
40
+ return response.status, dict(response.getheaders()), data
41
+ finally:
42
+ conn.close()
43
+
44
+
45
+ def test_console_keeps_all_runtime_panels_and_backward_payload(tmp_path):
46
+ payload = build_payload(tmp_path, tmp_path / "work/sessions")
47
+ page = _html_page(payload)
48
+ for label in ("Quality Issues", "Governance", "Runtime Diagnostics", "Quality Evaluation"):
49
+ assert label in page
50
+ for panel in ("plans", "overview", "flows", "recovery", "attention", "closure", "evidence", "handoff", "xids", "analysis", "missing-information", "decision-trace"):
51
+ assert f'data-panel="{panel}"' in page
52
+ assert f'id="{panel}"' in page
53
+ with server(tmp_path) as instance:
54
+ status, _, body = request(instance, "/api/runs")
55
+ assert status == 200
56
+ assert json.loads(body)["runs"] == payload["runs"]
57
+ status, headers, body = request(instance, "/?panel=closure&run_id=synthetic")
58
+ assert 'data-console-area="runtime"' in body
59
+ assert headers["Cache-Control"] == "no-store"
60
+ assert headers["X-Frame-Options"] == "DENY"
61
+
62
+
63
+ def test_list_filter_detail_and_governance(tmp_path):
64
+ saved, _ = save(tmp_path)
65
+ issue_id = saved["contribution_id"]
66
+ with server(tmp_path) as instance:
67
+ status, _, body = request(instance, "/api/quality-issues?status=reported&skill_id=sample")
68
+ assert status == 200
69
+ assert json.loads(body)["issues"][0]["issue_id"] == issue_id
70
+ assert json.loads(request(instance, "/api/quality-issues?status=closed")[2])["issues"] == []
71
+ detail = json.loads(request(instance, f"/api/quality-issues/{issue_id}")[2])
72
+ assert detail["report"]["unknowns"]
73
+ assert detail["binding"]["run_id"]
74
+ assert request(instance, f"/api/quality-issues/{issue_id}/source?xid=UNRELATED")[0] == 400
75
+ assert request(instance, f"/api/quality-issues/{uuid.uuid4()}")[0] == 404
76
+ assert json.loads(request(instance, "/api/contributions")[2])["contributions"][0]["contribution_id"] == issue_id
77
+ assert request(instance, f"/api/contributions/{issue_id}")[0] == 200
78
+
79
+
80
+ def test_human_decision_assertion_history_replay_and_stale_revision(tmp_path):
81
+ saved, _ = save(tmp_path)
82
+ issue_id = saved["contribution_id"]
83
+ fields = {"issue_id": issue_id, "decision_id": str(uuid.uuid4()), "status": "triaged",
84
+ "reviewer": "human:test", "decision_evidence": "Reviewed synthetic correction", "expected_revision": 0}
85
+ with server(tmp_path) as instance:
86
+ status, _, body = request(instance, "/api/quality-issues/decision-claims", fields)
87
+ assert status == 200
88
+ claims = json.loads(body)
89
+ fields["approval_assertion"] = issue_hmac_approval_assertion(SECRET, {**claims, "assertion_id": str(uuid.uuid4())})
90
+ assert request(instance, "/api/quality-issues/decisions", fields)[0] == 200
91
+ assert json.loads(request(instance, "/api/quality-issues/decisions", fields)[2])["idempotent_replay"]
92
+ detail = json.loads(request(instance, f"/api/quality-issues/{issue_id}")[2])
93
+ assert detail["status"] == "triaged"
94
+ assert len(detail["history"]) == 1
95
+ stale = {**fields, "decision_id": str(uuid.uuid4())}
96
+ stale.pop("approval_assertion")
97
+ claims = json.loads(request(instance, "/api/quality-issues/decision-claims", stale)[2])
98
+ stale["approval_assertion"] = issue_hmac_approval_assertion(SECRET, {**claims, "assertion_id": str(uuid.uuid4())})
99
+ status, _, body = request(instance, "/api/quality-issues/decisions", stale)
100
+ assert status == 400 and "stale" in body
101
+ assert not (tmp_path / "knowledge").exists()
102
+
103
+
104
+ @pytest.mark.parametrize("headers", [{"X-XRefKit-CSRF": "wrong"}, {"Origin": "https://foreign.invalid"}, {"Host": "foreign.invalid"}])
105
+ def test_browser_cross_origin_or_missing_token_cannot_decide(tmp_path, headers):
106
+ with server(tmp_path) as instance:
107
+ assert request(instance, "/api/quality-issues/decisions", {}, headers)[0] == 403
108
+
109
+
110
+ def test_assertion_not_reviewer_name_and_readonly_default(tmp_path):
111
+ saved, _ = save(tmp_path)
112
+ body = {"issue_id": saved["contribution_id"], "decision_id": str(uuid.uuid4()), "status": "triaged",
113
+ "reviewer": "human:test", "decision_evidence": "explicit synthetic choice", "expected_revision": 0,
114
+ "approval_assertion": "self-declared"}
115
+ with server(tmp_path) as instance:
116
+ assert request(instance, "/api/quality-issues/decisions", body)[0] == 400
117
+ assert request(instance, "/", headers={"Host": "foreign.invalid"})[0] == 403
118
+ with server(tmp_path, trusted=False) as instance:
119
+ assert request(instance, "/api/quality-issues/decisions", body)[0] == 403
120
+ assert "Read-only: a trusted human approval verifier is not configured" in request(instance, "/")[2]
121
+
122
+
123
+ def test_untrusted_report_is_only_rendered_as_text(tmp_path):
124
+ args = fixture_args()
125
+ args["title"] = '<img src=x onerror="alert(1)">'
126
+ save(tmp_path, args)
127
+ with server(tmp_path) as instance:
128
+ page = request(instance, "/")[2]
129
+ assert args["title"] not in page
130
+ assert "e.textContent = value" in page
131
+ assert "detail.replaceChildren" in page
132
+ assert "innerHTML" not in page[page.index('document.addEventListener("DOMContentLoaded"'):page.index("<div id=\"console-runtime\"")]
133
+
134
+
135
+ def test_bad_request_is_bounded_and_unknown_fields_refused(tmp_path):
136
+ with server(tmp_path) as instance:
137
+ assert request(instance, "/api/quality-issues/decision-claims", {"unexpected": "field"})[0] == 400
138
+ assert request(instance, "/api/quality-issues/decisions", {}, {"Content-Type": "text/plain"})[0] == 400
139
+ assert request(instance, "/api/quality-issues?status=not-a-state")[0] == 400
140
+ missing = {"issue_id": str(uuid.uuid4()), "decision_id": str(uuid.uuid4()), "status": "triaged", "reviewer": "human:test", "decision_evidence": "synthetic", "expected_revision": 0}
141
+ assert request(instance, "/api/quality-issues/decision-claims", missing)[0] == 404
142
+ assert request(instance, "/api/quality-issues/decisions", {**missing, "approval_assertion": "synthetic"})[0] == 404
143
+
144
+
145
+ @pytest.mark.parametrize("value", [False, 0, {}, [123]])
146
+ def test_decision_evidence_types_are_not_coerced(tmp_path, value):
147
+ saved, _ = save(tmp_path)
148
+ fields = {"issue_id": saved["contribution_id"], "decision_id": str(uuid.uuid4()), "status": "triaged",
149
+ "reviewer": "human:test", "decision_evidence": "synthetic", "expected_revision": 0,
150
+ "verification_evidence": value}
151
+ with server(tmp_path) as instance:
152
+ assert request(instance, "/api/quality-issues/decision-claims", fields)[0] == 400
153
+
154
+
155
+ def test_governance_reuses_review_and_separate_adoption(tmp_path):
156
+ (tmp_path / "ownership.yaml").write_text("""zones:
157
+ - id: records
158
+ owner: operational
159
+ paths:
160
+ - observations/
161
+ catalog: false
162
+ distribution: false
163
+ base_sync: false
164
+ shadowing: false
165
+ """, encoding="utf-8")
166
+ saved, _ = save(tmp_path)
167
+ fields = {"contribution_id": saved["contribution_id"], "decision_id": str(uuid.uuid4()),
168
+ "decision": "accepted", "reviewer": "human:test", "decision_evidence": "Reviewed inert observation",
169
+ "approved_target_path": "observations/synthetic-quality.md"}
170
+ target = tmp_path / fields["approved_target_path"]
171
+ with server(tmp_path) as instance:
172
+ status, _, body = request(instance, "/api/contributions/review-claims", fields)
173
+ assert status == 200, body
174
+ claims = json.loads(body)
175
+ assert not target.exists()
176
+ assert request(instance, "/api/contributions/review", {**fields, "approval_assertion": "self-declared"})[0] == 400
177
+ assertion = issue_hmac_approval_assertion(SECRET, {**claims, "assertion_id": str(uuid.uuid4())})
178
+ status, _, body = request(instance, "/api/contributions/review", {**fields, "approval_assertion": assertion})
179
+ assert status == 200, body
180
+ assert not target.exists()
181
+ adoption = {"contribution_id": fields["contribution_id"], "adoption_id": str(uuid.uuid4()),
182
+ "reviewer": "human:test", "decision_evidence": "Publish accepted observation",
183
+ "approval_token": json.loads(body)["approval_token"]}
184
+ assert request(instance, "/api/contributions/adopt", {**adoption, "approval_token": "wrong"})[0] == 400
185
+ status, _, body = request(instance, "/api/contributions/adopt", adoption)
186
+ assert status == 200, body
187
+ assert target.is_file()
188
+ assert json.loads(request(instance, f'/api/quality-issues/{fields["contribution_id"]}')[2])["status"] == "reported"
189
+ assert not (tmp_path / "knowledge").exists()
@@ -0,0 +1,354 @@
1
+ """Synthetic quality corrections; no real conversations or business data."""
2
+ from __future__ import annotations
3
+
4
+ import asyncio
5
+ import copy
6
+ import hashlib
7
+ import json
8
+ import os
9
+ import secrets
10
+ import shutil
11
+ import subprocess
12
+ import sys
13
+ import tempfile
14
+ import uuid
15
+ from concurrent.futures import ThreadPoolExecutor
16
+ from pathlib import Path
17
+
18
+ import pytest
19
+
20
+ from xrefkit.gateway import Feedback, evaluate
21
+ from xrefkit.mcp.audit import SessionRunBinding
22
+ from xrefkit.mcp.contribution_adoption import HmacHumanApprovalVerifier, issue_hmac_approval_assertion
23
+ from xrefkit.mcp.contribution_returns import submit_contribution_return, list_contribution_returns
24
+ from xrefkit.quality_issues import (
25
+ decide_quality_issue, get_quality_issue, list_quality_issues, prepare_quality_issue,
26
+ quality_decision_claims, submit_quality_feedback, validate_quality_report,
27
+ )
28
+
29
+ SECRET = secrets.token_hex(32)
30
+
31
+
32
+ def report():
33
+ attempt = {"id": "a1", "goal_id": "example", "scope_revision": 0,
34
+ "model": "test", "route_ref": "route-1", "reason": "initial"}
35
+ corrected = {**attempt, "id": "a2", "reason": "instruction_miss", "retry_of": "a1",
36
+ "reason_evidence": "human-correction-1: requested missing heading"}
37
+ return {
38
+ "version": 1, "occurred_at": "2026-11-15T10:00:00Z", "classification": "instruction_miss",
39
+ "common_rule_relation": "Approved output headings were omitted",
40
+ "observed_facts": ["The requested heading was absent from the first output"],
41
+ "correction_evidence": [{"evidence_id": "human-correction-1", "summary": "Add the agreed heading",
42
+ "content_hash": "a" * 64}],
43
+ "output_before": {"evidence_id": "output-1", "summary": "Heading omitted", "content_hash": "b" * 64},
44
+ "output_after": None, "diff_summary": "unknown: revised output not yet available",
45
+ "inferred_causes": [], "unknowns": ["cause unknown", "revised output unavailable"],
46
+ "impact": "One synthetic output", "similarity_key": "missing-heading",
47
+ "feedback": {"version": 1, "cost_unit": "unknown", "attempts": [attempt, corrected]},
48
+ "transfer": "sanitized_nonconfidential",
49
+ }
50
+
51
+
52
+ def fixture_args():
53
+ run_id = str(uuid.uuid4())
54
+ return {
55
+ "report": report(), "observation": {
56
+ "skill_id": "sample", "skill_content_hash": "c" * 64, "maturity_at_use": "trial",
57
+ "run_id": run_id, "client_id": "test-client-1", "execution_environment": "test",
58
+ "model_id": "test-model", "outcome": "failure", "retry_count": 1,
59
+ "evaluation_evidence": [{"evidence_id": "human-correction-1", "kind": "human_correction",
60
+ "reference": "sanitized-correction-1", "content_hash": "a" * 64}],
61
+ "ambiguities": ["cause unknown"],
62
+ }, "contribution_id": str(uuid.uuid4()), "title": "Missing agreed heading",
63
+ "summary": "Synthetic human correction", "destination": "test-server",
64
+ "policy": {"destination": "test-server", "allowed": True,
65
+ "data_classification": "sanitized_nonconfidential",
66
+ "authorization_reference": "test host configuration"},
67
+ "knowledge_versions": [{"xid": "ABCDEF123456", "content_hash": "d" * 64}],
68
+ }
69
+
70
+
71
+ def save(root, args=None):
72
+ args = args or fixture_args()
73
+ payload = prepare_quality_issue(**args)
74
+ binding = SessionRunBinding(run_id=args["observation"]["run_id"], mcp_session_id=str(uuid.uuid4()),
75
+ repository_fingerprint="a" * 32, skill_id="sample")
76
+ source = {"skill_id": "sample", "skill_content_hash": "c" * 64,
77
+ "skill_maturity": "trial", "knowledge_versions": args["knowledge_versions"]}
78
+ payload.pop("skill_content_hash")
79
+ payload.pop("knowledge_versions")
80
+ payload.pop("package_id")
81
+ result = submit_contribution_return(root, binding=binding, source_snapshot=source, **payload)
82
+ return result, {"binding": binding, "source_snapshot": source, **payload}
83
+
84
+
85
+ def decision(root, issue_id, **changes):
86
+ args = {"issue_id": issue_id, "decision_id": str(uuid.uuid4()), "status": "triaged",
87
+ "reviewer": "human:test", "decision_evidence": "Reviewed synthetic report", "expected_revision": 0}
88
+ args.update(changes)
89
+ claims = quality_decision_claims(root, **args)
90
+ assertion = issue_hmac_approval_assertion(SECRET, {**claims, "assertion_id": str(uuid.uuid4())})
91
+ return {**args, "approval_assertion": assertion, "approval_verifier": HmacHumanApprovalVerifier(SECRET)}
92
+
93
+
94
+ def test_explicit_first_correction_repetition_and_unknown():
95
+ data = report()
96
+ assert validate_quality_report(data)["output_after"] is None
97
+ assert evaluate(Feedback.model_validate(data["feedback"]))["quality_retries"] == 1
98
+ attempt = data["feedback"]["attempts"][-1]
99
+ data["feedback"]["attempts"].append({**attempt, "id": "a3", "retry_of": "a2"})
100
+ assert evaluate(Feedback.model_validate(data["feedback"]))["quality_retries"] == 2
101
+ data["feedback"]["attempts"].append({**attempt, "id": "a4", "retry_of": "a3", "reason": "unknown",
102
+ "reason_evidence": None})
103
+ result = validate_quality_report(data)
104
+ assert result["unknowns"] == data["unknowns"]
105
+ assert evaluate(Feedback.model_validate(result["feedback"]))["unknown_retries"] == 1
106
+
107
+
108
+ @pytest.mark.parametrize("reason", ["requirement_change", "unknown"])
109
+ def test_requirement_change_or_unclassified_repetition_not_issue(reason):
110
+ data = report()
111
+ data["feedback"]["attempts"][1]["reason"] = reason
112
+ if reason == "requirement_change":
113
+ data["feedback"]["attempts"][1]["scope_revision"] = 1
114
+ with pytest.raises(ValueError, match="explicit quality feedback"):
115
+ validate_quality_report(data)
116
+
117
+
118
+ @pytest.mark.parametrize("classification", ["confidential", "personal", "unknown"])
119
+ def test_transfer_denied_before_network(classification):
120
+ args = fixture_args()
121
+ args["policy"]["data_classification"] = classification
122
+ calls = []
123
+ async def call_tool(*values):
124
+ calls.append(values)
125
+ with pytest.raises(ValueError, match="not authorized"):
126
+ asyncio.run(submit_quality_feedback(call_tool=call_tool, **args))
127
+ assert calls == []
128
+
129
+
130
+ @pytest.mark.parametrize("change", [{"allowed": False}, {"destination": "other-server"}])
131
+ def test_destination_permission_not_inferred(change):
132
+ args = fixture_args()
133
+ args["policy"].update(change)
134
+ with pytest.raises(ValueError, match="not authorized"):
135
+ prepare_quality_issue(**args)
136
+
137
+
138
+ @pytest.mark.parametrize("secret", ['{"password": "synthetic-value"}',
139
+ "Bearer synthetic-token", "-----BEGIN PRIVATE KEY-----"])
140
+ def test_secret_encodings_in_summary_denied(secret):
141
+ args = fixture_args()
142
+ args["summary"] = secret
143
+ with pytest.raises(ValueError, match="sensitive"):
144
+ prepare_quality_issue(**args)
145
+
146
+
147
+ def test_unassessed_maturity_preserved_only_for_quality_extension():
148
+ args = fixture_args()
149
+ args["observation"]["maturity_at_use"] = "unassessed"
150
+ assert prepare_quality_issue(**args)["skill_observation"]["maturity_at_use"] == "unassessed"
151
+ from xrefkit.mcp.contribution_returns import _validate_skill_observation_metadata
152
+ with pytest.raises(ValueError, match="invalid maturity"):
153
+ _validate_skill_observation_metadata(args["observation"])
154
+
155
+
156
+ def test_raw_prompt_fields_rejected():
157
+ args = fixture_args()
158
+ args["report"]["prompt_body"] = "synthetic conversation"
159
+ with pytest.raises(ValueError, match="Extra inputs"):
160
+ prepare_quality_issue(**args)
161
+
162
+
163
+ @pytest.mark.parametrize("location", ["report", "title", "file"])
164
+ def test_sensitive_data_rejected_on_both_boundaries(tmp_path, location):
165
+ args = fixture_args()
166
+ if location == "report":
167
+ args["report"]["observed_facts"] = [f"password={secrets.token_hex(16)}"]
168
+ elif location == "title":
169
+ args["title"] = "Contact synthetic.person@example.invalid"
170
+ if location != "file":
171
+ with pytest.raises(ValueError, match="sensitive"):
172
+ prepare_quality_issue(**args)
173
+ return
174
+ _, payload = save(tmp_path, args)
175
+ payload["contribution_id"] = str(uuid.uuid4())
176
+ payload["files"][0]["content"] = f"api_key={secrets.token_hex(16)}"
177
+ payload["files"][0]["content_hash"] = hashlib.sha256(payload["files"][0]["content"].encode()).hexdigest()
178
+ with pytest.raises(ValueError, match="sensitive"):
179
+ submit_contribution_return(tmp_path, **payload)
180
+ assert not (tmp_path / ".xrefkit/contribution-returns" / payload["contribution_id"]).exists()
181
+
182
+
183
+ def test_optional_metadata_old_observation_and_inert_storage(tmp_path):
184
+ result, payload = save(tmp_path)
185
+ issue = get_quality_issue(tmp_path, result["contribution_id"])
186
+ assert issue["status"] == "reported"
187
+ assert issue["binding"]["run_id"] == payload["binding"].run_id
188
+ assert issue["source"]["knowledge_versions"][0]["xid"] == "ABCDEF123456"
189
+ assert issue["source"]["skill_content_hash"] == "c" * 64
190
+ assert not (tmp_path / "knowledge").exists()
191
+ assert not (tmp_path / "skills").exists()
192
+ payload["contribution_id"] = str(uuid.uuid4())
193
+ del payload["skill_observation"]["quality_issue"]
194
+ submit_contribution_return(tmp_path, **payload)
195
+ assert len(list_contribution_returns(tmp_path)) == 2
196
+ assert len(list_quality_issues(tmp_path)) == 1
197
+
198
+
199
+ def test_duplicate_and_concurrent_intake_preserve_reports(tmp_path):
200
+ result, payload = save(tmp_path)
201
+ with ThreadPoolExecutor(max_workers=3) as pool:
202
+ rows = list(pool.map(lambda _: submit_contribution_return(tmp_path, **payload), range(3)))
203
+ assert all(row["idempotent_replay"] for row in rows)
204
+ changed = copy.deepcopy(payload)
205
+ changed["summary"] = "Different content"
206
+ with pytest.raises(ValueError, match="different payload"):
207
+ submit_contribution_return(tmp_path, **changed)
208
+ args = fixture_args()
209
+ args["observation"]["client_id"] = "test-client-2"
210
+ other, _ = save(tmp_path, args)
211
+ listed = list_quality_issues(tmp_path, status="reported", skill_id="sample")
212
+ assert len(listed) == 2 and all(row["report_count"] == 2 for row in listed)
213
+ assert {row["issue_id"] for row in listed} == {result["contribution_id"], other["contribution_id"]}
214
+ assert len({row["observation"]["client_id"] for row in listed}) == 2
215
+ assert get_quality_issue(tmp_path, result["contribution_id"])["report_count"] == 2
216
+
217
+
218
+ def test_signed_human_decision_history_and_no_adoption(tmp_path):
219
+ result, _ = save(tmp_path)
220
+ issue_id = result["contribution_id"]
221
+ args = decision(tmp_path, issue_id)
222
+ first = decide_quality_issue(tmp_path, **args)
223
+ assert first["created"]
224
+ assert decide_quality_issue(tmp_path, **args)["idempotent_replay"]
225
+ with pytest.raises(ValueError, match="claim mismatch"):
226
+ decide_quality_issue(tmp_path, **{**args, "decision_evidence": "substituted evidence"})
227
+ with pytest.raises(ValueError, match="stale issue revision"):
228
+ decide_quality_issue(tmp_path, **decision(tmp_path, issue_id))
229
+ with pytest.raises(ValueError, match="verification evidence"):
230
+ decision(tmp_path, issue_id, status="resolved", expected_revision=1)
231
+ decide_quality_issue(tmp_path, **decision(tmp_path, issue_id, status="approved_for_improvement", expected_revision=1))
232
+ decide_quality_issue(tmp_path, **decision(tmp_path, issue_id, status="resolved", expected_revision=2,
233
+ verification_evidence=["synthetic regression verified"]))
234
+ issue = get_quality_issue(tmp_path, issue_id, HmacHumanApprovalVerifier(SECRET))
235
+ assert issue["status"] == "resolved" and issue["revision"] == 3
236
+ assert issue["report"]["inferred_causes"] == []
237
+ assert not (tmp_path / "knowledge").exists()
238
+ assert list_contribution_returns(tmp_path)[0]["status"] == "pending_review"
239
+ with pytest.raises(RuntimeError, match="verifier"):
240
+ get_quality_issue(tmp_path, issue_id)
241
+
242
+
243
+ def test_human_auth_and_tamper_fail_closed(tmp_path):
244
+ result, _ = save(tmp_path)
245
+ args = decision(tmp_path, result["contribution_id"])
246
+ with pytest.raises(RuntimeError, match="verifier"):
247
+ decide_quality_issue(tmp_path, **{**args, "approval_verifier": None})
248
+ with pytest.raises(ValueError, match="approval assertion"):
249
+ decide_quality_issue(tmp_path, **{**args, "approval_assertion": "human says yes"})
250
+ decide_quality_issue(tmp_path, **args)
251
+ event_path = tmp_path / ".xrefkit/contribution-returns" / result["contribution_id"] / "quality-decisions/00000000.json"
252
+ event = json.loads(event_path.read_text())
253
+ event["status"] = "closed"
254
+ event_path.write_text(json.dumps(event))
255
+ with pytest.raises(ValueError, match="signature"):
256
+ get_quality_issue(tmp_path, result["contribution_id"], args["approval_verifier"])
257
+
258
+
259
+ @pytest.mark.parametrize("field", ["verification_evidence", "related_issue_ids"])
260
+ @pytest.mark.parametrize("value", [False, 0, "", {}, [7], [False], [{}]])
261
+ def test_decision_arrays_and_items_are_strict(tmp_path, field, value):
262
+ result, _ = save(tmp_path)
263
+ with pytest.raises(ValueError, match="arrays|strings"):
264
+ decision(tmp_path, result["contribution_id"], **{field: value})
265
+
266
+
267
+ @pytest.mark.parametrize("field", ["issue_id", "decision_id", "status", "reviewer", "decision_evidence"])
268
+ @pytest.mark.parametrize("value", [False, 7, {}, []])
269
+ def test_decision_scalar_text_is_strict(tmp_path, field, value):
270
+ result, _ = save(tmp_path)
271
+ args = {"issue_id": result["contribution_id"], "decision_id": str(uuid.uuid4()), "status": "triaged",
272
+ "reviewer": "human:test", "decision_evidence": "Reviewed", "expected_revision": 0}
273
+ args[field] = value
274
+ with pytest.raises(ValueError, match="must be a string"):
275
+ quality_decision_claims(tmp_path, **args)
276
+
277
+
278
+ def test_concurrent_decisions_and_old_replay_do_not_roll_back(tmp_path):
279
+ result, _ = save(tmp_path)
280
+ issue_id = result["contribution_id"]
281
+ requests = [decision(tmp_path, issue_id), decision(tmp_path, issue_id, status="under_review")]
282
+ def submit(args):
283
+ try:
284
+ return decide_quality_issue(tmp_path, **args)
285
+ except ValueError as exc:
286
+ assert "stale issue revision" in str(exc)
287
+ return None
288
+ with ThreadPoolExecutor(max_workers=2) as pool:
289
+ responses = list(pool.map(submit, requests))
290
+ assert sum(response is not None for response in responses) == 1
291
+ winner = requests[next(i for i, response in enumerate(responses) if response is not None)]
292
+ verifier = winner["approval_verifier"]
293
+ assert get_quality_issue(tmp_path, issue_id, verifier)["revision"] == 1
294
+ decide_quality_issue(tmp_path, **decision(tmp_path, issue_id, status="deferred", expected_revision=1))
295
+ assert decide_quality_issue(tmp_path, **winner)["idempotent_replay"]
296
+ current = get_quality_issue(tmp_path, issue_id, verifier)
297
+ assert current["status"] == "deferred" and current["revision"] == 2
298
+
299
+
300
+ def test_quality_client_to_real_mcp(tmp_path):
301
+ anyio = pytest.importorskip("anyio")
302
+ pytest.importorskip("mcp")
303
+ from mcp.client.session import ClientSession
304
+ from mcp.client.stdio import StdioServerParameters, stdio_client
305
+ from xrefkit.mcp.catalog import XRefCatalog
306
+ code_root = Path(__file__).resolve().parents[1]
307
+ root = tmp_path / "repository"
308
+ root.mkdir()
309
+ for directory in ("docs", "agent", "skills", "knowledge", "governance", "observations"):
310
+ shutil.copytree(code_root / directory, root / directory)
311
+ shutil.copy2(code_root / "ownership.yaml", root / "ownership.yaml")
312
+ subprocess.run(["git", "-C", str(root), "init", "-q"], check=True, capture_output=True)
313
+ subprocess.run(["git", "-C", str(root), "add", "."], check=True, capture_output=True)
314
+ catalog = XRefCatalog.build(root)
315
+ skill = catalog.get_skill("python_review")
316
+ skill_hash = hashlib.sha256(skill["skill_content"].encode()).hexdigest()
317
+ async def scenario(errlog):
318
+ parameters = StdioServerParameters(command=sys.executable, cwd=str(code_root), args=[
319
+ "-m", "xrefkit.mcp.server", "--repo", str(root), "--profile", "admin",
320
+ "--audit-log", str(tmp_path / "audit.jsonl"), "--contribution-approval-secret", SECRET])
321
+ async with stdio_client(parameters, errlog=errlog) as (read, write):
322
+ async with ClientSession(read, write) as session:
323
+ await session.initialize()
324
+ assert (await session.call_tool("list_quality_issues", {})).isError
325
+ assert not (await session.call_tool("get_startup_context", {})).isError
326
+ assert not (await session.call_tool("get_quality_issue_contract", {})).isError
327
+ evaluated = await session.call_tool("evaluate_instruction_feedback", {"feedback": report()["feedback"]})
328
+ assert evaluated.structuredContent["quality_issue_follow_up"]["automatic_submission"] is False
329
+ changed = report()["feedback"]
330
+ changed["attempts"][1].update(reason="requirement_change", scope_revision=1)
331
+ evaluated = await session.call_tool("evaluate_instruction_feedback", {"feedback": changed})
332
+ assert "quality_issue_follow_up" not in evaluated.structuredContent
333
+ args = fixture_args()
334
+ args["observation"].update(skill_id="python_review", skill_content_hash=skill_hash,
335
+ maturity_at_use=skill["maturity"])
336
+ args["knowledge_versions"] = []
337
+ await session.call_tool("get_skill", {"skill_id": "python_review"})
338
+ assert not (await session.call_tool("bind_skill_run", {
339
+ "run_id": args["observation"]["run_id"], "skill_id": "python_review"})).isError
340
+ result = await submit_quality_feedback(call_tool=session.call_tool, **args)
341
+ assert not result.isError, result
342
+ replay = await submit_quality_feedback(call_tool=session.call_tool, **args)
343
+ assert replay.structuredContent["idempotent_replay"]
344
+ rows = await session.call_tool("list_quality_issues", {})
345
+ assert len(rows.structuredContent["result"]) == 1
346
+ dargs = decision(root, args["contribution_id"])
347
+ dargs.pop("approval_verifier")
348
+ decided = await session.call_tool("decide_quality_issue", dargs)
349
+ assert not decided.isError, decided
350
+ detail = await session.call_tool("get_quality_issue", {"issue_id": args["contribution_id"]})
351
+ assert detail.structuredContent["status"] == "triaged"
352
+ assert len(detail.structuredContent["history"]) == 1
353
+ with tempfile.TemporaryFile(mode="w+", encoding="utf-8") as errlog:
354
+ anyio.run(scenario, errlog)
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.7.11"
5
+ __version__ = "0.7.12"