Skip to content

PHP/Laravel: GraphQL SDL files (.graphql/.gql) produce zero nodes and no warning #85

Description

@filipechagas

Found while validating the fork (branch v8, graphify 0.9.40, origin/v8 = 5e9d95c11837aeabbbb5d90cb45544f49dc58ca4) on lawnstarter/services-api.lawnstarter.com for PE-80062.

This is the Q3 (what listens to X?) failure from that run.

What happens

.graphql / .gql files are never extracted. They produce no nodes, no edges, and — unlike pint.json, which got a produced zero nodes warning in the same build — no warning at all. A consumer cannot tell "this file has no graph content" from "this file was never looked at".

For a Lighthouse service this silently removes the entire public API contract from the graph: the query fields, the @guard / @find / @rename directives, and every GraphQL type.

Minimal reproduction

mkdir -p repro/app repro/graphql && cd repro
cat > app/Widget.php <<'PHP'
<?php
namespace App;
class Widget {}
PHP
cat > graphql/schema.graphql <<'GQL'
type Query {
    getWidget(id: ID!): Widget! @find
}

type Widget {
    name: String! @rename(attribute: "widget_name")
}
GQL
git init -q && git add -A && git -c user.email=a@b -c user.name=a commit -qm init
graphify update .

Output:

Re-extracting code files in . (no LLM needed)...
[graphify watch] Rebuilt: 2 nodes, 1 edges, 1 communities

Both nodes come from app/Widget.php:

$ python3 -c "import json,collections;g=json.load(open('graphify-out/graph.json'));print(collections.Counter(n.get('source_file') for n in g['nodes']))"
Counter({'app/Widget.php': 2})

No warning mentions graphql/schema.graphql.

Root cause

graphify/detect.py:32CODE_EXTENSIONS has no .graphql or .gql entry, so SDL files are not classified as code and are skipped before extraction. grep -n "graphql" graphify/extract.py graphify/extractors/engine.py returns nothing.

Expected

Either (a) extract GraphQL SDL — a node per type / input / enum / query field, with an edge from a field's return type to the matching PHP model class where the name resolves — or, at minimum, (b) list unhandled-but-present source extensions in the same produced zero nodes warning so the gap is visible.

Impact in the graded repo

explain "auth.php" returns Degree: 0, and affected "ServiceForm" omits graphql/schema.graphql:15 and graphql/types/serviceForm.graphql:9 — the two places that break first if the model's columns are renamed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions