Skip to content

test(core): Test negative-clause behavior - #299

Open
misonijnik wants to merge 6 commits into
mainfrom
misonijnik/negative-argument-position-tests
Open

test(core): Test negative-clause behavior#299
misonijnik wants to merge 6 commits into
mainfrom
misonijnik/negative-argument-position-tests

Conversation

@misonijnik

Copy link
Copy Markdown
Member

No description provided.

…ents

Negative pattern clauses (pattern-not and pattern-not-inside) whose excluded
event uses the tracked metavariable only in call-argument position never
exclude anything, while the identical event matches when required positively
and receiver-position counterparts exclude correctly. Static vs instance
calls, callee body contents, pattern-not forms, and context containment are
all ruled out as causes.

DocNegativeShapesTest pins the current behavior: samples named
PositiveNotYetExcluded assert the buggy outcome, so the suite is green today
and fails exactly when the defect is fixed. Full analysis and reproduction in
issues/negative-clause-argument-position.md.
@misonijnik misonijnik changed the title test(c0re): Test negative-clause behavior test(core): Test negative-clause behavior Jul 19, 2026
Drop the probe whose pattern-not-inside lacked a pattern-inside producer
(dismissible on shape grounds) and reshape the instance-argument and
sanitize-reassignment probes to the anchored form: producer declared in
pattern-inside, single-event main pattern, containment satisfiable. The
argument-position exclusions remain ineffective in the anchored shapes, so
the finding stands on clean rules; issue tables and repro updated to match.
Replace the PositiveNotYetExcluded naming hack with the repository's
established idiom: the affected samples are Negative (declaring the desired
semantics) annotated @TaintRuleFalsePositive, so the harness skips the known
over-reporting with a printed reason instead of asserting the buggy outcome.
The suite stays green and the skip log shows exactly which exclusions are
currently ineffective; when the defect is fixed, the annotations become
removable.
…efect

Drop the known-false-positive annotations: the argument-position and
negative-only-metavariable probes now assert that their Negative samples must
not report, and fail until negative clauses anchor on argument-position
events. Positive controls and receiver-position counterparts keep passing.
Remove InstanceArgNotInsideDoc, NegOnlyNotInsideDoc, and
ReceiverNotInsideSpanDoc; the suite keeps the argument-position probes with
shape-clean rules plus their positive controls and receiver counterparts.
@misonijnik
misonijnik requested a review from Saloed July 20, 2026 06:27
The earlier probes all declared their tracked value as Object while the
working counterexamples used declared types, so the apparent
receiver-vs-argument split was a fixture artifact. example/Rule.yaml already
excludes an argument-position event, which prompted the recheck.

Bisecting from that rule isolates the real discriminator: a structural
negative does not exclude when the tracked value's declared type is
java.lang.Object. The excluded call's own parameter type is irrelevant, and
an Object-typed value is excluded correctly when the negative rebinds it
through a receiver call. Retyping the original probes to String makes every
one of them pass.

ObjectTypedValueDoc and ObjectTypedValueCastDoc assert the desired semantics
and fail on the open defect; the rest are controls and clause-shape
coverage.
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