Skip to content

feat(vba): model TempVars keys as cross-form state nodes #50

Description

@ardelperal

Priority

P3 — high-value, Access-specific; new modeling concept (design before code).

Context

TempVars is Access's global key-value store and the canonical mechanism for passing state between forms (TempVars("IDExpediente") = Me.Id in the caller; TempVars("IDExpediente") read in the opened form's Form_Load). The dysflow corpus uses it in ~10 files. Today these cross-form data flows have zero graph representation — exactly the "dynamic dispatch" class of invisible flow the project's CLAUDE.md targets.

Current behavior

TempVars hits no scanner: not a call (often no parens in the write form TempVars!clave = x), and the receiver would be runtime-blacklisted anyway. Producers and consumers of the same key are unlinked.

Expected behavior

One synthetic node per TempVar key (deduped, line-independent id — same pattern as SQL table nodes in emitReference), with references edges from each reading/writing procedure, metadata.synthesizedBy: 'vba-tempvar' and metadata.access: 'read' | 'write'. Then codegraph_explore "quién produce IDExpediente" connects the producing form to the consuming form in one hop.

Implementation sketch

  • Scan inside procedures (reuse the proc stack in sweepCallsAndSql): /\bTempVars\s*(?:!\s*(\p{L}[\p{L}\p{N}_]*)|\(\s*"([^"]+)"\s*\))(?:\.Value)?/giu. The bang form scans the masked line; the string-literal form needs the ORIGINAL line (same split the SQL scanners use).
  • access = 'write' when the match is followed (after optional .Value) by \s*= (and not ==… VBA has no ==; a simple = suffix check on the masked line works); otherwise 'read'. TempVars.Add "clave", valor is a third form — cover it with /\bTempVars\.Add\s+"([^"]+)"/gi as a write.
  • Node kind: reuse the synthetic class placeholder for consistency with SQL tables, or introduce a tempvar kind if the schema tolerates new kinds cheaply — decide with the maintainer; the deterministic id must namespace keys (synthetic:tempvar/<key>).
  • Dynamic keys (TempVars(strNombre)) stay silent (REQ-CODE-4 spirit: unresolvable is silent).

Acceptance criteria

  • Write in Form_A.cls, read in Form_B.cls, same key → both edges point at ONE node; explore connects A→B through it.
  • read/write direction recorded in edge metadata.
  • Dynamic keys emit nothing; no node explosion (keys are deduped file-independently — verify cross-file id stability).

Validation

Index C:\Proyectos\dysflow\E2E_testing\src; enumerate all TempVars keys via grep and confirm graph parity; run one agent A/B question ("where does TempVars X get set?") per the CLAUDE.md methodology.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vbaVBA/Access-specific work (parent codegraph product)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions