[DIT-11523] Add support for meta flag #127
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Overview
Adds support for the
-mor--metaflag, which allows users to pass custom metadata along with a CLI command. We use this internally to identify requests that come from our github action, which dispatches the following commandpull -m githubActionRequest: true.If we get this particular piece of metadata, we want to place it in the request header, so that our main application will set
req.application = "github_action"for segment events. This is very different than the legacy implementation, which would indiscriminately pass all metadata along asreq.query. Now that we have strong zod typing for our requests, it didn't seem like a good idea to add random, user-defined values to the query object, so only this one value is actually used for anything. Any other metadata is currently processed but ultimately ignored.I do not intend to document this flag publicly, in the README or dev docs, since it's currently only used internally by us in the github action implementation.
Context
https://linear.app/dittowords/issue/DIT-11523/legacy-github-action-not-supported-in-cli-v500
Test Plan
Main app setup
marla/dit-11523-github-action-segmentbranch of the main ditto-app repo, until https://github.com/dittowords/ditto-app/pull/7869 is merged.yarn start:apiCLI Testing
yarn start pullclias theapplicationpropertyyarn start pull -m githubActionRequest:truegithub_actionas theapplicationpropertyyarn start pull --meta githubActionRequest:truegithub_actionas theapplicationpropertyyarn start pull -m something:elseclias theapplicationproperty