Skip to content

feat: add internal experimental features switch - #9369

Open
MarvelBR wants to merge 2 commits into
LibreSign:mainfrom
MarvelBR:feat/8333-experimental-features-switch
Open

MarvelBR wants to merge 2 commits into
LibreSign:mainfrom
MarvelBR:feat/8333-experimental-features-switch

Conversation

@MarvelBR

@MarvelBR MarvelBR commented Nov 5, 2026 •

Copy link
Copy Markdown

Resolves: #8333

Summary

Adds ExperimentalFeaturesService, a small internal switch backed by the experimental_features app config key. It is disabled by default (also when the key is missing) and has no UI, so future experimental features can be gated behind a single, tested check.

This PR does not gate any feature yet and does not change existing behavior.

How to test

  1. Run the unit tests: vendor/bin/phpunit -c tests/php/phpunit.xml --filter ExperimentalFeaturesServiceTest --no-coverage
  2. Optionally, toggle the key with occ and check that ExperimentalFeaturesService::isEnabled() follows it: occ config:app:set libresign experimental_features --value=true --type=boolean

I also verified that the value is read correctly when set without --type=boolean.

Validation evidence

  • Focused regression/acceptance test
  • Relevant lint/type/static-analysis checks (composer cs:check, composer psalm)
  • Broader suite required by the changed surface (composer test:unit)
  • CI reviewed

API / Back-end changes

  • New OCA\Libresign\Service\ExperimentalFeaturesService reading experimental_features through IAppConfig, defaulting to false
  • Unit tests added for missing, false and true values

Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

AI (if applicable)

  • The content of this PR was partially or fully generated using AI

AI assistance was used to locate existing test helpers and to review the code and PR text. The implementation and tests were written and verified by me.

Signed-off-by: MarvelBR <erickmg2005@gmail.com>
@MarvelBR
MarvelBR requested a review from a team as a code owner November 5, 2026 16:35

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please address the inline suggestion to consolidate the three equivalent configuration tests with a named PHPUnit data provider. The production service implementation otherwise aligns with issue #8333.

use OCA\Libresign\Tests\Unit\TestCase;

final class ExperimentalFeaturesServiceTest extends TestCase {
public function testExperimentalFeaturesAreDisabledWhenConfigurationIsMissing(): void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you consolidate these three tests using a #[DataProvider] with named datasets?

For example:

use PHPUnit\Framework\Attributes\DataProvider;

/**
 * @return array<string, array{?bool, bool}>
 */
public static function provideExperimentalFeatureStates(): array {
    return [
        'missing configuration' => [null, false],
        'explicitly disabled' => [false, false],
        'explicitly enabled' => [true, true],
    ];
}

#[DataProvider('provideExperimentalFeatureStates')]
public function testExperimentalFeaturesSwitch(?bool $configuredValue, bool $expected): void {
    $appConfig = self::getMockAppConfig();

    if ($configuredValue !== null) {
        $appConfig->setValueBool(
            Application::APP_ID,
            ExperimentalFeaturesService::APP_CONFIG_KEY,
            $configuredValue,
        );
    }

    $service = new ExperimentalFeaturesService($appConfig);

    $this->assertSame($expected, $service->isEnabled());
}

Here, null represents a missing configuration key, not a stored value. This preserves the distinction between an absent configuration and an explicit false.

The three cases will remain independently reported by PHPUnit, while sharing the same setup and assertion. This also follows the existing testing conventions in LibreSign.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review! I consolidated the three tests into a single one using a named #[DataProvider], as suggested.

@vitormattos vitormattos added this to the Next Major (36) milestone Nov 7, 2026
Signed-off-by: MarvelBR <erickmg2005@gmail.com>
@MarvelBR
MarvelBR force-pushed the feat/8333-experimental-features-switch branch from f981243 to 4d48e8b Compare November 17, 2026 13:21

This branch has not been deployed

No deployments
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.

Add an internal switch for experimental features

2 participants