Skip to content

[BUGFIX] Support standing up a FileDataContext on a read-only filesystem - #12000

Open
joshua-stauffer wants to merge 4 commits into
developfrom
b/file-data-context-readonly-fs
Open

[BUGFIX] Support standing up a FileDataContext on a read-only filesystem#12000
joshua-stauffer wants to merge 4 commits into
developfrom
b/file-data-context-readonly-fs

Conversation

@joshua-stauffer

Copy link
Copy Markdown
Collaborator

Summary

Standing up a file-backed DataContext (gx.get_context(mode="file") or
project_root_dir=...) against a fully-scaffolded, version-controlled project
on a read-only filesystem currently crashes during initialization.

The root cause is that the "is this project already scaffolded" check treats
the gitignored uncommitted/* runtime-output directories (and a separate
config-variables file that also lives under uncommitted/) as required
signals. On a fresh version-control checkout those directories are absent by
design, so the check false-negatives and triggers a full destructive
re-scaffold — which then fails outright on a read-only filesystem.

This PR redefines that check to hinge on the presence of a committed
great_expectations.yml alone. A project carrying a valid, committed config
is recognized as already set up without requiring gitignored runtime
directories to exist on disk, so a clean checkout (and a config that resolves
values purely via environment-variable interpolation) is no longer
mistaken for an unscaffolded project.

First-use scaffolding for a genuinely new/empty project directory is
unchanged.

  • Redefine the scaffolded-project check (this PR)
  • Make read-only filesystem failures non-fatal during store initialization
  • Read-only regression test coverage

Test plan

  • pytest tests/data_context/test_data_context.py tests/data_context/test_get_data_context.py -v — 55 passed, 5 skipped (pre-existing, unrelated)
  • ruff check / ruff format --check clean on changed files
  • Full read-only end-to-end coverage lands in a follow-up commit on this branch

FileDataContext previously re-scaffolded a project whenever the
gitignored uncommitted/* directories or a config-variables file were
absent, even though a committed great_expectations.yml already made
the project usable. On a fresh version-control checkout (where
uncommitted/* is intentionally untracked) or a config that resolves
values purely via environment-variable interpolation, this
false-negatived and triggered a destructive re-scaffold.

Redefine is_project_scaffolded to hinge on the presence of a
committed great_expectations.yml alone, so a version-controlled
project is recognized as already set up without requiring
gitignored runtime-output directories or a separate config-variables
file to exist on disk.
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit ae0a7e2
🔍 Latest deploy log https://app.netlify.com/projects/niobium-lead-7998/deploys/6a6384821d9f7700088e1212
😎 Deploy Preview https://deploy-preview-12000.docs.greatexpectations.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

TupleFilesystemStoreBackend.__init__ eagerly creates its base
directory for convenience. On a read-only filesystem this aborts
construction even though the directory isn't needed to read, and
even though _set/_move already self-create their own leaf directory
before writing.

Tolerate only the two read-only-shaped failures (a read-only
directory, or a read-only mount) at construction time and defer to
first write; re-raise every other OSError so a genuine fault on a
writable filesystem still fails fast exactly as before.
Prove end to end that standing up a FileDataContext against a
fully-scaffolded, version-controlled project succeeds on a genuinely
read-only filesystem: initialization, resolving a configured
datasource whose config uses environment-variable interpolation,
loading a suite, building a validator, and running a validation to
an in-memory result.

The fixture emulates a fresh version-control checkout by deleting
the gitignored uncommitted/ subtree before making the project
read-only -- without that deletion the suite would pass whether or
not the underlying fixes are present, since a fully scaffolded
project never exercises either failure mode. A skip-clean probe
keeps the suite green in environments where read-only permissions
cannot be enforced (root, or a mode-ignoring filesystem).

A store-backed write against the read-only context still fails with
a clear error rather than being silently swallowed, and an empty
project directory on a writable filesystem still scaffolds a full
project as before.
@joshua-stauffer
joshua-stauffer marked this pull request as ready for review July 24, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant