Skip to content

Adding search functionality for orgNr in party selection#4302

Open
olemartinorg wants to merge 2 commits into
mainfrom
fix/orgnr-search
Open

Adding search functionality for orgNr in party selection#4302
olemartinorg wants to merge 2 commits into
mainfrom
fix/orgnr-search

Conversation

@olemartinorg

@olemartinorg olemartinorg commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

This adds missing functionality (which was so severe I'm agreeing with calling this a bug) in the party selection view. This should now support searching for org numbers + ssn, even with whitespace.

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • New Features

    • Enhanced party search to support numeric identifier queries
    • Personal identifiers now masked in the system
  • Tests

    • Added test coverage for numeric search functionality with whitespace handling

@olemartinorg olemartinorg added kind/bug Something isn't working backport This PR should be cherry-picked onto older release branches labels Jun 19, 2026
@olemartinorg olemartinorg marked this pull request as ready for review June 19, 2026 09:41
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@olemartinorg, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 25 minutes and 51 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate limits work?

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

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1670347d-1a0f-44bf-8953-2cd7c8308d95

📥 Commits

Reviewing files that changed from the base of the PR and between 7b59be2 and 56896fa.

📒 Files selected for processing (2)
  • src/features/instantiate/containers/PartySelection.test.tsx
  • src/features/instantiate/containers/PartySelection.tsx
📝 Walkthrough

Walkthrough

Adds numeric-aware filtering to PartySelection so that search input containing only digits is matched against party ssn and orgNumber fields in addition to names. Updates the default SSN in getPartyMock to a masked format (010175*****), aligns test fixtures and assertions accordingly, and changes the e2e signing login to type the org number instead of the org name.

Changes

Party Search Filtering and Masked SSN

Layer / File(s) Summary
Numeric-aware filtering in PartySelection
src/features/instantiate/containers/PartySelection.tsx
Derives a numberFilterString (digits-only) and hasNumberFilter flag from user input; extends filteredParties to match case-insensitive name or, when the input is purely numeric, a partial ssn/orgNumber match. Deleted-party visibility remains gated by showDeleted.
Masked SSN in mock, unit tests, and e2e login
src/__mocks__/getPartyMock.ts, src/features/instantiate/containers/PartySelection.test.tsx, test/e2e/support/apps/signing-test/signing-login.ts
Default ssn in getPartyMock changed to '010175*****'. All PartySelection test fixtures updated to masked SSN strings; two new tests added to verify whitespace-tolerant search by org number and SSN. E2e signing login updated to type org.orgNr instead of org.name into the search textbox.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Altinn/app-frontend-react#4298: Implements SSN masking via maskSsn and updates related tests, directly producing the masked 010175***** format that this PR adopts in mocks and test fixtures.

Suggested reviewers

  • framitdavid
  • adamhaeger
  • phlipsterit
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding search functionality for organization numbers (orgNr) in party selection, which is the primary objective of the PR.
Description check ✅ Passed The PR description follows the template structure with all required sections completed: Description, Related Issues, and comprehensive Verification/QA checklist with appropriate selections.
Linked Issues check ✅ Passed The PR successfully addresses issue #19124 by implementing search functionality for organization numbers and SSN in party selection, including support for whitespace-containing queries as required.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing party selection search functionality: mock data updates, component logic updates, test additions, and E2E test modifications are all in scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/orgnr-search

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/features/instantiate/containers/PartySelection.tsx`:
- Around line 67-73: The numeric filter validation is incorrectly allowing mixed
text input (like "abc123") to trigger SSN and org number matching. Currently,
the code removes all non-digits from filterString to create numberFilterString,
then checks if numberFilterString matches only digits, but this means any input
with at least one digit will pass the validation. To fix this, change the
hasNumberFilter validation to check if the original filterString itself contains
only digits (using a regex like /^\d+$/ directly on filterString) instead of
validating the stripped numberFilterString. This ensures numeric field matching
only occurs when the user enters pure numeric input without any text characters.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ecd9b174-2f3e-4e43-8b33-41b5b41dc4f5

📥 Commits

Reviewing files that changed from the base of the PR and between 4433f32 and 7b59be2.

📒 Files selected for processing (4)
  • src/__mocks__/getPartyMock.ts
  • src/features/instantiate/containers/PartySelection.test.tsx
  • src/features/instantiate/containers/PartySelection.tsx
  • test/e2e/support/apps/signing-test/signing-login.ts

Comment thread src/features/instantiate/containers/PartySelection.tsx Outdated
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR should be cherry-picked onto older release branches kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tomt søkeresultat ved søk på organisasjonsnummer i aktørlisten etter instansiering av app

1 participant