Repository navigation
refactor: provider cleanup — remove deprecated fields, generalize taxonomy, add streaming protocol - #180
Conversation
yvonnedevlinrh
left a comment
There was a problem hiding this comment.
CI Status
| Check | Status |
|---|---|
| Unit + Integration Tests (Go 1.24) | ✅ PASS |
| Unit + Integration Tests (Go 1.25) | ✅ PASS |
| E2E Tests (Go 1.24) | ✅ PASS |
| E2E Tests (Go 1.25) | ✅ PASS |
| MegaLinter | ✅ PASS |
Summary
Well-structured cleanup PR completing Phase 3 of the external analyzer protocol initiative (#95). Removes deprecated backward-compatibility shims (ContractCoverageFunc, SSADegradedPackages), deduplicates isMainPkg, relocates BuildContractCoverageFunc to goprovider/, generalizes the taxonomy for multi-language support (GoVersion → LanguageVersion, Language field, 7 neutral SideEffectType aliases), and adds optional streaming protocol mode (analyze/stream with JSONL). All spec capabilities delivered, all CI checks pass, constitution compliance verified.
Findings
[MEDIUM] findModuleRoot duplication (CS-004/DRY) — internal/crap/coverage.go:257 introduces a local copy of findModuleRoot to avoid importing internal/loader. However, internal/loader is not Go-specific — it provides module root discovery, a language-neutral filesystem operation. This creates a second copy alongside the canonical loader.FindModuleRoot (internal/loader/loader.go:136). Consider keeping the loader.FindModuleRoot import instead, or documenting a stronger justification for the duplication in the design.
[LOW] Trailing blank lines — internal/provider/goprovider/sideeffect.go ends with two extra blank lines (108-109) after removing the local isMainPkg function.
[LOW] Missing trailing newline — openspec/changes/provider-cleanup/design.md and proposal.md lack a trailing newline at EOF.
Verdict
APPROVE — Spec-aligned, all CI green, no security or constitution concerns. The MEDIUM DRY finding is worth considering but does not block merge.
This review was generated by /review-pr (AI-assisted).
Reviewed-by: OpenCode (claude-opus-4-6)
… EOF newlines Addresses PR unbound-force#180 review feedback from @yvonnedevlinrh. - Remove 2 trailing blank lines in goprovider/sideeffect.go - Add missing trailing newline in design.md and proposal.md
|
Thanks for the review! Addressed the LOW findings in 2d33769: [LOW] Trailing blank lines — Fixed. Removed the 2 trailing blank lines in [LOW] Missing trailing newline — Fixed. Added trailing newlines to [MEDIUM] |
gxmiranda
left a comment
There was a problem hiding this comment.
Well-structured Phase 3 cleanup completing the external analyzer protocol initiative (#95). Removes deprecated backward-compat shims, relocates Go-specific code to goprovider, generalizes taxonomy for multi-language support, and adds optional streaming protocol. All CI green, constitution compliance verified, no security concerns. Two MEDIUM findings worth considering but non-blocking.
This review was generated by /review-pr (AI-assisted).
Reviewed-by: OpenCode (claude-opus-4-6)
| if parent == dir { | ||
| return "", fmt.Errorf("no go.mod found in %q or any parent directory", startDir) | ||
| } | ||
| dir = parent |
There was a problem hiding this comment.
[MEDIUM] findModuleRoot duplication (CS-004/DRY) — This introduces a local copy of findModuleRoot to avoid importing internal/loader. However, internal/loader provides module root discovery (a language-neutral filesystem operation). This creates a second copy alongside loader.FindModuleRoot. The comment says "local copy to avoid importing internal/loader" but the architectural motivation is not documented. Previously raised by @yvonnedevlinrh.
Consider either using loader.FindModuleRoot directly, or adding a comment explaining why internal/crap/ must avoid the loader dependency.
|
|
||
| // Return the stdout scanner for the caller to read JSONL lines. | ||
| // The caller is responsible for reading until EOF. | ||
| return c.stdout, nil |
There was a problem hiding this comment.
[MEDIUM] Shared scanner returned after mutex release — CallStream returns c.stdout (the shared *bufio.Scanner) to the caller after releasing c.mu. The current design is safe because the protocol is documented as sequential and loadStreaming holds its own mutex. However, the API now exposes the internal scanner — if a future caller reads from the scanner while another goroutine calls Call/Close, there's a data race.
Consider adding a doc-level warning: "The returned scanner MUST be fully consumed before any subsequent Call, CallStream, or Close invocation."
| // silently skipping the package. | ||
| return nil, fmt.Errorf("no test files found for %q", pkgPath) | ||
| } | ||
|
|
There was a problem hiding this comment.
[LOW] Missing sync comment — The original crap/contract.go version had // NOTE: keep in sync with internal/aireport/runner_steps.go:loadGazeConfigBestEffort. This copy omits the note. Until #139 consolidates these, the sync comment helps maintainers find all copies.
yvonnedevlinrh
left a comment
There was a problem hiding this comment.
LTGM
Medium finding to be addressed in #139. Other findings are low,related to documentation and non blocking
…und-force#95) Cleanup phase removing deprecated backward-compat shims from Phases 1-2: - Remove ContractCoverageFunc and SSADegradedPackages from crap.Options - Remove backward-compat fallback path in crap.Analyze - Deduplicate isMainPkg (use loader.IsMainPkg) - Move BuildContractCoverageFunc from crap/ to goprovider/ Pure cleanup — zero user-facing changes, zero behavioral changes. Ref: unbound-force#95
Phase 3 now covers the full remaining scope of Issue unbound-force#95: 1. Cleanup: deprecated field removal, isMainPkg dedup, BuildContractCoverageFunc relocation 2. Taxonomy: GoVersion → LanguageVersion rename, Language field, neutral SideEffectType aliases (AsyncTaskSpawn, FFICall, etc.) 3. Streaming: analyze/stream JSONL protocol method for large codebases 8 task groups, 27 tasks total. Ref: unbound-force#95
… add streaming protocol - Remove ContractCoverageFunc and SSADegradedPackages from crap.Options; contract coverage flows exclusively through ContractCoverageProvider - Deduplicate isMainPkg by replacing goprovider local copy with loader.IsMainPkg - Relocate BuildContractCoverageFunc and helpers from internal/crap/contract.go to internal/provider/goprovider/contract.go (zero Go-specific imports in crap) - Rename Metadata.GoVersion to LanguageVersion, add Language field, update schemas - Add 7 language-neutral SideEffectType aliases (AsyncTaskSpawn, FFICall, etc.) - Add streaming protocol: Streaming capability, analyze/stream method, CallStream, JSONL support in ExternalSideEffectAnalyzer, fake analyzer --hang-stream mode - Add LanguageVersion to protocol.InitializeResult and adapter.Providers
…regression - Add 3 tests for crap.findModuleRoot (found, not-found, at-start-dir) - Add TestCallStream_ReturnsScanner for protocol.CallStream - Fix streaming test hang: add --crash-after=analyze/stream to fake analyzer so it exits after writing JSONL (enables scanner EOF) - CRAPload back to 38 (was 40 due to untested new functions)
… EOF newlines Addresses PR unbound-force#180 review feedback from @yvonnedevlinrh. - Remove 2 trailing blank lines in goprovider/sideeffect.go - Add missing trailing newline in design.md and proposal.md
2d33769 to
40d90fd
Compare
Fix two gofmt formatting issues introduced by recent PRs: - internal/adapter/sideeffect.go: trailing blank line (PR unbound-force#180) - internal/taxonomy/types_test.go: misaligned struct field tags (PR unbound-force#184) Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Yvonne Devlin <[email protected]>
… EOF newlines Addresses PR unbound-force#180 review feedback from @yvonnedevlinrh. - Remove 2 trailing blank lines in goprovider/sideeffect.go - Add missing trailing newline in design.md and proposal.md
Fix two gofmt formatting issues introduced by recent PRs: - internal/adapter/sideeffect.go: trailing blank line (PR unbound-force#180) - internal/taxonomy/types_test.go: misaligned struct field tags (PR unbound-force#184) Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Yvonne Devlin <[email protected]>
… EOF newlines Addresses PR unbound-force#180 review feedback from @yvonnedevlinrh. - Remove 2 trailing blank lines in goprovider/sideeffect.go - Add missing trailing newline in design.md and proposal.md Signed-off-by: sonupreetam <[email protected]>
Fix two gofmt formatting issues introduced by recent PRs: - internal/adapter/sideeffect.go: trailing blank line (PR unbound-force#180) - internal/taxonomy/types_test.go: misaligned struct field tags (PR unbound-force#184) Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Yvonne Devlin <[email protected]> Signed-off-by: sonupreetam <[email protected]>
Summary
Completes the external analyzer protocol initiative (Phase 3 of #95) by removing backward-compatibility shims, deduplicating code, generalizing the taxonomy for multi-language support, and adding an optional streaming protocol mode.
Changes
ContractCoverageFuncandSSADegradedPackagesfromcrap.Options. Contract coverage now flows exclusively throughContractCoverageProvider. Removed the fallback dispatch path incrap.Analyze.goprovider/sideeffect.gowith canonicalloader.IsMainPkg. The copy incrap/contract.gowas also eliminated by the relocation below.internal/crap/contract.gotointernal/provider/goprovider/contract.go.internal/crap/now has zero Go-specific imports (internal/analysis,internal/classify,internal/quality,internal/loader,golang.org/x/tools/go/packages).Metadata.GoVersiontoLanguageVersion(JSON taglanguage_version), addedLanguagefield (JSON taglanguage). Updated JSON schemas. Breaking JSON change:go_version→language_version.SideEffectTypeconstants (AsyncTaskSpawn,AsyncMessageSend,AsyncChannelClose,BarrierOp,PanicRecovery,FFICall,ObjectPoolOp).Streamingcapability flag,analyze/streammethod constant,CallStreamon protocol client, streaming JSONL support inExternalSideEffectAnalyzer, fake analyzer--hang-streammode.Testing
go test -race -count=1 -short ./...findModuleRootandCallStreamto maintain threshold)Related Issues
Partially addresses #96 (generalize side effect taxonomy):
Metadata.GoVersion→LanguageVersion, addedLanguagefieldSideEffectTypealiases with backward-compatible Go names preservedlanguageandlanguage_versionLanguageVersiontoprotocol.InitializeResultandadapter.ProvidersErrorSignal,ContainerMutation,GeneratorYield)detailfield for language-specific contextGeneratorYield,MetaprogrammingMutation, etc.)Partially addresses #139 (consolidate duplicated package helpers):
isMainPkg: Eliminated 2 of 3 copies — goprovider now usesloader.IsMainPkg, crap copy removed withcontract.gorelocation. Only the canonicalloader.IsMainPkgremains.resolvePackagePaths: Was already consolidated toloader.ResolvePackagePathsprior to this branch.loadTestPackage: Moved crap copy to goprovider (not consolidated). Still 3 copies:cmd/gaze,aireport,goprovider. The aireport version still lacks thepkg.Errorscheck noted in Refactor: Consolidate duplicated package helpers from aireport/crap into internal/loader #139.loadGazeConfigBestEffort: Moved crap copy to goprovider (not consolidated). Still 3 copies:cmd/gaze,aireport,goprovider.