Change DMARC reporting template#11
Conversation
- Introduced functions to analyze DMARC records and generate issue links for the Wall of Shame. - Updated the modal to request the organization name instead of the company name for DMARC submissions. - Enhanced URL parameters for new issue creation to include DMARC record snippets and issue types.
- Removed deprecated functions related to DMARC issue reporting. - Introduced a new function to build the Wall of Shame DMARC issue URL. - Updated the modal to utilize the new URL building function for issue submissions.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a library to build prefilled GitHub "Wall of Shame" DMARC issue URLs with helpers/tests, and updates the popup to import and use that library while changing modal text to use "organisation" phrasing. ChangesDMARC Wall of Shame Issue URL Library
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/wallOfShameDmarcIssue.test.ts (1)
82-97: ⚡ Quick winAdd boundary tests for
maxChars <= 1truncation behavior.Current truncation coverage misses the edge bounds where
maxCharsis0or1, which is where regressions are most likely.✅ Proposed test additions
describe('formatWallOfShameDmarcRecordForUrl', () => { + it('returns empty for maxChars=0', () => { + expect(formatWallOfShameDmarcRecordForUrl(['v=DMARC1; p=none;'], 0)).toBe(''); + }); + + it('returns only ellipsis for maxChars=1 when input is non-empty', () => { + expect(formatWallOfShameDmarcRecordForUrl(['v=DMARC1; p=none;'], 1)).toBe('…'); + }); + it('truncates long records with an ellipsis suffix', () => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/wallOfShameDmarcIssue.test.ts` around lines 82 - 97, Add boundary unit tests for formatWallOfShameDmarcRecordForUrl to cover maxChars values 0 and 1: create two new it blocks in lib/wallOfShameDmarcIssue.test.ts that call formatWallOfShameDmarcRecordForUrl with a long DMARC record and maxChars set to 0 and 1 respectively, then assert the output length equals the given max (0 or 1), and verify truncation/ellipsis behavior for the 1 case (endsWith '…') and appropriate handling for 0 (empty string). Ensure you reference formatWallOfShameDmarcRecordForUrl and WALL_OF_SHAME_DMARC_RECORD_URL_MAX in the tests to keep behavior consistent with existing cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/wallOfShameDmarcIssue.ts`:
- Around line 9-13: The truncation function truncateForUrlSnippet can call slice
with a negative bound when max <= 0; update truncateForUrlSnippet to guard
non-positive max (e.g., if max <= 0 return '' and handle max === 1 as a special
case if you want a single ellipsis) so you never call slice with a negative
length and the returned string respects the requested max; make the same
guard/update in formatWallOfShameDmarcRecordForUrl (and the related snippet
logic referenced around lines 38–47) so both use the safe truncation behavior.
---
Nitpick comments:
In `@lib/wallOfShameDmarcIssue.test.ts`:
- Around line 82-97: Add boundary unit tests for
formatWallOfShameDmarcRecordForUrl to cover maxChars values 0 and 1: create two
new it blocks in lib/wallOfShameDmarcIssue.test.ts that call
formatWallOfShameDmarcRecordForUrl with a long DMARC record and maxChars set to
0 and 1 respectively, then assert the output length equals the given max (0 or
1), and verify truncation/ellipsis behavior for the 1 case (endsWith '…') and
appropriate handling for 0 (empty string). Ensure you reference
formatWallOfShameDmarcRecordForUrl and WALL_OF_SHAME_DMARC_RECORD_URL_MAX in the
tests to keep behavior consistent with existing cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 71b6ef44-e539-4ee7-84cc-6fa702b979e8
📒 Files selected for processing (3)
entrypoints/popup/main.tslib/wallOfShameDmarcIssue.test.tslib/wallOfShameDmarcIssue.ts
- Updated the inferWallOfShameDmarcIssueType function to correctly identify valid strict DMARC policies. - Added new test cases for valid strict policies and edge cases in URL formatting. - Implemented handling for non-positive maxChars in formatWallOfShameDmarcRecordForUrl function.
Summary
Adjusted the URL used to fill out the repo's template
How tested
Manual testing in Chrome and Edge confirm this is working
Checklist
npm testpasses locallypackage.json/package-lock.jsonchanged and this repo commits SBOMs: updatedsbom-cyclonedx-npm.jsonandsbom.spdx.jsonwxt.config.tsmanifest and docs (README / privacy notes) as neededSummary by CodeRabbit
New Features
Bug Fixes
Tests