Skip to content

chore: add v3 cleanup plan for CLI and server#745

Draft
jbpros wants to merge 2 commits intomainfrom
review-v3-potential-changes
Draft

chore: add v3 cleanup plan for CLI and server#745
jbpros wants to merge 2 commits intomainfrom
review-v3-potential-changes

Conversation

@jbpros
Copy link
Copy Markdown
Contributor

@jbpros jbpros commented Mar 30, 2026

Catalog all deprecated commands, flags, legacy code paths, and server-side backward-compatibility shims that should be removed in a v3 release.

Catalog all deprecated commands, flags, legacy code paths, and
server-side backward-compatibility shims that should be removed
in a v3 release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 30, 2026

Claude finished @jbpros's task in 4m 35s —— View job


Review of PR #745 — v3 Cleanup Plan

  • Phase 1: Static analysis (build, vet, mod tidy) — all clean
  • Phase 2: Read and review the TODO.md changes
  • Phase 3: Cross-reference plan items against codebase
  • Phase 4: Post review feedback

Summary

This is a thorough and well-organized catalog of v3 cleanup work. The latest commit adds good new sections (richer exit codes, evidence→attestation terminology, command aliases review, approval commands). I cross-referenced the plan items against the actual codebase and left inline comments on specific issues. Here are the key findings:

Deprecation gaps — items listed for removal that aren't formally deprecated yet:

  • --visibility and --template in createFlow.go — no DeprecateFlags/MarkDeprecated calls
  • All four approval commands (report, request, get, list) — no Deprecated: field set on any of them

These should either get deprecation warnings in a v2.x release first, or the plan should explicitly note they'll be removed without a deprecation period.

Items correctly marked as deprecated (verified in code):

  • --registry-provider in flags.go
  • --cluster and --service-name in snapshotECS.go
  • --function-name and --function-version in snapshotLambda.go
  • -e shorthand in fingerprint.go and snapshotServer.go
  • --require-provenance in createEnvironment.go
  • report artifact and snapshot server commands ✓

Fragile references — line numbers (138–153, 220–221) will drift; use code landmarks instead.

Risk callout — the pipeline_idflow_id rename (lines 117–121) is a cross-cutting change with a data migration dependency. It deserves its own epic with explicit sequencing constraints.

Minor suggestion — the evidence→attestation section mixes breaking changes (flag/help text) with non-breaking internal renames (evidencePath variables). The internal renames could land in v2.x without waiting for v3.

What's good

  • Comprehensive coverage of both CLI and server-side cleanup in one place
  • Clear table format for deprecated commands and flags with file references
  • Good cross-referencing between CLI and server items (e.g., flow creation endpoint appears in both sections)
  • Linking to the tracking issue (kosli-dev/server#5132) and related issues/PRs


| Flag | Command | Replacement | File |
|------|---------|-------------|------|
| `--visibility` | `create flow` | Remove (org-level concern, not flow-level) | `cmd/kosli/createFlow.go` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: --visibility is not currently marked as deprecated in createFlow.go (no DeprecateFlags or MarkDeprecated call for it). Same for --template — it's used in the legacy code path but never formally deprecated. Worth noting this distinction: these flags need to be deprecated (with a warning in v2.x) before removal in v3, or the plan should clarify they'll be removed without a deprecation period.

TODO.md Outdated
Comment on lines +30 to +31
- [ ] Remove the `--template` string-slice flag and the legacy code path in `createFlow.go` (lines 138–153)
- [ ] Only keep the `--template-file` / `--use-empty-template` path, which hits `PUT /api/v2/flows/<org>/template_file`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line numbers referenced here (138–153) are approximate and will drift as the file changes. Consider referencing the code by its identifying characteristics instead (e.g., "the if o.TemplateFile == "" && !o.UseEmptyTemplate branch") so this plan stays accurate over time.

Comment on lines +44 to +46

- [ ] Remove legacy flow detection code (lines 220–221) that checks for "legacy_flow" and skips new attestation logic
- [ ] Note: the `legacy_flow` resolution type in the server (`src/model/policy_compliance_checker.py`) is **defined but never created** — it's dead code on both sides
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same fragile line-number reference here (lines 220–221). The actual code is a case "legacy_flow": branch in a switch statement — that description would be more durable.

Comment on lines +84 to +89
#### Rename `pipeline_id` → `flow_id` Throughout

- [ ] Rename `pipeline_id` to `flow_id` in artifact model (`src/model/artifact.py`), attestation model, trail model
- [ ] Remove `pipeline_name` → `flow_name` converter in FastAPI Pydantic models (`src/fastapi_app/models/artifacts.py`)
- [ ] Update database indexes in `src/documentdb/indexes.py` (many still reference `pipeline_id`)
- [ ] Requires a data migration for existing documents
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the highest-risk item in the plan — a cross-cutting rename with a required data migration. Consider calling out an explicit sequencing constraint: the data migration must land and complete before any code referencing flow_id is deployed, or both field names need to be supported during a transition window. This deserves its own slice/epic rather than being a bullet in a larger list.

Add approval commands removal, flow creation simplification,
richer exit codes, evidence→attestation terminology cleanup,
and command alias review items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +16 to +19
| `kosli report approval` | Attestation workflow | `cmd/kosli/reportApproval.go` |
| `kosli request approval` | Attestation workflow | `cmd/kosli/requestApproval.go` |
| `kosli get approval` | Attestation workflow | `cmd/kosli/getApproval.go` |
| `kosli list approvals` | Attestation workflow | `cmd/kosli/listApprovals.go` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approval commands (report approval, request approval, get approval, list approvals) are not currently marked as deprecated in their cobra command definitions — no Deprecated: field is set on any of them. This is different from report artifact and snapshot server which are formally deprecated.

The plan should note this: these commands need deprecation warnings added in a v2.x release first (so users get advance notice), or the plan should explicitly state they'll be removed without a deprecation period in v3.


| Flag | Command | Replacement | File |
|------|---------|-------------|------|
| `--visibility` | `create flow` | Remove (org-level concern, not flow-level) | `cmd/kosli/createFlow.go` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note as the previous review: --visibility is not formally deprecated — there's no DeprecateFlags or MarkDeprecated call for it in createFlow.go. Same for --template. Both are still actively registered flags.

Consider adding deprecation warnings for these in a v2.x release before removing them in v3, or document that they'll be removed without a deprecation period.


### Flow Creation Simplification

- [ ] Remove the `--template` string-slice flag and the legacy code path in `createFlow.go` (lines 138–153)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line numbers referenced here (138–153) are approximate and will drift as the file changes. Consider referencing the code by its identifying characteristics instead (e.g., "the if o.TemplateFile == "" && !o.UseEmptyTemplate branch") so this plan stays accurate over time.

(Echoing the previous review's feedback since it still applies after the latest commit.)


### Legacy Flow Handling in `assertArtifact.go`

- [ ] Remove legacy flow detection code (lines 220–221) that checks for "legacy_flow" and skips new attestation logic
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same fragile line-number reference (lines 220–221). The actual code is a case "legacy_flow": branch in a switch statement — that description would be more durable.

(Echoing the previous review since it still applies.)

Comment on lines +117 to +121

- [ ] Rename `pipeline_id` to `flow_id` in artifact model (`src/model/artifact.py`), attestation model, trail model
- [ ] Remove `pipeline_name` → `flow_name` converter in FastAPI Pydantic models (`src/fastapi_app/models/artifacts.py`)
- [ ] Update database indexes in `src/documentdb/indexes.py` (many still reference `pipeline_id`)
- [ ] Requires a data migration for existing documents
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the highest-risk item in the plan — a cross-cutting rename with a required data migration. Consider calling out an explicit sequencing constraint: the data migration must land and complete before any code referencing flow_id is deployed, or both field names need to be supported during a transition window. This deserves its own slice/epic rather than being a bullet in a larger list.

(Echoing the previous review since it still applies and is critical.)

- [ ] `snykJsonResultsFileFlag` in `root.go` — "evidence vault"
- [ ] `snykSarifResultsFileFlag` in `root.go` — "evidence vault"
- [ ] `attachmentsFlag` in `root.go` — "evidence vault"
- [ ] Internal variable names: `evidencePath`, `evidencePaths` in attestation code (`attestation.go`, `pullrequest.go`, `attestCustom.go`, `attestGeneric.go`, `attestSnyk.go`, `attestSonar.go`)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: renaming internal variable names (evidencePath, evidencePaths) is a good cleanup but isn't a breaking change. Consider separating this section into "breaking" (flag/help text changes visible to users) and "non-breaking" (internal renames) to help prioritize. Internal renames could land in v2.x without waiting for v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant