Skip to content

SEC-2528: Environment variable suppressing snapshot generation on installation.#24

Merged
nchiasson-dgi merged 3 commits intomainfrom
adam-vessey-patch-1
Mar 10, 2026
Merged

SEC-2528: Environment variable suppressing snapshot generation on installation.#24
nchiasson-dgi merged 3 commits intomainfrom
adam-vessey-patch-1

Conversation

@adam-vessey
Copy link

@adam-vessey adam-vessey commented Mar 5, 2026

Snapshots might be rather intensive to build, and hook_install() can't kick off batches, so: Let's introduce an environment variable to allow the snapshot generation during module install to be suppressed, with the expectation of separate process being used to populate the snapshot, such as a drush content-sync:snapshot (which executes batch-wise).

Summary by CodeRabbit

  • New Features

    • Snapshot creation during module installation can be suppressed via an environment configuration; snapshots can be created manually afterward.
  • Documentation

    • Installation guide updated to explain how to suppress automatic snapshot creation and how to create snapshots later.

@adam-vessey adam-vessey added the minor Added functionality that is backwards compatible. label Mar 5, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

The install hook now checks the CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL environment variable and skips creating the content snapshot during module installation when that variable is truthy. README documentation was added to describe the new behavior and link to relevant source lines.

Changes

Cohort / File(s) Summary
Conditional Snapshot Installation
README.txt, content_sync.install
Added documentation and implementation to respect CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL: when truthy, the install hook skips snapshot() during module installation; otherwise snapshot creation proceeds. Minor formatting/brace style adjustments in the install hook.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I sniff the env var in the air,
If truthy, I hop past snapshot care.
Later, with drush, we'll build once more—
For now, I nibble peace on the install floor. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: introducing an environment variable to suppress snapshot generation during installation, which matches the core functionality modified across both README and install hook files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch adam-vessey-patch-1

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.txt`:
- Line 24: Fix the README sentence for clarity and precision: replace the
typo-filled, ambiguous line about CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL
with a concise statement that lists accepted boolean values (e.g., "1", "true",
"yes", "on" to enable suppression and "0", "false", "no", "off" to disable),
removes the commit-pinned link, and references the drush command name
content-sync:snapshot as the alternative way to build the snapshot; ensure the
env var name CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL is spelled correctly and
the behavior is explicitly stated (when set to a truthy value the snapshot build
during module installation is skipped).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2d78bc87-f172-46b1-a5bd-784261ea520a

📥 Commits

Reviewing files that changed from the base of the PR and between 7816728 and efd17ff.

📒 Files selected for processing (2)
  • README.txt
  • content_sync.install

README.txt Outdated
Extract module at drupal/modules/contrib directory and enable it from browser
by going in this path /admin/modules.

The `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` environment variable might be set dto soemthing truthy in order to skip the build of the snapshot during module installation, with the expectation that the snapshot will be built by other means, such as the `drush content-sync:snapshot` command ( https://github.com/discoverygarden/content_sync/blob/7816728adc70b3c85642bd254b9096a44a1d0308/src/Drush/Commands/ContentSyncCommands.php#L519-L528 ).
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix install note wording and make behavior precise.

Line 24 has typos and ambiguous wording ("truthy"). It also uses a commit-pinned link that will stale quickly. Please tighten this sentence and document accepted boolean values explicitly.

Suggested rewrite
-The `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` environment variable might be set dto soemthing truthy in order to skip the build of the snapshot during module installation, with the expectation that the snapshot will be built by other means, such as the `drush content-sync:snapshot` command ( https://github.com/discoverygarden/content_sync/blob/7816728adc70b3c85642bd254b9096a44a1d0308/src/Drush/Commands/ContentSyncCommands.php#L519-L528 ).
+Set `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` to a boolean true value (`1`, `true`, `on`, or `yes`) to skip snapshot build during module installation. Build it later with `drush content-sync:snapshot`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` environment variable might be set dto soemthing truthy in order to skip the build of the snapshot during module installation, with the expectation that the snapshot will be built by other means, such as the `drush content-sync:snapshot` command ( https://github.com/discoverygarden/content_sync/blob/7816728adc70b3c85642bd254b9096a44a1d0308/src/Drush/Commands/ContentSyncCommands.php#L519-L528 ).
Set `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` to a boolean true value (`1`, `true`, `on`, or `yes`) to skip snapshot build during module installation. Build it later with `drush content-sync:snapshot`.
🧰 Tools
🪛 LanguageTool

[style] ~24-~24: Consider a more concise word here.
Context: ...iable might be set dto soemthing truthy in order to skip the build of the snapshot during m...

(IN_ORDER_TO_PREMIUM)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.txt` at line 24, Fix the README sentence for clarity and precision:
replace the typo-filled, ambiguous line about
CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL with a concise statement that lists
accepted boolean values (e.g., "1", "true", "yes", "on" to enable suppression
and "0", "false", "no", "off" to disable), removes the commit-pinned link, and
references the drush command name content-sync:snapshot as the alternative way
to build the snapshot; ensure the env var name
CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL is spelled correctly and the behavior
is explicitly stated (when set to a truthy value the snapshot build during
module installation is skipped).

@adam-vessey adam-vessey changed the title Environment variable suppressing snapshot generation on installation. SEC-2528: Environment variable suppressing snapshot generation on installation. Mar 6, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
README.txt (1)

24-25: ⚠️ Potential issue | 🟡 Minor

Clarify accepted values and avoid commit-pinned links.

The documentation has several clarity issues:

  1. "truthy" is ambiguous—users won't know which values enable suppression (e.g., 1, true, yes, on vs. 0, false, no, off)
  2. The commit-pinned GitHub link will become stale when code moves or history changes
  3. The sentence is verbose and difficult to parse
📝 Suggested rewrite for clarity
-The `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` environment variable might be set to something truthy in order to skip the build of the snapshot during module installation, with the expectation that the snapshot will be built by other means such as the `drush content-sync:snapshot` command ( https://github.com/discoverygarden/content_sync/blob/7816728adc70b3c85642bd254b9096a44a1d0308/src/Drush/Commands/ContentSyncCommands.php#L519-L528 ).
+Set `CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL` to a truthy value (e.g., `1`, `true`, `yes`, or `on`) to skip snapshot build during module installation. Build the snapshot later using `drush content-sync:snapshot`.

As per static analysis, "in order to" can be simplified to "to" for conciseness.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.txt` around lines 24 - 25, The sentence about
CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL is unclear and links to a
commit-pinned blob; update the README text to (1) replace "truthy" with an
explicit list of accepted values (e.g., "set to 1, true, yes, or on to skip
snapshot build; set to 0, false, no, or off to build it"), (2) simplify wording
by using "to" instead of "in order to", and (3) remove the commit-specific
GitHub blob link—either reference the drush command name ("drush
content-sync:snapshot") or link to the repository/file at a branch or tag URL
that won't become stale; mention the drush command (content-sync:snapshot) so
readers know the alternative.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@README.txt`:
- Around line 24-25: The sentence about
CONTENT_SYNC__SUPPRESS_SNAPSHOT_ON_INSTALL is unclear and links to a
commit-pinned blob; update the README text to (1) replace "truthy" with an
explicit list of accepted values (e.g., "set to 1, true, yes, or on to skip
snapshot build; set to 0, false, no, or off to build it"), (2) simplify wording
by using "to" instead of "in order to", and (3) remove the commit-specific
GitHub blob link—either reference the drush command name ("drush
content-sync:snapshot") or link to the repository/file at a branch or tag URL
that won't become stale; mention the drush command (content-sync:snapshot) so
readers know the alternative.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d1c7cd2-a288-46a8-b24a-d8abc740d9db

📥 Commits

Reviewing files that changed from the base of the PR and between efd17ff and 50fa658.

📒 Files selected for processing (1)
  • README.txt

@nchiasson-dgi nchiasson-dgi merged commit 4fcb3eb into main Mar 10, 2026
1 of 2 checks passed
@github-actions
Copy link

Tag generated by PR: v3.1.0

@nchiasson-dgi nchiasson-dgi deleted the adam-vessey-patch-1 branch March 10, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Added functionality that is backwards compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants