-
Notifications
You must be signed in to change notification settings - Fork 296
Display secrecy and integrity fields in safe output step summary renderer #19552
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
Changes from all commits
3f342e3
ce5776a
3fe1dc8
3062e0b
6acf391
85bb7c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,117 @@ describe("safe_output_summary", () => { | |
| expect(summary).toContain("Project URL"); | ||
| expect(summary).toContain("https://github.com/orgs/owner/projects/123"); | ||
| }); | ||
|
|
||
| it("should display secrecy field when present in message", () => { | ||
| const options = { | ||
| type: "create_issue", | ||
| messageIndex: 1, | ||
| success: true, | ||
| result: { | ||
| repo: "owner/repo", | ||
| number: 123, | ||
| }, | ||
| message: { | ||
| title: "Secure Issue", | ||
| body: "Sensitive content", | ||
| secrecy: "private", | ||
| }, | ||
| }; | ||
|
|
||
| const summary = generateSafeOutputSummary(options); | ||
|
|
||
| expect(summary).toContain("Secrecy:"); | ||
| expect(summary).toContain("private"); | ||
| }); | ||
|
|
||
| it("should display integrity field when present in message", () => { | ||
| const options = { | ||
| type: "create_issue", | ||
| messageIndex: 1, | ||
| success: true, | ||
| result: { | ||
| repo: "owner/repo", | ||
| number: 123, | ||
| }, | ||
| message: { | ||
| title: "Trusted Issue", | ||
| body: "Verified content", | ||
| integrity: "high", | ||
| }, | ||
| }; | ||
|
|
||
| const summary = generateSafeOutputSummary(options); | ||
|
|
||
| expect(summary).toContain("Integrity:"); | ||
| expect(summary).toContain("high"); | ||
| }); | ||
|
|
||
| it("should display both secrecy and integrity fields when present", () => { | ||
| const options = { | ||
| type: "add_comment", | ||
| messageIndex: 2, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good test coverage including the failure case (success: false). The test at line 220+ verifies that secrecy/integrity fields are displayed even when the operation fails — this is an important edge case to validate. |
||
| success: true, | ||
| result: { | ||
| repo: "owner/repo", | ||
| number: 456, | ||
| }, | ||
| message: { | ||
| body: "A comment", | ||
| secrecy: "internal", | ||
| integrity: "medium", | ||
| }, | ||
| }; | ||
|
|
||
| const summary = generateSafeOutputSummary(options); | ||
|
|
||
| expect(summary).toContain("Secrecy:"); | ||
| expect(summary).toContain("internal"); | ||
| expect(summary).toContain("Integrity:"); | ||
| expect(summary).toContain("medium"); | ||
| }); | ||
|
|
||
| it("should not display secrecy or integrity when absent from message", () => { | ||
| const options = { | ||
| type: "create_issue", | ||
| messageIndex: 1, | ||
| success: true, | ||
| result: { | ||
| repo: "owner/repo", | ||
| number: 123, | ||
| }, | ||
| message: { | ||
| title: "Normal Issue", | ||
| body: "Normal content", | ||
| }, | ||
| }; | ||
|
|
||
| const summary = generateSafeOutputSummary(options); | ||
|
|
||
| expect(summary).not.toContain("Secrecy:"); | ||
| expect(summary).not.toContain("Integrity:"); | ||
| }); | ||
|
|
||
| it("should display secrecy and integrity fields even when operation fails", () => { | ||
| const options = { | ||
| type: "create_issue", | ||
| messageIndex: 1, | ||
| success: false, | ||
| result: null, | ||
| message: { | ||
| title: "Failed Issue", | ||
| secrecy: "public", | ||
| integrity: "low", | ||
| }, | ||
| error: "Permission denied", | ||
| }; | ||
|
|
||
| const summary = generateSafeOutputSummary(options); | ||
|
|
||
| expect(summary).toContain("Secrecy:"); | ||
| expect(summary).toContain("public"); | ||
| expect(summary).toContain("Integrity:"); | ||
| expect(summary).toContain("low"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("writeSafeOutputSummaries", () => { | ||
|
|
||
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 secrecy/integrity display logic correctly uses both
undefinedandnullchecks before rendering. Consider adding a brief validation that values are strings before interpolating them into the markdown summary to avoid unexpected rendering if non-string values are passed.