Skip to content

feat(artifacts): view-template role and J_DISPATCHES_TO from dispatch sites to the Artifact they reach - #260

Merged
rahlk merged 5 commits into
mainfrom
feat/issue-259-view-template-dispatch
Sep 11, 2026
Merged

rahlk merged 5 commits into
mainfrom
feat/issue-259-view-template-dispatch

Conversation

@rahlk

@rahlk rahlk commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #259. Spec: codellm-devkit/.github#80 (docs/design/specs/2026-09-11-java-view-templates-and-dispatch.md).

What

  • view-template role. ArtifactDiscovery classifies *.jsp *.jspx *.jspf *.tag *.tagx (format: jsp), *.xhtml (xhtml) and .html under templates/ or WEB-INF/ (html) as roles: ["view-template"]; faces-config.xml becomes tool-config. A bare .html elsewhere stays unknown — a static page and a Thymeleaf template are not distinguishable by name.
  • return body nodes carry their expression in argument_expr (empty for a bare return). Population of an existing field, no schema addition.
  • ViewDispatches, the same shape as ConfigUses: detection by declared receiver type (RequestDispatcher.forward / include, HttpServletResponse.sendRedirect, ModelAndView construction / setViewName, and a Spring entrypoint's String return), a literal tier at every level, the L3/L4 dataflow tiers widening it, and a target that closes on exactly one artifact or is recorded unresolved as non-literal / no-such-artifact / ambiguous. View names expand through spring.mvc.view.* when declared and spring.thymeleaf.* or Thymeleaf's defaults otherwise; redirect: / forward: prefixes re-dispatch as paths.
  • DataflowTiers hoists the intra (DDG) and interprocedural (call-graph) tiers out of ConfigUses unchanged so both passes share them; Literals likewise for the string decoders.
  • Both projections. application.view_dispatches[] {src, dst, via, prov} and view_dispatches_unresolved[] {site, callee, target, via, reason, prov} in analysis.json; J_DISPATCHES_TO {via, prov} from JBodyNode to Artifact in Neo4j. Unresolved dispatches have no target node and stay JSON-only. schema.neo4j.json diff is exactly the one relationship; schema_version stays 2.0.0.

Tests

  • ArtifactDiscoveryTest: each rule, the bare-.html refusal, and plantsbywebsphere's view-template set pinned to its 16 JSP/Facelets files exactly.
  • ReturnExpressionTest: literal, expression, bare return.
  • ViewDispatchesTest: forward / include / redirect resolve; servlet URL → no-such-artifact; two dup.jspambiguous; variable → non-literal; projection carries via/prov with both endpoints present and nothing for unresolved.
  • ViewDispatchDataflowTierTest: a local closes at −a 3 (prov: ["dataflow"]), a parameter at −a 4; disagreeing definitions and two callers with different pages stay non-literal with both tiers listed as attempted; a traced literal naming no file is no-such-artifact.
  • ViewNameDispatchTest: Thymeleaf defaults, declared spring.mvc.view.*, redirect: prefix, ModelAndView both forms, and the gate (return "home" outside a Spring entrypoint and a non-String return are not dispatches).
  • CodeAnalyzerV2CliTest: end to end over a servlet fixture in both projections.

Full suite: 593 tests green except CodeAnalyzerIntegrationTest, which needs Docker.

Caveats (from #259)

  • The servlet / Spring types must resolve for the pass to see anything — same condition config reads live with. The tests stub the API as fixture source for that reason.
  • return nodes exist from L3, so a controller's return-based view name is invisible at −a 1; its ModelAndView sites are not.
  • A dispatcher held in a local (rd.forward(...)) is non-literal for now (ponytail: comment in ViewDispatches.dispatcherArgument).
  • via: "navigation" is reserved and emits nothing until a JSF entrypoint finder exists.
  • Not re-run on DayTrader: the checkout used for the measurements in the spec is no longer on disk.

Follow-up

python-sdk: JViewDispatch / JViewDispatchUnresolved models, get_view_dispatches / get_view_dispatchers, Neo4j reconstruct — filed against the 3.3.0 wheel once it is cut.

…-dispatch literal tier (#259)

- ArtifactDiscovery classifies the JSP family, Facelets, and Thymeleaf
  html under templates/ or WEB-INF/ as view-template; faces-config.xml
  becomes tool-config; bare html elsewhere stays unknown.
- return body nodes carry the returned expression in argument_expr.
- ViewDispatches resolves forward/include/sendRedirect sites to the
  artifact they reach, by declared receiver type, or records them
  unresolved as non-literal / no-such-artifact / ambiguous.
- Literals hoists the string-literal decoders ConfigUses and the new
  pass share.
…wTiers (#259)

Hoists the L3 intra and L4 interprocedural tiers out of ConfigUses into
DataflowTiers, unchanged, and runs them over non-literal dispatch
targets: a bare local closes over the callable's own DDG, a parameter
over every call site that binds it, and any disagreement stays
non-literal.
…fault view resolver (#259)

A Spring entrypoint's String return, new ModelAndView(name) and
setViewName(name) are view-name dispatch sites. Names expand through
spring.mvc.view.* when declared and spring.thymeleaf.* or Thymeleaf's
defaults otherwise; redirect:/forward: prefixes re-dispatch as paths;
a return outside a Spring entrypoint is never a view name.
… application (#259)

- JApplication.view_dispatches / view_dispatches_unresolved, wired in
  CodeAnalyzer after config reads at every level.
- V2SchemaCatalog declares J_DISPATCHES_TO from JBodyNode to Artifact
  with via and prov; V2GraphProjector emits one edge per resolved
  dispatch and none for unresolved ones; schema.neo4j.json regenerated.
- The v2 JSON oracle accepts the two lists; the CLI test drives both
  projections end to end over a servlet fixture; plantsbywebsphere's
  view-template set is pinned exactly.
- SCHEMA_DECISIONS D32 and the README record the contract.
@rahlk
rahlk merged commit 7408caa into main Sep 11, 2026
@rahlk
rahlk deleted the feat/issue-259-view-template-dispatch branch September 11, 2026 14:02
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.

feat(artifacts): view-template role and J_DISPATCHES_TO from dispatch sites to the Artifact they reach

1 participant