Skip to content

feat: add compare command to cli - #72

Closed
kriscoleman wants to merge 1 commit into
open-feature:refactor-manifestfrom
kriscoleman:feat/compare-cmd
Closed

feat: add compare command to cli#72
kriscoleman wants to merge 1 commit into
open-feature:refactor-manifestfrom
kriscoleman:feat/compare-cmd

Conversation

@kriscoleman

@kriscoleman kriscoleman commented Mar 7, 2025

Copy link
Copy Markdown
Collaborator

This PR

feat: add compare command to cli

A new 'compare' command has been added to the CLI. This command allows users to compare two manifest files and list the changes between them. The comparison is done by loading each manifest file, then using a new function from the 'manifest' package to identify differences. Error handling has also been implemented for scenarios where loading or comparing manifests fails.

feat: add tests for manifest comparison

Added two new test functions in the 'manifest' package. The first function, 'TestCompareDifferentManifests', checks if the 'Compare' function correctly identifies changes between two different manifests. The second function, 'TestCompareIdenticalManifests', verifies that no changes are reported when comparing identical manifests. Both tests use a helper function to sort the changes before comparing them.

Related Issues

#32

Notes

These changes are pretty straightforward, just adds the compare function to the cli commands, but this is on top of Michaels WIP work. I did have to make a couple changes to get things building that I suspect Michael may have already handled in his code, so let me know if there are any conflicts you'd like me to sort out.

Follow-up Tasks

Introducing a simple comparison between two files is a good place to start.

However, long term I wonder if we could make it operate with a little more context awareness.

I use aws cdk a lot for Infrastructure as Code, and I'm a fan of it's cdk diff command. It has a pretty simple dev ex and it's behavior reminds me of what we're doing here.

At any time, I can check my branche's IaC stack differences against another environment.

I can branch off main and change my stacks, then run:

  • cdk diff --profile dev to check what the diff of my local is against dev
  • cdk diff --profile prod to check what the diff of my local is against prod
    and so forth.

It might be cool in the future if we could have a simple openfeature compare --env prod pattern to abstract the need to define paths for the compare.

I think as we add further foundational features, like openfeature pull, it might assist us achieving such a pattern.

How to test

manual testing:

  1. go build -o openfeature
  2. sudo mv openfeature /usr/local/bin/
  3. openfeature compare <pathToOld> <pathToNew>

unit tests:

  • go test .

@kriscoleman kriscoleman changed the title Feat/compare cmd feat: add compare command to cli Mar 7, 2025
@kriscoleman
kriscoleman force-pushed the feat/compare-cmd branch 4 times, most recently from f89dd13 to ecfab09 Compare March 13, 2025 15:05
A new 'compare' command has been added to the CLI. This command allows users to compare two manifest files and list the changes between them. The comparison is done by loading each manifest file, then using a new function from the 'manifest' package to identify differences. Error handling has also been implemented for scenarios where loading or comparing manifests fails. Tests were also included to test the compare function.

Signed-off-by: Kris Coleman <kriscodeman@gmail.com>
@beeme1mr
beeme1mr deleted the branch open-feature:refactor-manifest March 14, 2025 20:12
@beeme1mr beeme1mr closed this Mar 14, 2025
@beeme1mr

Copy link
Copy Markdown
Member

@kriscoleman, this was automatically closed by accident. Please reopen when you have moment. Thanks!

jonathannorris added a commit that referenced this pull request Aug 17, 2026
- @angular/core 20.3.25 -> 20.3.28 (high, alert #75: XSS via event-handler attributes)
- @angular/compiler 20.3.25 -> 20.3.28 (high, alert #74: XSS via event-handler attributes)
- @angular/common 20.3.25 -> 20.3.28 (high, alert #73: cache-key ambiguity in HttpTransferCache)
- brace-expansion 2.1.0 -> 2.1.4 (high, alert #72: DoS via exponential-time expansion)

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
jonathannorris added a commit that referenced this pull request Aug 17, 2026
* chore: resolve open dependabot security alerts

- vite ^6.4.2 -> ^6.4.3 (medium/high, alerts #57 #58)
- @babel/core transitive -> ^7.29.6 via override (low, alert #56)
- @angular/common, @angular/core, @angular/compiler 19.x -> 20.3.25 (high/medium, alerts #52 #53 #54 #55)

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* chore: align @openfeature/web-sdk with angular-sdk peer dependency

Address Copilot review feedback on PR #253: @openfeature/angular-sdk
1.3.1 requires @openfeature/web-sdk ^1.9.0 as a peer dependency, but
package.json still allowed ^1.7.3. Bump the declared range to match
and regenerate the lockfile.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* chore: resolve additional dependabot alerts for fast-uri

- fast-uri ^3.1.2 -> ^3.1.4 (high, alert #59: host confusion via failed IDN canonicalization)
- fast-uri ^3.1.2 -> ^3.1.4 (high, alert #60: host confusion via literal backslash authority delimiter)

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* fix(deps): regenerate OpenAPI client for oapi-codegen v2.8.0

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* chore: resolve postcss alert and pin fast-uri exactly

- postcss <= 8.5.17 -> ^8.5.18 override (high, alert #62)
- pin fast-uri override to exact 3.1.4 per CodeRabbit review suggestion

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* chore: bump fast-uri to 3.1.5 for dependabot alert #64

- fast-uri 3.1.4 -> 3.1.5 (high, alert #64: host confusion via backslash authority introducer)

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

* chore: resolve open dependabot security alerts

- @angular/core 20.3.25 -> 20.3.28 (high, alert #75: XSS via event-handler attributes)
- @angular/compiler 20.3.25 -> 20.3.28 (high, alert #74: XSS via event-handler attributes)
- @angular/common 20.3.25 -> 20.3.28 (high, alert #73: cache-key ambiguity in HttpTransferCache)
- brace-expansion 2.1.0 -> 2.1.4 (high, alert #72: DoS via exponential-time expansion)

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>

---------

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
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