Files
Devour/.desloppify/subagents/runs/20260223_100953/results/batch-5.raw.txt
T
Tomas Dvorak 898a3c303f update
2026-02-24 10:33:59 +01:00

79 lines
4.9 KiB
Plaintext

{
"batch": "Cross-cutting Sweep",
"batch_index": 5,
"assessments": {
"error_consistency": 71.0
},
"dimension_notes": {
"error_consistency": {
"evidence": [
"Raw error passthrough is common in core flows (e.g., `return nil, err` in `internal/search/engine.go:114`, `internal/search/engine.go:122`, `internal/scraper/openapi.go:45`, `internal/scraper/openapi.go:50`) while nearby code wraps with operation context (e.g., `internal/search/engine.go:111`, `internal/scraper/openapi.go:153`).",
"Failure handling style diverges between aborting, propagating, and suppressing in similar backend paths: `panic(...)` in `internal/quality/plugins/go/plugin.go:363`, warning print-and-continue in `internal/indexer/indexer.go:239`, and plain returns in `cmd/scrape.go:90`/`cmd/get.go:59`.",
"Some call paths lose caller context at command boundaries (`cmd/scrape.go:90`, `cmd/scrape.go:125`, `cmd/get.go:59`) despite contextual wrapping being used in other command-layer branches (`cmd/scrape.go:131`, `cmd/scrape.go:145`)."
],
"impact_scope": "subsystem",
"fix_scope": "multi_file_refactor",
"confidence": "high"
}
},
"findings": [
{
"dimension": "error_consistency",
"identifier": "mixed_error_wrapping_in_scrape_and_search_paths",
"summary": "Related scrape/search paths mix raw passthrough and contextual wrapping.",
"related_files": [
"internal/search/engine.go",
"internal/scraper/openapi.go",
"internal/scraper/localsearch.go",
"cmd/scrape.go"
],
"evidence": [
"`internal/search/engine.go` frequently returns raw errors (`:114`, `:117`, `:122`, `:170`) but also uses contextual errors (`:111`, `:230`).",
"`internal/scraper/openapi.go` propagates raw errors from `readSpec`/`parseOpenAPISpec` (`:45`, `:50`, `:123`, `:141`, `:149`, `:157`, `:164`) while also defining wrapped errors (`:135`, `:153`, `:217`).",
"`internal/scraper/localsearch.go` returns raw errors from helper boundaries (`:79`, `:164`, `:191`, `:222`) mixed with rich wrapped messages in the same workflow (`:196`, `:203`, `:209`, `:217`)."
],
"suggestion": "Define a package-level rule: public methods must wrap downstream errors with operation context (using `%w`), and helper internals may return raw errors. Apply this consistently to `Rebuild/EnsureIndexed`, `OpenAPIScraper.Scrape/DetectChanges/readSpec`, and `LocalSearchScraper` methods.",
"confidence": "high",
"impact_scope": "subsystem",
"fix_scope": "multi_file_refactor"
},
{
"dimension": "error_consistency",
"identifier": "inconsistent_failure_channel_panic_vs_error_vs_warning",
"summary": "Failure signaling varies between panic, error return, and warning-only logging.",
"related_files": [
"internal/quality/plugins/go/plugin.go",
"internal/indexer/indexer.go",
"cmd/scrape.go"
],
"evidence": [
"`internal/quality/plugins/go/plugin.go:363` panics on plugin registration failure.",
"`internal/indexer/indexer.go:239` prints a warning and suppresses deletion errors instead of returning them.",
"`cmd/scrape.go` is structured around returned errors (`:131`, `:145`, `:207`) and has no panic-based handling, creating inconsistent contracts across subsystems."
],
"suggestion": "Standardize on explicit error returns for recoverable startup/runtime failures; replace plugin `panic` with registration error propagation or controlled process-exit at the command entrypoint, and make indexer deletion behavior explicit (either aggregate and return partial-failure errors or document/encode best-effort mode).",
"confidence": "high",
"impact_scope": "codebase",
"fix_scope": "architectural_change"
},
{
"dimension": "error_consistency",
"identifier": "command_boundary_context_loss",
"summary": "CLI command boundaries sometimes return raw errors without command context.",
"related_files": [
"cmd/get.go",
"cmd/scrape.go",
"internal/config/config.go"
],
"evidence": [
"`cmd/get.go:59` and `cmd/scrape.go:90`/`:125` return raw errors directly from downstream calls.",
"Other branches in the same command wrap with explicit context (`cmd/scrape.go:131`, `cmd/scrape.go:145`, `cmd/scrape.go:154`).",
"Config layer already emits contextual wrapped errors (`internal/config/config.go:177`, `internal/config/config.go:181`), so command-layer inconsistency creates uneven user-facing diagnostics."
],
"suggestion": "At CLI entrypoints, wrap all returned downstream errors with command/action context (e.g., `run get`, `load config`, `scrape source`) and preserve root cause with `%w`; keep user-readable validation errors as direct messages.",
"confidence": "high",
"impact_scope": "module",
"fix_scope": "multi_file_refactor"
}
]
}