Skip to content

fix: webhook project scoping, OAuth request state, no-op transactions, view child posts and delete events - #289

Merged
HuiJun merged 1 commit into
developfrom
fix/release-review-findings
Nov 17, 2026
Merged

HuiJun merged 1 commit into
developfrom
fix/release-review-findings

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes five defects in code that has been on develop since the persistence refactor and has not been released yet. Four were reproduced against a running develop build before the change; the OAuth one was fixed from reading the code.

Webhooks (WebhooksController, FederatedWebhookPersistence)

  • Observed on develop: FederatedWebhookPersistence.findById / findByProjectIdAndUrl returned a WebhookJson without _projectId. Posting a webhook with an existing id returned 500 (NullPointerException in webhookExists), and re-posting an existing URL returned 400 "Cannot move webhooks between projects".
  • The cross-project overwrite was not reachable only because of that NullPointerException: save looked the webhook up by id without checking its project.
  • Now the lookups return the owning project, webhookExists returns an id match even when it belongs to another project so the controller answers 400, and save itself refuses an id owned by another project.

OAuth (OAuthProcessor)

  • grants was a field on a singleton bean, written and read during validateAuthToken, so concurrent validations could read each other's grants. It is now a local variable.

No-op writes (FederatedNodePersistence.commitChanges)

  • The transaction was opened before the toSaveNodeMap.isEmpty() check and never completed on the empty path. On develop, deleting elements that do not exist left connections idle in transaction, and a later request handled by one of those threads (a project creation) returned 200 without its data being committed.
  • The transaction is now opened only when there is something to save.

View posts (DefaultNodeService.createOrUpdate)

  • CameoViewService / MsosaViewService add generated properties and associations to changes.getUpdatedMap() from extraProcessPostedElement, while createOrUpdate was iterating that map. Posting a view with _childViews together with other elements returned 500 (ConcurrentModificationException). The loop now iterates a copy.

Deletes (DefaultNodeService.delete)

  • delete did not publish the commit event that createOrUpdate publishes, so webhooks were not called for deletions. It now publishes it when something was deleted.

Testing

  • New unit tests: DefaultNodeServiceTest, FederatedNodePersistenceTest, FederatedWebhookPersistenceTest. Run against the unchanged production code, the tests for each defect fail; with the fixes all pass, along with the rest of ./gradlew test.
  • The same HTTP requests that reproduced the four defects on a develop build were rerun against a build of this branch (PostgreSQL, Elasticsearch 9.5.6): a foreign webhook id returns 400 and the original webhook is unchanged, update by id and re-post of an existing URL return 200, a webhook listener receives the delete event, the _childViews post returns 200, and 60 concurrent no-op deletes leave no connection idle in transaction.
  • Not tested: the OAuth change against a real OAuth server, and there is no unit test for it.

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/d9f10869eb3d4b268da3834fb1b42689
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/d9f10869eb3d4b268da3834fb1b42689?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings

Devin Review

…, view child posts and delete events

- Webhook lookups return the owning project, so a posted id that belongs to
  another project is refused; the persistence layer refuses it as well.
- OAuthProcessor keeps the parsed token grants in a local variable instead of
  a field shared by all requests.
- FederatedNodePersistence.commitChanges opens its transaction only when there
  is something to save, so a write that changes nothing leaves none open.
- DefaultNodeService.createOrUpdate iterates a copy of the updated map, since
  view services add generated elements to it while processing.
- DefaultNodeService.delete publishes the commit event like createOrUpdate.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun merged commit 085732d into develop Nov 17, 2026
4 checks passed
@HuiJun
HuiJun deleted the fix/release-review-findings branch November 17, 2026 05:40
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.

1 participant