refactor(metatable): refresh metaobject cache in place - #111
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors nansen.metadata.MetaTable metaObject cache handling to refresh cached MetadataEntity instances in place when table entries or schema columns change, avoiding invalidating live handles where safe while retaining a delete-and-rebuild fallback for non-refreshable cache entries.
Changes:
- Add in-place refresh helpers to
MetadataEntity(refresh row/property, add/remove table-backed dynamic props). - Refactor
MetaTableentry/column mutation paths to repair cached metaObjects instead of always resetting the cache; rename the opt-out flag toRefreshCache=false. - Expand regression coverage with a new refreshable test entity and additional cache contract tests (refresh/skip/fallback/warn/delete paths).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/+nansen/+unittest/+metadata/MetaTableCacheInvalidationTest.m |
Updates/extends cache invalidation tests to assert in-place refresh behavior and fallback cases. |
tests/+nansen/+unittest/+metadata/+helper/RefreshableTestItem.m |
Introduces a minimal MetadataEntity subclass used to validate refresh-in-place semantics. |
code/+nansen/+metadata/+abstract/@MetadataEntity/MetadataEntity.m |
Adds internal APIs to refresh from a table row and manage table-backed properties (including dynamic ones). |
code/+nansen/+metadata/@MetaTable/MetaTable.m |
Implements cache repair on edits/column changes and renames the cache-skip option to RefreshCache. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MetadataEntityobjects in place when metatable entries change.RefreshCache=falseand cover the skip/fallback paths with regression tests.Why
Cached metaObjects could become stale or be deleted while UI/dialog code still held the handle. The cache repair path keeps live
MetadataEntityhandles current and only discards cache entries when they cannot be safely refreshed.