Skip to content

MLE-30002 MLE-30003 Add CLI and API support for sidecar collections and permissions inheritance - #685

Merged
prgs-rsingh merged 1 commit into
developfrom
feature/mle-30002-30003-sidecar-inheritance
Oct 13, 2026
Merged

prgs-rsingh merged 1 commit into
developfrom
feature/mle-30002-30003-sidecar-inheritance

Conversation

@prgs-rsingh

@prgs-rsingh prgs-rsingh commented Oct 8, 2026 •

Copy link
Copy Markdown

Summary

Implements Jira stories MLE-30002 (sidecar collections inheritance) and MLE-30003 (sidecar permissions inheritance) in Flux. The inheritance logic lives in the Spark connector (marklogic/marklogic-spark-connector#702); Flux exposes it via CLI and API and passes it to the connector.

Changes

  • SplitterParams / SplitterOptions: new flags and fluent API methods. Both are off by default; include the flag to enable it.
    • --splitter-sidecar-inherit-collections / outputInheritCollections(boolean) → spark.marklogic.write.splitter.sidecar.inheritCollections
    • --splitter-sidecar-inherit-permissions / outputInheritPermissions(boolean) → spark.marklogic.write.splitter.sidecar.inheritPermissions
  • docs/import/splitting.md:
    • Corrected the default sidecar metadata description (sidecars default to --permissions and no collections, not the source document's metadata).
    • Documented both flags and how they combine with --splitter-sidecar-collections / --splitter-sidecar-permissions.
    • Explained that sidecars inherit the source document's metadata as written, including --collections / --permissions (or --output-* for copy) overrides, and that permission inheritance is mainly useful for copy and archive imports.

Tests

Detailed coverage is in the connector PR (SplitWithInheritedMetadataTest). Flux tests:

  • Options tests:
    • ImportFilesOptionsTest and CopyOptionsTest: both CLI flags map to the connector options.
    • SplitterOptionsTest: both fluent API methods map to the connector options.
  • Integration test: CopyTest.splitWithInheritedCollectionsAndPermissions verifies sidecar collections and permissions in MarkLogic.

Dependency

Requires marklogic-spark-connector 3.2-SNAPSHOT with marklogic/marklogic-spark-connector#702. Merge the connector PR first.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:16

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 test correctness and CLI argument-handling issues need fixes.

3 open findings
What changed in this PR

Exposes sidecar metadata inheritance through Flux’s CLI and fluent API, allowing chunk documents to retain source collections and permissions.

Changes:

  • Adds collection and permission inheritance options.
  • Adds CLI, API, import, and copy tests.
  • Documents inheritance defaults and metadata union behavior.
File Description
flux-cli/​src/​test/​java/​com/​marklogic/​flux/​impl/​importdata/​SidecarInheritanceE2ETest.java Adds end-to-end inheritance scenarios.
flux-cli/​src/​test/​java/​com/​marklogic/​flux/​impl/​importdata/​ImportFilesOptionsTest.java Checks CLI option mapping.
flux-cli/​src/​test/​java/​com/​marklogic/​flux/​impl/​importdata/​ImportAndSplitFilesTest.java Tests inheritance, unions, and defaults.
flux-cli/​src/​test/​java/​com/​marklogic/​flux/​impl/​copy/​CopyTest.java Tests inheritance during copying.
flux-cli/​src/​test/​java/​com/​marklogic/​flux/​api/​SplitWithApiTest.java Exercises fluent API inheritance.
flux-cli/​src/​main/​java/​com/​marklogic/​flux/​impl/​importdata/​SplitterParams.java Wires inheritance flags to connector options.
flux-cli/​src/​main/​java/​com/​marklogic/​flux/​api/​SplitterOptions.java Declares fluent inheritance methods.
docs/​import/​splitting.md Explains sidecar metadata behavior.

🧠 Review effort: Balanced


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

Comment thread flux-cli/src/test/java/com/marklogic/flux/impl/copy/CopyTest.java Outdated
rjrudin
rjrudin previously requested changes Oct 8, 2026

@rjrudin rjrudin 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.

A thought on the tests - the beefier tests should be in the Spark connector, where the real work actually happens. Flux just collects CLI args and passes them to the connector.

Generally, I use the following approach for Flux tests, having already added a bunch of integration tests to the Spark connector to fully test it:

  1. Use "options tests" to make sure that setting the CLI options results in the correct connector options being set.
  2. Write a single integration test that uses the new options and verifies the data in MarkLogic.

I try to keep 2 to a minimum, as the tests should be redundant with what the Spark connector tests are already doing.

Comment thread flux-cli/src/test/java/com/marklogic/flux/impl/copy/CopyTest.java Outdated
@prgs-rsingh
prgs-rsingh force-pushed the feature/mle-30002-30003-sidecar-inheritance branch from dd00be0 to 484d35b Compare October 12, 2026 11:22
@prgs-rsingh

Copy link
Copy Markdown
Author

Member

Moved the detailed coverage to the connector (SplitWithInheritedMetadataTest, 6 tests).
Flux now has:
Options tests: ImportFilesOptionsTest and CopyOptionsTest assert both flags map to spark.marklogic.write.splitter.sidecar.inheritCollections / inheritPermissions.
One integration test: CopyTest.splitWithInheritedCollectionsAndPermissions. copy is used because permission inheritance only makes a difference when source rows carry their own metadata.
Removed SidecarInheritanceE2ETest, the extra ImportAndSplitFilesTest / SplitWithApiTest tests, and the second CopyTest test.
Updated splitting.md to explain that sidecars inherit the source document's metadata as written, including --collections/--permissions overrides.

@prgs-rsingh
prgs-rsingh requested review from rjrudin and a balanced review from Copilot October 12, 2026 11:27

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

The newly exposed fluent API inheritance path lacks automated test coverage.

1 open finding
3 resolved since last review

🧠 Review effort: Balanced

@prgs-rsingh
prgs-rsingh dismissed rjrudin’s stale review October 13, 2026 09:22

addressed all review comments

…nd permissions inheritance

MLE-30002 MLE-30003 Add CLI and API support for sidecar collections and permissions inheritance

- Added CLI options --splitter-sidecar-inherit-collections and --splitter-sidecar-inherit-permissions in SplitterParams.java.
- Added fluent builder methods outputInheritCollections() and outputInheritPermissions() in SplitterOptions.java.
- Corrected documentation errata in docs/import/splitting.md and added reference documentation for the new inheritance options.
- Added CLI parsing tests in ImportFilesOptionsTest.java.
- Added integration tests in ImportAndSplitFilesTest.java and CopyTest.java covering file import and database document copying.
- Added API tests in SplitWithApiTest.java.
- Added dedicated end-to-end multi-tenant test suite in SidecarInheritanceE2ETest.java with injected sample data verifying collection partitioning and RBAC isolation.
@prgs-rsingh
prgs-rsingh force-pushed the feature/mle-30002-30003-sidecar-inheritance branch from 5f73882 to 370ca8b Compare October 13, 2026 11:07
@prgs-rsingh
prgs-rsingh merged commit 77e7f37 into develop Oct 13, 2026
4 checks passed
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.

5 participants