Skip to content

Deepen selective package export and release-plan modules - #27

Merged
jbrazda merged 5 commits into
devfrom
refactor/deepen-packaging-and-release-plan
Sep 16, 2026
Merged

jbrazda merged 5 commits into
devfrom
refactor/deepen-packaging-and-release-plan

Conversation

@jbrazda

@jbrazda jbrazda commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Two architecture deepening refactors surfaced by an architecture review, each in its own commit. Both are pure internal restructurings: no CLI flag, output, error-text, or file-format changes; no CI/CD or docs impact.

refactor(package): deepen selective export into internal/packaging

Moves the selective-export pipeline out of package create's RunE closure (manifest selection, closure/parent-container/CDI-ref inclusion, metadata-graph building, file filtering, CSV/metadata regeneration) into a new internal/packaging module with a single entry point, BuildSelectivePackage.

cmd/package.go's RunE shrinks from ~370 lines of inline orchestration to a thin call into the new module; exportMetadata/exportedObject become aliases to their internal/packaging equivalents so the unrelated package dependencies subcommand keeps compiling unchanged.

Adds table-driven tests for the new module.

refactor(release): collapse plan-mode duplication into BuildPlan

release plan's RunE had two ~170-line branches (full-deployment vs selective/tag mode) duplicating the same per-target pipeline (filter missing-transitive, validate, render totals, write package/publish files, accumulate manifest-log rows), differing only in how the initial asset set is resolved.

Adds internal/release.BuildPlan, a composing entry point over the existing per-step functions in plan.go, parameterized by asset source and a few mode-specific hooks/labels. cmd/release.go's RunE now calls it once per mode and shrinks by about a third.

Drops releaseAssetsToManifestLog from cmd/manifest_log.go, dead code now that BuildPlan builds ManifestLogAsset rows internally.

Adds tests for BuildPlan covering both modes.

Verification

gofmt -s -l ., go build ./..., go vet ./..., go test ./... (incl. -race on the two touched packages), and golangci-lint run ./... all clean. CLI --help output for package create and release plan confirmed byte-identical before/after.

🤖 Generated with Claude Code

https://claude.ai/code/session_019KEFMYHnZwja4rcKZC5Pim

jbrazda and others added 5 commits September 13, 2026 15:11
Move the selective-export pipeline out of package create's RunE
closure (manifest selection, closure/parent-container/CDI-ref
inclusion, metadata-graph building, file filtering, CSV/metadata
regeneration) into a new internal/packaging module with a single
entry point, BuildSelectivePackage.

cmd/package.go's RunE shrinks from ~370 lines of inline orchestration
to a thin call into the new module; exportMetadata/exportedObject
become aliases to their internal/packaging equivalents so the
unrelated `package dependencies` subcommand keeps compiling unchanged.

No flag, output, error-text, or file-format changes; no CI/docs
impact. Adds table-driven tests for the new module in
internal/packaging.
release plan's RunE had two ~170-line branches (full-deployment vs
selective/tag mode) that duplicated the same per-target pipeline
(filter missing-transitive, validate, render totals, write package
and publish files, accumulate manifest-log rows), differing only in
how the initial asset set is resolved.

Add internal/release.BuildPlan, a composing entry point over the
existing per-step functions in plan.go, parameterized by asset
source and a few mode-specific hooks/labels. cmd/release.go's RunE
now calls it once per mode and shrinks by about a third.

Drops releaseAssetsToManifestLog from cmd/manifest_log.go, dead code
now that BuildPlan builds ManifestLogAsset rows internally.

No flag, output, error-text, or file-format changes; no CI/docs
impact. Adds tests for BuildPlan covering both modes.
wrapParagraph compared word length using raw len(), which counts ANSI
escape bytes. A short colored status like "found" was measured as
longer than the column width and hard-split at a raw byte offset,
slicing through the escape sequence (e.g. "foun"/"d" across two
physical rows in the release plan dependency status table). Measure
and accumulate using visibleLen instead, and only fall back to
stripped plain text when a word's visible length genuinely exceeds
the column width.
`release plan` was validating asset existence per target with one
Lookup/GetConnectionByName API call per asset, and recomputing that
same existence matrix twice whenever --verbose was on: once to render
the dependency status table, again inside BuildPlan to annotate the
package/publish files.

- validateAssetsExistInTarget batches all non-Connection assets for a
  target into a single Lookup call instead of one call per asset,
  matching the batching pattern already used in internal/dependencies.
- ValidateAssetsForTargets computes the per-target validation matrix
  once; cmd/release.go threads it through PlanOptions.Validations so
  BuildPlan's missing-transitive filter and package annotation reuse
  it instead of re-querying the target.

For a 65-asset / 2-target selective plan with --verbose, this cuts the
API round trips from ~260 down to 2.
Piped/redirected table output with no explicitly configured theme now
renders as markdown (colorless GFM table, already safe for scripting)
rather than plain ASCII borders. An explicitly configured theme other
than markdown/gh still downgrades to plain when non-interactive, same
as before.

resolveTableStyle previously seeded style.Theme with the literal
string "default" as its unset sentinel, which made effectiveTheme's
unset-theme branch unreachable from the main CLI flow. It now leaves
Theme empty so effectiveTheme can distinguish "nothing configured"
from an explicit --theme default.
@jbrazda
jbrazda merged commit 3b7fdb0 into dev Sep 16, 2026
8 checks passed
@jbrazda
jbrazda deleted the refactor/deepen-packaging-and-release-plan branch September 16, 2026 21:01
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