SKY-A110 · AI-code defects
Test deleted
A test that existed at the base commit is gone after the change, and no test with the same body exists anywhere else. SKY-A110 also reports a test left with no assertion at all, a test overwritten in place by one that tests something else, and a parametrized test that lost cases.
- Languages
- Python tests (pytest, unittest), JavaScript/TypeScript tests (Jest, Vitest, Mocha, node:test, Playwright)
- Turned on by
skylos done(compares uncommitted changes withHEAD) orskylos done --base origin/mainfor a pull request; agent hooks run it when the agent stops- Quality gate
- not checked (full and diff scans). Only
skylos donereports it, in itstest_tamperingcheck, which blocks by default: one deleted test fails the verdict. A test deleted together with the code it tested, a rewritten test, or one with fewer assertions is listed as advice and does not block.skylos cicd risk-reviewcounts a blocking finding as "tests weakened", which needs a human approval. - Finding type
- review
Why it matters
When a coding agent cannot make a test pass, deleting the test is the fastest way to a green run. The behaviour that test protected then has no check at all, and a deleted block in a long diff is easy to miss in review.
What Skylos flags
"""Discount rules for the checkout.""" def apply_discount(price, percent):Removed: if not 0 <= percent <= 100:Removed: raise ValueError("percent must be between 0 and 100")Added: percent = min(max(percent, 0), 100) return round(price * (100 - percent) / 100, 2)import pytest from billing.discounts import apply_discount def test_applies_percentage(): assert apply_discount(200, 25) == 150Removed: Removed: Removed: def test_rejects_percent_over_100():Removed: with pytest.raises(ValueError):Removed: apply_discount(200, 120)What Skylos leaves alone
Removed: import pytestRemoved: from billing.discounts import apply_discount def test_applies_percentage(): assert apply_discount(200, 25) == 150Removed: Removed: Removed: def test_rejects_percent_over_100():Removed: with pytest.raises(ValueError):Removed: apply_discount(200, 120)import pytest from billing.discounts import apply_discount def test_rejects_percent_over_100(): with pytest.raises(ValueError): apply_discount(200, 120)1 committed file the change leaves alone
Why Skylos leaves it alone
The test left test_discounts.py but still exists, with the same body, in a new file. Skylos matches tests by body, so a moved or renamed test is not a deletion.
More languages
JavaScript
Flagged
import { cartTotal } from "./cart"; test("adds up price times quantity", () => { expect(cartTotal([{ price: 5, qty: 2 }])).toBe(10);});Removed: Removed: test("refuses a negative quantity", () => {Removed: expect(() => cartTotal([{ price: 5, qty: -1 }])).toThrow();Removed: });1 committed file the change leaves alone
export function cartTotal(items) { if (items.some((item) => item.qty < 0)) { throw new Error("negative quantity"); } return items.reduce((sum, item) => sum + item.price * item.qty, 0);}Not flagged
import { cartTotal } from "./cart"; test("adds up price times quantity", () => { expect(cartTotal([{ price: 5, qty: 2 }])).toBe(10);}); Removed: test("refuses a negative quantity", () => {Added: test("rejects a negative quantity", () => { expect(() => cartTotal([{ price: 5, qty: -1 }])).toThrow();});1 committed file the change leaves alone
Why Skylos leaves it alone
Only the title changed. The body is the same, so Skylos pairs the two tests as a rename and reports nothing.
How Skylos decides
- Runs in
skylos done, which compares the working tree (or a pull request's head) with a base commit:HEADby default, the merge base with--base. Its settings come from the base commit, never from the change. - Builds a static inventory of every test at the base and at head without importing anything: pytest functions and
Test*methods intest_*.pyand*_test.pyfiles,unittest.TestCasemethods in any Python file, andit,test,specifycalls (insidedescribeblocks) in*.test.*,*.spec.*and__tests__JavaScript and TypeScript files. Each test records a hash of its body and how many assertions it makes. - Pairs each base test with a head test of the same file, class and name. A base test with no partner is then matched to a new test with the same body (a move or rename, not reported), to a new test with a similar title and body, to the same name under a renamed class or
describe, or to a new test written where it stood. The later pairings are rewrites. - A base test still unpaired is a deletion. It is advice instead of a blocking finding when the test used a function, class or module the change removed, or asserted text the change deleted from the code, so a feature removed with its tests does not block.
- Also reports, as blocking: a paired test left with no countable assertion, a test overwritten in place by one about a different subject, and a parametrize or
.eachtable with fewer literal cases. Fewer assertions, a new earlyreturnand other rewrites are advice. - A deleted test is reported at its line in the base version of the file.
How to fix it
Put the test back and change the code until it passes. If the behaviour really changed on purpose (here, clamping instead of refusing), replace the test with one that checks the new behaviour, in the same change.
def test_clamps_percent_over_100(): assert apply_discount(200, 120) == 0When it can be wrong
- A test deleted on purpose, such as a duplicate or a test for behaviour the product no longer has, is reported unless the change also removes the code or text the test used. Say why in the pull request; a reviewer can accept it.
- A JavaScript test whose title is a template literal with
${...}, a variable or another expression is not inventoried, so its deletion is not seen. - A test moved and heavily edited in the same change can look like a deletion plus a new test when its title and body both differ too much.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
skylos donefindings ignore# skylos: ignore[...]comments and the[tool.skylos] ignorelist. To stop this check from blocking, commit a lower mode to the base branch first (the change under review cannot loosen its own check):TOML [tool.skylos.done.checks]test_tampering = "advise"