e3c8979e8d
- cmd/fn/doctor.go - cmd/fn/main.go - cpp/apps/primitives_gallery/playground/tables/CMakeLists.txt - cpp/apps/primitives_gallery/playground/tables/data_table.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.h - cpp/apps/primitives_gallery/playground/tables/self_test.cpp - cpp/apps/primitives_gallery/playground/tables/tql.cpp - cpp/apps/primitives_gallery/playground/tables/viz.cpp - cpp/apps/primitives_gallery/playground/tables/viz.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.4 KiB
2.4 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, params, output
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | params | output | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| vault_doctor | function | go | infra | 1.0.0 | impure | func VaultDoctor(repoRoot string) ([]VaultDoctorEntry, error) | Audita la salud de todos los vaults declarados en projects/*/vaults/vault.yaml. Comprueba existencia del directorio, layout estándar, presencia del índice, staleness y drift entre disco e índice. Read-only. |
|
|
false | error_go_core |
|
true |
|
functions/infra/vault_doctor_test.go | functions/infra/vault_doctor.go |
|
Slice de VaultDoctorEntry con Status (ok/warning/error), Issues, DiskFiles, IndexedFiles y LastIndexedAt por vault. Error fatal solo si los manifests no se pueden leer. |
Checks aplicados
| Check | Condición | Severidad |
|---|---|---|
directory_missing |
e.Path no existe en disco |
error |
layout_missing |
no hay data/ ni knowledge/ en la raíz del vault |
warning |
non_standard_layout |
no hay data//knowledge/ pero sí otros subdirectorios (ej. imagegen_models) |
warning |
index_missing |
no existe vault_index.db |
warning |
index_stale |
algún archivo en disco tiene mtime > MAX(indexed_at) | warning |
index_drift |
count disco != count en tabla files |
warning |
empty_vault |
DiskFiles == 0 | warning |
Ejemplo
entries, err := infra.VaultDoctor("/home/lucas/fn_registry")
for _, e := range entries {
fmt.Printf("%-30s %-8s files=%d issues=%v\n",
e.VaultName, e.Status, e.DiskFiles, e.Issues)
}
Notas
- Función read-only: nunca escribe en disco ni en ninguna base de datos.
countDiskFilesusafilepath.WalkDirsin hash (cheap) — excluyevault_index.db*,.git/y ficheros ocultos.isIndexStaletambién usa WalkDir; compara mtime de archivos con MAX(indexed_at) de la BD.- El VaultIndexOpen de sólo lectura no crea el DB (si no existe, retorna error y se reporta
index_missing).