Skip to content

[WIP] Implement missing features from documentation#2859

Merged
asim merged 4 commits intomasterfrom
copilot/implement-missing-features-again
Feb 13, 2026
Merged

[WIP] Implement missing features from documentation#2859
asim merged 4 commits intomasterfrom
copilot/implement-missing-features-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Implementation Complete ✅

This PR successfully implements the missing --header and --metadata flags for the micro call command.

Summary of Changes

Problem: Documentation showed TODO comment at cmd/micro/cli/util/dynamic.go:144 indicating --header and --metadata flags should be implemented but weren't.

Solution: Implemented full support for both flags in both call modes (direct and dynamic).

Files Changed

  1. cmd/micro/cli/cli.go

    • Added --header and --metadata flags to the call command
    • Apply metadata to context before making RPC calls
    • Added clarifying comments for direct call path
  2. cmd/micro/cli/util/dynamic.go

    • Added AddMetadataToContext helper function to parse and apply metadata
    • Updated CallService to extract and apply metadata/header flags
    • Added clarifying comments for dynamic call path
    • Removed TODO comment (now implemented)
  3. cmd/micro/cli/util/dynamic_test.go

    • Added comprehensive test suite for AddMetadataToContext
    • Tests cover: single/multiple values, whitespace handling, colon-in-value, invalid formats
  4. Code formatting applied to ensure consistency

Usage Examples

# Authentication
micro call service endpoint '{"data":"value"}' --header 'Authorization:Bearer token'

# Request tracing
micro call service endpoint '{}' --metadata 'trace-id:123' --metadata 'user-id:456'

# Dynamic calls
micro service method --name="value" --header 'X-Custom:Value'

Testing & Validation

✅ All unit tests pass (including new metadata tests)
✅ CLI builds successfully
✅ Flags appear in --help output
✅ CodeQL security scan passes (0 alerts)
✅ Code review passes with no issues
✅ Code formatting applied

Architecture

Two code paths both properly handle metadata:

  • Direct: micro call service endpoint json → cli.go applies metadata
  • Dynamic: micro service method --flags → CallService applies metadata

Both paths are necessary and documented with comments.

Verification of Other Commands

During this work, I also verified that other documented commands are implemented:

  • micro status - implemented in cmd/micro/cli/remote/remote.go
  • micro logs - implemented in cmd/micro/cli/remote/remote.go
  • micro stop - implemented in cmd/micro/cli/remote/remote.go
  • micro deploy - implemented in cmd/micro/cli/deploy/deploy.go
  • micro init - implemented in cmd/micro/cli/init/init.go
  • micro build - implemented in cmd/micro/cli/build/build.go

All documented features are now fully implemented! 🎉


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 13, 2026 14:12
Co-authored-by: asim <17530+asim@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
@asim asim marked this pull request as ready for review February 13, 2026 14:20
@asim asim merged commit 1db7903 into master Feb 13, 2026
2 checks passed
Copilot AI requested a review from asim February 13, 2026 14:20
Copilot stopped work on behalf of asim due to an error February 13, 2026 14:20
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.

2 participants