Skip to content

fix(gap-assessment): fail loud when a requested framework does not resolve in the crosswalk - #220

Open
ethanolivertroy wants to merge 2 commits into
mainfrom
cursor/fix-gap-assessment-unresolved-frameworks-4980
Open

fix(gap-assessment): fail loud when a requested framework does not resolve in the crosswalk#220
ethanolivertroy wants to merge 2 commits into
mainfrom
cursor/fix-gap-assessment-unresolved-frameworks-4980

Conversation

@ethanolivertroy

@ethanolivertroy ethanolivertroy commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the silent-green failure mode from #215: gap-assessment rendered a normal, celebratory report ("Tier 1 blockers (0), None. 🎉") and exited 0 when the requested framework could not be resolved in the SCF crosswalk, so "never evaluated" was visually indistinguishable from a genuine clean pass.

Every requested framework is now resolved against the crosswalk before any report is produced. If any fail to resolve, the run aborts with new exit code 7, lists each unresolved framework with a specific reason, and writes no report bundle:

  • Frameworks SCF is known not to cover (HITRUST, StateRAMP, PBMM, US export controls) get the targeted explanation already maintained in scf-client.js's FRAMEWORKS_WITHOUT_SCF_CROSSWALK table, which was exported but previously never called from gap-assessment.js.
  • Any other unmatched label gets a not-found hint pointing at frameworks.js --search=<term> and docs/FRAMEWORK-COVERAGE.md.

Per the issue's suggestion, HITRUST-CSF (and PBMM, which has the same problem) are dropped from the documented alias list in commands/gap-assessment.md, with a new "Not supported" note and the exit code documented.

Resolves #215

Type of change

  • Connector
  • Framework plugin
  • Persona plugin
  • Documentation
  • Community / governance
  • CI / automation
  • Other

Schema impact

  • No schema changes
  • schemas/finding.schema.json changed
  • Another schema or contract surface changed

Test plan

New hermetic unit suite tests/gap-assessment-framework-resolution.test.mjs (stubbed SCF client, no network): resolved/unresolved separation, HITRUST-specific reason, generic not-found reason, distinct exit code. Named *.test.mjs so #216's tests/run-unit-tests.sh picks it up automatically once that lands.

$ node --test tests/gap-assessment-framework-resolution.test.mjs
# tests 5
# pass 5
# fail 0

End-to-end against the live SCF crosswalk (v2026.1) using the exact reproduction from #215:

$ node plugins/grc-engineer/scripts/gap-assessment.js HIPAA --cache-dir=/tmp/grc-repro/findings ...
| HIPAA | 1/87 (1%) | 0 | 1 | 0 | 0% |          exit 0 (unchanged)

$ node plugins/grc-engineer/scripts/gap-assessment.js HITRUST-CSF ...
[gap-assessment] cannot assess — 1 of 1 requested framework(s) did not resolve in the SCF crosswalk:
  - HITRUST-CSF: HITRUST CSF is proprietary; SCF does not publish a public crosswalk. Use the `hitrust` plugin directly.
No report was generated. Remove or correct the framework(s) above and re-run.
                                                 exit 7

$ node plugins/grc-engineer/scripts/gap-assessment.js NOT-A-REAL-FRAMEWORK ...
                                                 exit 7

$ node plugins/grc-engineer/scripts/gap-assessment.js HIPAA,HITRUST-CSF,NOT-A-REAL-FRAMEWORK ...
  - both unresolved frameworks listed             exit 7, no report bundle written

Also ran npm run test:contract (49 fixtures valid) and markdownlint on the changed Markdown files (clean).

CHANGELOG

  • No CHANGELOG entry needed
  • I added a CHANGELOG entry
  • A maintainer should add the CHANGELOG entry during merge

Notes for reviewers

  • Fail-fast applies to the whole request, including mixed requests where some frameworks resolve: the issue allowed either fail-all or partial-report-plus-nonzero, and fail-all is the safer contract since no misleading report ever exists on disk.
  • Resolution runs after SCF init but before findings are loaded, so NO_SOURCES (empty cache) still takes precedence, matching existing behavior.
  • resolveRequestedFrameworks and EXIT are exported for the test; the CLI guard (invokedFromCLI) already made the module import-safe.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Gap assessments now validate requested frameworks through the SCF crosswalk before generating reports.
    • Unresolved or unsupported frameworks stop processing with exit code 7 and framework-specific explanations.
    • Reports are no longer created when framework resolution fails.
    • HIPAA and SOC 2 requests resolve to their canonical frameworks.
    • Removed aliases for HITRUST-CSF, StateRAMP, and PBMM; proxy guidance is now documented.

…solve in the crosswalk

Resolve every requested framework against the SCF crosswalk before any
report is produced. Unresolved frameworks abort with new exit code 7 and
a per-framework reason: the specific no-public-crosswalk explanation
from scf-client's FRAMEWORKS_WITHOUT_SCF_CROSSWALK table for HITRUST /
StateRAMP / PBMM / US-Export, or a not-found hint pointing at
frameworks.js and FRAMEWORK-COVERAGE.md otherwise.

Previously an unresolvable framework rendered a normal green report
("Tier 1 blockers (0) - None") with exit 0, indistinguishable from a
genuine clean pass. Drops HITRUST-CSF and PBMM from the documented
alias list and documents the unsupported set and the new exit code.

Closes #215

Co-authored-by: Ethan Troy <ethanolivertroy@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f49bb18-95f8-4f80-9e4e-9c25482765f0

📥 Commits

Reviewing files that changed from the base of the PR and between a5365ea and bcbaaf8.

📒 Files selected for processing (2)
  • plugins/grc-engineer/scripts/gap-assessment.js
  • tests/gap-assessment-framework-resolution.test.mjs
📝 Walkthrough

Walkthrough

gap-assessment now resolves requested frameworks through the SCF crosswalk before loading findings or generating reports. Unresolved frameworks produce per-framework errors and exit code 7. Documentation removes unsupported aliases and tests cover resolution outcomes.

Changes

Gap-assessment framework resolution

Layer / File(s) Summary
Framework support and exit-code documentation
plugins/grc-engineer/commands/gap-assessment.md, CHANGELOG.md
Documents unsupported framework aliases, proxy guidance, crosswalk validation, and exit code 7.
Crosswalk resolution before reporting
plugins/grc-engineer/scripts/gap-assessment.js
Adds resolveRequestedFrameworks, resolves frameworks before report creation, reports unresolved reasons, and exports EXIT with UNRESOLVED_FRAMEWORK: 7.
Resolution behavior validation
tests/gap-assessment-framework-resolution.test.mjs
Tests canonical mappings, unresolved labels, HITRUST-CSF messaging, exit codes, and mixed framework requests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant GapAssessment
  participant SCFCrosswalk
  participant Report
  Operator->>GapAssessment: request frameworks
  GapAssessment->>SCFCrosswalk: resolve each framework
  SCFCrosswalk-->>GapAssessment: metadata or unresolved reason
  alt all frameworks resolve
    GapAssessment->>Report: load findings and generate report
  else framework unresolved
    GapAssessment-->>Operator: report error and exit 7
  end
Loading

Possibly related PRs

Suggested reviewers: ajy0127

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the gap-assessment fix for unresolved frameworks and matches the primary change.
Linked Issues check ✅ Passed The changes resolve requested frameworks before reporting, fail with exit code 7, explain unresolved frameworks, and update unsupported aliases as required by #215.
Out of Scope Changes check ✅ Passed The script, documentation, changelog, and tests directly support framework-resolution failure handling and the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-gap-assessment-unresolved-frameworks-4980

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

The PR prevents gap assessments from producing clean reports when requested frameworks cannot be resolved in the SCF crosswalk.

  • Preflights every requested framework and aborts unresolved requests with exit code 7.
  • Provides targeted explanations for known unsupported frameworks and generic guidance for unknown labels.
  • Updates command documentation, the changelog, and framework-resolution coverage.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
plugins/grc-engineer/scripts/gap-assessment.js Adds framework-resolution preflight validation before findings are loaded or reports are generated.
plugins/grc-engineer/commands/gap-assessment.md Documents unsupported framework labels and the new unresolved-framework exit code.
tests/gap-assessment-framework-resolution.test.mjs Adds focused unit cases for successful, unknown, unsupported, and mixed framework resolution.
CHANGELOG.md Records the corrected fail-loud behavior and associated documentation changes.

Reviews (2): Last reviewed commit: "fix(gap-assessment): resolve frameworks ..." | Re-trigger Greptile

Comment thread tests/gap-assessment-framework-resolution.test.mjs
@ethanolivertroy
ethanolivertroy marked this pull request as ready for review August 7, 2026 12:47
@ethanolivertroy
ethanolivertroy requested a review from a team as a code owner August 7, 2026 12:47
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@plugins/grc-engineer/scripts/gap-assessment.js`:
- Around line 63-75: Move SCF initialization and the resolveRequestedFrameworks
call before discoverSources and its no-source validation, using the existing
resolution and unresolved-framework handling. Ensure unresolved requested
frameworks fail with EXIT_UNRESOLVED_FRAMEWORK and their framework-specific
reasons before any no-source exit, while source validation runs only after all
frameworks resolve.

In `@tests/gap-assessment-framework-resolution.test.mjs`:
- Around line 10-12: Update the HIPAA entry in the test’s known framework
mapping and its corresponding expected result to use the canonical framework ID
usa-federal-law-hipaa-security-rule-2013, while preserving the existing display
name and other mappings.
🪄 Autofix

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: 49bda3d3-e4a3-459f-8040-61632278b322

📥 Commits

Reviewing files that changed from the base of the PR and between e98e63e and a5365ea.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • plugins/grc-engineer/commands/gap-assessment.md
  • plugins/grc-engineer/scripts/gap-assessment.js
  • tests/gap-assessment-framework-resolution.test.mjs

Comment thread plugins/grc-engineer/scripts/gap-assessment.js Outdated
Comment thread tests/gap-assessment-framework-resolution.test.mjs
…canonical HIPAA id in test stub

An unresolvable framework can never succeed, so it now fails with exit 7
and its specific reason even when the findings cache is empty, instead of
being masked by the NO_SOURCES exit. Valid frameworks with an empty cache
still exit 3. Test stub now uses the canonical
usa-federal-law-hipaa-security-rule-2013 id.

Co-authored-by: Ethan Troy <ethanolivertroy@users.noreply.github.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.

[Bug]: gap-assessment reports a clean pass (exit 0) for frameworks that do not resolve in the crosswalk

2 participants