Skip to content

refactor: extract shared vdir constants and diagnostics helpers#61

Merged
jamestexas merged 1 commit intomainfrom
refactor/shared-vdir-helpers
Feb 27, 2026
Merged

refactor: extract shared vdir constants and diagnostics helpers#61
jamestexas merged 1 commit intomainfrom
refactor/shared-vdir-helpers

Conversation

@jamestexas
Copy link
Copy Markdown
Contributor

Summary

  • Extract IsDiagPath() and ParseDiagPath() into internal/graph/vdirpath.go alongside existing callers/callees helpers
  • Add 9 named constants for virtual directory/file names used across FUSE and NFS backends
  • Delete duplicated isDiagPath() and parseDiagPath() from both internal/fs/root.go and internal/nfsmount/graphfs.go
  • Replace 40+ scattered string literals with shared constants

Details

vdirpath.go already shared callers/callees parsing between backends. This extends it with:

  • IsDiagPath(path) / ParseDiagPath(path) — reuses the existing parseVDirPath() generic implementation
  • Constants: SchemaDotJSON, DiagnosticsDir, ContextFile, PromptFile, CallersDir, CalleesDir, DiagLastWrite, DiagASTErrors, DiagLint

FUSE's isDiagPath() retains its Writable && guard by wrapping the shared helper.

Not touched (intentionally): diagContent() stays per-backend (different backing stores), .query/ stays FUSE-only, leyline pre-materializes into SQLite so has no path parsing.

Net: 3 files changed, 83 insertions, 103 deletions (-20 lines).

Test plan

  • task fmt && task vet && task lint — clean
  • task test — all passing, zero failures

Move duplicated parseDiagPath/isDiagPath from FUSE and NFS backends
into internal/graph/vdirpath.go alongside the existing callers/callees
helpers. Add named constants for all virtual directory/file names
(_schema.json, _diagnostics, context, PROMPT.txt, callers, callees,
last-write-status, ast-errors, lint) and use them across both backends.

Net reduction of 20 lines; eliminates ~30 lines of duplicated parsing
logic and replaces 40+ scattered string literals with shared constants.
@jamestexas jamestexas merged commit 7235d25 into main Feb 27, 2026
13 checks passed
@jamestexas jamestexas deleted the refactor/shared-vdir-helpers branch February 27, 2026 23:57
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.

1 participant