Skip to content

SDK-2615: PHP - Support configuration for IDV shortened flow - php#414

Open
mehmet-yoti wants to merge 1 commit into
masterfrom
websdk-auto/SDK-2615-php-php---support-configuration-for-idv-shortened-flow
Open

SDK-2615: PHP - Support configuration for IDV shortened flow - php#414
mehmet-yoti wants to merge 1 commit into
masterfrom
websdk-auto/SDK-2615-php-php---support-configuration-for-idv-shortened-flow

Conversation

@mehmet-yoti
Copy link
Copy Markdown
Contributor

Summary

Adds first-class support for configuring the IDV shortened flow by introducing a SuppressedScreen constants class and a convenience isScreenSuppressed() lookup on SdkConfig. This lets integrators suppress specific IDV screens (e.g. education, requirements, flow completion) using named constants rather than raw strings, and inspect whether a given screen has been suppressed.

Changes

  • src/DocScan/Session/Create/SuppressedScreen.php (new): Defines string constants for the supported suppressible screens: ID_DOCUMENT_EDUCATION, ID_DOCUMENT_REQUIREMENTS, SUPPLEMENTARY_DOCUMENT_EDUCATION, ZOOM_LIVENESS_EDUCATION, STATIC_LIVENESS_EDUCATION, FACE_CAPTURE_EDUCATION, FLOW_COMPLETION.
  • src/DocScan/Session/Create/SdkConfig.php: Adds isScreenSuppressed(string $screenIdentifier): bool, which returns false when no suppressed screens are configured and otherwise performs a strict in_array check against the configured list.
  • tests/DocScan/Session/Create/SdkConfigBuilderTest.php: Adds coverage for empty-array suppressed screens, building with the new constants, constant value assertions, and isScreenSuppressed across matched, unmatched, null, and case-sensitivity scenarios.
  • .claude/settings.local.json: Local tooling settings update (not production code).

QA Test Steps

  1. Check out the branch and run composer install to install dependencies.
  2. Run the full test suite: vendor/bin/phpunit — confirm all tests pass, including the new ones in SdkConfigBuilderTest.
  3. Run just the targeted class to focus review:
    vendor/bin/phpunit --filter SdkConfigBuilderTest tests/DocScan/Session/Create/SdkConfigBuilderTest.php.
  4. Happy path — constants usage: In a scratch script, build an SdkConfig via SdkConfigBuilder::withSuppressedScreens([SuppressedScreen::ID_DOCUMENT_EDUCATION, SuppressedScreen::FLOW_COMPLETION]) and assert getSuppressedScreens() returns exactly those values, and that isScreenSuppressed(SuppressedScreen::ID_DOCUMENT_EDUCATION) returns true.
  5. Happy path — single screen: Use withSuppressedScreen(SuppressedScreen::ID_DOCUMENT_EDUCATION) and verify isScreenSuppressed(SuppressedScreen::ID_DOCUMENT_EDUCATION) is true while isScreenSuppressed(SuppressedScreen::FLOW_COMPLETION) is false.
  6. Edge — empty list: withSuppressedScreens([]) builds successfully and getSuppressedScreens() returns [].
  7. Edge — not configured: An SdkConfigBuilder with no suppressed-screen call produces an SdkConfig where isScreenSuppressed(...) returns false for every constant (null-safe behavior).
  8. Edge — case sensitivity: After suppressing SuppressedScreen::ID_DOCUMENT_EDUCATION, call isScreenSuppressed('id_document_education') and verify it returns false (strict comparison).
  9. Constants sanity: Verify each SuppressedScreen::* constant string value matches its identifier name exactly (e.g. SuppressedScreen::FLOW_COMPLETION === 'FLOW_COMPLETION').
  10. Regression — serialization: Build an SdkConfig without calling any suppressed-screens setter and confirm jsonSerialize() output does not contain a suppressed_screens property (pre-existing behavior retained).
  11. Regression — existing suppressed-screen flows: Create a full DocScan session against the sandbox using a config with withSuppressedScreens([...]) and verify the sdk_config.suppressed_screens array in the outbound request payload is unchanged from prior releases.
  12. Run static analysis / linters used by the repo (e.g. composer test or any CI command defined in composer.json) and confirm no new warnings.

Notes

  • The SuppressedScreen class is a plain constants holder (no enum) to stay consistent with the PHP version floor of the SDK and with existing constants-style classes in the codebase.
  • isScreenSuppressed() is case-sensitive by design, matching the exact string values the backend expects.
  • No changes to the SdkConfigBuilder public API or the JSON wire format — this is purely additive (new class + new read helper), so existing integrations continue to work unchanged.
  • .claude/settings.local.json is an ancillary tooling file; reviewers may want to confirm whether it should be committed or gitignored per project convention.

Related Jira: SDK-2615
Auto-generated by n8n + Claude CLI

@mehmet-yoti
Copy link
Copy Markdown
Contributor Author

🤖 Claude Code Review

Code Review Findings

Summary

The branch extends SdkConfig / SdkConfigBuilder with a new SuppressedScreen constants class and an isScreenSuppressed() convenience method on SdkConfig. It also adds tests covering the new surface. The change is small, well-scoped, and aligned with existing patterns; no correctness or security issues found. Main concerns are an accidentally committed IDE/tooling file and a couple of minor consistency/test-coverage gaps.

Critical

None.

Major

  • File: .claude/settings.local.json (new file)
    • Issue: Local Claude tooling config committed as part of the feature branch. .gitignore does not ignore .claude/, so personal/local editor config is leaking into production-facing PRs for an externally-consumed SDK.
    • Recommendation: Remove the file (git rm --cached .claude/settings.local.json) and add /.claude/ (or at least /.claude/settings.local.json) to .gitignore. Keep the feature commit scoped to only src/ and tests/ changes.

Minor

  • File: src/DocScan/Session/Create/SuppressedScreen.php (new file)

    • Issue: The class is instantiable even though it is effectively a namespaced enum of constants. Similar constants-only holders elsewhere in this repo are typically not instantiable.
    • Recommendation: Mark the class final and add a private constructor:
      final class SuppressedScreen
      {
          private function __construct()
          {
          }
      
          public const ID_DOCUMENT_EDUCATION = 'ID_DOCUMENT_EDUCATION';
          // ...
      }
  • File: src/DocScan/Session/Create/SdkConfigBuilder.php:265-284

    • Issue: withSuppressedScreens() and withSuppressedScreen() interact in a surprising way — calling withSuppressedScreen(...) first, then withSuppressedScreens([...]) silently overwrites the earlier additions (and vice-versa: withSuppressedScreens([...]) followed by withSuppressedScreen(...) appends).
    • Recommendation: Either document that withSuppressedScreens() replaces the list and withSuppressedScreen() appends, or make withSuppressedScreens() merge/dedupe. At minimum add a test asserting the chosen semantics.
  • File: src/DocScan/Session/Create/SdkConfig.php:306-313

    • Issue: isScreenSuppressed() is new public API; its docblock does not guide consumers toward the SuppressedScreen::* constants.
    • Recommendation: Widen the docblock to mention the SuppressedScreen::* constants as the expected source of identifiers:
      /**
       * @param string $screenIdentifier One of the SuppressedScreen::* constants.
       */
  • File: tests/DocScan/Session/Create/SdkConfigBuilderTest.php:495-509

    • Issue: isScreenSuppressedShouldBeCaseSensitive implicitly enshrines case-sensitive exact-string match as a contract without a corresponding note in the method's doc comment. A future refactor to e.g. normalize to upper-case would break it silently.
    • Recommendation: Add a one-line note in isScreenSuppressed()'s PHPDoc: "matching is case-sensitive and requires an exact string match".

Nit

  • File: tests/DocScan/Session/Create/SdkConfigBuilderTest.php:479-483

    • isScreenSuppressedShouldReturnFalseForUnlistedScreen asserts only the negative case. Add an $this->assertTrue($result->isScreenSuppressed(SuppressedScreen::ID_DOCUMENT_EDUCATION)); as a sanity check that the positive path is reachable under the same builder state.
  • File: tests/DocScan/Session/Create/SdkConfigBuilderTest.php:470-478

    • suppressedScreenConstantsShouldHaveExpectedValues is essentially a tautology. Consider replacing it with a single test that round-trips each constant through jsonSerialize() to assert the wire format matches the backend contract.
  • File: src/DocScan/Session/Create/SdkConfigBuilder.php:277-284

    • withSuppressedScreen() has no dedupe — passing FLOW_COMPLETION twice will JSON-serialize a duplicate. Harmless today, but consider if (!in_array($screenIdentifier, $this->suppressedScreens, true)).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for configuring the Doc Scan IDV “shortened flow” suppressed screens via named constants and a convenience lookup API, with accompanying unit tests.

Changes:

  • Introduces SuppressedScreen constants for supported suppressible screen identifiers.
  • Adds SdkConfig::isScreenSuppressed() for strict lookup against configured suppressed screens.
  • Extends SdkConfigBuilderTest to cover constants and lookup behavior (including null/empty and case-sensitivity).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/DocScan/Session/Create/SuppressedScreen.php Adds a constants holder for supported suppressed_screens identifiers.
src/DocScan/Session/Create/SdkConfig.php Adds isScreenSuppressed() helper for checking suppression configuration.
tests/DocScan/Session/Create/SdkConfigBuilderTest.php Adds test coverage for constants and isScreenSuppressed() behavior.
.claude/settings.local.json Adds local Claude tooling permissions configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +9
{
"permissions": {
"allow": [
"Bash(git rev-list *)",
"Bash(./vendor/bin/phpunit --filter 'SdkConfigBuilderTest|SessionConfigurationResponseTest')",
"Bash(git config *)"
]
}
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

This adds a settings.local.json file that appears to be a machine-/developer-local Claude CLI permissions config (including allowed Bash commands). Committing a *.local.* file can unintentionally share local tooling permissions across the team and into releases (e.g., source distributions). Consider removing this from version control and adding it to .gitignore, or committing a non-local template (e.g. settings.json.example) with the minimal required permissions instead.

Suggested change
{
"permissions": {
"allow": [
"Bash(git rev-list *)",
"Bash(./vendor/bin/phpunit --filter 'SdkConfigBuilderTest|SessionConfigurationResponseTest')",
"Bash(git config *)"
]
}
}
{}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +9
{
"permissions": {
"allow": [
"Bash(git rev-list *)",
"Bash(./vendor/bin/phpunit --filter 'SdkConfigBuilderTest|SessionConfigurationResponseTest')",
"Bash(git config *)"
]
}
}
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.

2 participants