Skip to content

Neo4j: scope destructive statements on the can:// id prefix; retire _module #173

Description

@rahlk

Spec: 2026-09-02-prune-scope-on-can-id-prefix.md · Epic: codellm-devkit/.github#50

Problem

The purge is anchored on MODULE_OWNED_PATTERN, which stops it reaching other languages, but it is application-blind: MATCH (x:{PATTERN}) WHERE x._module = $m matches a second python application sharing that module path.

Python already generates one _module index per module-owned label; those retire with the property.

What to do

  • Scope the per-module purge and the orphan prune on the application's can:// id prefix (can://python/<app>), replacing the _module predicate and the label-list anchor.
  • Drop _module from the projection, from the graph catalog, and from any index on it.
  • Add a PyCanNode marker label to every node keyed by a can:// id, as an index anchor only — Neo4j property indexes are label-scoped, so MATCH (n) WHERE n.id STARTS WITH $p scans the whole store without one. STARTS WITH is index-backed on a range index; CONTAINS/ENDS WITH are not.
  • MAJOR graph-contract bump: a property is removed.
  • Grep this analyzer's SDK Neo4j backend for _module so a consumer is updated in the same train. The removal is not conditional on the answer — that was decided — but a surprise later is worse than a check now.

Two things not to get wrong

  • Prefix boundary. can://python/<app> also prefixes can://python/<app>Xtra. Match descendants on prefix + '/' and the node itself by equality.
  • Empty prefix. STARTS WITH '' matches every node in the database. Refuse a null or empty application id rather than falling through.

Goals

  • Both destructive statements scoped by id prefix
  • _module gone from projection, catalog and indexes
  • Marker label added and used as the index anchor
  • A test showing a second application in this same language, with a colliding module path, survives a push
  • The null/empty application id case is refused
  • Graph contract MAJOR bump

Definition of done

  • A test that fails before and passes after
  • The emitted graph is unchanged apart from _module's removal and the added marker label, shown by diffing a fixture projection
  • Full test suite green

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions