Skip to content

Temporarily pause classification model downloads and tests in CI - #37381

Merged
IceS2 merged 3 commits into
mainfrom
ci-ac-class-models-flakyness
Nov 9, 2026
Merged

IceS2 merged 3 commits into
mainfrom
ci-ac-class-models-flakyness

Conversation

@IceS2

@IceS2 IceS2 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Temporarily pauses classification model downloads and model-dependent tests in the shared Python CI pipeline. Environment setup can currently fail while fetching spaCy model metadata before any tests run. This is a flaky-test infrastructure fix; no linked implementation issue is required.

The existing model preparation job, cache, artifact steps, provisioning command, dependencies and tests remain available. OM_SKIP_CLASSIFICATION_MODELS=true makes provisioning a no-op and reports tests reaching real model loading as skipped. Model-free and mocked classification tests continue running. Set the workflow variable to false to restore existing behavior.

Type of change:

  • Bug fix

High-level design:

  • The shared workflow guards model cache/download/upload/install steps while retaining the producer job and its dependencies, so unrelated test jobs remain eligible to run.
  • Make and Nox use the checked-in lockfile with --frozen while paused, avoiding remote model metadata validation. Nox also excludes all four model wheels from installation and skips the explicit provisioning command.
  • A session fixture skips at the spacy.load boundary, covering model users outside the classification directories while preserving mocked loads and blank spaCy pipelines. The separate provisioning integration test is explicitly gated because it installs models in a subprocess.
  • Temporary tradeoff: paused mode does not validate lockfile freshness. Disabling the switch restores --locked, model installation and normal tests. Local behavior is unchanged unless the variable is enabled.

Tests:

Use cases covered

  • Paused setup succeeds offline with model-wheel references in its lockfile and leaves those model packages uninstalled.
  • Explicit provisioning is suppressed when paused and restored when enabled.
  • Real model loading is skipped when paused; model-free and mocked tests still execute.
  • The provisioning integration test is skipped even when its candidate-wheel variable is supplied.

Unit tests

  • Added behavioral regressions in ingestion/tests/unit/test_classification_model_pause.py and ingestion/tests/unit/test_python_tooling.py.
  • From the repository root, with env/ activated:
python -m pytest ingestion/tests/unit/test_classification_model_pause.py ingestion/tests/unit/test_python_tooling.py -k 'model_pause or classification_provisioning or paused_setup' -q

Result: 5 passed, 74 deselected. The offline setup case exercises the real Make/Nox/uv entry points using a small fixture project.

OM_SKIP_CLASSIFICATION_MODELS=true python -m pytest ingestion/tests/unit/pii ingestion/tests/unit/metadata/pii ingestion/tests/unit/metadata/cli/test_install_classification_models.py -q --tb=short

Result: 756 passed, 241 skipped. Coverage percentage was not measured; no application source files changed.

Backend integration tests

Not applicable — no Java or backend API changes.

Ingestion integration tests

OM_SKIP_CLASSIFICATION_MODELS=true OM_MODEL_PROVISIONING_WHEEL=/tmp/my_ingestion.whl python -m pytest ingestion/tests/integration/auto_classification/test_model_provisioning.py -q -rs

Result: 1 skipped, specifically because provisioning is paused. The complete unit suite, live-service integration suites and GitHub job graph have not been run locally; CI validation remains pending.

Playwright (UI) tests

Not applicable — no UI changes.

Manual testing performed

  • Ran the focused commands above, including enabled/disabled behavior and offline setup.
  • Ruff check and format verification passed for all changed Python files.
  • actionlint .github/workflows/py-tests-shared.yml and git diff --check passed.
  • For hosted validation, confirm that the model preparation job succeeds with its model steps skipped; unit/static-check jobs still run; model loading reports skips; and setup logs contain no model downloads. The shared workflow runs from the base branch on pull requests, so its workflow changes require validation after they reach that branch or in an authorized branch-based dispatch. Older PR heads must also include the Make/Nox/test-fixture changes.

UI screen recording:

Not applicable — CI and test infrastructure only.

Checklist:

  • Added focused regression tests and recorded actual results.
  • Self-reviewed the complete change against REVIEW.md; no unanswered blocking findings.
  • No schema, migration, backend API or UI changes; related checks and recording are not applicable.
  • Decision check: this is a temporary test-infrastructure pause; no durable product contract is introduced.
  • Linked issue and issue-number title: not applicable to this flaky-test fix; use the skip-pr-checks label for metadata validation.

Summary by Gitar

  • Test refactor:
    • Rewrote test_sample_usage.py to create its own BigQuery service, database, schema, and tables
    • Generates a CSV query_log fixture in tmp_path and replaces the unittest class with a pytest function

This will update automatically on new commits.

@IceS2
IceS2 requested a review from akash-jain-10 as a code owner November 9, 2026 06:45
@IceS2 IceS2 added the skip-pr-checks Bypass PR metadata validation check label Nov 9, 2026
@IceS2
IceS2 requested review from a team, harshach and tutte as code owners November 9, 2026 06:45
@IceS2
IceS2 requested review from akashverma0786 and a balanced review from Copilot November 9, 2026 06:45

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 9, 2026
Comment thread ingestion/noxfile.py
Comment on lines +105 to +111
skip_classification_models = os.environ.get("OM_SKIP_CLASSIFICATION_MODELS") == "true"
# Frozen sync avoids fetching model metadata while provisioning is paused.
lock_mode = "--frozen" if skip_classification_models else "--locked"
command = [uv, "sync", lock_mode, "--project", str(INGESTION_ROOT), "--python", str(python)]
if skip_classification_models:
for model in ("en-core-web-md", "es-core-news-md", "it-core-news-md", "pl-core-news-md"):
command.extend(["--no-install-package", model])

@gitar-bot gitar-bot Bot Nov 9, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Quality: Paused mode contradicts Accepted locked-profiles ADR without superseding

noxfile.py cites ADR:2026-10-27-local-python-environments-use-locked-profiles. That record is Accepted and says Nox "synchronizes with uv.lock using --locked". It also says "the test dependency group owns the four release-pinned classification model wheels" and that the provisioner validates the models during application setup. When OM_SKIP_CLASSIFICATION_MODELS=true, this PR switches both synchronize() and the Makefile python_tools target to --frozen. It also excludes all four model packages with --no-install-package and skips provisioning, and CI sets the variable globally. So CI no longer checks that the lockfile is fresh, and the guarded test profile is not the one the ADR describes. This isn't a bug fix whose correctness is obvious from the diff: it adds a new env-var contract and a different lock mode.

To fix it, add a revision (v3) to the ADR, or a new record that supersedes it. It would assert the rule from the description: "When OM_SKIP_CLASSIFICATION_MODELS=true, setup uses --frozen instead of --locked, omits the four classification model packages and skips provisioning, and spacy.load skips the calling test; setting it to false restores --locked, model installation and normal tests." Since the pause is temporary, the record should also name the condition or ticket for removing it. Otherwise this escape hatch can quietly become the permanent CI mode.

Amend the ADR with a v3 revision that states the pause rule and when it will be removed.:

- **Revisions:** v1 2026-10-27 (initial); v2 2026-10-28 (lock classification models); v3 2026-11 (temporary model pause)
...
- While `OM_SKIP_CLASSIFICATION_MODELS=true` (temporary, CI only; remove once spaCy model
  metadata fetches are reliable — <ticket>), application setup uses `--frozen`, omits the four
  classification model packages, skips provisioning, and `spacy.load` skips the calling test.
  `false` restores `--locked`, model installation and the full suite.

Was this helpful? React with 👍 / 👎

Copilot AI balanced review requested due to automatic review settings November 9, 2026 06:49

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 08:35

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 closed / 1 findings

🟡 Medium risk · Pausing classification model provisioning and model-dependent tests in shared CI could let model-related regressions pass undetected.

Temporarily pauses classification model downloads and model-dependent tests in shared Python CI by switching to --frozen setup, excluding the four model wheels, skipping provisioning, and skipping real spacy.load calls when OM_SKIP_CLASSIFICATION_MODELS=true. Changes requested: the pause contradicts the Accepted ADR 2026-10-27-local-python-environments-use-locked-profiles, which requires --locked and model-wheel ownership, and needs a superseding or revised record that also names the condition for removing the temporary switch.

⚠️ Quality: Paused mode contradicts Accepted locked-profiles ADR without superseding

📄 ingestion/noxfile.py:55 📄 ingestion/noxfile.py:105-111 📄 ingestion/noxfile.py:157 📄 ingestion/Makefile:19-24 📄 ingestion/Makefile:38 📄 .github/workflows/py-tests-shared.yml:47-48 📄 ingestion/tests/conftest.py:25-36

noxfile.py cites ADR:2026-10-27-local-python-environments-use-locked-profiles. That record is Accepted and says Nox "synchronizes with uv.lock using --locked". It also says "the test dependency group owns the four release-pinned classification model wheels" and that the provisioner validates the models during application setup. When OM_SKIP_CLASSIFICATION_MODELS=true, this PR switches both synchronize() and the Makefile python_tools target to --frozen. It also excludes all four model packages with --no-install-package and skips provisioning, and CI sets the variable globally. So CI no longer checks that the lockfile is fresh, and the guarded test profile is not the one the ADR describes. This isn't a bug fix whose correctness is obvious from the diff: it adds a new env-var contract and a different lock mode.

To fix it, add a revision (v3) to the ADR, or a new record that supersedes it. It would assert the rule from the description: "When OM_SKIP_CLASSIFICATION_MODELS=true, setup uses --frozen instead of --locked, omits the four classification model packages and skips provisioning, and spacy.load skips the calling test; setting it to false restores --locked, model installation and normal tests." Since the pause is temporary, the record should also name the condition or ticket for removing it. Otherwise this escape hatch can quietly become the permanent CI mode.

Amend the ADR with a v3 revision that states the pause rule and when it will be removed.
- **Revisions:** v1 2026-10-27 (initial); v2 2026-10-28 (lock classification models); v3 2026-11 (temporary model pause)
...
- While `OM_SKIP_CLASSIFICATION_MODELS=true` (temporary, CI only; remove once spaCy model
  metadata fetches are reliable — <ticket>), application setup uses `--frozen`, omits the four
  classification model packages, skips provisioning, and `spacy.load` skips the calling test.
  `false` restores `--locked`, model installation and the full suite.
🤖 Prompt for agents
Code Review: Temporarily pauses classification model downloads and model-dependent tests in shared Python CI by switching to `--frozen` setup, excluding the four model wheels, skipping provisioning, and skipping real `spacy.load` calls when `OM_SKIP_CLASSIFICATION_MODELS=true`. Changes requested: the pause contradicts the Accepted ADR `2026-10-27-local-python-environments-use-locked-profiles`, which requires `--locked` and model-wheel ownership, and needs a superseding or revised record that also names the condition for removing the temporary switch.

1. ⚠️ Quality: Paused mode contradicts Accepted locked-profiles ADR without superseding
   Files: ingestion/noxfile.py:55, ingestion/noxfile.py:105-111, ingestion/noxfile.py:157, ingestion/Makefile:19-24, ingestion/Makefile:38, .github/workflows/py-tests-shared.yml:47-48, ingestion/tests/conftest.py:25-36

   `noxfile.py` cites ADR:2026-10-27-local-python-environments-use-locked-profiles. That record is Accepted and says Nox "synchronizes with `uv.lock` using `--locked`". It also says "the test dependency group owns the four release-pinned classification model wheels" and that the provisioner validates the models during application setup. When `OM_SKIP_CLASSIFICATION_MODELS=true`, this PR switches both `synchronize()` and the Makefile `python_tools` target to `--frozen`. It also excludes all four model packages with `--no-install-package` and skips provisioning, and CI sets the variable globally. So CI no longer checks that the lockfile is fresh, and the guarded test profile is not the one the ADR describes. This isn't a bug fix whose correctness is obvious from the diff: it adds a new env-var contract and a different lock mode.
   
   To fix it, add a revision (v3) to the ADR, or a new record that supersedes it. It would assert the rule from the description: "When `OM_SKIP_CLASSIFICATION_MODELS=true`, setup uses `--frozen` instead of `--locked`, omits the four classification model packages and skips provisioning, and `spacy.load` skips the calling test; setting it to `false` restores `--locked`, model installation and normal tests." Since the pause is temporary, the record should also name the condition or ticket for removing it. Otherwise this escape hatch can quietly become the permanent CI mode.

   Fix (Amend the ADR with a v3 revision that states the pause rule and when it will be removed.):
   - **Revisions:** v1 2026-10-27 (initial); v2 2026-10-28 (lock classification models); v3 2026-11 (temporary model pause)
   ...
   - While `OM_SKIP_CLASSIFICATION_MODELS=true` (temporary, CI only; remove once spaCy model
     metadata fetches are reliable — <ticket>), application setup uses `--frozen`, omits the four
     classification model packages, skips provisioning, and `spacy.load` skips the calling test.
     `false` restores `--locked`, model installation and the full suite.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@IceS2
IceS2 merged commit 37be4a8 into main Nov 9, 2026
88 checks passed
@IceS2
IceS2 deleted the ci-ac-class-models-flakyness branch November 9, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants