Skip to content

artifacts: view templates get roles: ["unknown"] (.vue, .svelte, .astro, .ejs, .html) #208

Description

@rahlk

Problem

Every view template in a project lands in application.artifacts{} with roles: ["unknown"]. Measured on a fixture containing one of each shape (analyzer at HEAD, -a 2):

MODULES: ['src/real.ts']

ARTIFACT package.json           | roles ['dependency-manifest', 'tool-config'] | size 84
ARTIFACT public/index.html      | roles ['unknown'] | size 95
ARTIFACT src/Widget.vue         | roles ['unknown'] | size 227
ARTIFACT src/pages/index.astro  | roles ['unknown'] | size 151
ARTIFACT views/page.ejs         | roles ['unknown'] | size 76
ARTIFACT tsconfig.json          | roles ['tool-config'] | size 61

The record itself is complete — full source, sha256, size_bytes, correct repo-relative key — so nothing is lost. What is missing is the one field a consumer would filter on to ask "what are this application's views?", which today requires the consumer to re-derive the answer from file extensions the analyzer already inspected.

roles[] is where that answer belongs: dependency-manifest and tool-config are already assigned by exactly this kind of recognition.

Scope boundary

  • Roles only. This issue does not parse a single line of template content, does not add a symbol_table entry for a template, and does not model template expressions. Those are the structural half of the same subject and belong on the design rung (see the sibling issue).
  • No contract move. roles[] is an existing string[]; this adds new values to it, the same class of change as a new framework value in the entrypoint pass. No new field, node label, edge type or property, and schema.neo4j.json must stay byte-identical.
  • Cross-language parity is a live consideration: codeanalyzer-java is working on JSP/JSF/Thymeleaf views right now, so whichever analyzer assigns a role name first coins it for both. Prefer a name that is not TS-specific.

Goals

  • Recognize view templates by extension in the artifact role assignment: .vue, .svelte, .astro, .ejs, .hbs, .handlebars, .pug, .njk, .liquid, .html, .htm.
  • Assign one role name for the class, coined once (candidate: view-template), and record the chosen spelling in .claude/SCHEMA_DECISIONS.md so the sibling analyzers adopt rather than re-coin.
  • .html needs a judgment call, not a blanket rule: a public/index.html is a view, a coverage report under a non-skipped directory is not. Decide and document whether .html gets the role unconditionally or only outside build-output paths.
  • Test: a fixture with each extension asserts the role, and asserts a .json/.md artifact does not get it.
  • bun run gen:schema leaves schema.neo4j.json byte-identical.

Caveats and known risks

  • A role name is permanent vocabulary. codeanalyzer-java's equivalent work is in flight; coining view-template here and having java coin template there is the failure this repo's parity clause exists to prevent. Check before merging.
  • Extension-based recognition will mislabel a hand-written .html fixture used as test input as a view. Acceptable — roles[] is best-effort classification, and the artifact record is unchanged either way — but say so in the code comment rather than pretending precision.
  • .astro and .vue files are also the subject of the module issue. This issue must not pre-empt that decision: assigning a role now must not require re-deciding it later if the file additionally becomes a symbol_table module.

Definition of done

A fixture containing all listed extensions produces artifacts whose roles[] carries the coined view-template role, a non-template artifact does not, the chosen name is written into .claude/SCHEMA_DECISIONS.md with a note that siblings adopt it verbatim, and schema.neo4j.json is byte-identical.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions