0.5.1-pre.002
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_khadhroony_workspace_rules.py
|
||||
# version: 17
|
||||
# version: 18
|
||||
|
||||
"""Audit mechanically verifiable rules specific to khadhroony-bot3."""
|
||||
|
||||
@@ -51,7 +51,7 @@ def audit_tracing(root: pathlib.Path) -> list[Violation]:
|
||||
violations: list[Violation] = []
|
||||
for cargo in sorted(root.glob("*/Cargo.toml")):
|
||||
crate = cargo.parent
|
||||
if crate.name == "kb-lib":
|
||||
if crate.name == "ks-lib":
|
||||
continue
|
||||
if not relevant_tracing_crate(crate):
|
||||
continue
|
||||
@@ -82,11 +82,11 @@ def audit_tracing(root: pathlib.Path) -> list[Violation]:
|
||||
return violations
|
||||
|
||||
|
||||
def audit_kb_lib_tracing(root: pathlib.Path) -> list[Violation]:
|
||||
"""Audit hierarchical tracing targets owned by operational kb-lib components."""
|
||||
def audit_ks_lib_tracing(root: pathlib.Path) -> list[Violation]:
|
||||
"""Audit hierarchical tracing targets owned by operational ks-lib components."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
crate = root / "kb-lib"
|
||||
crate = root / "ks-lib"
|
||||
crate_root = crate / "src/lib.rs"
|
||||
if not crate_root.exists():
|
||||
return violations
|
||||
@@ -177,8 +177,8 @@ def audit_solana_types(root: pathlib.Path) -> list[Violation]:
|
||||
return violations
|
||||
|
||||
|
||||
def audit_kb_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]:
|
||||
"""Require stable family prefixes on non-method kb-lib declarations."""
|
||||
def audit_ks_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]:
|
||||
"""Require stable family prefixes on non-method ks-lib declarations."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
families = {
|
||||
@@ -194,7 +194,7 @@ def audit_kb_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]:
|
||||
r"([A-Za-z_][A-Za-z0-9_]*)"
|
||||
)
|
||||
for family, prefixes in families.items():
|
||||
family_root = root / "kb-lib/src" / family
|
||||
family_root = root / "ks-lib/src" / family
|
||||
paths = [family_root.with_suffix(".rs")]
|
||||
if family_root.is_dir():
|
||||
paths.extend(sorted(family_root.rglob("*.rs")))
|
||||
@@ -227,7 +227,7 @@ def audit_reserved_decoder_scaffolds(root: pathlib.Path) -> list[Violation]:
|
||||
"""Reject incomplete reserved decoder contracts."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
decoder_root = root / "kb-lib/src/decoder"
|
||||
decoder_root = root / "ks-lib/src/decoder"
|
||||
forbidden = (
|
||||
"MIGRATION_BOUNDARIES",
|
||||
"LEGACY_CRATE",
|
||||
@@ -298,7 +298,7 @@ def audit_reserved_materializer_scaffolds(root: pathlib.Path) -> list[Violation]
|
||||
"""Reject incomplete reserved materializer contracts."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
materializer_root = root / "kb-lib/src/materializer"
|
||||
materializer_root = root / "ks-lib/src/materializer"
|
||||
forbidden = (
|
||||
"MIGRATION_BOUNDARIES",
|
||||
"LEGACY_CRATE",
|
||||
@@ -437,7 +437,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
"""Audit materializer names, constants and component facade structure."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
materializer_root = root / "kb-lib/src/materializer"
|
||||
materializer_root = root / "ks-lib/src/materializer"
|
||||
component_pattern = re.compile(
|
||||
r'pub\(crate\) const (MT_[A-Z0-9_]+)_COMPONENT_NAME: &str\s*=\s*"([^"]+)";'
|
||||
)
|
||||
@@ -524,7 +524,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_MT017",
|
||||
"kb-lib/src/materializer",
|
||||
"ks-lib/src/materializer",
|
||||
1,
|
||||
"materializer component names must be unique",
|
||||
)
|
||||
@@ -533,7 +533,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_MT018",
|
||||
"kb-lib/src/materializer",
|
||||
"ks-lib/src/materializer",
|
||||
1,
|
||||
"materializer processor names must be unique",
|
||||
)
|
||||
@@ -699,7 +699,7 @@ def audit_reserved_executor_scaffolds(root: pathlib.Path) -> list[Violation]:
|
||||
"""Reject incomplete reserved executor contracts."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
executor_root = root / "kb-lib/src/executor"
|
||||
executor_root = root / "ks-lib/src/executor"
|
||||
forbidden = (
|
||||
"MIGRATION_BOUNDARIES",
|
||||
"LEGACY_CRATE",
|
||||
@@ -778,7 +778,7 @@ def audit_reserved_executor_scaffolds(root: pathlib.Path) -> list[Violation]:
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_EX007",
|
||||
"kb-lib/src/executor",
|
||||
"ks-lib/src/executor",
|
||||
1,
|
||||
f"expected 103 reserved executor boundaries, found {reserved_count}",
|
||||
)
|
||||
@@ -801,7 +801,7 @@ def audit_token_2022_naming(root: pathlib.Path) -> list[Violation]:
|
||||
root / "docs/rules/RULES_GENERAL.md",
|
||||
root / "docs/rules/RULES_RUST.md",
|
||||
root / "docs/rules/RULES_SPECIFIC_KHADHROONY.md",
|
||||
root / "kb-lib/README.md",
|
||||
root / "ks-lib/README.md",
|
||||
]
|
||||
candidates.extend(sorted((root / "docs").glob("*.md")))
|
||||
for path in candidates:
|
||||
@@ -822,8 +822,8 @@ def audit_token_2022_naming(root: pathlib.Path) -> list[Violation]:
|
||||
return violations
|
||||
|
||||
|
||||
def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violation]:
|
||||
"""Reject documentation that presents private kb-lib modules as public APIs."""
|
||||
def audit_private_ks_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violation]:
|
||||
"""Reject documentation that presents private ks-lib modules as public APIs."""
|
||||
|
||||
violations: list[Violation] = []
|
||||
candidates = [
|
||||
@@ -833,12 +833,12 @@ def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violat
|
||||
root / "docs/rules/RULES_GENERAL.md",
|
||||
root / "docs/rules/RULES_RUST.md",
|
||||
root / "docs/rules/RULES_SPECIFIC_KHADHROONY.md",
|
||||
root / "kb-lib/README.md",
|
||||
root / "kb-program-ids/README.md",
|
||||
root / "ks-lib/README.md",
|
||||
root / "ks-program-ids/README.md",
|
||||
]
|
||||
candidates.extend(sorted((root / "docs").glob("*.md")))
|
||||
candidates.extend(sorted((root / "docs").glob("*.json")))
|
||||
pattern = re.compile(r"kb_lib::(?:decoder|executor|materializer|model)::")
|
||||
pattern = re.compile(r"ks_lib::(?:decoder|executor|materializer|model)::")
|
||||
for path in candidates:
|
||||
if not path.is_file():
|
||||
continue
|
||||
@@ -851,7 +851,7 @@ def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violat
|
||||
"KH_API001",
|
||||
relative,
|
||||
index,
|
||||
f"private kb-lib module path `{match.group(0)}` is forbidden in active documentation",
|
||||
f"private ks-lib module path `{match.group(0)}` is forbidden in active documentation",
|
||||
)
|
||||
)
|
||||
return violations
|
||||
@@ -930,14 +930,14 @@ def main() -> int:
|
||||
root = pathlib.Path(arguments.root).resolve()
|
||||
violations = (
|
||||
audit_tracing(root)
|
||||
+audit_kb_lib_tracing(root)
|
||||
+audit_kb_lib_symbol_prefixes(root)
|
||||
+audit_ks_lib_tracing(root)
|
||||
+audit_ks_lib_symbol_prefixes(root)
|
||||
+audit_reserved_decoder_scaffolds(root)
|
||||
+audit_reserved_materializer_scaffolds(root)
|
||||
+audit_materializer_conventions(root)
|
||||
+audit_reserved_executor_scaffolds(root)
|
||||
+audit_token_2022_naming(root)
|
||||
+audit_private_kb_lib_paths_in_active_docs(root)
|
||||
+audit_private_ks_lib_paths_in_active_docs(root)
|
||||
+audit_solana_types(root)
|
||||
+audit_wincode_resolution(root)
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_rust_general_rules.py
|
||||
# version: 9
|
||||
# version: 10
|
||||
|
||||
"""Audit mechanically verifiable Rust rules shared by all Rust projects."""
|
||||
|
||||
@@ -117,8 +117,8 @@ def audit_file(root: pathlib.Path, path: pathlib.Path) -> list[Violation]:
|
||||
previous_export_key: tuple[object, ...] | None = None
|
||||
blank_since_export = False
|
||||
crate_visibility_seen = False
|
||||
enforce_visibility_order = relative == "kb-lib/src/lib.rs" or relative.startswith(
|
||||
"kb-lib/src/executor"
|
||||
enforce_visibility_order = relative == "ks-lib/src/lib.rs" or relative.startswith(
|
||||
"ks-lib/src/executor"
|
||||
)
|
||||
for index, line in enumerate(lines, 1):
|
||||
if not line.strip():
|
||||
|
||||
Reference in New Issue
Block a user