feat: attention-optimized semantic protocol v2.7

Core changes:
- Add @defgroup/@ingroup to 1791 C2+ contracts (555 files) for HCA 128× pre-training DSA grouping
- Add §0.1 Pre-Training Frequency matrix to semantics-core
- Add §VIII Attention Architecture rules (ATTN_1-4) with MLA/CSA/HCA/DSA mechanics
- Add @defgroup/@ingroup to canonical syntax (§II) and all contract examples

Agent prompts (5 files):
- Add ZERO-STATE RATIONALE with MLA/CSA/HCA/DSA compression mechanics
- Add pre-training note: @RATIONALE/@REJECTED are in-context learned tags
- svelte-coder: add missing #region contract, fix Svelte rule violations
- python-coder/fullstack-coder: honor function contracts from speckit plan
- qa-tester: add attention compliance audit (P3 ATTN_1-4 checks)

Skills (6 files):
- Translate all axiom_config descriptions to English
- Fix doc_dirs to index .opencode/ and .specify/
- Deduplicate 5× complexity_rules → single global_tags catalog
- Reduce semantics-svelte 591→485 lines (remove duplicate code blocks)
- Fix semantics-testing: 'Short IDs' → 'Short hierarchical IDs'
- Fix all examples: flat IDs → hierarchical Domain.Name format
- Fix Svelte examples: replace raw Tailwind + <button> with semantic tokens + /ui

Speckit workflow (commands + templates):
- speckit.plan: add Function-Level Contracts for C3+ with @PRE/@POST/@TEST_EDGE
- speckit.plan: add Attention Compliance Gate (ATTN_1-4 before contract generation)
- speckit.tasks: add function contract inlining format (constraints in task description)
- speckit.specify: load semantics-core for spec density rules
- spec-template: add #region contract, @SEMANTICS grouping, hierarchical IDs
- ux-reference-template: add #region wrapper
- plan-template: add attention gate, @defgroup/@ingroup guidance
- tasks-template: add attention audit + rebuild + orphan check tasks
- constitution.md: translate to English, add Principle VIII (attention-optimized contracts)

Reference modules rewritten (hierarchical IDs + full contracts):
- Auth.Jwt: 6 child contracts with @RATIONALE/@REJECTED/@TEST_EDGE
- Api.Auth: 5 endpoints with @TEST_EDGE + molecular CoT markers
- Migration.Model: @defgroup Migration with 18 @ACTION + 6 @INVARIANT

Scripts:
- add_defgroup_ingroup.py: zero-risk additive @ingroup migration (1791 insertions)
- migrate_hierarchical.py: flat→hierarchical ID dry-run analysis (792 contracts)
- merge_prompts.py: merge all prompts/skills/commands into one review file

Config:
- axiom_config.yaml: 749→395 lines (-47%), English, doc_dirs include prompts
- Fix test_datasets.py import collision (rename → test_datasets_routes.py)
- Fix test_preview.py: SupersetClient→get_superset_client, AsyncMock, logger f-string
This commit is contained in:
2026-06-08 16:30:59 +03:00
parent db16886ce4
commit b5e741077d
562 changed files with 2523 additions and 244 deletions

View File

@@ -1,4 +1,5 @@
# #region SettingsRouter [C:5] [TYPE Module] [SEMANTICS fastapi, api, superset, logging-config-response]
# @defgroup Api Module group.
#
# @BRIEF Provides API endpoints for managing application settings and Superset environments.
# @LAYER API
@@ -91,6 +92,7 @@ async def _validate_superset_connection_fast(env: Environment) -> None:
# #region get_settings [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Retrieves all application settings.
# @PRE Config manager is available.
# @POST Returns masked AppConfig.
@@ -145,6 +147,7 @@ async def get_allowed_languages(
# #region update_global_settings [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Updates global application settings.
# @PRE New settings are provided.
# @POST Global settings are updated.
@@ -165,6 +168,7 @@ async def update_global_settings(
# #region get_storage_settings [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Retrieves storage-specific settings.
@router.get("/storage", response_model=StorageConfig)
async def get_storage_settings(
@@ -179,6 +183,7 @@ async def get_storage_settings(
# #region update_storage_settings [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Updates storage-specific settings.
# @POST Storage settings are updated and saved.
@router.put("/storage", response_model=StorageConfig)
@@ -202,6 +207,7 @@ async def update_storage_settings(
# #region get_environments [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Lists all configured Superset environments.
# @PRE Config manager is available.
# @POST Returns list of environments.
@@ -223,6 +229,7 @@ async def get_environments(
# #region add_environment [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Adds a new Superset environment.
# @PRE Environment data is valid and reachable.
# @POST Environment is added to config.
@@ -255,6 +262,7 @@ async def add_environment(
# #region update_environment [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Updates an existing Superset environment.
# @PRE ID and valid environment data are provided.
# @POST Environment is updated in config.
@@ -298,6 +306,7 @@ async def update_environment(
# #region delete_environment [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Deletes a Superset environment.
# @PRE ID is provided.
# @POST Environment is removed from config.
@@ -315,6 +324,7 @@ async def delete_environment(
# #region test_environment_connection [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Tests the connection to a Superset environment.
# @PRE ID is provided.
# @POST Returns success or error status.
@@ -348,6 +358,7 @@ async def test_environment_connection(
# #region get_logging_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Retrieves current logging configuration.
# @PRE Config manager is available.
# @POST Returns logging configuration.
@@ -369,6 +380,7 @@ async def get_logging_config(
# #region update_logging_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Updates logging configuration.
# @PRE New logging config is provided.
# @POST Logging configuration is updated and saved.
@@ -417,6 +429,7 @@ class ConsolidatedSettingsResponse(BaseModel):
# #region get_consolidated_settings [C:4] [TYPE Function]
# @ingroup Api
# @BRIEF Retrieves all settings categories in a single call.
# @PRE Config manager is available and the caller holds admin settings read permission.
# @POST Returns consolidated settings, provider metadata, and persisted notification payload in one stable response.
@@ -500,6 +513,7 @@ async def get_consolidated_settings(
# #region update_consolidated_settings [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Bulk update application settings from the consolidated view.
# @PRE User has admin permissions, config is valid.
# @POST Settings are updated and saved via ConfigManager.
@@ -569,6 +583,7 @@ async def update_consolidated_settings(
# #region get_validation_policies [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Lists all validation policies.
@router.get("/automation/policies", response_model=list[ValidationPolicyResponse])
async def get_validation_policies(
@@ -582,6 +597,7 @@ async def get_validation_policies(
# #region create_validation_policy [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Creates a new validation policy.
@router.post("/automation/policies", response_model=ValidationPolicyResponse)
async def create_validation_policy(
@@ -601,6 +617,7 @@ async def create_validation_policy(
# #region update_validation_policy [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Updates an existing validation policy.
@router.patch("/automation/policies/{id}", response_model=ValidationPolicyResponse)
async def update_validation_policy(
@@ -627,6 +644,7 @@ async def update_validation_policy(
# #region delete_validation_policy [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Deletes a validation policy.
@router.delete("/automation/policies/{id}")
async def delete_validation_policy(
@@ -648,6 +666,7 @@ async def delete_validation_policy(
# #region get_translation_schedules [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Lists all translation schedules joined with translation job names.
@router.get("/automation/translation-schedules", response_model=list[TranslationScheduleItem])
async def get_translation_schedules(