Skip to content

feat: add invalidateMetadataCache method to data access objects and update usage in GetConnectionDiagramUseCase#1771

Merged
Artuomka merged 1 commit into
mainfrom
backend_mermaid_uncashed
May 14, 2026
Merged

feat: add invalidateMetadataCache method to data access objects and update usage in GetConnectionDiagramUseCase#1771
Artuomka merged 1 commit into
mainfrom
backend_mermaid_uncashed

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

@Artuomka Artuomka commented May 14, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved cache invalidation mechanisms for connection and table metadata to ensure connection diagrams consistently reflect the current state of database structures and configurations.
    • Enhanced metadata cache management across data access operations to provide improved data freshness and reliability when retrieving connection information.

Review Change Stack

Copilot AI review requested due to automatic review settings May 14, 2026 15:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 01a0848b-c911-419b-930c-35dfeacf41c3

📥 Commits

Reviewing files that changed from the base of the PR and between 99f2a58 and 02efad9.

📒 Files selected for processing (5)
  • backend/src/entities/connection/use-cases/get-connection-diagram.use.case.ts
  • shared-code/src/data-access-layer/data-access-objects/basic-data-access-object.ts
  • shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts
  • shared-code/src/shared/interfaces/data-access-object-agent.interface.ts
  • shared-code/src/shared/interfaces/data-access-object.interface.ts

📝 Walkthrough

Walkthrough

This PR adds a public invalidateMetadataCache() method to data access object interfaces and implementations, enabling explicit cache clearing via LRUStorage. The method is then called in GetConnectionDiagramUseCase after validating the schema cache to ensure fresh metadata before generating Mermaid ER diagrams.

Changes

Metadata Cache Invalidation

Layer / File(s) Summary
Cache invalidation interface contracts
shared-code/src/shared/interfaces/data-access-object.interface.ts, shared-code/src/shared/interfaces/data-access-object-agent.interface.ts
IDataAccessObject and IDataAccessObjectAgent interfaces each declare a new invalidateMetadataCache(): void method.
Data access object cache invalidation implementations
shared-code/src/data-access-layer/data-access-objects/basic-data-access-object.ts, shared-code/src/data-access-layer/data-access-objects/data-access-object-agent.ts
BasicDataAccessObject imports LRUStorage and implements invalidateMetadataCache() to clear connection/table metadata. DataAccessObjectAgent implements the same method via LRUStorage.invalidateConnectionTableMetadata(this.connection).
Connection diagram use case cache invalidation call
backend/src/entities/connection/use-cases/get-connection-diagram.use.case.ts
GetConnectionDiagramUseCase calls dao.invalidateMetadataCache() immediately after validateSchemaCache(...) to invalidate cached metadata before fetching table lists and constructing the Mermaid diagram response.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • rocket-admin/rocketadmin#1750: The main PR's cache invalidation (dao.invalidateMetadataCache() after validateSchemaCache(...) in GetConnectionDiagramUseCase) is directly part of implementing the same Mermaid connection-diagram endpoint/use case added in the retrieved PR.

Poem

🐰 A cache grows stale, so we clear the way,
Invalidate metadata, fresh each day,
Diagram flows true with no old bones,
LRUStorage hums through connection zones,
Clean slates for all, our queries sing! 🌟

✨ 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 backend_mermaid_uncashed

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

@Artuomka Artuomka merged commit 1096f52 into main May 14, 2026
15 of 17 checks passed
@Artuomka Artuomka deleted the backend_mermaid_uncashed branch May 14, 2026 15:23
@Artuomka Artuomka review requested due to automatic review settings May 14, 2026 15:46
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.

1 participant