-
Notifications
You must be signed in to change notification settings - Fork 9
fix(jtk)!: shape-stable fulltext, fail-closed sprint resolution, deterministic automation export #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
fix(jtk)!: shape-stable fulltext, fail-closed sprint resolution, deterministic automation export #461
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
09d4136
fix(jtk)!: shape-stable fulltext, fail-closed sprint resolution, dete…
rianjs 146ba04
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 3eaf125
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs d12ad51
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs fa479f5
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs c1100a5
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 45585b4
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 02c6332
test(jtk): cover transitions list --fields expansion and columns (#455)
rianjs 6da0e8b
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs ca1130d
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 99b2800
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 6f39698
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 07baefc
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs e84e687
docs(jtk): sweep runnable-example and JSON-scope classes across all d…
rianjs bd31784
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 9363477
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs 804c05a
Merge branch '455-jtk-pagination' into 455-jtk-contracts
rianjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| package automation | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "context" | ||
| "net/http" | ||
| "net/http/httptest" | ||
| "testing" | ||
|
|
||
| "github.com/open-cli-collective/atlassian-go/testutil" | ||
|
|
||
| "github.com/open-cli-collective/jira-ticket-cli/api" | ||
| "github.com/open-cli-collective/jira-ticket-cli/internal/cmd/root" | ||
| ) | ||
|
|
||
| func TestRunExportFormatsJSONDeterministically(t *testing.T) { | ||
| t.Parallel() | ||
| tests := []struct { | ||
| name string | ||
| raw string | ||
| compact bool | ||
| want string | ||
| }{ | ||
| {"pretty input defaults to pretty", "{\n \"name\": \"rule\",\n \"enabled\": true\n}", false, "{\n \"name\": \"rule\",\n \"enabled\": true\n}\n"}, | ||
| {"compact input defaults to pretty", `{"name":"rule","enabled":true}`, false, "{\n \"name\": \"rule\",\n \"enabled\": true\n}\n"}, | ||
| {"compact normalizes whitespace", " { \"name\" : \"rule\", \"enabled\" : true } ", true, `{"name":"rule","enabled":true}` + "\n"}, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| server := automationExportServer(tt.raw) | ||
| defer server.Close() | ||
|
|
||
| opts, stdout := exportTestOptions(t, server) | ||
| testutil.RequireNoError(t, runExport(context.Background(), opts, "rule-1", tt.compact)) | ||
| if stdout.String() != tt.want { | ||
| t.Fatalf("output mismatch:\n got %q\nwant %q", stdout.String(), tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestRunExportMalformedJSONLeavesStdoutEmpty(t *testing.T) { | ||
| t.Parallel() | ||
| for _, compact := range []bool{false, true} { | ||
| server := automationExportServer(`{"broken":`) | ||
| opts, stdout := exportTestOptions(t, server) | ||
| err := runExport(context.Background(), opts, "rule-1", compact) | ||
| server.Close() | ||
|
|
||
| if err == nil { | ||
| t.Fatalf("compact=%v: expected malformed JSON error", compact) | ||
| } | ||
| if stdout.Len() != 0 { | ||
| t.Fatalf("compact=%v: stdout must stay empty, got %q", compact, stdout.String()) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func automationExportServer(raw string) *httptest.Server { | ||
| return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
| if r.URL.Path == "/_edge/tenant_info" { | ||
| _, _ = w.Write([]byte(`{"cloudId":"test-cloud"}`)) | ||
| return | ||
| } | ||
| _, _ = w.Write([]byte(raw)) | ||
| })) | ||
| } | ||
|
|
||
| func exportTestOptions(t *testing.T, server *httptest.Server) (*root.Options, *bytes.Buffer) { | ||
| t.Helper() | ||
| client, err := api.New(api.ClientConfig{URL: server.URL, Email: "t@x.com", APIToken: "tok"}) | ||
| testutil.RequireNoError(t, err) | ||
| stdout := &bytes.Buffer{} | ||
| opts := &root.Options{Stdout: stdout, Stderr: &bytes.Buffer{}} | ||
| opts.SetAPIClient(client) | ||
| return opts, stdout | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
--fulltextexample still ends the body with..., even though the preceding text now says truncation is disabled. The renderer only appends an ellipsis when fulltext is false, so this example teaches the opposite behavior. Show the complete sample body (or clearly mark omitted illustrative text outside the command-output block).Reply inline to this comment.