Skip to content

Commit 142890b

Browse files
authored
Remove unused pipeline process stage (#26)
1 parent f3581cc commit 142890b

7 files changed

Lines changed: 12 additions & 63 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for full detail. Component ma
4343
| `internal/testutil` | Test helpers (fake binary builder) |
4444
| `internal/system` | OS-level helpers |
4545

46-
Scan pipeline: `runtimePreparation → subprojectDiscovery → preResolveHooks → detect (per-package-manager chains) → scopeFilter → consolidate → match (license enrichment on the consolidated graph) → commandProcess → audit → postResolveHooks → format`.
46+
Scan pipeline: `runtimePreparation → subprojectDiscovery → preResolveHooks → detect (per-package-manager chains) → scopeFilter → consolidate → match (license enrichment on the consolidated graph) → audit → postResolveHooks → format`.
4747

4848
Runtime preparation is owned by `internal/engine`: build the filtered registry once, index the execution target with that same registry, and reuse the prepared runtime for `scan`, `diff`, `explain`, license enrichment, and auditing. The CLI resolves raw execution targets and flags, but it must not discover subprojects with a separate registry.
4949

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ internal/testutil/ Test helpers (fake binary builder)
7272

7373
**`bomly explain`** is implemented by `newExplainCmd` in `internal/cli/explain_cmd.go`.
7474

75-
**Scan pipeline order**: `runtimePreparation → subprojectDiscovery → preResolveHooks → detect (per-package-manager chains) → scopeFilter → consolidate → match (license enrichment) → commandProcess → audit → postResolveHooks → format`
75+
**Scan pipeline order**: `runtimePreparation → subprojectDiscovery → preResolveHooks → detect (per-package-manager chains) → scopeFilter → consolidate → match (license enrichment) → audit → postResolveHooks → format`
7676

7777
Runtime preparation is owned by `internal/engine` and is reached through CLI option helpers before pipeline execution. The CLI resolves raw targets and flags but must not discover subprojects with a separate registry.
7878

docs/ARCHITECTURE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ flowchart TD
2828
E --> F[Run detector chains]
2929
F --> G[Consolidate graph]
3030
G --> H[Optional package enrichment]
31-
H --> I[Command-specific processing]
32-
I --> J[Optional policy evaluation]
33-
J --> K[Render report or SBOM]
31+
H --> I[Optional policy evaluation]
32+
I --> J[Render report or SBOM]
3433
```
3534

3635
## Execution Targets
@@ -53,7 +52,7 @@ flowchart LR
5352
A[Runtime preparation]
5453
B[Subproject discovery]
5554
C[Detector chains]
56-
D[Scope filtering and command processing]
55+
D[Scope filtering]
5756
E[Graph consolidation]
5857
F[Matchers]
5958
G[Auditors]
@@ -67,13 +66,14 @@ Stage summary:
6766
1. Runtime preparation builds the filtered registry and execution plan.
6867
2. Subproject discovery finds supported package-manager roots for the target.
6968
3. Detector chains resolve dependency graphs per package manager.
70-
4. Command processing applies scope filtering or focused queries when needed.
69+
4. Scope filtering applies requested dependency scopes before consolidation.
7170
5. Consolidation merges subproject graphs into a unified view.
7271
6. Matchers enrich packages with additional metadata such as licenses, EOL status, and vulnerability records.
73-
7. Command processing applies focused graph transforms such as scope filtering or explain-path selection.
74-
8. Auditors evaluate policy against whatever vulnerability data is already present on packages and create findings when `--audit` is enabled.
75-
9. Users combine `--enrich --audit` when they want external matcher data to feed policy evaluation in the same run.
76-
10. Output rendering emits text, JSON, SARIF, or SBOM documents.
72+
7. Auditors evaluate policy against whatever vulnerability data is already present on packages and create findings when `--audit` is enabled.
73+
8. Users combine `--enrich --audit` when they want external matcher data to feed policy evaluation in the same run.
74+
9. Output rendering emits text, JSON, SARIF, or SBOM documents.
75+
76+
`bomly explain` reuses the same resolution, scope filtering, consolidation, and matching stages, then performs dependency path selection in its explain orchestration before optional component audit.
7777

7878
## Detector and Auditor Model
7979

internal/engine/pipeline.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// Pipeline orchestrates a full scan through a sequence of typed stages:
14-
// pre-resolve hooks -> detect -> consolidate -> match -> process -> audit -> post-resolve hooks.
14+
// pre-resolve hooks -> detect -> scope filter -> consolidate -> match -> audit -> post-resolve hooks.
1515
type Pipeline struct {
1616
Registry *Registry
1717
Logger *zap.Logger
@@ -49,9 +49,6 @@ func (p *Pipeline) Run(ctx context.Context, req PipelineRequest) (PipelineResult
4949
return result, err
5050
}
5151
p.runMatch(ctx, &result, req)
52-
if err := p.runProcessor(ctx, &result, req); err != nil {
53-
return result, err
54-
}
5552
p.runAudit(ctx, &result, req)
5653
p.runPost(ctx, req, result)
5754
return result, nil
@@ -124,16 +121,6 @@ func (p *Pipeline) runMatch(ctx context.Context, result *PipelineResult, req Pip
124121
}
125122
}
126123

127-
func (p *Pipeline) runProcessor(ctx context.Context, result *PipelineResult, req PipelineRequest) error {
128-
if req.Processor == nil {
129-
return nil
130-
}
131-
if err := req.Processor(ctx, result); err != nil {
132-
return fmt.Errorf("stage processor: %w", err)
133-
}
134-
return nil
135-
}
136-
137124
func (p *Pipeline) runAudit(ctx context.Context, result *PipelineResult, req PipelineRequest) {
138125
if !req.AuditEnabled || result.Graph == nil {
139126
return

internal/engine/pipeline_explain.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func (p *Pipeline) RunExplain(ctx context.Context, req ExplainRequest) (ExplainR
3838
pipeReq := req.Pipeline
3939
auditEnabled := pipeReq.AuditEnabled
4040
pipeReq.AuditEnabled = false
41-
pipeReq.Processor = nil
4241

4342
base := PipelineResult{}
4443
if err := p.runPre(ctx, pipeReq); err != nil {

internal/engine/pipeline_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -394,37 +394,6 @@ func TestPipeline_Run_ProducesConsolidatedResult(t *testing.T) {
394394
}
395395
}
396396

397-
func TestPipeline_Run_WithStageProcessor(t *testing.T) {
398-
registry := newTestRegistry()
399-
registry.registerDetector(fakeDetector{
400-
descriptor: DetectorDescriptor{Name: "npm-detector", Enabled: true, SupportedEcosystems: []Ecosystem{EcosystemNPM}, SupportedManagers: []PackageManager{PackageManagerNPM}, SupportedModes: []TargetMode{TargetModeFullGraph}},
401-
result: ResolveGraphResult{Graphs: SingleGraphContainer(sdk.New(), sdk.ManifestMetadata{Path: "package-lock.json", Kind: "package-lock.json"})},
402-
})
403-
404-
processorCalled := false
405-
pipeline := NewPipeline(registry, zap.NewNop())
406-
result, err := pipeline.Run(context.Background(), PipelineRequest{
407-
Subprojects: []Subproject{{
408-
ExecutionTarget: ExecutionTarget{Kind: ExecutionTargetFilesystem, Location: "/repo"},
409-
RelativePath: ".",
410-
PrimaryDetector: "npm-detector",
411-
DetectedPackageManagers: []PackageManager{PackageManagerNPM},
412-
Ecosystem: EcosystemNPM,
413-
}},
414-
Processor: func(_ context.Context, r *PipelineResult) error {
415-
processorCalled = true
416-
return nil
417-
},
418-
})
419-
if err != nil {
420-
t.Fatalf("Run() error = %v", err)
421-
}
422-
if !processorCalled {
423-
t.Fatal("expected stage processor to be called")
424-
}
425-
_ = result
426-
}
427-
428397
func TestPipeline_Run_DeduplicatesAuditFindings(t *testing.T) {
429398
registry := newTestRegistry()
430399
g := sdk.New()

internal/engine/types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package engine
22

33
import (
4-
"context"
54
"io"
65

76
"github.com/bomly-dev/bomly-cli/internal/engine/hooks"
@@ -19,16 +18,11 @@ type (
1918
PostResolveHook = hooks.PostResolveHook
2019
)
2120

22-
// StageProcessor is a command-specific graph manipulation step injected into the
23-
// pipeline between consolidation and audit. Return a non-nil error to abort.
24-
type StageProcessor func(context.Context, *PipelineResult) error
25-
2621
// PipelineRequest defines input for a full pipeline run.
2722
type PipelineRequest struct {
2823
ProjectPath string
2924
ExecutionTarget sdk.ExecutionTarget
3025
Subprojects []sdk.Subproject
31-
Processor StageProcessor
3226
EnrichEnabled bool
3327
MatchEnabled bool
3428
AuditEnabled bool

0 commit comments

Comments
 (0)