Skip to content

test(api): retire the stale hosts-key assertion in the parked migrations test (#16261) - #17379

Merged
mrveiss merged 1 commit into
mainfrom
issue-16261-parked-migrations-test
Sep 24, 2026
Merged

mrveiss merged 1 commit into
mainfrom
issue-16261-parked-migrations-test

Conversation

@mrveiss

@mrveiss mrveiss commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

#16261 describes a one-line fix that could not be made, blocked by two gates. The branch carrying it had been left behind unpushed, so the first question was not "how do I fix this" but "is the fix still the right one" — the branch was written against a tree that has since moved.

Two of its three parts turned out to be obsolete:

The hook exemption is already in main. The branch carried a no-local-schemas change to exempt test files, which is what originally blocked the edit. #16298 landed that as an owner ruling on 2026-09-11, with the same rationale and naming this very file:

:100   - NOT a test file (``*_test.py`` or ``test_*.py``)
:103   Test files are skipped (owner ruling, 2026-09-11, #16298) ... Scanning tests
       made any edit to ``api_endpoint_migrations_test.py`` impossible: it defines
       four such fixtures, and they predate this hook.

Main's hook test file has 32 tests where the branch's older copy had 19, including test_test_files_in_api_are_not_scanned. So the branch's version of both hook files was dropped in favour of main's rather than merged — re-applying it would have deleted 13 tests. A rebase can succeed onto an older copy of a file main has grown, and only counting both sides shows it.

The ceiling numbers were stale. The branch proposed 31039, computed when the file was 31040 lines. Main has since shrunk it to 31025, with both ceilings at exactly 31025 — zero headroom. Re-measured rather than carried.

What remains is the actual defect.

What Changed

Deletes the stale assertion:

-        self.assertIn("hosts", source)

inspect.getsource(frontend_config.get_frontend_config) no longer contains hosts: #16240 removed NetworkConstants.get_host_configs() from that endpoint's anonymous payload, because it published every VM's address and port to unauthenticated callers. The assertion has been false ever since, and nothing noticed because the whole file is pytest.mark.skipped at collection (#15173) — none of its 31k lines run.

Lowers both recorded ceilings by the one line removed, together, as the ratchet requires.

Three files, not five.

Verification

Measured on the rebased tree, not taken from the branch:

value
file lines after this change 31024
scripts/python_file_size_known_large.py 31024
repo_tests/python_file_size_ratchet_baseline.py 31024

Acceptance criteria:

This does not un-park the file. It stays skipped at collection under #15173 — the assertion is removed so the recorded defect is gone, not so the file starts running.

Closes #16261

Model Used

Claude Opus 5 (1M context).

…ons test (#16261)

Line 19640 of api_endpoint_migrations_test.py asserted that
inspect.getsource(frontend_config.get_frontend_config) contains "hosts".
host-list disclosure, #15745), so the check goes stale once it merges. The
whole file is skip-marked (#5359/#15173), so nothing caught it. Delete the
one assertion; the method's other nine checks (fallback structure, config
sections) still exercise real, currently-true behavior.

Editing the file put it in no-local-schemas' (#6056) scan, which flagged
four pre-existing test-fixture BaseModel subclasses that predate the hook.
Exempt *_test.py/test_*.py from that endpoint-schema-placement hook -- a
model a test defines inline is a fixture, not a production schema -- the
same exemption made independently on #16298.

Lower both file-size ratchet ceilings (scripts/python_file_size_known_large.py,
repo_tests/python_file_size_ratchet_baseline.py) to the file's new actual
line count, 31039, so the deleted line cannot be re-spent elsewhere.

Not done here, per the issue's own scope: other getsource substring checks
in this parked file may also be stale (e.g. "default_config" is not
currently present in get_frontend_config's source either) -- that drift
belongs to #15173, not this fix.
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: mrveiss/AutoBot-AI/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ebbdfe02-6f82-496a-bf93-a5b85b1206ee

📥 Commits

Reviewing files that changed from the base of the PR and between 554a15b and 349aa66.

⛔ Files ignored due to path filters (2)
  • repo_tests/python_file_size_ratchet_baseline.py is excluded by !repo_tests/python_file_size_ratchet_baseline.py
  • scripts/python_file_size_known_large.py is excluded by !scripts/python_file_size_known_large.py
📒 Files selected for processing (1)
  • autobot-backend/api/api_endpoint_migrations_test.py

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

Correcting my own claim: "main's hook version is a superset" — now verified, previously not

Review flagged that I justified discarding the branch's tools/lint/check_no_local_schemas.py (and its test) by comparing test counts — 32 in main against 19 on the branch. That is a proxy, not an identity check, and the reviewer correctly said the claim was unverifiable from a fresh clone: the discarded version is not in any reachable ref.

It is in my reflog. 450722f2f3 is the pre-rebase commit, so the question is answerable after all.

git diff 450722f2f3:tools/lint/check_no_local_schemas.py origin/main:tools/lint/check_no_local_schemas.py
-> 186 insertions(+), 46 deletions(-)

The 46 are what the branch had and main does not. Checked each:

symbol main branch
enforce_reach 2 2
scan_python_files 2 2
PY_FLOOR 2 2
_is_target_file 2 2
_DOMAIN_GUIDE 0 2

Only _DOMAIN_GUIDE is genuinely absent — a static string listing which schemas_*.py each domain belongs in. It was not dropped; it was superseded. git log -S shows it removed by #16178/#16241, "scope no-local-schemas to the lines a change added, and point at modules with headroom", which replaced the frozen list with a computed _destination_guide(repo_root) called at line 263. A guide that names modules with headroom is strictly better than one that cannot know.

So main's version is a functional superset and taking it was right — but that is established now by diffing the discarded blob, not by counting tests. Verified, where before it was asserted.

Two stale counts in the same file, one of which this PR makes staler

Also raised in review, and both hold:

docstring line 9   : "2148 inspect.getsource() assertions"
skip reason line 43: "2143 inspect.getsource() call sites"
actual, on main AND on this tip: 2142

Three numbers, none matching. Pre-existing.

The second is mine to answer for: the skip reason also says "710 of those asserts substring in checks", and the line this PR deletes is exactly such a check — assertIn(..., source) goes 3833 → 3832 across the change. The PR moves the population that sentence describes without touching the sentence.

Not fixing it here, deliberately. The figures were already wrong in three places before this change, so correcting one leaves two; correcting all three means auditing a 31k-line parked file, which is a different piece of work from deleting one stale assertion. Pushing that to this PR also discards an in-flight suite for prose in a file that never executes. Filed separately instead.

It is worth naming what the file is: a docstring about silent assertion-rot, whose own counts have rotted. Prose citing a measurement goes stale at the next change — drop the figure or accept the drift.

AC4's destination is closed

AC4 says "if the rest of this parked file is also drifting… record that on #15173 rather than fixing it piecemeal." #15173 is CLOSED, and the condition is close to unfalsifiable as written: 2142 getsource sites and 3832 substring assertions against live source, none of which execute, so "is the rest drifting?" cannot be answered without unparking the file. I have ticked AC4 on the ground that the recording exists on #15173 already — but a later reader ticking it fresh would be ticking something nobody measured, and that is worth knowing.

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.

test(api): a stale assertion in the parked migrations test cannot be removed without moving test fixtures into production schemas

1 participant