Skip to content

DRY: consolidate duplicated DB/graph helpers (_sanitize_value, _formatResultAsMarkdown, build-loop) into ai.common.utils #1602

Description

@dsapandora

Problem Statement

@asclearuc's review on #1584 flagged several near-duplicate helpers across the DB/graph nodes that have already drifted:

Proposed Solution

Extract the genuinely engine-agnostic helpers — _sanitize_value, _formatResultAsMarkdown, and the build-loop control flow — into ai.common.utils, and consume them from db_instance_base, db_arango, db_neo4j, and graph_instance_base. Keep the engine-specific driver-level serialisers local (they legitimately differ per engine). Do this as a dedicated refactor pass, not smuggled into a feature PR.

Alternatives Considered

Leave the copies as-is — rejected: they have already diverged silently and will keep doing so as each node evolves.

Affected Modules

  • nodes (pipeline)
  • ai

DRY follow-up to #1584. Lower priority than the correctness port (companion bug issue).

Metadata

Metadata

Assignees

Labels

P3-lowLow priorityaiAI/ML modulesfeatureNew feature or enhancementnodesPipeline nodes

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions