Skip to content

refactor(metatable): refresh metaobject cache in place - #111

Merged
ehennestad merged 5 commits into
devfrom
codex/metatable-metaobject-cache-refresh
Jun 5, 2026
Merged

refactor(metatable): refresh metaobject cache in place#111
ehennestad merged 5 commits into
devfrom
codex/metatable-metaobject-cache-refresh

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Summary

  • Refresh cached MetadataEntity objects in place when metatable entries change.
  • Repair cached objects after column add/remove when possible, with drop-and-rebuild fallback for unsupported cache entries.
  • Rename the edit skip option to RefreshCache=false and 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 MetadataEntity handles current and only discards cache entries when they cannot be safely refreshed.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Test Results

254 tests  +9   254 ✅ +9   28s ⏱️ +6s
 16 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit dbb5418. ± Comparison against base commit 9563aef.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 MetaTable entry/column mutation paths to repair cached metaObjects instead of always resetting the cache; rename the opt-out flag to RefreshCache=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.

Comment thread code/+nansen/+metadata/@MetaTable/MetaTable.m Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread code/+nansen/+metadata/@MetaTable/MetaTable.m Fixed
@ehennestad
ehennestad marked this pull request as ready for review June 5, 2026 17:50
@ehennestad
ehennestad merged commit 7ba0f41 into dev Jun 5, 2026
5 of 6 checks passed
@ehennestad
ehennestad deleted the codex/metatable-metaobject-cache-refresh branch June 5, 2026 17:53
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.

3 participants