Skip to content
cccskills
FreePublished on GitHub

grafema-uri-semantic-id-parsing

Fix silent failures when parsing Grafema semantic IDs that are in URI format instead of legacy arrow format. Use when: (1) code splits semantic IDs by "->" but gets the whole string back because IDs are grafema:// URIs, (2) file path extraction from semantic IDs returns empty or wrong values, (3) derived edges (DEPENDS_ON, etc.) produce 0 results despite source edges existing, (4) any code that processes semantic IDs after the analysis pipeline's to_uri_format() has run. The grafema:// URI format uses # fragments with percent-encoded characters instead of -> separators.

The English summary is being prepared. Showing the original description.

Run score Not tested

See how to install

Files included (1)

  • SKILL.md4.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Grafema URI Semantic ID Parsing

Problem

Code that processes semantic IDs using split("->") silently fails when the analysis pipeline has converted IDs to grafema:// URI format. The URI format uses # fragments with percent-encoded characters (%3E instead of >), so -> never appears and split("->") returns the entire string as element 0.

Context / Trigger Conditions

  • Derived edges (e.g., MODULE->MODULE DEPENDS_ON from IMPORTS_FROM) produce 0 results
  • File path extraction from semantic IDs returns the whole URI string
  • Any Rust code in the orchestrator that processes semantic IDs from RFDB after to_uri_format() has been called during analysis
  • Lookups into file_to_module or similar file-keyed maps always miss

The Two Formats

Legacy compact format (before to_uri_format):

src/components/App.tsx->IMPORT_BINDING->react
MODULE#src/components/App.tsx

URI format (after to_uri_format, stored in RFDB):

grafema://github.com/owner/repo/src/components/App.tsx#IMPORT_BINDING%3Ereact
grafema://github.com/owner/repo/src/components/App.tsx#MODULE

Virtual nodes (no file path):

grafema://github.com/owner/repo/_/EXTERNAL_MODULE%3Elodash
grafema://github.com/owner/repo/_/GLOBAL%3A%3Aconsole

Solution

Always handle both formats when extracting file paths from semantic IDs:

// Pre-compute URI prefix (authority is known from resolve_authority())
let uri_prefix = format!("grafema://{authority}/");

let extract_file = |id: &str| -> &str {
    if let Some(rest) = id.strip_prefix(&uri_prefix) {
        // URI format: take path up to '#'
        rest.split('#').next().unwrap_or("")
    } else {
        // Legacy format: take path up to first '->'
        id.split("->").next().unwrap_or("")
    }
};

Key points:

  • authority is always available via resolve_authority(&cfg) in main.rs
  • Virtual nodes have _/ as the file path component — these won't match real files (correct behavior)
  • node.file fields stay as relative paths (not URI-formatted), so file_to_module maps use relative paths as keys
  • Edge src/dst fields ARE URI-formatted (they reference node IDs which were converted)

Verification

After fixing, check:

  1. all_imports_from_edges.len() > 0 (edges are collected)
  2. depends_on_pairs.len() > 0 (file paths extracted and matched)
  3. Tracing output shows "Module dependency edges derived" with non-zero count

Example: The DEPENDS_ON Bug

The to_uri_format() method in analyzer.rs converts node IDs but keeps node.file as-is:

pub fn to_uri_format(&mut self, authority: &str) {
    for node in &mut self.nodes {
        node.id = convert(&node.id);  // → grafema://authority/path#FRAGMENT
        // node.file stays as relative path
    }
    for edge in &mut self.edges {
        edge.src = convert(&edge.src);  // → URI format
        edge.dst = convert(&edge.dst);  // → URI format
    }
}

So IMPORTS_FROM edges in RFDB have URI-formatted src/dst, but MODULE nodes have relative file paths. The derivation code must parse URIs to extract relative paths for the file_to_module lookup.

Notes

  • This affects ALL code that processes semantic IDs from RFDB in the orchestrator
  • The compact_to_uri function in analyzer.rs defines the exact URI structure
  • Fragment encoding: > → %3E, [ → %5B, ] → %5D, # → %23
  • If authority changes between runs, old and new URIs won't match

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Fix Elixir/Erlang AST processing bugs in Grafema beam-analyzer. Use when: (1) Elixir parser returns MODULE node but 0 functions/calls — body nesting issue, (2) Erlang parser crashes with "cannot convert list to string" on OTP 26+ — location format changed from integer to keyword list, (3) pipe operator |> creates spurious CALL nodes instead of desugared function calls — clause ordering bug, (4) multi-module .ex files return only the first module — missing __block__ handler, (5) installing Erlang/Elixir on macOS with outdated Xcode/Clang.

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

Fires after fixing any non-trivial bug or regression. Asks: could the graph have caught this as a guarantee? Pairs with reflection-in-and-on-action — picks up after "earliest catchable signal" and asks the next question: was that signal expressible in graph? Triggers: (1) after any non-trivial bug fix is verified working, (2) after a regression report (something used to work, broke), (3) during step 6 (knowledge extraction) of the workflow, (4) when reflection-on-action surfaces a "would have been catchable" signal. Outcome is a triage decision (graph-reachable? rule expressible? rule sound?) and either a draft Linear issue + guarantee proposal, or a recorded "graph capability gap" note. Never auto-creates guarantees.

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

Fix Playwright automation failures against code-server (VS Code in browser). Use when: (1) trust dialog blocks all clicks — "monaco-dialog-modal-block intercepts pointer events", (2) button:has-text() finds wrong buttons behind modal dialog, (3) keyboard shortcuts don't work — Meta vs Control inconsistency, (4) VS Code extension activity bar icon not found by aria-label, (5) panels show placeholder text despite extension being "Connected". Covers trust dialog dismissal, keyboard shortcut hybrid mode, extension panel selectors, and database connection verification for Grafema extension.

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

Systematic methodology for achieving 100% backward dataflow reachability in a new language. Create gauntlet fixture, write trace, diagnose gaps, fix analyzer/algorithm, iterate to 100%. Language-agnostic process. Use when: (1) adding a new language to Grafema, (2) auditing dataflow coverage for existing language, (3) user says "/dataflow-gauntlet".

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

Fix docker exec hanging when starting background processes (servers, daemons) inside containers. Use when: (1) docker exec never returns despite using & or nohup, (2) background server started in container causes docker exec to hang indefinitely, (3) env_startup_command in SWE-bench or similar frameworks times out, (4) setsid/disown needed for proper process detachment in Docker. Root cause: docker exec tracks ALL processes in the exec session, not just the top-level PID.

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

Fix Node.js CLI tools crashing inside Docker containers when host-installed node_modules require a newer Node version than the container provides. Use when: (1) "SyntaxError: Invalid regular expression flags" with /v flag in string-width or similar packages, (2) node_modules installed on host with Node 20+ but container has Node 18, (3) `npm install` with file: protocol creates symlinks that break inside Docker, (4) pnpm workspace packages become broken symlinks in containers. Covers version detection, Node binary mounting, and npm install strategies for cross-version compatibility.

The English summary is being prepared. Showing the original description.

Disentinel/grafema35Updated Aug 24, 2026

See all skills by Disentinel

Report a problem with this skill