Implement AST-based dependency extraction in FormulaVisitor.calculateDependencies (markdown-template)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Start by reading packages/markdown-template/src/FormulaVisitor.ts and trace how calculateDependencies is called from templatemarkutil.ts and how dependencies is serialized and read back. The issue leaves the runtime parser and which identifiers count unresolved, so first settle those decisions in the discussion before implementing. Done means extracting the agreed dependencies from formula TypeScript while respecting the agreed handling of bindings and parse failures.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
FormulaVisitor.calculateDependencies(tsCode) in packages/markdown-template/src/FormulaVisitor.ts is a stub (// TODO!!) that always returns []. It's invoked during TemplateMark typing (templatemarkutil.ts → templateMarkTypingGen), which sets dependencies on every FormulaDefinition / ConditionalDefinition, and the value is serialized through markdown-html (ToHtmlStringVisitor.ts writes the dependencies attribute, rules.ts reads it back). Today that attribute is always an empty array.
Continuing the working discussion with @mttrbrts
Current state / safety
Traced consumers of the field across the org:
markdown-transform: only written (HTML attr), read back (rules.ts), or stripped (markdown-cicero/ToCommonMarkVisitor.tsdeletes it).template-engine: onlyTemplateMarkInterpreter.tsdoesdelete context.dependencies.
No code branches on the values, so implementing real extraction is self-contained with no regression surface — it only populates a field that is currently always empty.
Proposed approach
Extract root identifiers from the formula's TypeScript source (the param is named tsCode) via the AST rather than regex:
- Collect root identifiers that reference template variables / model, excluding locally-bound names, function params, and built-ins.
- Handle optional chaining (
a?.b?.c→ roota). - Return
[]on parse failure or unrecognized constructs (note: this changes the currentcatch, which throws — flagging so it's an explicit decision).
Open questions to scope before implementation
- Runtime parser:
typescriptis currently a devDependency of markdown-template. Preference for promoting the TS compiler API to a runtime dep vs. a lighter parser (e.g.@typescript-eslint/typescript-estree)? - Dependency definition: which identifier classes count — model/variable refs only, and are locally-declared bindings and function params always excluded?
- Cross-formula references: Devanshi noted formulas lack stable user-facing names, so these look out-of-scope for v1 — agreed to defer?
I can't make the Wednesday call, so opening this for async discussion per your
suggestion. Once (1) the runtime parser and (2) the dependency-definition
question are settled here, I'll scope the PR to those decisions.
- Lingua principale
- TypeScript
- Stelle
- 86
- Fork
- 69
- Merge medio
- 6m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di accordproject/markdown-transform
-
@accordproject/markdown-it-template has a Nerq Trust Score of 68.0/100 — verified badge availableApertaStale
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
accordproject/markdown-transform#664 · 1 commento ·
-
Stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
accordproject/markdown-transform#582 · 2 commenti ·
-
Rename CiceroMark to AgreementMarkForse di nuovo libera @anablaz l’ha presa 979 giorni fa e non c’è nessuna pull request aperta. ApertaStale
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
accordproject/markdown-transform#536 · 4 commenti ·
-
Variable Name ConflictsApertaDifficulty: Challenging maintainer-engaged Priority: High ⚠️ Type: Bug 🐛
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
accordproject/markdown-transform#371 · 3 commenti ·
-
Help Wanted 🆘 maintainer-engaged Type: Discussion 🗣 Type: Feature Request 🛍️ Type: Need Investigation 🔬
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
accordproject/markdown-transform#368 · 7 commenti ·
Tutte le issue di accordproject/markdown-transform
Issue simili
-
Mend: dependency security vulnerability
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
fdm-monster/fdm-monster#5563 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
be-BOP-io-SA/be-BOP#2849 ·
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
growilabs/growi#12246 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 The Rulekeeper - An index run that gives up on the lock ends SucceededForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SSWConsulting/SSW.Rules#2809 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automated-triage type/bug type/ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno