Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8576,7 +8576,8 @@ asks for anchors.
outbound rule on PetClinic classifies the repository interfaces by their
supertype; it cannot tell a read from a write off `member`. Closing this
is a resolution rule of its own (a `derived` edge to the external
ancestor, naming the member), not done.
ancestor, naming the member): done since, as the follow-up bullet "M24a,
Java, ancestor-attributed calls" below records; the five writes are edges.
- **M24a, TypeScript** (2026-11-28, `m24/a-typescript`). The fixture names 14
of 18, the self-hosted model 29 641 of 47 493; nothing merges and nothing
splits.
Expand Down Expand Up @@ -8772,6 +8773,57 @@ asks for anchors.
convention.
- A concepts rule does not tell a read from a write: an adapter found this
way has no member.
- **M24a, Java, ancestor-attributed calls** (2026-11-29,
`feat/java-ancestor-attribution`; the follow-up the Java bullet above left
open). The Python rule (`ancestor-attributed`), in the Java extractor:
`AncestorCallLookup`, a sibling of `UnboundCallLookup`.
- Traced drop path: a call inherited from a library type has a NULL
declaring type; `targetOf` gives it `UNKNOWN_TYPE_ID`, the member is not
whitelisted, and `emitTypeLevelCall` drops it on that id, counted in
`droppedUnidentifiedTargets`. Not `targetOf` itself.
- The rule fires only on such a call, so no edge that existed changes. It
writes an `invocation` (a `reference` outside every invocable) of the one
library ancestor's erased stub, the type the corpus WROTE (`JpaRepository`,
though `CrudRepository` declares `save`), naming the method, `derived`.
Conditions: the receiver is a written corpus type (field, parameter, local
not `var`), `this`, `super` (from the superclass: the class's own override
is no evidence against it), or the implicit `this` of an unqualified call
(every enclosing class); no corpus type of the closure declares the name;
exactly one library type there could answer (a JDK type only for a name
it has, `Object` never). Two: dropped, counted `ambiguous-ancestor`.
- Two conditions the brief did not name, each found by measuring, each
pinned by a test that keeps the call dropped. A corpus type of the closure
with a Lombok annotation: on apache/fineract 2 319 generated getters were
charged to Spring's `Persistable`. A static on-demand import, or a single
static import of the name, for an unqualified call: Mockito's `mock(…)`
arrives exactly as an inherited call does.
- The stderr summary gains `ancestor-attributed` and `ambiguous-ancestor`.
- Measured: PetClinic 891 → 896 edges, the five writes now edges to the
`JpaRepository` stub naming `save` / `saveAndFlush`, the ten reads
byte-identical, the model diff exactly the five lines; 13 with its tests,
0 ambiguous. An outbound rule on `org.springframework.data.jpa.repository`
with `save*` → `write` files five `database` `write` rows where it found
none. BroadleafCommerce: 383 sites, 12 ambiguous; fineract: 313, 1 103;
in both, only additions. Samples read on both showed no false attribution.
- The fixture moved by one edge: `super.post(document)` in `LedgerAdapter`
(189 → 190, members named 21 of 62). The counts that move are restated
with the reason; explain's Java goldens moved (fake client) for
`LedgerAdapter.post`, its type and its module, the only units with a new
fact. The same holds for a real model: a unit with such a call gets a new
prompt line, so its fingerprint changes and its stored insight is re-asked.
- Not covered: reads the corpus redeclares (already edges), an interface
with two library parents (ambiguous), a receiver whose type is not written
(`var`, a call's result, an inferred lambda parameter), method references.
- Follow-up (lead's review). A type whose declaration is corpus source (an
anonymous class, a local class, an enum constant body) is walked as corpus
whatever its id, never a candidate. Measured first: pass 3's ids already
mapped an anonymous class to its declared id, so the outcome did not change
on any corpus; the tests now hold even when the id is the undeclared
`Outer.1` form (jMock's `new Expectations() {{ oneOf(x); }}` under
`TestCase`: ambiguous). `Iface.super.m()` was missed: Spoon writes the
interface as the super access's target, with no type; it now starts there.
PetClinic, BroadleafCommerce and fineract models are byte-identical to the
first version's.
- **Known on this machine, older than the phase:** the website build stops
on Hugo (`unknown output format "llms" for kind "home"`), and
`scale.test.ts` can time out at its 5 s under a loaded full run; it passes
Expand Down
12 changes: 9 additions & 3 deletions docs/boundaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,15 @@ of an explain TYPE record (`TypeBlock.concept`, the closed vocabulary
`outbound.concepts` rule names is one row, after every edge row, by type:
`stub`, `member`, `effect`, `edge` and `provenance` null, `missing` `no edge`,
`from` the type, `anchor` the type's own (a type without one gets no row). It
is filed whether or not an edge row exists for it: a Spring Data interface's
inherited `save` leaves no edge (§25.7, M24a Java), which is the case this
answers.
is filed whether or not an edge row exists for it. It was built for a Spring
Data interface whose inherited `save` left no edge (§25.7, M24a Java). Since
the Java ancestor rule (§25.7, its follow-up bullet) that `save` IS an edge: a
`derived` invocation of the `JpaRepository` stub naming `save`, which an
`outbound.modules` rule on `org.springframework.data.jpa.repository` with an
`effects` rule `save*` → `write` files as a write (five rows on PetClinic).
The concepts row still answers what no edge says: the reads the interface
redeclares are calls into the code, and a repository nothing calls has no
edge at all.
- **The CLI's reader is M16c's.** Only when the file holds a concepts rule, the
CLI opens `<model>.insights.db` beside the first model (`--insights FILE` on
`analyze`, `walk` and `explain` names another): `existsSync` first, an ordinary
Expand Down
36 changes: 32 additions & 4 deletions extractors/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ RESOLUTION SUMMARY
resolution rate : 87.5%
entities : 642 (stubs: 118)
edges : 2104 (self-edges dropped: 12)
ancestor-attributed : 5 (derived)
ambiguous-ancestor : 0 (dropped)
```

- **type references** — every type reference in the Spoon model, type variables
Expand All @@ -152,6 +154,10 @@ RESOLUTION SUMMARY
- **edges (self-edges dropped: n)** — the metamodel forbids `from == to`
(METAMODEL.md §4). Recursion is legal Java, so those edges are dropped and
counted rather than treated as an error.
- **ancestor-attributed / ambiguous-ancestor** — call sites with no declaring
type charged to the one library ancestor that could answer (`derived` edges,
below), and those dropped because two could. Named as the Python and Ruby
extractors name them.

Note that "resolved" is **not** "internal". `java.lang.String` resolves and is
external; an invented FQN does not resolve and is external too. Which is which is
Expand Down Expand Up @@ -182,7 +188,8 @@ decided by `CorpusWhitelist` alone.
enclosing type with a method of that name, then the one method whose arity
fits — `declared` when every type consulted has its supertypes in the corpus,
`derived` otherwise; same-arity overloads, `Object` method names, `this.m()`,
`super.m()` and method references stay dropped. Until this was fixed,
`super.m()` and method references are not resolved by it (the ancestor rule
below may still charge one to a library type). Until this was fixed,
spring-petclinic's `cm -> cm.createCache("vets", cacheConfiguration())` left
`cacheConfiguration()` with no caller.
- **An edge to a stub names the member the site wrote** (MM-6, schema 1.1.0):
Expand All @@ -193,9 +200,30 @@ decided by `CorpusWhitelist` alone.
The member is part of the edge (`EdgeExtractor`'s `LinkedHashSet<Edge>` and its
`AccessKey`), so two members of one stub at one site are two edges, while a
read and a write of one member at one site stay one access with both flags.
A call to a method a corpus interface inherits from a library type
(`owners.save(owner)` on a Spring Data repository) still yields no edge in
noClasspath, so it names nothing.
- **A call to a method inherited from a library type is charged to that type,
by elimination** (`AncestorCallLookup`). Without the jar, ECJ cannot see what
`JpaRepository` declares, so `owners.save(owner)` on
`OwnerRepository extends JpaRepository<Owner, Integer>` arrives with no
declaring type, and was dropped. It is now an `invocation` of the
`JpaRepository` stub naming `save`, provenance `derived`, when: the receiver's
type is a corpus type that is written (a field, a parameter, a local not
`var`; `this`, `Outer.this` in `Outer` alone; `super`, from the superclass,
`Iface.super` from that interface; the implicit `this` of an unqualified call,
every enclosing class looked through). A type written in the corpus (an
anonymous or local class, an enum constant body) is walked as corpus whatever
its id, never a candidate. No corpus type of its
supertype closure declares the name or carries a Lombok annotation; and
exactly one library type there could answer (a JDK type only for a name it
has, `Object` never). The target is the type the corpus wrote, erased, even
where an ancestor of it really declares the method. Two candidates: dropped,
`ambiguous-ancestor`. An unqualified call in a file with a static on-demand
import, or a single static import of that name, stays dropped. Not covered:
a read the corpus redeclares (already an edge), an interface with two library
parents, a receiver whose type is not written, a method reference. A unit
with such a call gets a new fact: its explain prompt and fingerprint change,
and its stored insight is re-asked. The fixture's one case is
`super.post(document)` in `LedgerAdapter`; on spring-petclinic the five
repository writes.

## Layout

Expand Down
Loading
Loading