Skip to content

fix: iappconfig cache sync#6234

Merged
vitormattos merged 3 commits intomainfrom
fix/iappconfig-cache-sync
Dec 18, 2025
Merged

fix: iappconfig cache sync#6234
vitormattos merged 3 commits intomainfrom
fix/iappconfig-cache-sync

Conversation

@vitormattos
Copy link
Copy Markdown
Member

No description provided.

IAppConfig uses per-process cache, causing race conditions when CLI
commands and HTTP requests execute simultaneously during Behat tests.
The CLI generates a ca_id, but HTTP requests see an empty cache and
generate a different ca_id, overwriting the CLI value.

Solution:
- Detect debug mode (automatically set during Behat tests)
- Apply file lock + cache clear workaround only in debug mode
- Production code remains unchanged for optimal performance

This fix resolves test failures in features/sign/request.feature:28
and features/sign/request.feature:61 where setup validation was
failing due to mismatched certificate paths.

Signed-off-by: Vitor Mattos <[email protected]>
When getCaId() finds an empty CA ID in cache, it now calls
clearCache(true) to reload from database before generating a new one.
This prevents race conditions in test environments where CLI commands
and HTTP requests may execute simultaneously with independent caches.

The solution is simpler than using file locks and works transparently
in both test and production environments with minimal overhead.

Signed-off-by: Vitor Mattos <[email protected]>
@vitormattos vitormattos added this to the Next Major (33) milestone Dec 17, 2025
@vitormattos vitormattos self-assigned this Dec 17, 2025
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Dec 17, 2025
@vitormattos
Copy link
Copy Markdown
Member Author

/backport to stable32

@vitormattos
Copy link
Copy Markdown
Member Author

/backport to stable31

Replace 'libresign:configure:openssl --cn test' CLI commands with
HTTP POST requests to '/apps/libresign/api/v1/admin/certificate/openssl'
in integration tests to prevent race conditions between CLI and HTTP
processes during test execution.

This ensures all certificate setup happens via HTTP requests, avoiding
IAppConfig cache synchronization issues that can occur when mixing CLI
commands with HTTP requests in the same test scenario.

Signed-off-by: Vitor Mattos <[email protected]>
@vitormattos vitormattos force-pushed the fix/iappconfig-cache-sync branch from 4a4c613 to 4eb4ab9 Compare December 17, 2025 16:50
@vitormattos vitormattos merged commit 183d4f7 into main Dec 18, 2025
64 of 84 checks passed
@vitormattos vitormattos deleted the fix/iappconfig-cache-sync branch December 18, 2025 13:11
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant