Skip to content

test: run the near-miss label guards in the default tox env - #1089

Open
dchaudhari7177 wants to merge 1 commit into
mloda-ai:mainfrom
dchaudhari7177:test/label-guards-in-default-tox-env
Open

test: run the near-miss label guards in the default tox env#1089
dchaudhari7177 wants to merge 1 commit into
mloda-ai:mainfrom
dchaudhari7177:test/label-guards-in-default-tox-env

Conversation

@dchaudhari7177

@dchaudhari7177 dchaudhari7177 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #1082.

The hole

The default [testenv] command passes --ignore=tests/test_documentation, and only python314 clears DEACTIVATE_NOTEBOOK_AND_DOC_TESTS. So the near-miss label guards — the tests whose whole job is to redden when a stage label is renamed and a published page keeps quoting the old one — never run under a plain local tox. CI runs the 3.14 env, so the gate holds there, which is exactly what made the hole invisible.

The change

Move tests/test_documentation/test_near_miss_labels_in_docs.py to tests/test_docs_near_miss_labels.py, next to test_docs_fences.py — the precedent named in the issue, which already sits outside tests/test_documentation for this reason and says so in its docstring.

Moved whole rather than split by dependency. All 46 cases are string parsing over docs/docs/**.md plus a _STAGE_LABELS import, and the one self-test that renders a real failure builds an EvaluationResult and calls render_resolution_failure directly, so it needs no backend and no flight server. The whole file runs in 0.21s. Moving it whole also keeps one home for the label vocabulary (ALLOWED_LABELS, NEAR_MISS_BULLET_PATTERN, DOC_BULLET_STAGES, PROSE_LABEL_PAGES, LABEL_TABLE_PAGE), which a split would have had to duplicate or export.

The diff is the rename, the docstring paragraph explaining the placement, and REPO_ROOT moving from parents[2] to parents[1] because the file sits one level shallower. Nothing else changes.

Verification

Label guards collected by the default env's own selection, pytest --ignore=tests/test_documentation -m 'not notebooks':

main this branch
label guard cases collected 0 46

Then the rename the guard exists to catch — _STAGE_LABELS["input_data"] from "input data" to "input source", under that same selection:

FAILED test_rendered_near_miss_bullets_carry_a_current_stage_label[docs/docs/in_depth/data-access-patterns.md]
FAILED test_a_registered_page_still_renders_the_bullet_of_its_own_stage[in_depth/data-access-patterns.md]
FAILED TestProseLabelMentions::test_the_page_still_spells_the_current_label[in_depth/data-access-patterns.md-input_data]
FAILED test_the_label_table_rows_are_exactly_the_distinct_stage_labels
4 failed, 42 passed in 0.45s

The stale page and the troubleshooting label table are both named. On main the same rename is green under that selection. Source file restored afterwards — git diff main -- mloda/ is empty on this branch.

Gates on the moved file: ruff format --check --line-length 120, ruff check, mypy --strict --ignore-missing-imports all clean. No remaining references to the old path anywhere in the repo.

One note on the issue text

The issue mentions "the two self-tests that render a real failure and drive GlobalFilter.warn_on_unmatched_filters". In this file there is one such self-test (test_the_scanner_pattern_matches_a_rendered_near_miss_bullet); nothing here touches warn_on_unmatched_filters. It made no difference to the outcome, since the render is backend-free either way and the file moved whole — flagging it in case a second guard was meant to exist and is missing.

Rebased onto current main (9caea51d), which picked up the parents[2] anchoring and the relative parametrize ids from #937 in the meantime; this branch keeps those as they are.

tests/test_documentation/test_near_miss_labels_in_docs.py exists to redden when a
near-miss stage label is renamed and a published page keeps quoting the old one.
The default [testenv] command passes --ignore=tests/test_documentation and only
python314 clears DEACTIVATE_NOTEBOOK_AND_DOC_TESTS, so a contributor running tox
locally renames a label, sees green, and pushes a page quoting a label no stage
carries. CI runs the 3.14 env, so the gate holds there, which is what made the
hole invisible.

Move the file to tests/test_docs_near_miss_labels.py, next to test_docs_fences.py,
which already sits outside tests/test_documentation for exactly this reason and
says so in its docstring.

The guards move whole rather than split by dependency. All 46 cases are string
parsing over docs/docs/**.md plus a _STAGE_LABELS import, and the one self-test
that renders a real failure builds an EvaluationResult and calls
render_resolution_failure directly, so it needs no backend and no flight server.
The whole file runs in 0.21s. Moving it whole also keeps one home for the label
vocabulary, which a split would have had to duplicate or export.

Collected by the default env's own selection (--ignore=tests/test_documentation):
0 label guards on main, 46 on this branch.

Renaming _STAGE_LABELS['input_data'] from 'input data' to 'input source' then
fails 4 of them, naming docs/docs/in_depth/data-access-patterns.md and the
troubleshooting label table. On main the same rename is green under that selection.

REPO_ROOT moves from parents[2] to parents[1], since the file sits one level
shallower now. Everything else is unchanged.

Closes mloda-ai#1082
@dchaudhari7177
dchaudhari7177 force-pushed the test/label-guards-in-default-tox-env branch from fba7b38 to a4a60b0 Compare August 7, 2026 03:50
@TomKaltofen

Copy link
Copy Markdown
Collaborator

@dchaudhari7177 Please rebase your PR.

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.

Doc label guards run only in the python314 tox env, so a local tox misses a stale page

2 participants