Skip to content

Model generated artifacts without letting copied symbols enter canonical resolution #4815

Open

Description

@legendteddy

Problem

Graphify currently has no project-level way to distinguish a checked-in generated code artifact from the canonical source files that produced it.

When a generated aggregate/bundle repeats the same declarations as its source modules, Graphify legitimately extracts both copies. That can make otherwise-resolvable symbols ambiguous, even though the project itself has a clear source-of-truth relationship.

Ignoring the generated file entirely is also lossy: the artifact can be operationally important (for example, the exact deployment input) and should remain visible in the graph with provenance back to its sources.

Real-world evidence

I reproduced this on a production-style Google Apps Script repository while validating PR #4263.

The repository has four canonical .gs modules and one checked-in aggregate generated by concatenating those modules. The repository instructions explicitly identify the modules as authoritative and the aggregate as generated.

Using #4263's native Apps Script extraction:

  • canonical modules + generated aggregate: 0 cross-file calls across the .gs corpus because the duplicated declarations make targets ambiguous;
  • canonical modules only: 365 cross-file calls resolve across the same four source modules.

No private source is needed to reproduce the shape: any global-scope codebase with a checked-in concatenated artifact can create the same duplicate-definition problem.

Desired behavior

Add an explicit, deterministic project declaration for generated artifacts. No filename/content heuristics and no globs in the first version.

For example, fitting the existing flat .graphifyrc format:

generated.apps-script/Code.gs=apps-script/Core.gs,apps-script/Security.gs,apps-script/Service.gs,apps-script/Integrity.gs

Semantics:

  1. apps-script/Code.gs remains represented as a file/artifact node.
  2. It gets deterministic generated_from edges to the declared canonical source file nodes.
  3. Symbols copied into the generated artifact do not enter canonical symbol-resolution indexes and do not compete with the source definitions.
  4. Canonical source files are extracted normally.
  5. Incremental/update bookkeeping still treats the generated file as processed, so changing the artifact does not create retry churn.
  6. Default behavior is unchanged when no declaration exists.

Invariant

An explicitly declared generated artifact may be present in persistent graph state, but declarations copied into that artifact must not become peer definitions of the canonical source declarations.

The provenance relationship should be explicit rather than inferred.

Conservative v1 boundary

  • exact repo-relative paths only;
  • no automatic generated-file detection;
  • no wildcard declarations;
  • paths may not escape the scan root;
  • only emit generated_from when the declared source exists in the structural corpus (otherwise warn and fail closed);
  • preserve the generated artifact as a file node, but not its duplicated AST symbols.

This can later generalize to generated JS bundles, concatenated deployment files, generated clients, checked-in transpiled outputs, etc., without relying on language-specific heuristics.

Why .graphifyignore is not enough

Ignoring the artifact removes the duplicate symbols, but it also removes the fact that the artifact exists and loses the generated_from provenance that explains how deployment/build output relates to canonical source.

I can contribute the narrow explicit-config implementation plus regression tests if this shape fits the project.

Activity

  1. github-actions commented on Oct 27, 2026

    @github-actions

    Thanks for opening this issue, @legendteddy. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

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