Skip to content

Fixes #32459: Allow owners to read private memories - #32858

Merged
pmbrull merged 3 commits into
mainfrom
pmbrull/fix-private-memory-owner
Sep 8, 2026
Merged

pmbrull merged 3 commits into
mainfrom
pmbrull/fix-private-memory-owner

Conversation

@pmbrull

@pmbrull pmbrull commented Sep 7, 2026

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #32459

Private context-memory visibility is checked after the entity is fetched. When a caller did not request owners (including the default GET projection), the relationship was absent from the fetched entity, so an owner could be rejected with a 403 for their own private memory.

This change uses the existing ContextMemoryVisibility.guardFields(...) helper for both direct read paths so the visibility decision always has the owner relationship it needs:

  • GET /api/v1/contextCenter/memories/{id}
  • GET /api/v1/contextCenter/memories/name/{fqn}

The integration tests issue both requests as the non-admin owner without a fields parameter. Each test reproduced the 403 before the corresponding resource change and passes afterward.

Type of change:

  • Bug fix

High-level design:

N/A — small bug fix that reuses the existing visibility-decision field helper.

Tests:

Use cases covered

  • A non-admin owner can read their private memory by ID without requesting fields.
  • A non-admin owner can read their private memory by fully qualified name without requesting fields.
  • Existing private/shared/entity visibility rules continue to pass their unit suite.

Unit tests

  • I ran the existing unit tests for the reused visibility logic.
  • File: openmetadata-service/src/test/java/org/openmetadata/service/resources/context/ContextMemoryVisibilityTest.java
  • Result: 17 tests passed.
  • JaCoCo coverage for guardFields: 100% lines (6/6) and 100% branches (4/4).

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for the changed API endpoints.
  • File: openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ContextMemoryIT.java
  • Result: 2 tests passed, 0 failures, 0 errors.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Built and installed the changed service locally with mvn install -pl openmetadata-service -DskipTests.
  2. Ran ContextMemoryIT against its local PostgreSQL, Elasticsearch, MinIO, and OpenMetadata test containers.
  3. Created private memories owned by the non-admin test user.
  4. Read them by ID and FQN without fields; both returned the expected memory instead of 403.
  5. No non-local OpenMetadata instance was modified during verification.

UI screen recording / screenshots:

Not applicable — no UI changes.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • The existing guardFields Javadoc documents why visibility decision fields are required.
  • For JSON Schema changes: not applicable; there are no schema changes.
  • For UI changes: not applicable; there are no UI changes.
  • I have added tests and listed them above.
  • I have added a test that covers the exact scenario being fixed.

Private memory visibility depends on owners, but projected GETs cleared that relationship before the visibility guard ran. Load the decision field for ID and name reads so owners are not denied.
Copilot AI lite review requested due to automatic review settings September 7, 2026 10:36
@pmbrull
pmbrull requested a review from a team as a code owner September 7, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 0a665fdeef36d53d1c0c9fec59e6ea3963cdccbd in Playwright run 34186752014, attempt 1.

✅ 936 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 49m 2s

⏱️ Max setup 5m 19s · max shard execution 15m 53s · max shard-job elapsed before upload 19m 21s · reporting 6s

🌐 206.47 requests/attempt · 2.44 app boots/UI scenario · 24.76% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 24.76% (convergence target: at most 15%).
  • Browser traffic was 206.47 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.44 per UI scenario (2422 boots / 991 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🟡 Shard chromium-01 131 0 1 0 0 0
✅ Shard chromium-02 146 0 0 0 0 0
✅ Shard chromium-03 128 0 0 0 0 0
🟡 Shard chromium-04 134 0 1 0 0 0
✅ Shard chromium-05 119 0 0 0 0 0
🟡 Shard chromium-06 120 0 1 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 3 flaky test(s) (passed on retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard chromium-01, 1 retry)
  • Features/ContextCenterMemories.spec.ts › typing the linked table name in the asset search returns it as a result (shard chromium-04, 1 retry)
  • Pages/Entity.spec.ts › Tag Add, Update and Remove for child entities (shard chromium-06, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings September 7, 2026 12:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pmbrull
pmbrull enabled auto-merge September 7, 2026 15:41
Copilot AI review requested due to automatic review settings September 8, 2026 04:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes private memory visibility check for owners by hydrating the owners relationship during reads. Owners can now read their private memories by ID and FQN without explicitly requesting fields. Existing visibility rules continue to pass, and integration tests confirm the fix works as expected.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@pmbrull
pmbrull disabled auto-merge September 8, 2026 05:22
@pmbrull
pmbrull enabled auto-merge September 8, 2026 05:22
@pmbrull
pmbrull added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 34bf9e1 Sep 8, 2026
140 of 141 checks passed
@pmbrull
pmbrull deleted the pmbrull/fix-private-memory-owner branch September 8, 2026 13:01
pmbrull added a commit that referenced this pull request Sep 8, 2026
Private memory visibility depends on owners, but projected GETs cleared that relationship before the visibility guard ran. Load the decision field for ID and name reads so owners are not denied.
@pmbrull

pmbrull commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

picked to 2.0

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory visibility check missing on some context memory endpoints

5 participants