Cleanup: Remove temporary scripts from local root.
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
# Paths
|
|
||||||
API_VENV = "/home/scott/OSIT_dev/aether_api_fastapi/environment/bin/python3"
|
|
||||||
SCHEMA_SCRIPT = "/home/scott/agents_sync/scripts/schema_sync.py"
|
|
||||||
OUTPUT_FILE = "/home/scott/agents_sync/technical/aether_interfaces.ts"
|
|
||||||
|
|
||||||
def main():
|
|
||||||
print(f"Starting E2E Schema Sync...")
|
|
||||||
|
|
||||||
# Run schema_sync.py without arguments to get JSON
|
|
||||||
try:
|
|
||||||
result = subprocess.run(
|
|
||||||
[API_VENV, SCHEMA_SCRIPT],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
full_schema = json.loads(result.stdout)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error getting schema JSON: {e}")
|
|
||||||
print(f"Stdout: {result.stdout if 'result' in locals() else 'N/A'}")
|
|
||||||
print(f"Stderr: {result.stderr if 'result' in locals() else 'N/A'}")
|
|
||||||
return
|
|
||||||
|
|
||||||
ts_content = [
|
|
||||||
"/**",
|
|
||||||
" * Aether Unified Type Definitions",
|
|
||||||
" * Generated by backend_fastapi agent",
|
|
||||||
" */",
|
|
||||||
""
|
|
||||||
]
|
|
||||||
|
|
||||||
for obj_type, data in full_schema.items():
|
|
||||||
interface_name = data['interface_name']
|
|
||||||
ts_content.append(f"export interface {interface_name} {{")
|
|
||||||
for f in data['fields']:
|
|
||||||
opt = "?" if f['optional'] else ""
|
|
||||||
ts_content.append(f" {f['name']}{opt}: {f['type']};")
|
|
||||||
ts_content.append("}")
|
|
||||||
ts_content.append("")
|
|
||||||
|
|
||||||
# Ensure output dir exists
|
|
||||||
os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
|
|
||||||
|
|
||||||
with open(OUTPUT_FILE, "w") as f:
|
|
||||||
f.write("\n".join(ts_content))
|
|
||||||
|
|
||||||
print(f"Successfully exported {len(full_schema)} interfaces to {OUTPUT_FILE}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Setup path to include the app directory
|
|
||||||
sys.path.append(os.getcwd())
|
|
||||||
|
|
||||||
def verify_searchable_fields():
|
|
||||||
try:
|
|
||||||
from app.ae_obj_types_def import obj_type_kv_li
|
|
||||||
except ImportError as e:
|
|
||||||
print(f"Error importing object definitions: {e}")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"{'Object Type':<30} | {'Status':<10} | {'Issues'}")
|
|
||||||
print("-" * 120)
|
|
||||||
|
|
||||||
total_objects = 0
|
|
||||||
mismatched_fields = 0
|
|
||||||
missing_searchable_attr = 0
|
|
||||||
|
|
||||||
for obj_type, def_kv in obj_type_kv_li.items():
|
|
||||||
total_objects += 1
|
|
||||||
searchable_fields = def_kv.get('searchable_fields', [])
|
|
||||||
model = def_kv.get('mdl')
|
|
||||||
|
|
||||||
if not searchable_fields:
|
|
||||||
missing_searchable_attr += 1
|
|
||||||
print(f"{obj_type:<30} | WARNING | No searchable_fields defined")
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not model:
|
|
||||||
print(f"{obj_type:<30} | ERROR | No model (mdl) defined")
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not hasattr(model, '__fields__'):
|
|
||||||
print(f"{obj_type:<30} | SKIP | Model {model.__name__} has no __fields__")
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Collect all valid field names: variable names AND aliases
|
|
||||||
valid_fields = set()
|
|
||||||
for field_name, field_obj in model.__fields__.items():
|
|
||||||
valid_fields.add(field_name)
|
|
||||||
if field_obj.alias:
|
|
||||||
valid_fields.add(field_obj.alias)
|
|
||||||
|
|
||||||
mismatches = [f for f in searchable_fields if f not in valid_fields]
|
|
||||||
|
|
||||||
if mismatches:
|
|
||||||
mismatched_fields += len(mismatches)
|
|
||||||
print(f"{obj_type:<30} | MISMATCH | {', '.join(mismatches)}")
|
|
||||||
|
|
||||||
print("-" * 120)
|
|
||||||
print(f"Summary:")
|
|
||||||
print(f"Total Objects Checked: {total_objects}")
|
|
||||||
print(f"Objects missing searchable_fields: {missing_searchable_attr}")
|
|
||||||
print(f"Total Field Mismatches found: {mismatched_fields}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
verify_searchable_fields()
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
from sqlalchemy import text
|
|
||||||
|
|
||||||
# Setup path to include the app directory
|
|
||||||
sys.path.append(os.getcwd())
|
|
||||||
|
|
||||||
def verify_all():
|
|
||||||
try:
|
|
||||||
from app.ae_obj_types_def import obj_type_kv_li
|
|
||||||
from app.db_connection import engine
|
|
||||||
except ImportError as e:
|
|
||||||
print(f"Error importing dependencies: {e}")
|
|
||||||
return
|
|
||||||
|
|
||||||
for obj_type, def_kv in obj_type_kv_li.items():
|
|
||||||
if obj_type != 'activity_log': continue
|
|
||||||
|
|
||||||
searchable_fields = def_kv.get('searchable_fields', [])
|
|
||||||
table_name = def_kv.get('tbl_default') or def_kv.get('tbl')
|
|
||||||
|
|
||||||
db_valid_fields = set()
|
|
||||||
if table_name:
|
|
||||||
try:
|
|
||||||
with engine.connect() as conn:
|
|
||||||
# Use a standard SQL query to get column names
|
|
||||||
result = conn.execute(text(f"SHOW COLUMNS FROM `{table_name}`"))
|
|
||||||
for row in result:
|
|
||||||
db_valid_fields.add(row[0])
|
|
||||||
except Exception as e:
|
|
||||||
print(f"DB Error for {table_name}: {e}")
|
|
||||||
|
|
||||||
print(f"Object: {obj_type}")
|
|
||||||
print(f"Table: {table_name}")
|
|
||||||
print(f"Fields: {db_valid_fields}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
verify_all()
|
|
||||||
Reference in New Issue
Block a user