Skip to content

test: skip optional-extra suites when the sandbox lacks them - #503

Merged
seonghobae merged 1 commit into
fix/frontend-adminpanel-unauthenticated-buildfrom
test/skip-optional-extra-collection
Aug 23, 2026
Merged

test: skip optional-extra suites when the sandbox lacks them#503
seonghobae merged 1 commit into
fix/frontend-adminpanel-unauthenticated-buildfrom
test/skip-optional-extra-collection

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Product result

OpenCode coverage-evidence can collect LineageWeave tests in the networkless sandbox that has pytest/coverage but not optional backend extras, instead of failing at ModuleNotFoundError for asyncpg, psycopg2, redis, or fast_mlsirm.

Stack

This head stacks on LineageWeave#494 (login tsc only). It does not rewrite docs/product-technical-gap-baseline.md. The ADR 0001 baseline lives on LineageWeave#426.

What this head changes

  • lineageweave/optional_extra_collection.py decides which files need missing extras.
  • tests/conftest.py ignores those files during collection when extras are absent.
  • Hosted CI still installs dev and backend extras, so every suite still collects and runs there.
  • Unit tests cover skip/keep paths, including that the helper tests themselves are never ignored.

Local verification

uv run python -m pytest -q tests/test_optional_extra_collection.py — 6 passed.

Remaining gates

Independent exact-head OpenCode / Strix / Noema review is required. This identity cannot self-approve. Merge #494 first, then this head, or merge the stack in order.

No COPILOT_GITHUB_TOKEN, no self-approval, no force-push, no PII.


Open in Devin Review

OpenCode coverage-evidence cannot install LineageWeave backend extras.
Collection now ignores files that import asyncpg, psycopg2, redis, or
fast_mlsirm when those modules are absent. Hosted CI still installs
the extras, so the full suite continues to run there.
@seonghobae
seonghobae merged commit bc56273 into fix/frontend-adminpanel-unauthenticated-build Aug 23, 2026
2 of 4 checks passed

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review current-head review for c97104d. Stacked on #494. Independent OpenCode / Strix / Noema required. This identity cannot self-approve.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fdd0bb20-d621-4e0b-b951-5114633ec2ad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

Open in Devin Review

Comment thread tests/conftest.py
Comment on lines +13 to +19
def pytest_ignore_collect(collection_path: Path, config: object) -> bool:
"""Skip files that import optional extras the sandbox did not install."""
del config
return collection_path_requires_missing_extras(
collection_path,
missing_optional_extra_modules(),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Backend test suite still fails collection in the sandbox

The ignore hook lives in conftest.py, so pytest_ignore_collect runs only for paths under tests/, never for the separate backend/tests testpath declared in pyproject.toml. In the sandbox, backend/tests/test_api.py still imports psycopg2 and redis at module level, so collection aborts with ModuleNotFoundError.

Prompt for agents
The pytest_ignore_collect hook is defined in tests/conftest.py, but pytest scopes collection hooks to the directory subtree of the conftest that defines them. pyproject.toml sets testpaths = ["tests", "backend/tests"], and backend/tests/test_api.py imports psycopg2 and redis at module level. Because tests/conftest.py is not an ancestor of backend/tests/, its hook is never invoked for backend/tests paths, so collecting the backend suite still fails with ModuleNotFoundError when those extras are absent — defeating the PR's goal and leaving the _BACKEND_EXTRAS branch of collection_path_requires_missing_extras unreachable for real backend paths. Move the hook to a repo-root conftest.py (or add a conftest.py under backend/tests/) so the ignore logic applies to both testpaths.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +57 to +67
for name in missing:
if (
f"import {name}" in text
or f"from {name} " in text
or f"from {name}." in text
):
return True
if name in _BACKEND_EXTRAS and (
"from backend" in text or "import backend" in text
):
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Substring import matching can over-skip files

The import scan in collection_path_requires_missing_extras uses plain substring checks (optional_extra_collection.py), so commented lines, string literals, or prefix collisions like import asyncpg_pool count as a match. Only affects the missing-extras sandbox, but can silently skip tests that merely mention a module name.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

return False
posix = collection_path.as_posix()
if any(name in _BACKEND_EXTRAS for name in missing):
if posix == "backend" or posix.startswith("backend/") or "/backend/" in posix:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Two backend-path checks are dead code

pytest passes absolute paths, so posix == "backend" and posix.startswith("backend/") at optional_extra_collection.py never match; only the "/backend/" in posix substring ever fires. Harmless, but the first two conditions are unreachable.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

seonghobae added a commit that referenced this pull request Aug 23, 2026
* fix: restore login typecheck and non-identifying gap baseline

Unauthenticated login no longer mounts Admin settings with an undefined
token, so tsc -b succeeds on protected main. Login persists a validated
OIDC return URL through the existing helpers. The gap baseline is
rewritten without identifying record identifiers and bound to the
current PR and issue inventory.

* docs: bind gap baseline to org coverage and hourly caller PRs

Record ContextualWisdomLab/.github#1258 (pnpm 9 coverage-evidence) and
#1259 (thin LineageWeave hourly caller) in the non-identifying baseline so
the merge loop names the org-side unblockers without a repo-local duplicate
scheduler.

* Revert "docs: bind gap baseline to org coverage and hourly caller PRs"

This reverts commit a4b604b.

* fix: keep login gate repair minimal

* test: skip optional-extra suites when the sandbox lacks them (#503)

OpenCode coverage-evidence cannot install LineageWeave backend extras.
Collection now ignores files that import asyncpg, psycopg2, redis, or
fast_mlsirm when those modules are absent. Hosted CI still installs
the extras, so the full suite continues to run there.

* fix: apply optional-extra skips repository-wide

* fix: keep optional collection work unique

* fix: parse optional imports exactly

* fix: preserve pytest ignore semantics

* test: cover optional collection hook edges

* fix: restore login typecheck without unauthenticated AdminPanel

Main fails tsc because login imported unused OIDC helpers and mounted
AdminPanel with an undefined access token. Keep the optional-extra
collection work unique; do not fold the ADR 0001 gap baseline into
this head.

* Revert "fix: restore login typecheck without unauthenticated AdminPanel"

This reverts commit 327c359.

* test: cover optional collection edges

* fix: avoid skipping lazy redis imports

* fix: tolerate non-UTF-8 collection paths

* fix: restore login typecheck without unauthenticated AdminPanel

Protected main fails tsc because login imported unused OIDC helpers
and mounted AdminPanel with an undefined access token. Keep optional-
extra collection unique. Do not fold the ADR 0001 gap baseline into
this head.

* Revert "fix: restore login typecheck without unauthenticated AdminPanel"

This reverts commit b195b42.
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.

1 participant