fix: Ad4mModel don't parse every Literal in properties (only when resolve language)#695
fix: Ad4mModel don't parse every Literal in properties (only when resolve language)#695
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTightens literal-URI parsing so Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@core/src/model/Ad4mModel.ts`:
- Around line 1698-1701: getData() currently parses any "literal://" values
unconditionally; mirror the guard added elsewhere by only parsing literal://
URIs when the property's propMeta.resolveLanguage === 'literal' (same check used
in the other branch). Update getData() to inspect propMeta.resolveLanguage
before unwrapping literal:// strings so get()/save() paths behave consistently;
reference the getData() function and the propMeta.resolveLanguage literal check
used where you added the guard, and ensure behavior matches get()/save() by
refusing to parse literal:// unless resolveLanguage === 'literal'.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/js/bootstrapSeed.json (1)
1-1: Consider externalizing the embedded bundle from the JSON fixture.Line 1 packs a very large escaped JS payload into one JSON field, which makes diffs hard to review and conflict-prone. Optional improvement: keep the bundle in a separate fixture file and load/inject it in test setup.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/js/bootstrapSeed.json` at line 1, The JSON fixture embeds a huge JS bundle in the languageLanguageBundle field which makes reviews and diffs painful; move the bundle into a separate fixture file (e.g. tests/fixtures/languageBundle.js), replace the languageLanguageBundle value in tests/js/bootstrapSeed.json with a small sentinel (for example "@file:languageBundle.js"), and update your test setup code to detect that sentinel and load the external file via Deno.readTextFileSync (injecting its contents into the languageLanguageBundle key before tests run). Ensure the test loader looks for the languageLanguageBundle field in the bootstrap fixture and performs the read/replace so existing consumers (fields named languageLanguageBundle) continue to work unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/js/bootstrapSeed.json`:
- Line 1: The JSON fixture embeds a huge JS bundle in the languageLanguageBundle
field which makes reviews and diffs painful; move the bundle into a separate
fixture file (e.g. tests/fixtures/languageBundle.js), replace the
languageLanguageBundle value in tests/js/bootstrapSeed.json with a small
sentinel (for example "@file:languageBundle.js"), and update your test setup
code to detect that sentinel and load the external file via
Deno.readTextFileSync (injecting its contents into the languageLanguageBundle
key before tests run). Ensure the test loader looks for the
languageLanguageBundle field in the bootstrap fixture and performs the
read/replace so existing consumers (fields named languageLanguageBundle)
continue to work unchanged.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (26)
ad4m-hooks/helpers/package.jsonad4m-hooks/react/package.jsonad4m-hooks/vue/package.jsonbootstrap-languages/agent-language/package.jsonbootstrap-languages/direct-message-language/package.jsonbootstrap-languages/neighbourhood-language/package.jsonbootstrap-languages/p-diff-sync/package.jsonbootstrap-languages/perspective-language/package.jsoncli/Cargo.tomlconnect/package.jsoncore/package.jsoncore/src/model/Ad4mModel.tsdocs-src/package.jsonexecutor/package.jsonexecutor/src/core/Config.tspackage.jsonrust-client/Cargo.tomlrust-executor/Cargo.tomlrust-executor/package.jsonrust-executor/src/globals.rstest-runner/package.jsontests/js/bootstrapSeed.jsontests/js/package.jsonui/package.jsonui/src-tauri/Cargo.tomlui/src-tauri/tauri.conf.json
✅ Files skipped from review due to trivial changes (8)
- executor/package.json
- bootstrap-languages/neighbourhood-language/package.json
- bootstrap-languages/agent-language/package.json
- rust-executor/Cargo.toml
- test-runner/package.json
- bootstrap-languages/p-diff-sync/package.json
- package.json
- ad4m-hooks/helpers/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- core/src/model/Ad4mModel.ts
…ge === literal|undefined Same root cause as #695 (do not parse every literal:// target unconditionally), but the fix differs because our refactored mutation layer always encodes plain scalar values as literal:// URIs (unlike the old monolithic Ad4mModel where only explicit resolveLanguage:"literal" props used literal://). Before: resolveValue() parsed ANY literal:// target regardless of resolveLanguage. A property with resolveLanguage set to a custom language address whose stored target happened to be a literal:// string (e.g. a model baseExpression URI stored as a string property) would have its URI silently destroyed, returning the unwrapped random ID instead. After: literal:// is only parsed when resolveLanguage is "literal" or undefined (the normal case for plain string/number properties). A non-literal resolveLanguage whose value starts with literal:// is left raw, preserving the URI for the caller. PR #695 can be dropped from dev once this branch merges — we replace the entire Ad4mModel.ts, so the old code path no longer exists.
Summary by CodeRabbit
Bug Fixes
Chores
Tests