Skip to content

feat(routing): add publish all support - #1988

Merged
tkircsi merged 4 commits into
agntcy:mainfrom
dlanov:feat-1965-routing-publish-all
Aug 10, 2026
Merged

tkircsi merged 4 commits into
agntcy:mainfrom
dlanov:feat-1965-routing-publish-all

Conversation

@dlanov

@dlanov dlanov commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add an all_records publication request to the routing API
  • add dirctl routing publish --all with an interactive confirmation
  • add --yes to support non-interactive bulk publication
  • publish every currently stored record; publication is idempotent
  • refuse interactive --all prompting on non-terminal stdin unless --yes is provided
  • reject conflicting CID, --stdin, --all, and --yes input modes
  • add focused CLI, controller, and publication-worker tests

Testing

  • (cd proto && go run github.com/bufbuild/buf/cmd/[email protected] dep update)
  • (cd proto && go run github.com/bufbuild/buf/cmd/[email protected] lint)
  • (cd proto && go run github.com/bufbuild/buf/cmd/[email protected] generate --template buf.gen.yaml)
  • golangci-lint run --config .golangci.yml ./cmd/routing
  • golangci-lint run --config .golangci.yml ./publication
  • go test ./cmd/routing -count=1
  • go test ./publication -count=1
  • regenerated the routing API bindings and verified regeneration produces no changes

Fixes #1965

@dlanov
dlanov requested a review from a team as a code owner August 6, 2026 18:24

@paralta paralta left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution! Just one small fix before we merge: use presenter.PrintSmartf here instead of Printf — the former routes to stderr for structured output formats, so the prompt and abort message don't end up inside the JSON stream on --all --output json.

Comment thread cli/cmd/routing/publish.go Outdated
}

func confirmPublishAll(cmd *cobra.Command) (bool, error) {
presenter.Printf(cmd, "%s [y/N]: ", publishAllPrompt)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
presenter.Printf(cmd, "%s [y/N]: ", publishAllPrompt)
presenter.PrintSmartf(cmd, "%s [y/N]: ", publishAllPrompt)

Comment thread cli/cmd/routing/publish.go Outdated
}

if !confirmed {
presenter.Printf(cmd, "Aborted. No records were submitted for publication.\n")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
presenter.Printf(cmd, "Aborted. No records were submitted for publication.\n")
presenter.PrintSmartf(cmd, "Aborted. No records were submitted for publication.\n")

@github-actions github-actions Bot added the size/M Denotes a PR that changes 200-999 lines label Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.95349% with 31 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/cmd/routing/publish.go 57.8% 26 Missing and 1 partial ⚠️
cli/cmd/install/batch.go 0.0% 3 Missing ⚠️
cli/cmd/install/install.go 0.0% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@tkircsi tkircsi left a comment

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.

Thanks a lot for contributing! Please, check the routing Publish process. I think, the unpublished filtering is not needed, because Publish is idempotent.

Comment thread cli/cmd/routing/publish.go Resolved
Comment thread cli/cmd/routing/publish.go Resolved
Comment thread cli/cmd/routing/publish.go Resolved
Comment thread cli/cmd/routing/publish.go Outdated
return confirmPublishAll(cmd)
}

func confirmPublishAll(cmd *cobra.Command) (bool, error) {

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.

confirmPublishAll is a duplicate of the unexported confirm in cli/cmd/install/install.go Canwe export it to a shared helper in something like cli/util/prompt.

@dlanov

dlanov commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@tkircsi Thanks for the review. I addressed the requested changes:

  • --all now publishes every stored record directly without filtering against the routing layer, since publication is idempotent.
  • Updated the CLI and API wording accordingly.
  • Added a TTY check so non-interactive --all requires --yes.
  • Moved the duplicated yes/no confirmation logic into the shared cli/util/prompt helper and reused it from install and routing.
  • Added and updated focused tests for the shared prompt and publish behavior.

All checks are passing. Could you please take another look when you have a chance?

@tkircsi tkircsi left a comment

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.

LGTM. @dlanov Thank You very much!

@tkircsi
tkircsi merged commit c766b64 into agntcy:main Aug 10, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add dirctl routing publish --all flag

3 participants