mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 12:03:06 +00:00
167 lines
8.7 KiB
Plaintext
167 lines
8.7 KiB
Plaintext
{
|
|
"batch": "Full Codebase Sweep",
|
|
"batch_index": 6,
|
|
"assessments": {
|
|
"cross_module_architecture": 74.0,
|
|
"error_consistency": 68.0,
|
|
"abstraction_fitness": 62.0,
|
|
"test_strategy": 55.0,
|
|
"design_coherence": 64.0
|
|
},
|
|
"dimension_notes": {
|
|
"cross_module_architecture": {
|
|
"evidence": [
|
|
"`cmd/root.go` relies on blank import `_ \"github.com/yourorg/devour/internal/scraper/external\"` to activate runtime registration side effects.",
|
|
"`internal/scraper/external/register.go` mutates global scraper registry in `init()` for all language scrapers.",
|
|
"`internal/scraper/registry_simple.go` uses global mutable registry (`globalRegistry`) shared process-wide, increasing hidden coupling and order sensitivity."
|
|
],
|
|
"impact_scope": "subsystem",
|
|
"fix_scope": "architectural_change",
|
|
"confidence": "high"
|
|
},
|
|
"error_consistency": {
|
|
"evidence": [
|
|
"`cmd/root.go` and `cmd/scorecard.go` terminate with `os.Exit`, while most command flows return wrapped errors.",
|
|
"`internal/quality/plugins/go/plugin.go` panics during plugin registration (`panic(fmt.Sprintf(...))`) instead of surfacing an error contract.",
|
|
"`cleanup_unused.go` uses `log.Fatal` and mixed logging/exit style unlike the rest of the codebase's `fmt.Errorf(...%w...)` propagation."
|
|
],
|
|
"impact_scope": "codebase",
|
|
"fix_scope": "multi_file_refactor",
|
|
"confidence": "high"
|
|
},
|
|
"abstraction_fitness": {
|
|
"evidence": [
|
|
"Language-specific scraper implementations (`internal/scraper/external/godocs.go`, `internal/scraper/external/rustdocs.go`, `internal/scraper/external/reactdocs.go`, and peers) repeat near-identical HTTP fetch/hash/error scaffolding with only parser/document mapping differences.",
|
|
"`internal/scraper/external/types.go` is a thin alias layer over `internal/scraper` types and does not enforce additional policy or invariants.",
|
|
"High repeated constructor/scrape boilerplate across external scrapers indicates abstraction cost is paid repeatedly without shared leverage."
|
|
],
|
|
"impact_scope": "subsystem",
|
|
"fix_scope": "architectural_change",
|
|
"confidence": "high",
|
|
"sub_axes": {
|
|
"abstraction_leverage": 58.0,
|
|
"indirection_cost": 72.0,
|
|
"interface_honesty": 70.0
|
|
}
|
|
},
|
|
"test_strategy": {
|
|
"evidence": [
|
|
"Critical runtime surfaces have no direct tests: `internal/server/server.go`, `pkg/client/client.go`, `internal/vector/store.go`, `internal/search/engine.go`, `internal/indexer/indexer.go`.",
|
|
"`pkg/client/client.go` has TODO stubs returning `nil, nil` for `Query` and `Status`, but there are no tests asserting failure behavior or contract correctness.",
|
|
"`internal/server/server.go` Start methods are TODO/no-op `nil` returns and remain unvalidated by tests, creating false-green behavior for unimplemented paths."
|
|
],
|
|
"impact_scope": "codebase",
|
|
"fix_scope": "multi_file_refactor",
|
|
"confidence": "high"
|
|
},
|
|
"design_coherence": {
|
|
"evidence": [
|
|
"`cmd/quality.go` (695 LOC) mixes CLI wiring, scan orchestration, status persistence, scoring output, resolution updates, fixer execution, and review import/export in one file.",
|
|
"`cmd/scrape.go` (444 LOC) combines source parsing, source-type inference, profile heuristics, scrape orchestration, persistence, and source-state hashing.",
|
|
"These large command files show recurring multi-responsibility patterns rather than cohesive command/use-case units."
|
|
],
|
|
"impact_scope": "module",
|
|
"fix_scope": "multi_file_refactor",
|
|
"confidence": "high"
|
|
}
|
|
},
|
|
"findings": [
|
|
{
|
|
"dimension": "cross_module_architecture",
|
|
"identifier": "init_side_effect_registration_coupling",
|
|
"summary": "Scraper registration depends on import-time side effects and global mutable registry state.",
|
|
"related_files": [
|
|
"cmd/root.go",
|
|
"internal/scraper/external/register.go",
|
|
"internal/scraper/registry_simple.go"
|
|
],
|
|
"evidence": [
|
|
"Blank import in root command triggers registration implicitly rather than explicit bootstrap wiring.",
|
|
"Registration happens in `init()` and mutates shared global registry."
|
|
],
|
|
"suggestion": "Replace import-time registration with explicit bootstrap registration (e.g., `RegisterExternalScrapers()` called from startup), and pass registry instances through constructors to remove hidden global coupling.",
|
|
"confidence": "high",
|
|
"impact_scope": "subsystem",
|
|
"fix_scope": "architectural_change"
|
|
},
|
|
{
|
|
"dimension": "error_consistency",
|
|
"identifier": "mixed_process_termination_and_error_propagation",
|
|
"summary": "Error handling mixes panic/log.Fatal/os.Exit with returned errors across adjacent layers.",
|
|
"related_files": [
|
|
"cmd/root.go",
|
|
"cmd/scorecard.go",
|
|
"internal/quality/plugins/go/plugin.go",
|
|
"cleanup_unused.go"
|
|
],
|
|
"evidence": [
|
|
"`Execute()` exits process directly; scorecard helper exits inside utility flow; plugin registration panics on failure.",
|
|
"Most other command paths return wrapped errors, creating inconsistent failure semantics."
|
|
],
|
|
"suggestion": "Standardize on returning errors from library/command internals and only perform process exit in one top-level entrypoint; replace panic/log.Fatal in shared code with typed/wrapped errors.",
|
|
"confidence": "high",
|
|
"impact_scope": "codebase",
|
|
"fix_scope": "multi_file_refactor"
|
|
},
|
|
{
|
|
"dimension": "abstraction_fitness",
|
|
"identifier": "external_scraper_boilerplate_without_shared_base",
|
|
"summary": "External scraper implementations duplicate fetch/hash/error/document plumbing instead of sharing a base abstraction.",
|
|
"related_files": [
|
|
"internal/scraper/external/godocs.go",
|
|
"internal/scraper/external/rustdocs.go",
|
|
"internal/scraper/external/reactdocs.go",
|
|
"internal/scraper/external/nuxtdocs.go",
|
|
"internal/scraper/external/cloudflaredocs.go",
|
|
"internal/scraper/external/types.go"
|
|
],
|
|
"evidence": [
|
|
"Each scraper repeats `fetchPage`, status code checks, hash generation, and near-identical scrape control flow.",
|
|
"Alias-only types file adds indirection without behavior."
|
|
],
|
|
"suggestion": "Introduce a shared external-scraper base/helper for HTTP fetch, retries, hashing, and common error mapping; keep only parser-specific extraction and document shaping in each language scraper.",
|
|
"confidence": "high",
|
|
"impact_scope": "subsystem",
|
|
"fix_scope": "architectural_change"
|
|
},
|
|
{
|
|
"dimension": "test_strategy",
|
|
"identifier": "untested_unimplemented_runtime_paths",
|
|
"summary": "Core runtime paths are both under-tested and partially stubbed, leaving high-risk behavior unvalidated.",
|
|
"related_files": [
|
|
"internal/server/server.go",
|
|
"pkg/client/client.go",
|
|
"internal/vector/store.go",
|
|
"internal/search/engine.go",
|
|
"internal/indexer/indexer.go"
|
|
],
|
|
"evidence": [
|
|
"Server/client/store contain TODO or not-implemented branches without direct tests.",
|
|
"No direct test files exist for several core modules that govern querying, indexing, and serving."
|
|
],
|
|
"suggestion": "Add table-driven tests for client/server/store/indexer contracts first (error behavior and non-nil results), then implement missing paths behind those tests; prioritize integration tests that exercise scrape->index->query flow.",
|
|
"confidence": "high",
|
|
"impact_scope": "codebase",
|
|
"fix_scope": "multi_file_refactor"
|
|
},
|
|
{
|
|
"dimension": "design_coherence",
|
|
"identifier": "command_files_mix_multiple_responsibilities",
|
|
"summary": "Large CLI command files blend orchestration, domain logic, persistence, and formatting concerns.",
|
|
"related_files": [
|
|
"cmd/quality.go",
|
|
"cmd/scrape.go",
|
|
"cmd/ask.go"
|
|
],
|
|
"evidence": [
|
|
"`cmd/quality.go` combines scan setup, scoring/status persistence, resolve/fix/review workflows.",
|
|
"`cmd/scrape.go` combines config parsing, source detection/profiling, scrape execution, indexing, and source-state updates.",
|
|
"`cmd/ask.go` includes query derivation, source URL heuristics, ranking, summarization, and output formatting in one command module."
|
|
],
|
|
"suggestion": "Split command files into focused packages (transport/CLI binding vs service layer vs persistence helpers) and keep Cobra handlers as thin adapters invoking composable use-case functions.",
|
|
"confidence": "high",
|
|
"impact_scope": "module",
|
|
"fix_scope": "multi_file_refactor"
|
|
}
|
|
]
|
|
} |