Skip to content

fix(core): deep merge workflow metadata - #696

Merged
rafaelscosta merged 1 commit into
mainfrom
devops/issue-621-context-metadata-deep-merge-20260508
May 8, 2026
Merged

fix(core): deep merge workflow metadata#696
rafaelscosta merged 1 commit into
mainfrom
devops/issue-621-context-metadata-deep-merge-20260508

Conversation

@rafaelscosta

@rafaelscosta rafaelscosta commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • makes ContextManager.updateMetadata() preserve nested metadata instead of overwriting whole subtrees
  • keeps scalar/array replacement behavior and preserves null as an explicit metadata value
  • adds regression coverage for nested observability metadata
  • regenerates the install manifest

Fixes part of #621.

Validation

  • node -c .aiox-core/core/orchestration/context-manager.js
  • jest tests/core/orchestration/context-manager.test.js --runInBand (154 passed)
  • npm run generate:manifest
  • npm run validate:manifest
  • git diff --check
  • npm run lint (0 errors, 114 existing warnings)
  • npm run typecheck
  • node scripts/validate-package-completeness.js (34/34 passed)
  • node bin/utils/validate-publish.js (PASS, 4199 files)
  • npm test -- --runInBand --forceExit (330 suites passed, 8339 tests passed, 11 suites/149 tests skipped)

Notes

  • pro/ submodule initialized before package/publish validation
  • a parallel validate-publish attempt overlapped with another npm pack dry-run and returned 0 files; reran validate-publish alone and it passed
  • .aiox-core/data/entity-registry.yaml was touched by tests/hooks and restored as generated noise

Summary by CodeRabbit

  • Bug Fixes
    • Metadata updates now recursively merge nested plain-object values while replacing arrays, nulls, and primitives; invalid (non-plain-object) metadata inputs are rejected.
  • Tests
    • Added coverage verifying successive metadata updates preserve and update nested fields as expected.
  • Chores
    • Installation manifest regenerated to reflect the updated build artifacts.

@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aiox-core Ready Ready Preview, Comment May 8, 2026 5:21am

Request Review

@github-actions github-actions Bot added area: agents Agent system related area: workflows Workflow system related squad mcp type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: installer Installer and setup (packages/installer/) area: synapse SYNAPSE context engine area: cli CLI tools (bin/, packages/aios-pro-cli/) area: pro Pro features (pro/) area: health-check Health check system area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels May 8, 2026
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 138e0bb7-825b-4b0e-94b4-78c881bc5d22

📥 Commits

Reviewing files that changed from the base of the PR and between cb52030 and dbae2c6.

📒 Files selected for processing (3)
  • .aiox-core/core/orchestration/context-manager.js
  • .aiox-core/install-manifest.yaml
  • tests/core/orchestration/context-manager.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • .aiox-core/core/orchestration/context-manager.js
  • tests/core/orchestration/context-manager.test.js

Walkthrough

This PR changes ContextManager to deep-merge incoming metadata via a new mergeMetadata helper, tightens updateMetadata input validation to require plain objects, adds tests verifying nested metadata preservation across successive updates, and regenerates the install manifest.

Changes

Metadata Deep Merge Implementation

Layer / File(s) Summary
Metadata Merge Logic
.aiox-core/core/orchestration/context-manager.js
Introduces mergeMetadata helper that recursively deep-merges plain objects while replacing non-plain values; updateMetadata now validates input and uses this helper.
Test Coverage
tests/core/orchestration/context-manager.test.js
New test verifies updateMetadata deep-merges nested metadata.observability across successive calls and rejects non-plain-object inputs without persisting.
Manifest Regeneration
.aiox-core/install-manifest.yaml
generated_at timestamp and recorded SHA256/size for core/orchestration/context-manager.js updated to reflect the change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

area: core, type: test, area: installer, area: workflows

Suggested reviewers

  • oalanicolas
  • Pedrovaleriolopez
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(core): deep merge workflow metadata' directly and clearly summarizes the main change: updating metadata merging behavior from shallow to deep merge in the ContextManager.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 devops/issue-621-context-metadata-deep-merge-20260508

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.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

Coverage report not available

📈 Full coverage report available in Codecov


Generated by PR Automation (Story 6.1)

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.aiox-core/core/orchestration/context-manager.js (1)

19-19: ⚡ Quick win

Use absolute import instead of relative import

require('../config/merge-utils') breaks the repository import convention for JS/TS files. Please switch this to the project’s absolute import style used in this codebase.

As per coding guidelines, **/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.aiox-core/core/orchestration/context-manager.js at line 19, The require
call using a relative path for isPlainObject breaks the repo's import
convention; replace require('../config/merge-utils') with the project's absolute
import of the same module (keeping the isPlainObject symbol) so the file
.aiox-core/core/orchestration/context-manager.js uses the codebase's absolute
import style (i.e., require or import from the repo root/module alias used
elsewhere) and verify the import still exposes isPlainObject.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.aiox-core/core/orchestration/context-manager.js:
- Around line 245-247: The public method updateMetadata currently passes any
value to mergeMetadata which silently ignores non-object inputs; add an explicit
guard at the start of updateMetadata to validate that the incoming metadata is a
plain object (e.g., typeof metadata === 'object' && metadata !== null &&
!Array.isArray(metadata'') && metadata.constructor === Object or use the repo's
isPlainObject utility if available). If validation fails, throw a TypeError with
clear context (e.g., "updateMetadata expects a plain object, received:
<type/value>") so callers fail fast; otherwise proceed to call loadState() and
mergeMetadata(state.metadata, metadata) as before.

---

Nitpick comments:
In @.aiox-core/core/orchestration/context-manager.js:
- Line 19: The require call using a relative path for isPlainObject breaks the
repo's import convention; replace require('../config/merge-utils') with the
project's absolute import of the same module (keeping the isPlainObject symbol)
so the file .aiox-core/core/orchestration/context-manager.js uses the codebase's
absolute import style (i.e., require or import from the repo root/module alias
used elsewhere) and verify the import still exposes isPlainObject.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c900b40-bc4a-4ed6-a351-d8433e085aeb

📥 Commits

Reviewing files that changed from the base of the PR and between c1a9ff6 and cb52030.

📒 Files selected for processing (3)
  • .aiox-core/core/orchestration/context-manager.js
  • .aiox-core/install-manifest.yaml
  • tests/core/orchestration/context-manager.test.js

Comment thread .aiox-core/core/orchestration/context-manager.js
@rafaelscosta
rafaelscosta force-pushed the devops/issue-621-context-metadata-deep-merge-20260508 branch from cb52030 to dbae2c6 Compare May 8, 2026 05:20
@rafaelscosta
rafaelscosta merged commit 6604086 into main May 8, 2026
42 checks passed
@rafaelscosta
rafaelscosta deleted the devops/issue-621-context-metadata-deep-merge-20260508 branch May 8, 2026 05:24
tuanmedeiros pushed a commit to tuanmedeiros/aios-core-synkraay that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: cli CLI tools (bin/, packages/aios-pro-cli/) area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) area: health-check Health check system area: installer Installer and setup (packages/installer/) area: pro Pro features (pro/) area: synapse SYNAPSE context engine area: workflows Workflow system related mcp squad type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant