Skip to content

Feature/ggw 369/export import structures - #4518

Open
brianbrix wants to merge 83 commits into
future/v4.0from
feature/GGW-369/Export-Import-Structures
Open

brianbrix wants to merge 83 commits into
future/v4.0from
feature/GGW-369/Export-Import-Structures

Conversation

@brianbrix

Copy link
Copy Markdown
Contributor

No description provided.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 8, 2026 10:23
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

One or more issues must be addressed before approval.

2 open findings
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Staged file deleted before activity save completes

amp/​src/​main/​java/​org/​dgfoundation/​amp/​onepager/​util/​ActivityUtil.java:1274

The staged file is deleted as soon as the JCR node is created, but saveActivityNewVersion continues with contacts, budgets, structures, a Hibernate merge/flush, and audit work afterward. If any later step fails and the activity save is retried, the pending resource still references this upload ID but its file has already been removed, so the retry cannot succeed. Defer cleanup until the complete activity save commits, or retain/re-stage the file on failure.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

brianbrix and others added 2 commits October 8, 2026 13:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 8, 2026 10:51
…ructures' into feature/GGW-369/Export-Import-Structures

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.

🟡 Changes recommended

Unresolved critical session-serialization and multiple moderate correctness, reliability, and security issues block approval.

1 open finding
2 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Premature staged-file deletion prevents retry after save failure

amp/​src/​main/​java/​org/​dgfoundation/​amp/​onepager/​util/​ActivityUtil.java:1274

The staged file is deleted as soon as the JCR node is created, but the activity's Hibernate transaction is committed later by ActivityUtil.saveActivity/endConversation and can still fail. A failed save therefore leaves the pending stagedUploadId with no backing file, so the user cannot retry the save; defer cleanup until the activity commit succeeds.

Medium severity deleteOnExit hooks accumulate for uploads

amp/​src/​main/​java/​org/​digijava/​kernel/​ampapi/​endpoints/​resource/​ResourceEndpoint.java:263

deleteOnExit() registers a JVM shutdown hook for every upload, while this feature already deletes the file in finally or through the staged-store TTL/session cleanup. On a long-running Tomcat process, repeated uploads accumulate exit-hook entries and their path strings, causing avoidable memory growth; rely on the existing explicit cleanup instead.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 10:58

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.

🔵 Needs a closer look

One or more issues must be addressed before approval.

0 open findings

1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Unknown multipart length is incorrectly rejected

amp/​src/​main/​java/​org/​digijava/​kernel/​ampapi/​endpoints/​gis/​StructureImportEndpoint.java:49

getContentLengthLong() is allowed to return -1 for a valid chunked/unknown-length multipart request. Rejecting that value means imports fail with 413 when the client or reverse proxy uses chunked transfer, even when the workbook is within the limit. Enforce the limit while consuming the stream (for example with a bounded/counting stream) and only reject a known length when it exceeds the limit.

Medium severity deleteOnExit registrations grow without bound

amp/​src/​main/​java/​org/​digijava/​kernel/​ampapi/​endpoints/​resource/​ResourceEndpoint.java:263

deleteOnExit() registers every staged path in the JVM-wide DeleteOnExitHook set, and entries are never removed even when the TTL/session cleanup deletes the file. Repeated uploads can therefore grow this in-memory set without bound; use the store's bounded cleanup/periodic temp-directory cleanup instead of registering each upload with deleteOnExit.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 11:39

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.

🔵 Needs a closer look

Multiple unresolved moderate issues affect authentication, import validation, upload reliability, persistence recovery, and resource lifecycle management.

0 open findings

Previously missed (2)

In code that hasn't changed since last review

Medium severity Staged upload deleted before save completes

amp/​src/​main/​java/​org/​dgfoundation/​amp/​onepager/​util/​ActivityUtil.java:1275

The staged file is deleted immediately after the JCR call, before saveActivityNewVersion finishes its later flush and persistence work. If a later resource, structure, or activity save fails, the pending TemporaryActivityDocument still points at this upload ID but the file has already been removed, so the user cannot retry the save without re-uploading (and the JCR node may be orphaned). Defer cleanup until the complete activity save succeeds, or restore/retain the staged upload on failure.

Medium severity deleteOnExit registry grows for every upload

amp/​src/​main/​java/​org/​digijava/​kernel/​ampapi/​endpoints/​resource/​ResourceEndpoint.java:263

deleteOnExit() registers every staged path in the JVM shutdown-hook registry, and deleting the file later does not remove that registry entry. Since this endpoint can handle many uploads, the registry grows for the lifetime of the server and retains every pathname; rely on the store's TTL/cleanup (and a bounded startup/temp-directory cleanup strategy) instead of registering each upload with deleteOnExit().

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 12:32

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.

🟡 Changes recommended

Unresolved critical and moderate findings affect upload reliability, security, validation, and rendering.

1 open finding
Previously missed (2)

In code that hasn't changed since last review

Medium severity Clear pending upload after rejected file selection

amp/​src/​main/​java/​org/​dgfoundation/​amp/​onepager/​components/​upload/​FileUploadBehavior.js:95

pendingUploadData is retained while the user chooses a file, but rejected-file branches do not clear it. If a valid file is selected and then an invalid or oversized file is chosen before clicking this button, the next click still submits the earlier file. Clear the pending upload and reset its UI state whenever a selection is rejected.

Medium severity Remove deleteOnExit for staged uploads

amp/​src/​main/​java/​org/​digijava/​kernel/​ampapi/​endpoints/​resource/​ResourceEndpoint.java:263

deleteOnExit() registers every staged upload in the JVM-wide shutdown hook, while the store already deletes these files on replacement, expiry, session cleanup, and save. On a long-running server this registration set grows for every upload and retains paths until JVM shutdown, creating avoidable memory growth; remove this call and rely on the store's explicit cleanup (with a separate startup/orphan cleanup strategy if crash recovery is required).

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI lite review requested due to automatic review settings October 8, 2026 13:00

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.

🟡 Changes recommended

Unresolved critical and moderate issues affect staged-upload lifecycle, component rendering, cookie behavior, and security configuration.

3 open findings
Previously missed (1)

In code that hasn't changed since last review

Medium severity Defer staged file cleanup until activity save succeeds

amp/​src/​main/​java/​org/​dgfoundation/​amp/​onepager/​util/​ActivityUtil.java:1275

The staged file is deleted immediately after its JCR node is created, but insertResources runs before the rest of saveActivityNewVersion (saveEditors, contacts, structures, and the final Hibernate flush). If any later step fails, the activity is not committed yet but the user can no longer retry with the staged document because its source file has already been removed. Defer cleanup until the whole activity save succeeds, or retain a rollback/retryable copy.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Remove deleteOnExit call for staged file as cleanup is handled by StagedResourceUploadStore.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 8, 2026 13:14

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.

🔵 Needs a closer look

Unresolved upload, import validation, resource lifecycle, cookie, and filter-registration issues remain.

0 open findings

3 resolved since last review

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

This branch has not been deployed

No deployments
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