Full optimization cycle: Protocol (15 files): - 4-layer SSOT architecture for agent prompts & skills - Anti-Corruption Protocol consolidated from 5 duplicates - Tag-to-tier permissiveness matrix (all @tags allowed at all tiers) Axiom config: - complexity_rules: all 22+ tags available on C1-C5 - contract_type_overrides: removed (was narrowing per-type) - 18 new tags added, LAYER enum expanded (Infra, Frontend, Atom, etc.) - RELATION predicates expanded (USES, CONTAINS, BELONGS_TO, etc.) Code fixes: - 2216 @TAG: normalized to @TAG (colon→space) - 518 [DEF] blocks migrated to #region/#endregion (37 files) - VERIFIES→BINDS_TO, :Class/:Function suffixes removed, paths→IDs - 1173-line _external_stubs.py deleted (EXT: handled natively) - Batch EXT: reference audit (240 targets: 132 external, 99 internal, 9 fix) - QA regression check: 0 regressions across all checks Infrastructure: - DuckDB rebuild stabilized (appender API, INSERT OR IGNORE) - Anchor regex fix (parent-child BINDS_TO now resolves) - EXT:*/DTO:/NEED_CONTEXT: regex fixed in validator - 34MB Doxygen API portal (3194 contract pages)
3.5 KiB
3.5 KiB
Feature Request: Handle [EXT:*] targets in Axiom validator
Проблема
Сейчас Axiom-валидатор проверяет @RELATION PREDICATE -> [Target] на существование контракта с ID Target. Для кастомных контрактов это верно. Но для [EXT:*] (external references) это generates false unresolved_relation.
Пример бага:
# @RELATION DEPENDS_ON -> [EXT:Python:json]
# @RELATION DEPENDS_ON -> [EXT:Library:pydantic]
# @RELATION DEPENDS_ON -> [EXT:frontend:authStore]
Валидатор: «ищу контракт EXT:Python:json — не нашёл → unresolved_relation».
Временный костыль
Агент создал backend/src/schemas/_external_stubs.py — ~250 пустышек-контрактов:
# #region EXT:Library:pydantic [C:1] [TYPE External]
# @BRIEF External library stub — no code
# #endregion EXT:Library:pydantic
Проблемы костыля:
- 250 мусорных контрактов в индексе (шум в графе, раздувает DuckDB)
- Нужно поддерживать вручную — каждый новый EXT требует новой пустышки
- Ломает семантику:
EXT:означает «external, контракт не нужен»
Правильный фикс (Rust-код)
В валидаторе unresolved_relation нужно добавить проверку: если target начинается с EXT: — пропустить unresolved check.
Suggestion
// Сейчас:
fn check_resolved(target_id: &str, contracts: &ContractIndex) -> bool {
contracts.contains(target_id) // требует контракт для любого ID
}
// Должно быть:
fn check_resolved(target_id: &str, contracts: &ContractIndex) -> bool {
if target_id.starts_with("EXT:") {
return true; // external reference — контракт не нужен
}
contracts.contains(target_id)
}
Ожидаемый эффект
@RELATION CALLS -> [EXT:Python:json]→ not checked → 0 warnings@RELATION DEPENDS_ON -> [EXT:Library:pydantic]→ not checked → 0 warnings@RELATION BINDS_TO -> [EXT:frontend:authStore]→ not checked → 0 warnings- Можно полностью удалить
_external_stubs.py→ -250 шумовых контрактов
Альтернатива: registry approach
Если нужна валидация формата EXT, можно сделать registry разрешённых неймспейсов:
# axiom_config.yaml
external_namespaces:
- EXT:Python # Python stdlib
- EXT:Library # External PyPI/npm libraries
- EXT:frontend # Frontend stores/components
- EXT:path # File system paths
- EXT:code # Code expressions
- EXT:method # Method references
- EXT:docker # Docker/shell scripts
- EXT:internal # Internal module references
Тогда валидатор проверяет не наличие контракта, а формат: ^EXT:\w+:\S+$.
Что делать с существующим stubs-файлом
После фикса в Rust:
# 1. Удалить файл пустышек
rm backend/src/schemas/_external_stubs.py
# 2. Перестроить индекс
axiom_semantic_index rebuild rebuild_mode="full" use_duckdb=true
# 3. Аудит должен показать 0
axiom_semantic_validation audit_contracts