From c8ac2bc4cb111a5ae031fe3cf2bb50d5158e9bbe Mon Sep 17 00:00:00 2001 From: sunerpy Date: Thu, 20 Aug 2026 23:55:47 +0800 Subject: [PATCH] feat(extract): detect generated files by their content banner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Go's convention marks a generated file in its content, not its name, so a `payroll.go` carrying `// Code generated by protoc-gen-go. DO NOT EDIT.` beside hand-written code was invisible to a path-only check and could outrank the implementation it shadows. The verdict is now decided at index time and stored on the file row, so a query never reads a header to rank a result. The flag only ever ADDS to the path signal: a file the path table already demotes stays demoted, and a header scan can promote nothing. The window is bounded, and precision comes from the patterns rather than the `generat` stem pre-filter — a comment that merely discusses code generation is not a banner, which the corpus pins with a one-clause `by` line and a banner declared inside a function body as negatives. All three extraction write paths compute it from the source they already read — fresh index, incremental sync, and the outdated rebuild — because filling a default at any one of them would make `sync` disagree with `index --force` and break the byte-equality invariant the golden suite rests on. Each path has its own test. SCHEMA_VERSION 7 -> 8 carries the column. EXTRACTION_VERSION 8 -> 9 is what makes an existing index classify outdated and re-extract; a DDL-only bump would leave every old row stuck at zero forever, since sync skips unchanged files. Verified in both directions across two binaries: the new one upgrades a v8 index with `2 reindexed, 0 skipped`, and the old one refuses a v9 index as `future` rather than misreading it. STORAGE_PROTOCOL stays 2 — bumping it would make an old binary judge every phase future, a wider refusal than this warrants. Sixteen corpora regenerate for the column plus a new go corpus; nodes, edges and refs are byte-identical, because the flag never enters extraction output. mini and godot additionally normalise their index CREATE order, which is expected: they are migrated artifacts where the v7 migration appended an index the newer corpora take from the base schema. --- AGENTS.md | 14 +- README.md | 13 + crates/codegraph-bench/fixtures/go/api.pb.go | 14 + .../codegraph-bench/fixtures/go/generator.go | 14 + crates/codegraph-bench/fixtures/go/nightly.go | 9 + crates/codegraph-bench/fixtures/go/payroll.go | 12 + .../fixtures/go/payroll_usecase.go | 6 + .../fixtures/go/worker_types.go | 12 + .../src/oracle/canonicalize.rs | 8 +- crates/codegraph-bench/tests/equivalence.rs | 28 + crates/codegraph-cli/src/main.rs | 3 + crates/codegraph-cli/tests/parallel_index.rs | 44 ++ crates/codegraph-core/src/generated_header.rs | 670 ++++++++++++++++++ crates/codegraph-core/src/lib.rs | 1 + crates/codegraph-core/src/types.rs | 6 + .../tests/godot_resource_audit.rs | 1 + crates/codegraph-graph/tests/traversal.rs | 1 + crates/codegraph-mcp/src/engine.rs | 325 ++++++++- .../codegraph-mcp/tests/godot_honesty_mcp.rs | 1 + crates/codegraph-mcp/tests/golden_mcp.rs | 1 + crates/codegraph-mcp/tests/reopen.rs | 1 + crates/codegraph-resolve/src/context.rs | 1 + crates/codegraph-resolve/src/resolver.rs | 3 + .../codegraph-resolve/src/snapshot_context.rs | 1 + .../tests/godot_class_member.rs | 1 + .../tests/godot_post_extract.rs | 1 + .../tests/golden_resolution.rs | 1 + .../tests/snapshot_equivalence.rs | 1 + crates/codegraph-resolve/tests/tauri_ipc.rs | 1 + .../tests/tier2_false_edges.rs | 1 + .../tests/tier3_union_edges.rs | 1 + .../tests/tier6_resolution.rs | 1 + crates/codegraph-store/src/index_state.rs | 2 +- crates/codegraph-store/src/migrations.rs | 154 +++- crates/codegraph-store/src/queries.rs | 118 ++- crates/codegraph-store/src/schema.rs | 6 +- crates/codegraph-store/tests/index_state.rs | 2 +- crates/codegraph-store/tests/schema_parity.rs | 7 +- crates/codegraph-watch/src/migrate.rs | 2 + crates/codegraph-watch/src/sync.rs | 90 +++ docs/equivalence.md | 121 ++++ reference/golden/arkts/colby.db | Bin 151552 -> 155648 bytes reference/golden/arkts/files.json | 1 + reference/golden/arkts/schema.sql | 4 +- reference/golden/cfml/colby.db | Bin 151552 -> 155648 bytes reference/golden/cfml/files.json | 3 + reference/golden/cfml/schema.sql | 4 +- reference/golden/colby.schema.sql | 4 +- reference/golden/cpp/colby.db | Bin 217088 -> 221184 bytes reference/golden/cpp/files.json | 17 + reference/golden/cpp/schema.sql | 4 +- reference/golden/cuda/colby.db | Bin 151552 -> 155648 bytes reference/golden/cuda/files.json | 1 + reference/golden/cuda/schema.sql | 4 +- reference/golden/erlang/colby.db | Bin 151552 -> 155648 bytes reference/golden/erlang/files.json | 1 + reference/golden/erlang/schema.sql | 4 +- reference/golden/go/colby.db | Bin 0 -> 155648 bytes reference/golden/go/edges.json | 128 ++++ reference/golden/go/files.json | 56 ++ reference/golden/go/nodes.json | 376 ++++++++++ reference/golden/go/refs.json | 1 + reference/golden/go/schema.sql | 119 ++++ reference/golden/godot/colby.db | Bin 151552 -> 155648 bytes reference/golden/godot/files.json | 6 + reference/golden/godot/schema.sql | 8 +- reference/golden/kotlin/colby.db | Bin 151552 -> 155648 bytes reference/golden/kotlin/files.json | 1 + reference/golden/kotlin/schema.sql | 4 +- reference/golden/metal/colby.db | Bin 151552 -> 155648 bytes reference/golden/metal/files.json | 1 + reference/golden/metal/schema.sql | 4 +- reference/golden/mini/colby.db | Bin 147456 -> 155648 bytes reference/golden/mini/files.json | 3 + reference/golden/mini/schema.sql | 8 +- reference/golden/nix/colby.db | Bin 151552 -> 155648 bytes reference/golden/nix/files.json | 3 + reference/golden/nix/schema.sql | 4 +- reference/golden/python/colby.db | Bin 151552 -> 155648 bytes reference/golden/python/files.json | 3 + reference/golden/python/schema.sql | 4 +- reference/golden/ruby/colby.db | Bin 151552 -> 155648 bytes reference/golden/ruby/files.json | 2 + reference/golden/ruby/schema.sql | 4 +- reference/golden/rust/colby.db | Bin 151552 -> 155648 bytes reference/golden/rust/files.json | 2 + reference/golden/rust/schema.sql | 4 +- reference/golden/solidity/colby.db | Bin 151552 -> 155648 bytes reference/golden/solidity/files.json | 2 + reference/golden/solidity/schema.sql | 4 +- reference/golden/terraform/colby.db | Bin 151552 -> 155648 bytes reference/golden/terraform/files.json | 1 + reference/golden/terraform/schema.sql | 4 +- reference/golden/typescript/colby.db | Bin 151552 -> 155648 bytes reference/golden/typescript/files.json | 6 + reference/golden/typescript/schema.sql | 4 +- 96 files changed, 2467 insertions(+), 41 deletions(-) create mode 100644 crates/codegraph-bench/fixtures/go/api.pb.go create mode 100644 crates/codegraph-bench/fixtures/go/generator.go create mode 100644 crates/codegraph-bench/fixtures/go/nightly.go create mode 100644 crates/codegraph-bench/fixtures/go/payroll.go create mode 100644 crates/codegraph-bench/fixtures/go/payroll_usecase.go create mode 100644 crates/codegraph-bench/fixtures/go/worker_types.go create mode 100644 crates/codegraph-core/src/generated_header.rs create mode 100644 reference/golden/go/colby.db create mode 100644 reference/golden/go/edges.json create mode 100644 reference/golden/go/files.json create mode 100644 reference/golden/go/nodes.json create mode 100644 reference/golden/go/refs.json create mode 100644 reference/golden/go/schema.sql diff --git a/AGENTS.md b/AGENTS.md index ba3ec800..a364d641 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,12 +39,22 @@ Protocol) stdio server. No AI / vector / LLM anywhere in the binary — output i where the unit struct produced NO node before — plus the Rust half of PR #1516's first-class `union` kind, byte-for-byte; it deliberately claims NO `instantiates` edge, because that edge fires only for the call-expression construction form and - a Rust union is constructible only as `U { … }`). + a Rust union is constructible only as `U { … }`), and `reference/golden/go/` + (corpus `crates/codegraph-bench/fixtures/go/`; the repo's only Go corpus, and the + only corpus where `files.generated` is anything other than `0` — it byte-pins + #1500 content-header detection at BOTH values, three each way: `payroll.go` + (Go's codified `Code generated … DO NOT EDIT.`), `worker_types.go` (pattern 6 / + CG-25, Wrangler's TWO `by` clauses) and `api.pb.go` (the PATH signal, no banner) + at `1`; `payroll_usecase.go` (hand-written, and the must-not-demote side), + `nightly.go` (ONE `by` clause — ordinary prose) and `generator.go` (the banner is + a `const` in the function BODY, so the comment-line fence rejects it) at `0`). The Python cross-file edge is resolved by Gate 3a's unique-name fallback; import Gate 3b is deliberately unreachable for real Python nodes because the extractor does not mark them exported. Regen recipe: `docs/equivalence.md` "Godot fixture" / "Ruby fixture" / "Python fixture" / "Kotlin fixture" / - "TypeScript resolution fixture" / "C++ fixture" / "Rust fixture" sections. + "TypeScript resolution fixture" / "C++ fixture" / "Rust fixture" / "Go fixture" + sections. `mini` has no re-indexable provenance and a schema migration cannot + normalise it in place, so it has its own "Mini schema rebuild" recipe there. - **node-id formula**: `{kind}:{sha256("{filePath}:{kind}:{name}:{line}").hex[:32]}`; file nodes are the literal `file:{relpath}`; lines are 1-based; paths relative with `/`. - **No AI / vector / LLM crates** — enforced by `scripts/guardrail.sh` (CI gate): diff --git a/README.md b/README.md index 3aea8db5..09627189 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,19 @@ Project configuration remains in `.codegraph/config.toml` and fields `legacyIndexPresent` and `legacyIndexPaths` remain in `status --json`, but always report `false` and `[]` respectively. +### Re-index required for content-header generated-file detection + +Generated-file detection now also reads a file's **content banner**, not only its +filename, so a machine-written `payroll.go` carrying +`// Code generated … DO NOT EDIT.` is demoted in ranking like a `.pb.go` file +already was. The verdict is computed at index time and stored on the file row. + +An index built by an earlier release therefore reports every file as +non-generated for the content half until it is re-extracted. Nothing breaks in the +meantime — the filename signal keeps working exactly as before — and the next +`codegraph index` or `codegraph sync` picks the new detection up automatically, +since the extraction-version bump classifies the old index as outdated. + --- ## Installation diff --git a/crates/codegraph-bench/fixtures/go/api.pb.go b/crates/codegraph-bench/fixtures/go/api.pb.go new file mode 100644 index 00000000..443bceee --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/api.pb.go @@ -0,0 +1,14 @@ +package payroll + +type PayrollRequest struct { + ID string + Amount int64 +} + +func (m *PayrollRequest) Reset() { + *m = PayrollRequest{} +} + +func (m *PayrollRequest) GetAmount() int64 { + return m.Amount +} diff --git a/crates/codegraph-bench/fixtures/go/generator.go b/crates/codegraph-bench/fixtures/go/generator.go new file mode 100644 index 00000000..9f965b20 --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/generator.go @@ -0,0 +1,14 @@ +package payroll + +// Emitter writes CRUD scaffolding for a table. +type Emitter struct { + Table string +} + +// Emit renders the file body, prefixing it with the standard banner. +// The banner literal lives in the BODY as a string constant, so this +// generator source must NOT be classified as generated itself. +func (e *Emitter) Emit() string { + const banner = "// Code generated by fkit-crud. DO NOT EDIT." + return banner + "\\n\\npackage " + e.Table + "\\n" +} diff --git a/crates/codegraph-bench/fixtures/go/nightly.go b/crates/codegraph-bench/fixtures/go/nightly.go new file mode 100644 index 00000000..8dd61656 --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/nightly.go @@ -0,0 +1,9 @@ +package payroll + +// RunNightly kicks off the ETL job. Note the wording below: the report is +// generated by running the ETL job, which is ONE "by" clause and therefore +// ordinary prose rather than a generation banner. +func RunNightly(jobID string) error { + _ = jobID + return nil +} diff --git a/crates/codegraph-bench/fixtures/go/payroll.go b/crates/codegraph-bench/fixtures/go/payroll.go new file mode 100644 index 00000000..f4f00de3 --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/payroll.go @@ -0,0 +1,12 @@ +// Code generated by fkit-crud. DO NOT EDIT. + +package payroll + +type Payroll struct { + ID string + Amount int64 +} + +func ComputePay(p *Payroll) int64 { + return p.Amount +} diff --git a/crates/codegraph-bench/fixtures/go/payroll_usecase.go b/crates/codegraph-bench/fixtures/go/payroll_usecase.go new file mode 100644 index 00000000..6aac0d1c --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/payroll_usecase.go @@ -0,0 +1,6 @@ +package payroll + +// ComputePay applies the real business rules for a payroll run. +func ComputePay(p *Payroll, bonus int64) int64 { + return p.Amount + bonus +} diff --git a/crates/codegraph-bench/fixtures/go/worker_types.go b/crates/codegraph-bench/fixtures/go/worker_types.go new file mode 100644 index 00000000..58a3a991 --- /dev/null +++ b/crates/codegraph-bench/fixtures/go/worker_types.go @@ -0,0 +1,12 @@ +// Generated by Wrangler by running `wrangler types` (hash: 6f3a1c9d2b) + +package worker + +type Env struct { + AccountID string + Bucket string +} + +func NewEnv(account string, bucket string) *Env { + return &Env{AccountID: account, Bucket: bucket} +} diff --git a/crates/codegraph-bench/src/oracle/canonicalize.rs b/crates/codegraph-bench/src/oracle/canonicalize.rs index 67b5aab9..d1df91f3 100644 --- a/crates/codegraph-bench/src/oracle/canonicalize.rs +++ b/crates/codegraph-bench/src/oracle/canonicalize.rs @@ -146,8 +146,9 @@ fn canonical_refs(conn: &Connection) -> Result> { } fn canonical_files(conn: &Connection) -> Result> { - let mut stmt = - conn.prepare("SELECT path, content_hash, language, size, node_count, errors FROM files")?; + let mut stmt = conn.prepare( + "SELECT path, content_hash, language, size, node_count, errors, generated FROM files", + )?; let rows = stmt.query_map([], |row| { Ok(RawFile { path: row.get(0)?, @@ -156,6 +157,7 @@ fn canonical_files(conn: &Connection) -> Result> { size: row.get(3)?, node_count: row.get(4)?, errors: row.get(5)?, + generated: row.get(6)?, }) })?; @@ -387,6 +389,7 @@ struct RawFile { size: i64, node_count: i64, errors: Option, + generated: i64, } impl RawFile { @@ -399,6 +402,7 @@ impl RawFile { row.insert("size".to_string(), json!(self.size)); row.insert("node_count".to_string(), json!(self.node_count)); row.insert("errors".to_string(), json_column(self.errors, "errors")?); + row.insert("generated".to_string(), json!(self.generated)); Ok(row) } } diff --git a/crates/codegraph-bench/tests/equivalence.rs b/crates/codegraph-bench/tests/equivalence.rs index 76296097..1ab71041 100644 --- a/crates/codegraph-bench/tests/equivalence.rs +++ b/crates/codegraph-bench/tests/equivalence.rs @@ -128,6 +128,26 @@ fn rust_db_is_self_equivalent_to_rust_golden() { assert_equivalent(&rust_db(), &rust_golden_dir()).unwrap(); } +#[test] +fn generated_golden_matches_committed_go_fixture() { + // Guards #1500 content-header detection: `files.generated` is byte-pinned at + // BOTH values — 1 for the Go banner, the Wrangler double-`by` banner, and the + // path-only `.pb.go`; 0 for the hand-written sibling, the single-`by` prose + // negative, and the generator whose banner is a `const` in its body. + let tempdir = TestDir::new("generated-golden-go"); + write_golden(&go_db(), tempdir.path()).unwrap(); + + let expected = load_golden(&go_golden_dir()).unwrap(); + let actual = load_golden(tempdir.path()).unwrap(); + + diff_canonical(&expected, &actual, None).unwrap(); +} + +#[test] +fn go_db_is_self_equivalent_to_go_golden() { + assert_equivalent(&go_db(), &go_golden_dir()).unwrap(); +} + #[test] fn generated_golden_matches_committed_python_fixture() { let tempdir = TestDir::new("generated-golden-python"); @@ -438,6 +458,14 @@ fn rust_golden_dir() -> PathBuf { workspace_root().join("reference/golden/rust") } +fn go_db() -> PathBuf { + workspace_root().join("reference/golden/go/colby.db") +} + +fn go_golden_dir() -> PathBuf { + workspace_root().join("reference/golden/go") +} + fn python_db() -> PathBuf { workspace_root().join("reference/golden/python/colby.db") } diff --git a/crates/codegraph-cli/src/main.rs b/crates/codegraph-cli/src/main.rs index 09e1d085..8eb3e40d 100644 --- a/crates/codegraph-cli/src/main.rs +++ b/crates/codegraph-cli/src/main.rs @@ -17,6 +17,7 @@ use anyhow::{Context, Result, anyhow, bail}; use clap::{CommandFactory, Parser, Subcommand, ValueEnum}; use clap_complete::{Shell, generate}; use codegraph_core::config::Config; +use codegraph_core::generated_header::detect_generated_file; use codegraph_core::logger::{LoggerConfig, init_logger}; use codegraph_core::node_id::hash_content; use codegraph_core::types::{ExtractionResult, FileRecord, Language, Node, NodeKind}; @@ -4866,6 +4867,7 @@ fn index_project_inner( .filter(|n| n.file_path == *relative) .count() as i64, errors: result.errors.clone(), + generated: detect_generated_file(relative, &source), }; tx.send((i, relative.clone(), file, result)) .map_err(|_| anyhow!("parse result channel disconnected"))?; @@ -6957,6 +6959,7 @@ mod formatter_and_env_tests { indexed_at: 0, node_count, errors: Vec::new(), + generated: false, } } diff --git a/crates/codegraph-cli/tests/parallel_index.rs b/crates/codegraph-cli/tests/parallel_index.rs index 47703ae9..6b63f0a7 100644 --- a/crates/codegraph-cli/tests/parallel_index.rs +++ b/crates/codegraph-cli/tests/parallel_index.rs @@ -52,6 +52,10 @@ fn mini_fixture() -> PathBuf { workspace_root().join("crates/codegraph-bench/fixtures/mini") } +fn go_fixture() -> PathBuf { + workspace_root().join("crates/codegraph-bench/fixtures/go") +} + fn copy_tree(src: &Path, dst: &Path) { fs::create_dir_all(dst).unwrap(); for entry in fs::read_dir(src).unwrap() { @@ -258,6 +262,46 @@ fn oversized_file_size_skips_with_exact_file_record() { ); } +/// WRITE PATH 1 (`index --force`, the rayon producer closure): the persisted +/// `files.generated` must carry the real per-file verdict, not a hardcoded false. +/// This is the CLI counterpart to the two `codegraph-watch` tests that cover the +/// incremental-sync and Outdated-rebuild write paths — three independent sites +/// build their own `FileRecord`, so each needs its own end-to-end assertion. +#[test] +fn index_force_writes_the_generated_flag_per_file() { + let dir = TestDir::new("generated-flag"); + let project = dir.path().join("go"); + copy_tree(&go_fixture(), &project); + + init_and_force_index(&project); + + let store = Store::open(&db_path(&project)).unwrap(); + let mut rows: Vec<(String, i64)> = store + .connection() + .prepare("SELECT path, generated FROM files ORDER BY path") + .unwrap() + .query_map([], |row| { + Ok((row.get::<_, String>(0)?, row.get::<_, i64>(1)?)) + }) + .unwrap() + .map(Result::unwrap) + .collect(); + rows.sort(); + + assert_eq!( + rows, + vec![ + ("api.pb.go".to_string(), 1), + ("generator.go".to_string(), 0), + ("nightly.go".to_string(), 0), + ("payroll.go".to_string(), 1), + ("payroll_usecase.go".to_string(), 0), + ("worker_types.go".to_string(), 1), + ], + "index --force must persist the real generated verdict for every file" + ); +} + /// SYNC PRAGMA GUARD (end-to-end): the bulk-index path runs under /// `synchronous=OFF` (T5) but must restore NORMAL before returning. After a real /// `index --force` via the CLI, a FRESH `Store::open` on the produced DB must diff --git a/crates/codegraph-core/src/generated_header.rs b/crates/codegraph-core/src/generated_header.rs new file mode 100644 index 00000000..d67ca23f --- /dev/null +++ b/crates/codegraph-core/src/generated_header.rs @@ -0,0 +1,670 @@ +//! Content-header detection for machine-generated files (upstream #1500). +//! +//! [`crate::file_class::is_generated_file`] answers the same question from the +//! PATH alone, and for most ecosystems that is enough: codegen output follows a +//! `..` convention (`.pb.go`, `_pb2.py`, `.g.dart`) that a +//! suffix check catches for free. Go is the exception that motivates this +//! module. Its convention is a CONTENT marker rather than a filename one, so a +//! machine-written `payroll.go` sitting beside hand-written use-cases is +//! invisible to a path check — and renaming it is not an option, because +//! `payroll.go` is a legal, ordinary Go filename. +//! +//! The two signals stay deliberately separate: +//! +//! 1. the path check is pure, allocation-free, and safe to call inside a sort +//! comparator; +//! 2. this module reads the head of a file's text, so it is evaluated ONCE per +//! file at index time (the content is already in memory for parsing) and the +//! verdict is persisted to `files.generated`. Readers take it from the +//! database instead of re-reading headers per request, which is what keeps +//! ranking a function of the index rather than of the filesystem's current +//! state. +//! +//! The two are combined by [`detect_generated_file`], which is what the indexer +//! writes. Consumers UNION the stored flag with the path check rather than +//! trusting the column alone: a database written before this module existed has +//! `0` on every row, and reading it alone would silently drop the path demotion +//! those indexes already had. +//! +//! Both remain RELEVANCE HINTS, never filters, exactly as `file_class` says: a +//! machine-written file stays fully present in the graph and reachable in +//! results, and only ranks after a real implementation of the same name. +//! +//! # Three fences, all load-bearing +//! +//! Precision is the whole game here — a false positive silently demotes +//! hand-written code in every ranking path — so the marker must clear all +//! three: +//! +//! 1. **A bounded window.** [`HEADER_SCAN_CHARS`] AND [`HEADER_SCAN_LINES`], +//! both, not either. Generous enough for a build-tag block plus an +//! Apache-2.0 preamble above the marker, tight enough that the same text +//! quoted in the BODY of a generator's own source does not qualify. +//! 2. **A cheap stem pre-filter.** Every marker contains the stem `generat`, so +//! one unanchored case-insensitive scan rejects nearly every hand-written +//! file before any line splitting. This exists for SPEED, not precision. +//! 3. **A comment line.** The marker must sit on a line with a comment leader, +//! or inside an open block comment. Generators always emit theirs as a +//! comment, and requiring it is what rules out string literals and +//! identifiers that merely contain the words. +//! +//! # NOTE for future editors +//! +//! The marker literals in this file sit BELOW the line window this detector +//! scans, so the module does not classify its own source. A test pins that: if +//! you move the pattern table above [`HEADER_SCAN_LINES`], the test fails +//! rather than the repo silently demoting this file. The same hazard is live in +//! `file_class.rs`, whose own doc comment quotes the Go marker inside the +//! character window and is spared by the line bound alone; a second test pins +//! that too. + +use crate::file_class::is_generated_file; + +/// How much of a file's head counts as "the header", in bytes of the scanned +/// prefix. Paired with [`HEADER_SCAN_LINES`] — a marker must clear BOTH. +const HEADER_SCAN_CHARS: usize = 8192; + +/// How many lines of the window are examined. This bound is what spares this +/// module's own pattern table, so it is load-bearing rather than decorative. +const HEADER_SCAN_LINES: usize = 60; + +/// Line-comment leaders across the languages indexed here, matched after +/// leading whitespace and case-insensitively. `--` covers SQL/Haskell/Lua, `%` +/// LaTeX/Erlang/Prolog, `;` Lisp/asm/ini, `'` VB, `!` Fortran, and a bare `*` a +/// continuation line inside a `/* … */` block. +const COMMENT_LEADERS: &[&str] = &[ + "//", "/*", "*", "#", "--", ""), + ("\"\"\"", "\"\"\""), + ("'''", "'''"), + ("=begin", "=end"), + ("<#", "#>"), +]; + +/// Whether the head of `content` carries a recognized machine-generation +/// banner. +/// +/// Bounded to [`HEADER_SCAN_CHARS`] and [`HEADER_SCAN_LINES`], and the marker +/// must sit on a comment line, so a generator's own source — which holds the +/// same text as a string constant in its body — is not flagged. +pub fn has_generated_header(content: &str) -> bool { + if content.is_empty() { + return false; + } + + let head = header_window(content); + // Fast reject for nearly every hand-written file: every marker contains the + // stem, so this runs before any line splitting. Speed, not precision. + if !contains_ignore_ascii_case(head, "generat") { + return false; + } + + let mut open_block: Option<(&str, &str)> = None; + for line in head.lines().take(HEADER_SCAN_LINES) { + let lower = line.to_ascii_lowercase(); + + let on_comment_line = open_block.is_some() || starts_with_comment_leader(&lower); + if on_comment_line && matches_generated_banner(&lower) { + return true; + } + + // Advance the block state AFTER testing, so the opening line of a + // `/* Code generated … */` block is itself matched by the leader rule. + if let Some((_, close)) = open_block { + if lower.contains(close) { + open_block = None; + } + continue; + } + for &(open, close) in BLOCK_DELIMS { + let Some(at) = lower.find(open) else { continue }; + // A same-line close (`/* … */`, a one-line docstring) leaves no open + // block, so a later bare code line is not read as commented out. + if !lower[at + open.len()..].contains(close) { + open_block = Some((open, close)); + } + break; + } + } + + false +} + +/// The leading [`HEADER_SCAN_CHARS`] bytes, truncated at a char boundary. +/// +/// Slicing on the raw byte index would panic mid-codepoint, which a multibyte +/// file reaches routinely; `floor_char_boundary` is still unstable, so the +/// boundary is walked down by hand. +fn header_window(content: &str) -> &str { + if content.len() <= HEADER_SCAN_CHARS { + return content; + } + let mut end = HEADER_SCAN_CHARS; + while end > 0 && !content.is_char_boundary(end) { + end -= 1; + } + &content[..end] +} + +/// Whether `haystack` holds `needle` (already lowercase) anywhere, comparing +/// ASCII-case-insensitively without allocating. +fn contains_ignore_ascii_case(haystack: &str, needle: &str) -> bool { + let (h, n) = (haystack.as_bytes(), needle.as_bytes()); + if n.is_empty() || h.len() < n.len() { + return n.is_empty(); + } + h.windows(n.len()) + .any(|w| w.iter().zip(n).all(|(a, b)| a.to_ascii_lowercase() == *b)) +} + +/// Whether `lower` — a lowercased line — opens with a comment leader. +fn starts_with_comment_leader(lower: &str) -> bool { + let trimmed = lower.trim_start(); + COMMENT_LEADERS + .iter() + .any(|leader| trimmed.starts_with(leader)) +} + +/// Whether a lowercased comment line matches one of the eight banner shapes. +/// +/// The workspace deliberately carries no regex dependency (the sibling path +/// check is hand-written too), so each upstream pattern is expressed with +/// `find` plus a bounded-gap helper. Every gap bound is upstream's. +fn matches_generated_banner(lower: &str) -> bool { + // 1. Go's codified convention, honored by gofmt/linguist and emitted by + // protoc-gen-go, mockgen, sqlc, ent, wire, stringer. + if phrase_then(lower, "code generated", &["do not edit"], 200) { + return true; + } + + // 2. protoc's Java/C#/Python banner, ANTLR, Dagger, FlatBuffers, + // rust-bindgen, Xcode asset catalogs, Bazel. + for lead in ["generated by", "generated from", "generated with"] { + if phrase_then( + lower, + lead, + &["do not edit", "do not modify", "do not change"], + 200, + ) { + return true; + } + } + + // 3. The `@generated` tag, guarded so `foo@generated` and `@@generated` do + // not qualify: the preceding byte must not be alphanumeric, `_`, or `@`. + if let Some(rest) = find_standalone_at_generated(lower) { + return rest; + } + + // 4. .NET's `` / `` doc tag. + for open in ["') || tail.starts_with("/>") { + return true; + } + } + } + + // 5. swagger-codegen / OpenAPI Generator, Thrift, FlatBuffers. The trailing + // `by` is REQUIRED — bare "automatically generated" is ordinary prose. + for form in [ + "automatically generated by", + "auto-generated by", + "auto generated by", + "autogenerated by", + ] { + if lower.contains(form) { + return true; + } + } + + // 6. CG-25 — the "run this to regenerate" shape (Cloudflare Wrangler). + // TWO separate `by` clauses is the discriminator: the banner must name a + // tool AND then say `by running`, so "generated by running the nightly + // job" (one clause) is correctly rejected. + if let Some(at) = lower.find("generated by") { + let rest = &lower[at + "generated by".len()..]; + let named_tool = rest.trim_start(); + if named_tool.len() < rest.len() + && !named_tool.is_empty() + && within(named_tool, "by running", 80) + { + return true; + } + } + + // 7. Self-declaring in-house banners that name no tool. + for subject in ["this file ", "this class ", "this code ", "this module "] { + if let Some(at) = lower.find(subject) { + let rest = &lower[at + subject.len()..]; + for verb in ["is ", "was "] { + if let Some(tail) = rest.strip_prefix(verb) { + for form in [ + "generated", + "auto-generated", + "auto generated", + "autogenerated", + ] { + if tail.starts_with(form) { + return true; + } + } + } + } + } + } + + // 8. The reverse ordering: "DO NOT EDIT — this is a generated file". + for lead in ["do not edit", "do not modify"] { + if phrase_then( + lower, + lead, + &[ + "auto-generated", + "auto generated", + "autogenerated", + "generated file", + "generated code", + ], + 120, + ) { + return true; + } + } + + false +} + +/// Whether `lead` occurs and any of `tails` follows it within `gap` bytes. +fn phrase_then(lower: &str, lead: &str, tails: &[&str], gap: usize) -> bool { + let mut from = 0; + while let Some(rel) = lower[from..].find(lead) { + let after = from + rel + lead.len(); + if tails.iter().any(|t| within(&lower[after..], t, gap)) { + return true; + } + from = after; + } + false +} + +/// Whether `needle` starts within the first `gap` bytes of `rest`. +fn within(rest: &str, needle: &str, gap: usize) -> bool { + let mut end = rest.len().min(gap + needle.len()); + while end > 0 && !rest.is_char_boundary(end) { + end -= 1; + } + rest[..end] + .find(needle) + .is_some_and(|at| at <= gap.min(rest.len())) +} + +/// Whether the line carries a STANDALONE `@generated` tag. +/// +/// Returns `Some(true)` on a match. The byte before the `@` must not be a +/// letter, digit, `_`, or another `@`, which is what rejects `foo@generated` +/// (an address-shaped token) and `@@generated`. +fn find_standalone_at_generated(lower: &str) -> Option { + let tag = "@generated"; + let mut from = 0; + while let Some(rel) = lower[from..].find(tag) { + let at = from + rel; + let prev_ok = lower[..at] + .chars() + .next_back() + .is_none_or(|c| !(c.is_alphanumeric() || c == '_' || c == '@')); + let next_ok = lower[at + tag.len()..] + .chars() + .next() + .is_none_or(|c| !(c.is_alphanumeric() || c == '_')); + if prev_ok && next_ok { + return Some(true); + } + from = at + tag.len(); + } + None +} + +/// The union signal — path convention OR content banner — and the value the +/// indexer persists to `files.generated`. +/// +/// The content half only ever ADDS: a file the path check already flags stays +/// flagged whatever its header says, so this can never REMOVE a demotion an +/// existing index applied. +pub fn detect_generated_file(path: &str, content: &str) -> bool { + is_generated_file(path) || has_generated_header(content) +} + +#[cfg(test)] +mod tests { + use super::*; + + // ---- pattern 1: Go's codified convention (the #1500 defect itself) ----- + + #[test] + fn go_banner_in_header_is_detected() { + assert!(has_generated_header( + "// Code generated by fkit-crud. DO NOT EDIT.\n\npackage payroll\n" + )); + } + + // ---- patterns 2-5, 7, 8 ------------------------------------------------ + + #[test] + fn protoc_generated_by_do_not_edit_banner_is_detected() { + assert!(has_generated_header( + "// Generated by the protocol buffer compiler. DO NOT EDIT!\n// source: a.proto\n" + )); + // "from" and "with", and the DO NOT MODIFY / CHANGE spellings. + assert!(has_generated_header( + "# Generated from Foo.g4 - DO NOT EDIT\n" + )); + assert!(has_generated_header( + "/* generated with rust-bindgen; do not modify */\n" + )); + assert!(has_generated_header( + "-- automatically generated by sqlc. do not change.\n" + )); + } + + #[test] + fn standalone_at_generated_tag_is_detected() { + assert!(has_generated_header("// @generated\n")); + assert!(has_generated_header( + "/* @generated SignedSource<<0123456789abcdef>> */\n" + )); + // Start-of-line with no leader is still a comment line via `#`. + assert!(has_generated_header("# @generated by protobuf-es\n")); + } + + #[test] + fn dotnet_auto_generated_doc_tag_is_detected() { + assert!(has_generated_header("// \n")); + assert!(has_generated_header("// \n")); + assert!(has_generated_header( + "//------------------------------------------------------------------------------\n\ + // \n\ + // This code was generated by a tool.\n\ + // \n" + )); + } + + #[test] + fn openapi_and_thrift_autogenerated_by_banner_is_detected() { + assert!(has_generated_header( + "// NOTE: This class is auto generated by OpenAPI Generator.\n" + )); + assert!(has_generated_header( + "// Autogenerated by Thrift Compiler (0.14.1)\n" + )); + assert!(has_generated_header( + "// automatically generated by the FlatBuffers compiler, do not modify\n" + )); + } + + #[test] + fn bare_automatically_generated_prose_is_not_a_banner() { + // Pattern 5 REQUIRES a following "by": without it the phrase is ordinary + // prose, and flagging it would demote hand-written code. + assert!(!has_generated_header( + "// The table below is automatically generated at runtime.\n" + )); + } + + #[test] + fn self_declaring_in_house_banner_is_detected() { + assert!(has_generated_header("// This file is auto-generated.\n")); + assert!(has_generated_header( + "# This module was generated -- edits will be lost\n" + )); + assert!(has_generated_header("// This class is autogenerated\n")); + } + + #[test] + fn reverse_ordered_do_not_edit_banner_is_detected() { + assert!(has_generated_header( + "// DO NOT EDIT -- this is a generated file.\n" + )); + assert!(has_generated_header( + "# do not modify: generated code, regenerate instead\n" + )); + } + + // ---- pattern 6 / CG-25: the Wrangler double-`by` discriminator --------- + + #[test] + fn wrangler_double_by_banner_is_detected() { + assert!(has_generated_header( + "// Generated by Wrangler by running `wrangler types` (hash: abc123)\n" + )); + } + + #[test] + fn single_by_prose_is_not_a_banner() { + // ONE "by" clause. Bare "generated by" is deliberately not enough, or + // every changelog line describing a nightly job would be a banner. + assert!(!has_generated_header( + "// the report is generated by running the nightly job\n" + )); + assert!(!has_generated_header( + "// This chart is generated by the dashboard service.\n" + )); + } + + // ---- the three fences ------------------------------------------------- + + #[test] + fn banner_below_the_line_bound_is_not_detected() { + // 60 filler lines, so the banner lands on line 61 — one past the bound. + let mut content = String::new(); + for _ in 0..HEADER_SCAN_LINES { + content.push_str("// padding\n"); + } + content.push_str("// Code generated by protoc-gen-go. DO NOT EDIT.\n"); + assert!(!has_generated_header(&content)); + + // Moving it one line UP makes it the 60th line and it IS found, so the + // test pins the boundary rather than merely "deep banners are missed". + let mut inside = String::new(); + for _ in 0..(HEADER_SCAN_LINES - 1) { + inside.push_str("// padding\n"); + } + inside.push_str("// Code generated by protoc-gen-go. DO NOT EDIT.\n"); + assert!(has_generated_header(&inside)); + } + + #[test] + fn banner_beyond_the_char_window_is_not_detected() { + // ONE long comment line pushes the second line past the byte window, so + // this isolates the CHAR fence: the line count is 2, far under the line + // bound, so only the window can reject it. + let mut content = String::from("// "); + content.push_str(&"a".repeat(HEADER_SCAN_CHARS + 8)); + content.push('\n'); + content.push_str("// Code generated by protoc-gen-go. DO NOT EDIT.\n"); + assert!(content.lines().count() < HEADER_SCAN_LINES); + assert!(!has_generated_header(&content)); + } + + #[test] + fn banner_off_a_comment_line_is_not_detected() { + // A generator's OWN source holds the banner as a string constant in its + // body. Flagging that would demote the generator itself. + assert!(!has_generated_header( + "package gen\n\nconst Banner = \"Code generated by fkit-crud. DO NOT EDIT.\"\n" + )); + assert!(!has_generated_header( + "banner = 'Code generated by tool. DO NOT EDIT.'\n" + )); + } + + #[test] + fn banner_inside_an_open_block_comment_is_detected() { + // Line 2 carries NO comment leader of its own — only the open `/*` + // state makes it count. + assert!(has_generated_header( + "/*\nCode generated by protoc-gen-go. DO NOT EDIT.\n*/\npackage p\n" + )); + assert!(has_generated_header( + "\n" + )); + assert!(has_generated_header( + "\"\"\"\nGenerated by protoc. DO NOT EDIT.\n\"\"\"\n" + )); + } + + #[test] + fn a_closed_block_comment_does_not_leak_its_state() { + // A same-line close leaves NO open block, so a later bare code line + // holding the words must not be read as still-inside a comment. + assert!(!has_generated_header( + "/* header */\nbanner := \"Code generated by tool. DO NOT EDIT.\"\n" + )); + } + + #[test] + fn at_generated_requires_a_standalone_tag() { + // Guarded against an e-mail-ish `foo@generated` and a doubled `@@`. + assert!(!has_generated_header("// foo@generated\n")); + assert!(!has_generated_header("// @@generated\n")); + // The standalone form still matches, so the guard is not over-broad. + assert!(has_generated_header("// @generated\n")); + } + + #[test] + fn multibyte_content_does_not_panic_at_the_window_boundary() { + // A file whose 8192nd BYTE lands INSIDE a 3-byte codepoint, so a naive + // `&content[..HEADER_SCAN_CHARS]` panics instead of returning a verdict. + // The `is_char_boundary` assertions pin that precondition, so the test + // cannot silently degrade into scanning ordinary ASCII. + let filler = "€".repeat(4000); + assert!(!filler.is_char_boundary(HEADER_SCAN_CHARS)); + assert!(!has_generated_header(&filler)); + + // Same hazard WITH a real banner on line 1: the verdict must still be + // reachable, so the fix cannot be "give up on multibyte input". + let banner = format!("// Code generated by protoc-gen-go. DO NOT EDIT.\n{filler}"); + assert!(!banner.is_char_boundary(HEADER_SCAN_CHARS)); + assert!(has_generated_header(&banner)); + } + + #[test] + fn empty_and_stemless_content_is_rejected_cheaply() { + assert!(!has_generated_header("")); + assert!(!has_generated_header("package main\n\nfunc main() {}\n")); + } + + // ---- self-classification guards (D4) ---------------------------------- + + #[test] + fn this_module_does_not_classify_itself() { + // This file quotes all eight banner shapes. They sit below the line + // bound, so the detector must not flag its own source. Moving the + // pattern table above HEADER_SCAN_LINES fails HERE rather than silently + // demoting this module in every ranking path. + let own_source = include_str!("generated_header.rs"); + assert!( + !has_generated_header(own_source), + "generated_header.rs classified ITSELF as generated: the pattern \ + table has moved inside the first {HEADER_SCAN_LINES} lines" + ); + // The guard is the LINE bound, so prove the banner text really is + // present and inside the char window — otherwise this test could pass + // for the trivial reason that nothing matches anywhere. + let window = header_window(own_source); + assert!(contains_ignore_ascii_case(window, "generat")); + + // MEASURED, and thinner than it looks: the first banner LITERAL sits at + // byte ~8089 of this file, i.e. ~100 bytes inside the 8192 window, so + // widening HEADER_SCAN_LINES alone does NOT trip the assertion above — + // the char window clips the literals instead. Both fences must stay. + // Pin the line distance so growth above the table fails here rather + // than quietly consuming the cushion. + let first_literal = own_source + .find("\"code generated\"") + .expect("the pattern table must still hold the Go marker literal"); + let literal_line = own_source[..first_literal].lines().count(); + assert!( + literal_line > HEADER_SCAN_LINES, + "the first banner literal moved to line {literal_line}, inside the \ + {HEADER_SCAN_LINES}-line bound" + ); + } + + #[test] + fn file_class_rs_is_not_classified_by_its_own_doc_comment() { + // file_class.rs's doc comment quotes Go's marker on a `///` line, INSIDE + // the char window (measured: byte offset ~5519, line ~136). Only the + // line bound spares it, which is what makes that bound load-bearing. + let sibling = include_str!("file_class.rs"); + assert!( + !has_generated_header(sibling), + "file_class.rs classified as generated by its own doc comment" + ); + let window = header_window(sibling); + assert!(contains_ignore_ascii_case(window, "generat")); + } + + #[test] + fn no_first_party_source_in_this_crate_is_classified() { + // A Rust `///` doc comment IS a comment line, so any of this crate's + // files could trip the detector the same way. Sweep the whole crate + // rather than pinning the two files already known to be at risk. + for (name, source) in [ + ("lib.rs", include_str!("lib.rs")), + ("types.rs", include_str!("types.rs")), + ("traits.rs", include_str!("traits.rs")), + ("node_id.rs", include_str!("node_id.rs")), + ("config.rs", include_str!("config.rs")), + ("errors.rs", include_str!("errors.rs")), + ("index_paths.rs", include_str!("index_paths.rs")), + ("logger.rs", include_str!("logger.rs")), + ] { + assert!( + !has_generated_header(source), + "{name} was classified as generated" + ); + } + } + + // ---- the union written to files.generated ----------------------------- + + #[test] + fn detect_generated_file_unions_path_and_content() { + // Path signal alone: a `.pb.go` with NO banner is still generated. + assert!(detect_generated_file("api.pb.go", "package api\n")); + // Content signal alone: an ordinary Go filename WITH a banner. + assert!(detect_generated_file( + "payroll.go", + "// Code generated by fkit-crud. DO NOT EDIT.\npackage payroll\n" + )); + // Both. + assert!(detect_generated_file( + "api.pb.go", + "// Code generated by protoc-gen-go. DO NOT EDIT.\n" + )); + // Neither — a hand-written file must never be flagged. + assert!(!detect_generated_file( + "payroll_usecase.go", + "package payroll\n\nfunc ComputePay() {}\n" + )); + } + + #[test] + fn the_content_half_never_removes_the_path_signal() { + // D1's direction: content can only ADD. A path-flagged file stays + // flagged even when its content is plainly hand-written, so the union + // cannot re-rank an existing index in the wrong direction. + let handwritten = "package api\n\nfunc Real() {}\n"; + assert!(!has_generated_header(handwritten)); + assert!(detect_generated_file("api.pb.go", handwritten)); + } +} diff --git a/crates/codegraph-core/src/lib.rs b/crates/codegraph-core/src/lib.rs index e52b442a..e90c6fda 100644 --- a/crates/codegraph-core/src/lib.rs +++ b/crates/codegraph-core/src/lib.rs @@ -3,6 +3,7 @@ pub mod config; pub mod errors; pub mod file_class; +pub mod generated_header; pub mod index_paths; pub mod logger; pub mod node_id; diff --git a/crates/codegraph-core/src/types.rs b/crates/codegraph-core/src/types.rs index 7d5f6056..5ce22bb1 100644 --- a/crates/codegraph-core/src/types.rs +++ b/crates/codegraph-core/src/types.rs @@ -526,6 +526,11 @@ pub struct FileRecord { pub indexed_at: i64, pub node_count: i64, pub errors: Vec, + /// Whether this file looks machine-generated, from + /// [`crate::generated_header::detect_generated_file`] — the union of the + /// path convention and a content banner. A relevance hint for ranking, never + /// a filter. + pub generated: bool, } /// Structural label for HOW a reference was extracted, orthogonal to the typed @@ -700,6 +705,7 @@ mod tests { indexed_at: 1_700_000_001_000, node_count: 3, errors: vec!["warning".to_string()], + generated: false, }; let file_value = serde_json::to_value(file).expect("file record serializes"); assert_eq!(file_value["contentHash"], json!("sha256")); diff --git a/crates/codegraph-graph/tests/godot_resource_audit.rs b/crates/codegraph-graph/tests/godot_resource_audit.rs index e443f4bb..2fd55fbc 100644 --- a/crates/codegraph-graph/tests/godot_resource_audit.rs +++ b/crates/codegraph-graph/tests/godot_resource_audit.rs @@ -63,6 +63,7 @@ fn run_pipeline(test_name: &str, root: &Path, relative_files: &[&str]) -> Store indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-graph/tests/traversal.rs b/crates/codegraph-graph/tests/traversal.rs index 93506a6c..5532918b 100644 --- a/crates/codegraph-graph/tests/traversal.rs +++ b/crates/codegraph-graph/tests/traversal.rs @@ -498,6 +498,7 @@ fn file_record(path: &str) -> codegraph_core::types::FileRecord { indexed_at: 1, node_count: 1, errors: Vec::new(), + generated: false, } } diff --git a/crates/codegraph-mcp/src/engine.rs b/crates/codegraph-mcp/src/engine.rs index 688463fa..9863312a 100644 --- a/crates/codegraph-mcp/src/engine.rs +++ b/crates/codegraph-mcp/src/engine.rs @@ -1578,6 +1578,28 @@ impl CodeGraphEngine { // === Symbol resolution ============================================== + /// Sort `nodes` so machine-generated files rank LAST, by the D1 union of the + /// path convention and the stored `files.generated` flag. + /// + /// The union is what makes this safe on an index written before #1500: those + /// rows all read 0, so reading the column ALONE would drop the path demotion + /// they already had. One batch query over the sorted+deduped candidate paths, + /// so no `HashSet` iteration order reaches output. + fn sort_generated_last(&self, nodes: &mut [Node]) -> anyhow::Result<()> { + let mut paths = nodes + .iter() + .map(|n| n.file_path.clone()) + .collect::>(); + paths.sort_unstable(); + paths.dedup(); + let stored = self.store.generated_paths_among(&paths)?; + // ASCENDING on "is generated", so `false` (0) comes first. + nodes.sort_by_key(|n| { + u8::from(is_generated_file(&n.file_path) || stored.contains(&n.file_path)) + }); + Ok(()) + } + /// `findSymbolMatches` (`tools.ts:3220-3265`): exact-name enumeration for a /// bare name, falling back to the top fuzzy result. fn find_symbol_matches(&self, symbol: &str) -> anyhow::Result> { @@ -1586,7 +1608,7 @@ impl CodeGraphEngine { let exact = self.store.nodes_by_name(symbol)?; if !exact.is_empty() { let mut sorted = exact; - sorted.sort_by_key(|n| is_generated_file(&n.file_path) as u8); + self.sort_generated_last(&mut sorted)?; return Ok(sorted); } let fuzzy = search_nodes( @@ -1617,7 +1639,7 @@ impl CodeGraphEngine { return Ok(Vec::new()); } let mut sorted = exact; - sorted.sort_by_key(|n| is_generated_file(&n.file_path) as u8); + self.sort_generated_last(&mut sorted)?; Ok(sorted) } @@ -1643,7 +1665,7 @@ impl CodeGraphEngine { }); } let mut ranked = exact; - ranked.sort_by_key(|n| is_generated_file(&n.file_path) as u8); + self.sort_generated_last(&mut ranked)?; let locations = ranked .iter() .map(|n| format!("{} at {}:{}", n.kind.as_str(), n.file_path, n.start_line)) @@ -1747,6 +1769,18 @@ impl CodeGraphEngine { self.rescue_change_surface(&mut sub, &seed_ids, query, &traverser)?; + // The stored half of the generated signal, in ONE batch query. Sorted and + // deduped first, so no `HashSet` iteration order can reach output — the + // same discipline `rescue_change_surface` applies to its candidates. + let mut candidate_paths = sub + .nodes + .iter() + .map(|n| n.file_path.clone()) + .collect::>(); + candidate_paths.sort_unstable(); + candidate_paths.dedup(); + sub.generated_files = self.store.generated_paths_among(&candidate_paths)?; + sub.finalize(); Ok(sub) } @@ -2253,6 +2287,12 @@ struct ExploreSubgraph { /// lexically-dissimilar answer file (grpc's `dialoptions.go`) is not buried /// under incidental roots that merely share query words. rescued_files: HashSet, + /// Paths whose `files.generated` row is 1, fetched in ONE batch query before + /// `finalize` runs. `finalize` has no store handle, so the stored half of the + /// generated signal has to arrive as a field — exactly how `rescued_files` + /// reaches it. Empty leaves behavior on the path check alone, which is what + /// keeps a pre-#1500 index ranking as it always did. + generated_files: HashSet, } impl ExploreSubgraph { @@ -2336,7 +2376,8 @@ impl ExploreSubgraph { // when it is the only match. The sort is descending, so real // code must carry the HIGHER value. `find_symbol_matches` and // `find_all_symbols` apply the same signal. - let not_generated = u8::from(!is_generated_file(fp)); + let not_generated = + u8::from(!(is_generated_file(fp) || self.generated_files.contains(fp))); let sym_count = self .nodes .iter() @@ -3313,6 +3354,7 @@ mod tests { indexed_at: 0, node_count, errors: Vec::new(), + generated: false, } } @@ -3358,6 +3400,33 @@ mod tests { put_file(engine, &file); } + /// `put_indexed_source` plus the stored `files.generated` verdict, so a test + /// can model a banner-marked file (flag 1 on an ORDINARY path) and a + /// pre-#1500 index (flag 0 on a path the suffix check still catches). + fn put_indexed_source_generated( + engine: &CodeGraphEngine, + rel: &str, + content: &str, + language: Language, + node_count: i64, + generated: bool, + ) { + write_src(engine, rel, content); + let metadata = std::fs::metadata(engine.project_root.join(rel)).unwrap(); + let modified_at = metadata + .modified() + .unwrap() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() as i64; + let mut file = file_rec(rel, language, node_count); + file.content_hash = codegraph_core::node_id::hash_content(content); + file.size = metadata.len() as i64; + file.modified_at = modified_at; + file.generated = generated; + put_file(engine, &file); + } + #[test] fn ext_search_empty_query_errors() { let engine = test_engine(); @@ -5103,6 +5172,254 @@ mod tests { ); } + /// #1500 — the same ranking property as the `.pb.go` test above, but the + /// generated file carries an ORDINARY Go filename and is known only by its + /// stored `files.generated` flag. The path check cannot see it, so this fails + /// unless `finalize` consults the batch-fetched set. + #[test] + fn explore_ranks_a_real_impl_above_a_banner_marked_generated_file() { + let mut engine = test_engine(); + // Both names are ordinary: `a_banner.go` sorts FIRST alphabetically and + // would win on the tie-break, so a pass cannot come from name ordering. + let generated = node_lang( + "ComputePay", + "ComputePay", + "payroll/a_banner.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + let real = node_lang( + "ComputePay", + "ComputePay", + "payroll/zz_real.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + put_indexed_source_generated( + &engine, + "payroll/a_banner.go", + "// Code generated by fkit-crud. DO NOT EDIT.\nfunc ComputePay() int {\n\treturn 0\n}\n", + Language::Go, + 1, + true, + ); + put_indexed_source_generated( + &engine, + "payroll/zz_real.go", + "func ComputePay() int {\n\treturn 42\n}\n", + Language::Go, + 1, + false, + ); + // Neither path matches the suffix check, so the stored flag is the ONLY + // signal available — that is what makes this test the #1500 regression. + assert!(!is_generated_file("payroll/a_banner.go")); + put_nodes(&mut engine, &[generated.clone(), real.clone()]); + + let text = text_of(&engine.execute( + "codegraph_explore", + &serde_json::json!({"query": "ComputePay"}), + )); + let order: Vec<&str> = text + .lines() + .filter(|l| l.starts_with("#### ")) + .filter_map(|l| { + ["payroll/zz_real.go", "payroll/a_banner.go"] + .into_iter() + .find(|f| l.contains(f)) + }) + .collect(); + assert_eq!( + order, + vec!["payroll/zz_real.go", "payroll/a_banner.go"], + "the real implementation must precede the banner-marked file; got {order:?} in:\n{text}" + ); + } + + /// #1500 — the same signal in `find_symbol_matches`, whose sort is ASCENDING + /// (so `false` sorts first). A flipped polarity would still compile, so this + /// pins the direction as well as the presence of the union. + #[test] + fn find_symbol_matches_demotes_a_banner_marked_definition() { + let mut engine = test_engine(); + let generated = node_lang( + "ComputePay", + "ComputePay", + "payroll/a_banner.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + let real = node_lang( + "ComputePay", + "ComputePay", + "payroll/zz_real.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + put_indexed_source_generated( + &engine, + "payroll/a_banner.go", + "// Code generated by fkit-crud. DO NOT EDIT.\nfunc ComputePay() int {\n\treturn 0\n}\n", + Language::Go, + 1, + true, + ); + put_indexed_source_generated( + &engine, + "payroll/zz_real.go", + "func ComputePay() int {\n\treturn 42\n}\n", + Language::Go, + 1, + false, + ); + put_nodes(&mut engine, &[generated, real]); + + let matches = engine.find_symbol_matches("ComputePay").unwrap(); + let files: Vec<&str> = matches.iter().map(|n| n.file_path.as_str()).collect(); + assert_eq!( + files, + vec!["payroll/zz_real.go", "payroll/a_banner.go"], + "find_symbol_matches must rank the banner-marked definition LAST" + ); + } + + /// D1 GUARD — the stored flag only ever ADDS. A database written before + /// #1500 has `generated = 0` on every row, so a `.pb.go` file must STILL be + /// demoted by the path check alone. Drop the `is_generated_file(...) ||` half + /// and this fails, which is what stops the change from silently re-ranking + /// every existing index in the wrong direction. + #[test] + fn a_pre_change_index_keeps_the_path_demotion_when_generated_is_zero() { + let mut engine = test_engine(); + let generated = node_lang( + "Marshal", + "Marshal", + "payroll/a_stub.pb.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + let real = node_lang( + "Marshal", + "Marshal", + "payroll/zz_real.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + // `generated = 0` on BOTH rows, exactly as a pre-#1500 database reads. + put_indexed_source_generated( + &engine, + "payroll/a_stub.pb.go", + "func Marshal() int {\n\treturn 0\n}\n", + Language::Go, + 1, + false, + ); + put_indexed_source_generated( + &engine, + "payroll/zz_real.go", + "func Marshal() int {\n\treturn 42\n}\n", + Language::Go, + 1, + false, + ); + put_nodes(&mut engine, &[generated, real]); + + // find_symbol_matches (ASCENDING) still demotes it. + let matches = engine.find_symbol_matches("Marshal").unwrap(); + let files: Vec<&str> = matches.iter().map(|n| n.file_path.as_str()).collect(); + assert_eq!( + files, + vec!["payroll/zz_real.go", "payroll/a_stub.pb.go"], + "a stored 0 must not remove the PATH demotion in find_symbol_matches" + ); + + // ... and so does finalize, through the explore surface. + let text = text_of(&engine.execute( + "codegraph_explore", + &serde_json::json!({"query": "Marshal"}), + )); + let order: Vec<&str> = text + .lines() + .filter(|l| l.starts_with("#### ")) + .filter_map(|l| { + ["payroll/zz_real.go", "payroll/a_stub.pb.go"] + .into_iter() + .find(|f| l.contains(f)) + }) + .collect(); + assert_eq!( + order, + vec!["payroll/zz_real.go", "payroll/a_stub.pb.go"], + "a stored 0 must not remove the PATH demotion in finalize; got {order:?} in:\n{text}" + ); + } + + /// Pins the TODO-28 wiring on its own, so a refactor that stops populating + /// the field fails a NAMED test instead of only shifting a ranking. + #[test] + fn explore_generated_files_set_is_populated_before_finalize() { + let mut engine = test_engine(); + let generated = node_lang( + "ComputePay", + "ComputePay", + "payroll/a_banner.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + put_indexed_source_generated( + &engine, + "payroll/a_banner.go", + "// Code generated by fkit-crud. DO NOT EDIT.\nfunc ComputePay() int {\n\treturn 0\n}\n", + Language::Go, + 1, + true, + ); + put_indexed_source_generated( + &engine, + "payroll/zz_real.go", + "func ComputePay() int {\n\treturn 42\n}\n", + Language::Go, + 1, + false, + ); + let real = node_lang( + "ComputePay", + "ComputePay", + "payroll/zz_real.go", + 1, + 3, + NodeKind::Function, + Language::Go, + ); + put_nodes(&mut engine, &[generated, real]); + + let sub = engine.find_relevant_context("ComputePay").unwrap(); + assert!( + sub.generated_files.contains("payroll/a_banner.go"), + "the flagged path must reach the subgraph before finalize; got {:?}", + sub.generated_files + ); + assert!( + !sub.generated_files.contains("payroll/zz_real.go"), + "an unflagged path must NOT appear; got {:?}", + sub.generated_files + ); + } + /// Tier 1 item 2 NEGATIVE — the demotion is a RANKING hint, never a filter: /// a generated file must stay reachable, and when it is the ONLY definition /// site it still renders. diff --git a/crates/codegraph-mcp/tests/godot_honesty_mcp.rs b/crates/codegraph-mcp/tests/godot_honesty_mcp.rs index 4a725e04..8149ad1d 100644 --- a/crates/codegraph-mcp/tests/godot_honesty_mcp.rs +++ b/crates/codegraph-mcp/tests/godot_honesty_mcp.rs @@ -78,6 +78,7 @@ fn pipeline_project(files: &[(&str, &str)]) -> TestProject { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .unwrap(); store.upsert_nodes(&result.nodes).unwrap(); diff --git a/crates/codegraph-mcp/tests/golden_mcp.rs b/crates/codegraph-mcp/tests/golden_mcp.rs index c30534a6..1e7057b0 100644 --- a/crates/codegraph-mcp/tests/golden_mcp.rs +++ b/crates/codegraph-mcp/tests/golden_mcp.rs @@ -774,6 +774,7 @@ fn index_fixture(files: &[(&str, &str)]) -> TestProject { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .unwrap(); } diff --git a/crates/codegraph-mcp/tests/reopen.rs b/crates/codegraph-mcp/tests/reopen.rs index fc80920a..f323d549 100644 --- a/crates/codegraph-mcp/tests/reopen.rs +++ b/crates/codegraph-mcp/tests/reopen.rs @@ -95,6 +95,7 @@ fn index_into(base: &Path, files: &[(&str, &str)]) { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .unwrap(); } diff --git a/crates/codegraph-resolve/src/context.rs b/crates/codegraph-resolve/src/context.rs index 2fc93e07..97d7db49 100644 --- a/crates/codegraph-resolve/src/context.rs +++ b/crates/codegraph-resolve/src/context.rs @@ -504,6 +504,7 @@ mod tests { indexed_at: 0, node_count: count, errors: Vec::new(), + generated: false, } } diff --git a/crates/codegraph-resolve/src/resolver.rs b/crates/codegraph-resolve/src/resolver.rs index f825dd13..7220bac9 100644 --- a/crates/codegraph-resolve/src/resolver.rs +++ b/crates/codegraph-resolve/src/resolver.rs @@ -2767,6 +2767,7 @@ mod tests { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); @@ -3820,6 +3821,7 @@ mod tests { indexed_at: 0, node_count: 0, errors: Vec::new(), + generated: false, } } @@ -3869,6 +3871,7 @@ mod tests { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/src/snapshot_context.rs b/crates/codegraph-resolve/src/snapshot_context.rs index d619b0fa..7e7c7f3a 100644 --- a/crates/codegraph-resolve/src/snapshot_context.rs +++ b/crates/codegraph-resolve/src/snapshot_context.rs @@ -422,6 +422,7 @@ mod tests { indexed_at: 0, node_count: count, errors: Vec::new(), + generated: false, } } diff --git a/crates/codegraph-resolve/tests/godot_class_member.rs b/crates/codegraph-resolve/tests/godot_class_member.rs index a80e0d25..cf974f83 100644 --- a/crates/codegraph-resolve/tests/godot_class_member.rs +++ b/crates/codegraph-resolve/tests/godot_class_member.rs @@ -70,6 +70,7 @@ fn run_pipeline(test_name: &str, root: &Path, relative_files: &[&str]) -> (Store indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/godot_post_extract.rs b/crates/codegraph-resolve/tests/godot_post_extract.rs index 02e3d8aa..e25e44c1 100644 --- a/crates/codegraph-resolve/tests/godot_post_extract.rs +++ b/crates/codegraph-resolve/tests/godot_post_extract.rs @@ -67,6 +67,7 @@ fn run_pipeline(test_name: &str, root: &Path, relative_files: &[&str]) -> (Store indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/golden_resolution.rs b/crates/codegraph-resolve/tests/golden_resolution.rs index 59be0e64..ad4c7493 100644 --- a/crates/codegraph-resolve/tests/golden_resolution.rs +++ b/crates/codegraph-resolve/tests/golden_resolution.rs @@ -137,6 +137,7 @@ fn resolve_fixture(test_name: &str, root: &Path, relative_files: &[&str]) -> Vec indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/snapshot_equivalence.rs b/crates/codegraph-resolve/tests/snapshot_equivalence.rs index 42c962bc..60386311 100644 --- a/crates/codegraph-resolve/tests/snapshot_equivalence.rs +++ b/crates/codegraph-resolve/tests/snapshot_equivalence.rs @@ -66,6 +66,7 @@ fn index_fixture(test_name: &str, root: &Path, relative_files: &[&str]) -> (Stor indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/tauri_ipc.rs b/crates/codegraph-resolve/tests/tauri_ipc.rs index 4a99dd1c..f9895c20 100644 --- a/crates/codegraph-resolve/tests/tauri_ipc.rs +++ b/crates/codegraph-resolve/tests/tauri_ipc.rs @@ -103,6 +103,7 @@ fn index_without_resolve(test_name: &str, root: &Path, relative_files: &[&str]) indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/tier2_false_edges.rs b/crates/codegraph-resolve/tests/tier2_false_edges.rs index 221cc1d7..930584d3 100644 --- a/crates/codegraph-resolve/tests/tier2_false_edges.rs +++ b/crates/codegraph-resolve/tests/tier2_false_edges.rs @@ -145,6 +145,7 @@ fn resolve_fixture(name: &str) -> Resolved { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/tier3_union_edges.rs b/crates/codegraph-resolve/tests/tier3_union_edges.rs index 22b2d848..f0d584b6 100644 --- a/crates/codegraph-resolve/tests/tier3_union_edges.rs +++ b/crates/codegraph-resolve/tests/tier3_union_edges.rs @@ -128,6 +128,7 @@ fn resolve_fixture(name: &str) -> Resolved { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-resolve/tests/tier6_resolution.rs b/crates/codegraph-resolve/tests/tier6_resolution.rs index 08cee4db..0184d68c 100644 --- a/crates/codegraph-resolve/tests/tier6_resolution.rs +++ b/crates/codegraph-resolve/tests/tier6_resolution.rs @@ -150,6 +150,7 @@ fn resolve_fixture(name: &str) -> Resolved { indexed_at: 0, node_count: result.nodes.len() as i64, errors: Vec::new(), + generated: false, }) .expect("upsert file"); store.upsert_nodes(&result.nodes).expect("upsert nodes"); diff --git a/crates/codegraph-store/src/index_state.rs b/crates/codegraph-store/src/index_state.rs index b33aba64..04dd58e9 100644 --- a/crates/codegraph-store/src/index_state.rs +++ b/crates/codegraph-store/src/index_state.rs @@ -115,7 +115,7 @@ pub const CURRENT_STORAGE_PROTOCOL: u64 = 2; /// The extraction-pipeline version this binary produces. This is the single /// source of truth: no other crate may define its own copy. -pub const CURRENT_EXTRACTION_VERSION: u64 = 8; +pub const CURRENT_EXTRACTION_VERSION: u64 = 9; /// The `project_metadata` key under which a built index records the extraction /// version it was produced with. Single source of truth for the key spelling. diff --git a/crates/codegraph-store/src/migrations.rs b/crates/codegraph-store/src/migrations.rs index 38313d88..eba02366 100644 --- a/crates/codegraph-store/src/migrations.rs +++ b/crates/codegraph-store/src/migrations.rs @@ -2,7 +2,7 @@ use rusqlite::{Connection, OptionalExtension, params}; use crate::schema::BASE_SCHEMA; -pub const CURRENT_SCHEMA_VERSION: i64 = 7; +pub const CURRENT_SCHEMA_VERSION: i64 = 8; pub const FRESH_SCHEMA_DESCRIPTION: &str = "Initial schema includes all migrations"; const MIGRATIONS: &[Migration] = &[ @@ -21,6 +21,7 @@ const MIGRATIONS: &[Migration] = &[ CREATE INDEX IF NOT EXISTS idx_unresolved_file_path ON unresolved_refs(file_path); CREATE INDEX IF NOT EXISTS idx_edges_provenance ON edges(provenance); "#, + adds_column: Some(("unresolved_refs", "file_path")), }, Migration { version: 3, @@ -28,6 +29,7 @@ const MIGRATIONS: &[Migration] = &[ sql: r#" CREATE INDEX IF NOT EXISTS idx_nodes_lower_name ON nodes(lower(name)); "#, + adds_column: None, }, Migration { version: 4, @@ -36,6 +38,7 @@ const MIGRATIONS: &[Migration] = &[ DROP INDEX IF EXISTS idx_edges_source; DROP INDEX IF EXISTS idx_edges_target; "#, + adds_column: None, }, Migration { version: 5, @@ -43,6 +46,7 @@ const MIGRATIONS: &[Migration] = &[ sql: r#" ALTER TABLE nodes ADD COLUMN return_type TEXT; "#, + adds_column: Some(("nodes", "return_type")), }, Migration { version: 6, @@ -50,6 +54,7 @@ const MIGRATIONS: &[Migration] = &[ sql: r#" ALTER TABLE unresolved_refs ADD COLUMN reference_subkind TEXT; "#, + adds_column: Some(("unresolved_refs", "reference_subkind")), }, Migration { version: 7, @@ -63,6 +68,22 @@ const MIGRATIONS: &[Migration] = &[ CREATE UNIQUE INDEX IF NOT EXISTS idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); "#, + adds_column: None, + }, + Migration { + version: 8, + description: "Add files.generated — content-header generated-file detection (#1500)", + // DDL ONLY, deliberately no backfill: the flag derives from file CONTENT + // and this table stores `content_hash`, not bytes. Backfilling would mean + // re-reading every file from disk inside a schema step, on paths that may + // no longer exist. Existing rows therefore stay 0 until re-extraction, + // and readers UNION the column with the path check so a pre-#1500 index + // keeps the demotion it already had. + sql: r#" + ALTER TABLE files ADD COLUMN generated INTEGER NOT NULL DEFAULT 0; + CREATE INDEX IF NOT EXISTS idx_files_generated ON files(path) WHERE generated = 1; + "#, + adds_column: Some(("files", "generated")), }, ]; @@ -71,6 +92,15 @@ struct Migration { version: i64, description: &'static str, sql: &'static str, + /// A `(table, column)` this migration ADDS. When the column is already + /// present the `sql` is skipped and only the version row is recorded. + /// + /// Needed because `ALTER TABLE` has no `IF NOT EXISTS` and + /// `run_pending_migrations` can legitimately replay a migration over a + /// database created from a NEWER `BASE_SCHEMA` that already carries the + /// column. Measured: without this, replaying migration 8 over a + /// `BASE_SCHEMA` database fails with `duplicate column name: generated`. + adds_column: Option<(&'static str, &'static str)>, } pub fn ensure_schema_and_migrations(conn: &mut Connection) -> rusqlite::Result<()> { @@ -174,7 +204,13 @@ fn run_pending_migrations(conn: &mut Connection) -> rusqlite::Result<()> { for migration in pending { let tx = conn.transaction()?; - tx.execute_batch(migration.sql)?; + let already_applied = match migration.adds_column { + Some((table, column)) => table_has_column(&tx, table, column)?, + None => false, + }; + if !already_applied { + tx.execute_batch(migration.sql)?; + } record_migration(&tx, migration.version, migration.description)?; tx.commit()?; } @@ -182,6 +218,21 @@ fn run_pending_migrations(conn: &mut Connection) -> rusqlite::Result<()> { Ok(()) } +/// Whether `table` already declares `column`, read from `PRAGMA table_info`. +/// +/// A missing table reports `false`, so a guarded migration still runs its `sql` +/// and fails loudly there rather than being silently skipped. +fn table_has_column(conn: &Connection, table: &str, column: &str) -> rusqlite::Result { + let mut stmt = conn.prepare(&format!("PRAGMA table_info({table})"))?; + let mut rows = stmt.query([])?; + while let Some(row) = rows.next()? { + if row.get::<_, String>(1)? == column { + return Ok(true); + } + } + Ok(false) +} + fn record_migration( conn: &Connection, version: i64, @@ -258,6 +309,7 @@ mod tests { CREATE TABLE unresolved_refs (id INTEGER PRIMARY KEY AUTOINCREMENT, from_node_id TEXT, reference_name TEXT, reference_kind TEXT, line INTEGER, col INTEGER, candidates TEXT); CREATE TABLE edges (id INTEGER PRIMARY KEY AUTOINCREMENT, source TEXT, target TEXT, kind TEXT, metadata TEXT, line INTEGER, col INTEGER); CREATE TABLE nodes (id TEXT PRIMARY KEY, name TEXT); + CREATE TABLE files (path TEXT PRIMARY KEY, content_hash TEXT NOT NULL, language TEXT NOT NULL, size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, errors TEXT); CREATE INDEX idx_edges_source ON edges(source); CREATE INDEX idx_edges_target ON edges(target); INSERT INTO schema_versions (version, applied_at, description) VALUES (1, 0, 'base');", @@ -304,6 +356,101 @@ mod tests { .collect() } + // Builds a v7-shaped `files` table (the 8 pre-#1500 columns) with one row, so + // migration 8's effect on a PRE-EXISTING row is observable. + fn seed_v7_schema_with_one_file(conn: &Connection) { + conn.execute_batch( + "CREATE TABLE schema_versions (version INTEGER PRIMARY KEY, applied_at INTEGER NOT NULL, description TEXT); + CREATE TABLE files (path TEXT PRIMARY KEY, content_hash TEXT NOT NULL, language TEXT NOT NULL, size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, errors TEXT); + INSERT INTO schema_versions (version, applied_at, description) VALUES (7, 0, 'v7'); + INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors) + VALUES ('payroll.go', 'cafebabe', 'go', 172, 0, 0, 3, NULL);", + ) + .unwrap(); + } + + #[test] + fn migration_v8_adds_generated_column_defaulting_to_zero() { + let mut conn = Connection::open_in_memory().unwrap(); + seed_v7_schema_with_one_file(&conn); + assert_eq!(get_current_version(&conn).unwrap(), 7); + assert!(!has_column(&conn, "files", "generated")); + + run_pending_migrations(&mut conn).unwrap(); + + assert_eq!(get_current_version(&conn).unwrap(), CURRENT_SCHEMA_VERSION); + assert!(has_column(&conn, "files", "generated")); + assert!(has_index(&conn, "idx_files_generated")); + + // DDL only: the pre-existing row reads 0 rather than being backfilled, + // because the verdict derives from CONTENT this migration cannot see. + // Readers UNION the column with the path check, which is what keeps a + // pre-#1500 index ranking the way it already did. + let generated: i64 = conn + .query_row( + "SELECT generated FROM files WHERE path = 'payroll.go'", + [], + |row| row.get(0), + ) + .unwrap(); + assert_eq!(generated, 0); + + // NOT NULL, so a row inserted without the column still reads 0. + conn.execute_batch( + "INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at) + VALUES ('other.go', 'f00d', 'go', 1, 0, 0);", + ) + .unwrap(); + let nulls: i64 = conn + .query_row( + "SELECT COUNT(*) FROM files WHERE generated IS NULL", + [], + |r| r.get(0), + ) + .unwrap(); + assert_eq!(nulls, 0); + } + + #[test] + fn migration_v8_is_idempotent_when_the_column_already_exists() { + // Settles S4's guard question by MEASUREMENT: `ALTER TABLE` has no + // `IF NOT EXISTS`, so replaying migration 8 over a database whose + // BASE_SCHEMA already carries `generated` would raise + // `duplicate column name: generated` — and if it does, the migration + // needs a `PRAGMA table_info` guard rather than a plain `&'static str`. + let mut conn = Connection::open_in_memory().unwrap(); + ensure_schema_and_migrations(&mut conn).unwrap(); + assert!(has_column(&conn, "files", "generated")); + + // Rewind the recorded version to exactly 7 so ONLY migration 8 is + // pending, over a table that already has the column — the replay the + // guard must survive. `initialize_fresh_schema` records just two rows, + // 1 and CURRENT_SCHEMA_VERSION, so a row 7 has to be inserted rather + // than uncovered by deleting 8: dropping 8 alone would leave MAX = 1 and + // make migrations 2..8 pending, which tests a different thing. + conn.execute("DELETE FROM schema_versions WHERE version = 8", []) + .unwrap(); + conn.execute( + "INSERT INTO schema_versions (version, applied_at, description) VALUES (7, 0, 'v7')", + [], + ) + .unwrap(); + assert_eq!(get_current_version(&conn).unwrap(), 7); + + let replayed = run_pending_migrations(&mut conn); + + // Whichever way this lands, the column and index must still be intact + // and the version restored, so the assertion is meaningful either way. + assert!( + replayed.is_ok(), + "replaying migration 8 over a BASE_SCHEMA database must not fail: {:?}", + replayed.err() + ); + assert_eq!(get_current_version(&conn).unwrap(), CURRENT_SCHEMA_VERSION); + assert!(has_column(&conn, "files", "generated")); + assert!(has_index(&conn, "idx_files_generated")); + } + #[test] fn fresh_schema_dedups_duplicate_edge_identities() { let mut conn = Connection::open_in_memory().unwrap(); @@ -361,7 +508,7 @@ mod tests { run_pending_migrations(&mut conn).unwrap(); - assert_eq!(get_current_version(&conn).unwrap(), 7); + assert_eq!(get_current_version(&conn).unwrap(), CURRENT_SCHEMA_VERSION); assert!(has_index(&conn, "idx_edges_identity")); assert_eq!( @@ -391,6 +538,7 @@ mod tests { "CREATE TABLE schema_versions (version INTEGER PRIMARY KEY, applied_at INTEGER NOT NULL, description TEXT); CREATE TABLE nodes (id TEXT PRIMARY KEY, name TEXT); CREATE TABLE edges (id INTEGER PRIMARY KEY AUTOINCREMENT, source TEXT NOT NULL, target TEXT NOT NULL, kind TEXT NOT NULL, metadata TEXT, line INTEGER, col INTEGER, provenance TEXT DEFAULT NULL); + CREATE TABLE files (path TEXT PRIMARY KEY, content_hash TEXT NOT NULL, language TEXT NOT NULL, size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, errors TEXT); INSERT INTO schema_versions (version, applied_at, description) VALUES (6, 0, 'v6'); INSERT INTO edges (id, source, target, kind, line, col) VALUES (1,'a','b','calls',5,3), diff --git a/crates/codegraph-store/src/queries.rs b/crates/codegraph-store/src/queries.rs index bc972211..c68c4fcc 100644 --- a/crates/codegraph-store/src/queries.rs +++ b/crates/codegraph-store/src/queries.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeSet, HashMap}; +use std::collections::{BTreeSet, HashMap, HashSet}; use codegraph_core::types::{ Edge, EdgeKind, FileRecord, Language, Node, NodeKind, ReferenceSubkind, UnresolvedRef, @@ -287,6 +287,37 @@ impl Store { Ok(out) } + /// The subset of `paths` whose file row has `generated = 1`. Batched and + /// chunked like [`Self::nodes_by_ids`]; a path with no row is simply absent + /// from the result. + /// + /// Reports ONLY what is stored: the union with the path convention + /// (`is_generated_file`) is the CALLER's job, so this stays a faithful view + /// of the column and the partial `idx_files_generated` index serves it. + pub fn generated_paths_among(&self, paths: &[String]) -> rusqlite::Result> { + let mut out = HashSet::new(); + if paths.is_empty() { + return Ok(out); + } + let mut unique = paths.to_vec(); + unique.sort_unstable(); + unique.dedup(); + for chunk in unique.chunks(SQLITE_PARAM_CHUNK_SIZE) { + let placeholders = std::iter::repeat_n("?", chunk.len()) + .collect::>() + .join(","); + let sql = + format!("SELECT path FROM files WHERE generated = 1 AND path IN ({placeholders})"); + let params = chunk.iter().map(|p| p as &dyn ToSql).collect::>(); + let mut stmt = self.conn.prepare(&sql)?; + let rows = stmt.query_map(params.as_slice(), |row| row.get::<_, String>(0))?; + for path in rows { + out.insert(path?); + } + } + Ok(out) + } + /// Ports the FTS SQL from `searchNodesFTS` in `upstream db/queries.ts:986-1052`. /// Keeps the upstream FTS5 escaping/prefix rules, BM25 weights, `ORDER BY score LIMIT/OFFSET`. pub fn search_nodes_fts( @@ -666,8 +697,8 @@ impl Store { let errors = json_array_or_null(&file.errors)?; self.conn.execute( r#" - INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors) - VALUES (@path, @contentHash, @language, @size, @modifiedAt, @indexedAt, @nodeCount, @errors) + INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors, generated) + VALUES (@path, @contentHash, @language, @size, @modifiedAt, @indexedAt, @nodeCount, @errors, @generated) ON CONFLICT(path) DO UPDATE SET content_hash = @contentHash, language = @language, @@ -675,7 +706,8 @@ impl Store { modified_at = @modifiedAt, indexed_at = @indexedAt, node_count = @nodeCount, - errors = @errors + errors = @errors, + generated = @generated "#, named_params! { "@path": file.path, @@ -686,6 +718,7 @@ impl Store { "@indexedAt": file.indexed_at, "@nodeCount": file.node_count, "@errors": errors, + "@generated": i64::from(file.generated), }, ) } @@ -1600,6 +1633,7 @@ fn row_to_file(row: &Row<'_>) -> rusqlite::Result { indexed_at: millis_column(row, "indexed_at")?, node_count: row.get("node_count")?, errors: parse_json_array(row.get("errors")?)?, + generated: row.get::<_, i64>("generated")? != 0, }) } @@ -1954,9 +1988,85 @@ mod tests { indexed_at: 2, node_count: 1, errors: vec!["warn".to_string()], + generated: false, } } + #[test] + fn upsert_file_round_trips_the_generated_flag() { + let store = store("generated-round-trip"); + + let mut rec = file("payroll.go"); + rec.generated = true; + store.upsert_file(&rec).unwrap(); + assert!(store.file_by_path("payroll.go").unwrap().unwrap().generated); + + // Re-upserting the SAME path with a false verdict must overwrite it. This + // half is what catches a missing `ON CONFLICT ... DO UPDATE SET generated`: + // without it the row keeps its stale `1` forever. + rec.generated = false; + store.upsert_file(&rec).unwrap(); + assert!(!store.file_by_path("payroll.go").unwrap().unwrap().generated); + + // And back again, so the update is not one-directional. + rec.generated = true; + store.upsert_file(&rec).unwrap(); + assert!(store.file_by_path("payroll.go").unwrap().unwrap().generated); + } + + #[test] + fn generated_paths_among_returns_only_flagged_paths() { + let store = store("generated-paths-among"); + + let mut flagged = file("api.pb.go"); + flagged.generated = true; + store.upsert_file(&flagged).unwrap(); + store.upsert_file(&file("handwritten.go")).unwrap(); + + let asked = vec![ + "api.pb.go".to_string(), + "handwritten.go".to_string(), + // A path with NO row at all is simply absent, never an error. + "never_indexed.go".to_string(), + ]; + let got = store.generated_paths_among(&asked).unwrap(); + assert_eq!(got, HashSet::from(["api.pb.go".to_string()])); + + // An EMPTY slice returns an empty set. MEASURED: `chunks()` on an empty + // slice yields ZERO chunks, so the loop body never runs and no `IN ()` + // syntax error is reachable — the early return saves an allocation and a + // sort, it is not what makes this correct. Asserted anyway: the contract + // is "no rows", and a future rewrite that builds SQL before chunking + // would break it. + assert!(store.generated_paths_among(&[]).unwrap().is_empty()); + } + + #[test] + fn generated_paths_among_crosses_the_parameter_chunk_boundary() { + let store = store("generated-paths-chunked"); + + // More paths than SQLITE_PARAM_CHUNK_SIZE, with flagged rows placed in the + // FIRST and LAST chunk, so a loop that only ever runs once still fails. + let total = SQLITE_PARAM_CHUNK_SIZE * 2 + 7; + let mut asked = Vec::with_capacity(total); + for i in 0..total { + let path = format!("gen/f{i:04}.go"); + let mut rec = file(&path); + rec.generated = i == 0 || i == total - 1; + store.upsert_file(&rec).unwrap(); + asked.push(path); + } + + let got = store.generated_paths_among(&asked).unwrap(); + assert_eq!( + got, + HashSet::from([ + "gen/f0000.go".to_string(), + format!("gen/f{:04}.go", total - 1), + ]) + ); + } + #[test] fn round_trip_insert_then_read_by_id_name_and_file() { let mut store = store("round-trip"); diff --git a/crates/codegraph-store/src/schema.rs b/crates/codegraph-store/src/schema.rs index d4ed1a59..c87f5c1a 100644 --- a/crates/codegraph-store/src/schema.rs +++ b/crates/codegraph-store/src/schema.rs @@ -65,7 +65,8 @@ CREATE TABLE IF NOT EXISTS files ( modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, - errors TEXT -- JSON array + errors TEXT, -- JSON array + generated INTEGER NOT NULL DEFAULT 0 ); -- Unresolved References: References that need resolution after full indexing @@ -149,6 +150,9 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_edges_identity -- File indexes CREATE INDEX IF NOT EXISTS idx_files_language ON files(language); CREATE INDEX IF NOT EXISTS idx_files_modified_at ON files(modified_at); +-- Partial: the generated set is a small minority of any repo, so the index is +-- proportional to the generated files rather than to the whole file table. +CREATE INDEX IF NOT EXISTS idx_files_generated ON files(path) WHERE generated = 1; -- Unresolved refs indexes CREATE INDEX IF NOT EXISTS idx_unresolved_from_node ON unresolved_refs(from_node_id); diff --git a/crates/codegraph-store/tests/index_state.rs b/crates/codegraph-store/tests/index_state.rs index 5d0fa0a6..c73152ba 100644 --- a/crates/codegraph-store/tests/index_state.rs +++ b/crates/codegraph-store/tests/index_state.rs @@ -119,7 +119,7 @@ fn assert_corrupt( fn index_state_constants_and_canonical_payload_are_exact() { /// The extraction version the immediately preceding release wrote. Read from /// `index_state.rs` at implementation time; see plan decision C1 step 0. - const PREVIOUS_EXTRACTION_VERSION: u64 = 7; + const PREVIOUS_EXTRACTION_VERSION: u64 = 8; assert_eq!(CURRENT_STORAGE_PROTOCOL, 2); assert_eq!(CURRENT_EXTRACTION_VERSION, PREVIOUS_EXTRACTION_VERSION + 1); diff --git a/crates/codegraph-store/tests/schema_parity.rs b/crates/codegraph-store/tests/schema_parity.rs index def17d0f..09425264 100644 --- a/crates/codegraph-store/tests/schema_parity.rs +++ b/crates/codegraph-store/tests/schema_parity.rs @@ -2,6 +2,7 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicU64, Ordering}; use codegraph_store::Store; +use codegraph_store::migrations::CURRENT_SCHEMA_VERSION; const GOLDEN_SCHEMA: &str = include_str!("../../../reference/golden/colby.schema.sql"); @@ -42,7 +43,7 @@ fn reopening_database_does_not_rerun_migrations() { assert_eq!(first_count, 2); assert_eq!(first_count, second_count); - assert_eq!(first_max, 7); + assert_eq!(first_max, CURRENT_SCHEMA_VERSION); assert_eq!(first_max, second_max); } @@ -86,8 +87,10 @@ fn old_v5_database_migrates_to_current_without_data_loss() { CREATE TABLE nodes (id TEXT PRIMARY KEY, kind TEXT NOT NULL, name TEXT NOT NULL, qualified_name TEXT NOT NULL, file_path TEXT NOT NULL, language TEXT NOT NULL, start_line INTEGER NOT NULL, end_line INTEGER NOT NULL, start_column INTEGER NOT NULL, end_column INTEGER NOT NULL, docstring TEXT, signature TEXT, visibility TEXT, is_exported INTEGER DEFAULT 0, is_async INTEGER DEFAULT 0, is_static INTEGER DEFAULT 0, is_abstract INTEGER DEFAULT 0, decorators TEXT, type_parameters TEXT, return_type TEXT, updated_at INTEGER NOT NULL); CREATE TABLE edges (id INTEGER PRIMARY KEY AUTOINCREMENT, source TEXT NOT NULL, target TEXT NOT NULL, kind TEXT NOT NULL, metadata TEXT, line INTEGER, col INTEGER, provenance TEXT DEFAULT NULL); CREATE TABLE unresolved_refs (id INTEGER PRIMARY KEY AUTOINCREMENT, from_node_id TEXT NOT NULL, reference_name TEXT NOT NULL, reference_kind TEXT NOT NULL, line INTEGER NOT NULL, col INTEGER NOT NULL, candidates TEXT, file_path TEXT NOT NULL DEFAULT '', language TEXT NOT NULL DEFAULT 'unknown', FOREIGN KEY (from_node_id) REFERENCES nodes(id) ON DELETE CASCADE); + CREATE TABLE files (path TEXT PRIMARY KEY, content_hash TEXT NOT NULL, language TEXT NOT NULL, size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, errors TEXT); INSERT INTO schema_versions (version, applied_at, description) VALUES (1, 0, 'Initial schema'), (5, 0, 'Initial schema includes all migrations'); INSERT INTO nodes (id, kind, name, qualified_name, file_path, language, start_line, end_line, start_column, end_column, updated_at) VALUES ('file:a.gd', 'file', 'a.gd', 'a.gd', 'a.gd', 'gdscript', 1, 1, 0, 0, 0); + INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors) VALUES ('a.gd', 'deadbeef', 'gdscript', 12, 0, 0, 1, NULL); INSERT INTO unresolved_refs (from_node_id, reference_name, reference_kind, line, col, file_path, language) VALUES ('file:a.gd', 'player.gd', 'references', 3, 0, 'a.gd', 'godot_scene');", ) .unwrap(); @@ -98,7 +101,7 @@ fn old_v5_database_migrates_to_current_without_data_loss() { // Then it migrates to the current version, gains the reference_subkind column // (NULL for the pre-existing row), and the row's data is preserved. - assert_eq!(store.schema_version().unwrap(), 7); + assert_eq!(store.schema_version().unwrap(), CURRENT_SCHEMA_VERSION); let (name, subkind): (String, Option) = store .connection() .query_row( diff --git a/crates/codegraph-watch/src/migrate.rs b/crates/codegraph-watch/src/migrate.rs index de0f2cf6..4ddce4cf 100644 --- a/crates/codegraph-watch/src/migrate.rs +++ b/crates/codegraph-watch/src/migrate.rs @@ -34,6 +34,7 @@ use std::time::Instant; use anyhow::{Context, Result}; use codegraph_core::IndexPaths; +use codegraph_core::generated_header::detect_generated_file; use codegraph_core::node_id::hash_content; use codegraph_core::types::{Edge, FileRecord, Node, UnresolvedRef}; use codegraph_extract::{detect_language_with, extract_source_with}; @@ -126,6 +127,7 @@ pub(crate) fn migrate_project( .filter(|node| node.file_path == *relative) .count() as i64, errors: result.errors.clone(), + generated: detect_generated_file(relative, &source), }; rebuild.store().upsert_file(&file)?; diff --git a/crates/codegraph-watch/src/sync.rs b/crates/codegraph-watch/src/sync.rs index ed27445c..76242000 100644 --- a/crates/codegraph-watch/src/sync.rs +++ b/crates/codegraph-watch/src/sync.rs @@ -7,6 +7,7 @@ use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use anyhow::{Context, Result, bail}; use codegraph_core::IndexPaths; use codegraph_core::config::Config; +use codegraph_core::generated_header::detect_generated_file; use codegraph_core::node_id::hash_content; use codegraph_core::types::FileRecord; use codegraph_extract::{ @@ -756,6 +757,7 @@ fn reextract_into_store( .filter(|node| node.file_path == relative) .count() as i64, errors: result.errors, + generated: detect_generated_file(relative, &source), }; // A name's resolution outcomes (confidence, chosen target) depend on the set @@ -1685,6 +1687,94 @@ pub(crate) mod tests { built } + #[test] + fn incremental_sync_writes_the_generated_flag_both_ways() { + // Given: an indexed hand-written Go file whose row reads 0. + let dir = TestDir::new("watch-generated-incremental"); + let target = dir.path().join("payroll.go"); + fs::write( + &target, + "package payroll\n\nfunc ComputePay() int64 { return 1 }\n", + ) + .unwrap(); + let db = default_db_path(dir.path()).unwrap(); + sync_changed_paths(dir.path(), &db, ["payroll.go"]).unwrap(); + assert!(!read_generated(dir.path(), "payroll.go")); + + // When: an edit ADDS a generation banner and the incremental sync runs. + fs::write( + &target, + "// Code generated by fkit-crud. DO NOT EDIT.\n\npackage payroll\n\nfunc ComputePay() int64 { return 1 }\n", + ) + .unwrap(); + sync_changed_paths(dir.path(), &db, ["payroll.go"]).unwrap(); + + // Then: the stored verdict flips 0 -> 1 through the real sync path. + assert!( + read_generated(dir.path(), "payroll.go"), + "adding a banner must flip the stored flag to 1" + ); + + // And removing the banner flips it BACK, which re-tests the + // `DO UPDATE SET` half through sync rather than through the store test. + fs::write( + &target, + "package payroll\n\nfunc ComputePay() int64 { return 2 }\n", + ) + .unwrap(); + sync_changed_paths(dir.path(), &db, ["payroll.go"]).unwrap(); + assert!( + !read_generated(dir.path(), "payroll.go"), + "removing the banner must flip the stored flag back to 0" + ); + } + + #[test] + fn outdated_rebuild_writes_the_generated_flag() { + // Given: a banner-marked file and a hand-written sibling, indexed and then + // marked Outdated so the next sync escalates into `migrate_project`. + let dir = TestDir::new("watch-generated-migrate"); + fs::write( + dir.path().join("payroll.go"), + "// Code generated by fkit-crud. DO NOT EDIT.\n\npackage payroll\n\nfunc ComputePay() int64 { return 1 }\n", + ) + .unwrap(); + fs::write( + dir.path().join("payroll_usecase.go"), + "package payroll\n\nfunc ComputeNet() int64 { return 2 }\n", + ) + .unwrap(); + sync_project_once(dir.path()).unwrap(); + stage_outdated(&dir); + + // When: the cold full sync runs, which is the path an existing index + // actually takes when it upgrades (migrate.rs, NOT main.rs). + sync_project_once(dir.path()).unwrap(); + + // Then: the rebuild wrote the real verdict, not a hardcoded false. This is + // the assertion that fails if write path 3 is left filling `false`. + assert!( + read_generated(dir.path(), "payroll.go"), + "the Outdated rebuild must write generated = 1 for a banner-marked file" + ); + assert!( + !read_generated(dir.path(), "payroll_usecase.go"), + "the Outdated rebuild must leave a hand-written file at 0" + ); + } + + fn read_generated(project_root: &Path, relative: &str) -> bool { + let paths = index_paths(project_root).unwrap(); + let store = + Store::open_for_read(&paths, Instant::now() + Duration::from_secs(10), || false) + .unwrap(); + store + .file_by_path(relative) + .unwrap() + .unwrap_or_else(|| panic!("{relative} must have a file row")) + .generated + } + #[test] fn watcher_sync_on_outdated_namespace_migrates_every_file_without_skips() { // Given: an indexed project whose namespace is then marked as built by an diff --git a/docs/equivalence.md b/docs/equivalence.md index 172f0503..3306df51 100644 --- a/docs/equivalence.md +++ b/docs/equivalence.md @@ -568,6 +568,127 @@ cargo run -p codegraph-bench --bin bench -- \ `generated_golden_matches_committed_rust_fixture` and `rust_db_is_self_equivalent_to_rust_golden` enforce byte-stability. +### Go fixture + +`reference/golden/go/` byte-pins `files.generated` — the content-header +generated-file detection ported from upstream #1500 (`16e1749`) plus the +Wrangler double-`by` fix (`57e0854`). It is the repo's only Go corpus, and the +only corpus where `files.generated` is anything other than `0`. + +Go is the language that forces content detection to exist: its convention for a +generated file is a **comment banner**, not a filename suffix, so a machine-written +`payroll.go` sitting beside hand-written use-cases is invisible to the path-only +`is_generated_file`. Renaming is not an option — `payroll.go` is a legal, ordinary +Go filename. + +Six files pin BOTH values of the flag, three each way: + +| fixture | `generated` | what it guards | +| -------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------- | +| `payroll.go` | **1** | pattern 1, Go's codified `Code generated … DO NOT EDIT.` — the #1500 defect itself | +| `worker_types.go` | **1** | pattern 6 / CG-25, Wrangler's TWO `by` clauses (`Generated by Wrangler by running …`) | +| `api.pb.go` | **1** | the PATH signal still writes 1 with no banner present | +| `payroll_usecase.go` | **0** | the must-not-demote side: hand-written code beside a generated sibling | +| `nightly.go` | **0** | pattern 6 PRECISION — one `by` clause (`generated by running the ETL job`) is ordinary prose | +| `generator.go` | **0** | the comment-line fence: the banner is a `const` string in the function BODY, so a generator's own source is not flagged | + +`payroll.go` and `payroll_usecase.go` both define `ComputePay`, which is what makes +the ranking effect observable: without the content signal the generated definition +wins on name overlap alone. + +Regenerate reproducibly (identical recipe to the Rust fixture, substituting `go`): + +```bash +mkdir -p reference/golden/go +rm -rf /tmp/cg-fixture-go +cp -r crates/codegraph-bench/fixtures/go /tmp/cg-fixture-go +cargo build --release -p codegraph-rs +CODEGRAPH_NO_DAEMON=1 CODEGRAPH_NO_WATCH=1 \ + ./target/release/codegraph init /tmp/cg-fixture-go +cp /tmp/cg-fixture-go/.codegraph/codegraph.db reference/golden/go/colby.db +cargo run -p codegraph-bench --bin bench -- \ + --gen-golden reference/golden/go/colby.db reference/golden/go +``` + +`generated_golden_matches_committed_go_fixture` and +`go_db_is_self_equivalent_to_go_golden` enforce byte-stability. + +### Mini schema rebuild (schema-migration recipe) + +`reference/golden/mini/` is the one corpus with **no re-indexable provenance** — it +is upstream-derived, and its `files.modified_at` is a JS `Date.now()` +(`typeof(modified_at) = real`, versus `integer` in every corpus we produce). So the +recipe above cannot regenerate it: re-indexing the fixture would replace upstream's +data with ours. + +An in-place `Store::open` migration is also **not** sufficient when a schema +migration adds an index. `CREATE INDEX` APPENDS a `sqlite_master` row and never +reorders an existing one, and the golden `schema.sql` is a `sqlite_master` dump +compared as a strict string, so a migrated corpus accumulates its indexes in +migration order while a freshly-created one carries them in `BASE_SCHEMA` order. +That is why `mini` and `godot` used to carry `idx_edges_identity` LAST while the +other corpora carried it alphabetically. + +For a schema migration, rebuild `mini` on the fresh schema and transplant its rows: + +```bash +# 1. A fresh index over mini's own fixture → a database created from the CURRENT +# BASE_SCHEMA, so every index lands in declaration order. +rm -rf /tmp/mini-rebuild && mkdir -p /tmp/mini-rebuild +cp -a crates/codegraph-bench/fixtures/mini/. /tmp/mini-rebuild/ +CODEGRAPH_NO_DAEMON=1 CODEGRAPH_NO_WATCH=1 \ + ./target/release/codegraph init /tmp/mini-rebuild +DB=/tmp/mini-rebuild/.codegraph/codegraph.db + +# 2. Replace its freshly-extracted rows with mini's COMMITTED rows, preserving +# the upstream-derived values instead of re-extracting them. Run from the repo +# root — the ATTACH path is relative. +sqlite3 "$DB" " + ATTACH DATABASE 'reference/golden/mini/colby.db' AS src; + BEGIN; + DELETE FROM unresolved_refs; DELETE FROM edges; DELETE FROM files; + DELETE FROM nodes; DELETE FROM project_metadata; + INSERT INTO nodes SELECT * FROM src.nodes; + INSERT INTO edges SELECT * FROM src.edges; + INSERT INTO unresolved_refs SELECT * FROM src.unresolved_refs; + INSERT INTO project_metadata SELECT * FROM src.project_metadata; + INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors) + SELECT path, content_hash, language, size, modified_at, indexed_at, node_count, errors FROM src.files; + COMMIT; + DETACH src;" + +# 3. Commit as the fixture's colby.db, then re-derive the JSON + schema goldens. +cp "$DB" reference/golden/mini/colby.db +cargo run -p codegraph-bench --bin bench -- \ + --gen-golden reference/golden/mini/colby.db reference/golden/mini +``` + +Two constraints in that transplant are load-bearing: + +- **The `files` insert MUST use an explicit column list.** `SELECT *` fails with + `table files has N columns but 8 values were supplied` once a column is added, + and the omitted column correctly takes its `DEFAULT`, which is exactly the + migrated-but-not-re-extracted semantics the goldens should pin. +- **Do NOT transplant `schema_versions`.** `codegraph_store::test_support:: +finalize_current_test_fixture` calls `Store::open` on a COPY of this database + from seven call sites. Copying `mini`'s rows would leave `MAX(version)` behind + the current schema on a database that already HAS the new column, so + `run_pending_migrations` would fire the `ALTER TABLE` against it and every one of + those tests would die on `duplicate column name: …`. Keeping the fresh rows + leaves nothing pending, so `Store::open` is a no-op on the copy. + +Verify the rebuild preserved provenance and normalised the order: + +```bash +sqlite3 reference/golden/mini/colby.db 'SELECT DISTINCT typeof(modified_at) FROM files;' # real +sqlite3 reference/golden/mini/colby.db 'SELECT COUNT(*) FROM nodes;' # 13 +sqlite3 reference/golden/mini/colby.db 'SELECT COUNT(*) FROM edges;' # 21 +diff reference/golden/mini/schema.sql reference/golden/cpp/schema.sql # byte-equal +``` + +That last `diff` is the real proof: the rebuilt `mini` schema is now the same text +as a freshly-created corpus's, so every corpus `schema.sql` shares one hash. + ### Metal fixture A fifth golden fixture, `reference/golden/metal/`, guards Metal Shading Language diff --git a/reference/golden/arkts/colby.db b/reference/golden/arkts/colby.db index 84e0368d26be00483be0c95f1146ea7b7d538e2f..c8eebe188ad7d13fc0f4e0be92543b59507f776c 100644 GIT binary patch delta 869 zcmc&yJxo(k6n^)#ukWWVw@A$cgYE5mue4QY#Wsp2L`o=V(zHscL>UOCRZ5T;iV@>L z8y(!Byy3E_?ck&X@dX+pAxyeBXbgi6Mh7sAx|x{ZYc(*sn0SYC&v(A>4CgziP!R7vU>edC0< zg_9%+J-DL_f)#0}c&GnH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zgVP|;(G;}nQPU}i(r_AD=|&3fM}E3vIIgC_M;}i^7uP0wqx4P+n&^eJej&{nomkfi z)JlI#Llm{ph_P1>=IKKj2$rv9;5IJ5KLk%I0?aZ#G(^P&^r-)79t|-+>!a=pOzx)( z2?(Gdy^??!3eg`7D_~en)Sc8v;{QwFo_ IK;_SW0WcSM{Qv*} diff --git a/reference/golden/cpp/files.json b/reference/golden/cpp/files.json index 0b31b98c..3bff7c69 100644 --- a/reference/golden/cpp/files.json +++ b/reference/golden/cpp/files.json @@ -2,6 +2,7 @@ { "content_hash": "ae235688285955ff53f65aa9468ee11fc2691fac2cbd99b76f36b6d72f363a98", "errors": null, + "generated": 0, "language": "c", "node_count": 6, "path": "attr_macro.c", @@ -10,6 +11,7 @@ { "content_hash": "918ff675ba5d4bc2916b5f0b01a6efe803acec492ab71f0bf83c593be612a202", "errors": null, + "generated": 0, "language": "cpp", "node_count": 9, "path": "base.hpp", @@ -18,6 +20,7 @@ { "content_hash": "6b55a06389ed10d1d23bcab95a9ae02421e1cf0aa566526df2f367e29270e7c2", "errors": null, + "generated": 0, "language": "cpp", "node_count": 7, "path": "com_interface.hpp", @@ -26,6 +29,7 @@ { "content_hash": "7866bdbba877acfa0b4b8e7e4be58875893da925ac91aa333a4c3658bea64e69", "errors": null, + "generated": 0, "language": "cpp", "node_count": 12, "path": "derived.cpp", @@ -34,6 +38,7 @@ { "content_hash": "e3331a39e14456236ae24d3d0cc31562b65008bf1027a065d8f403066d74a46e", "errors": null, + "generated": 0, "language": "cpp", "node_count": 5, "path": "instantiate_agg.cpp", @@ -42,6 +47,7 @@ { "content_hash": "5d9bf2ad4d29787d69c168a79c0efb471614f5996f9b065b206da7170bc0fe70", "errors": null, + "generated": 0, "language": "cpp", "node_count": 6, "path": "instantiate_rank.cpp", @@ -50,6 +56,7 @@ { "content_hash": "bfd6da256b748444e2bfdff365e7d56daa640afa638e50b294db94cca1f2a7f8", "errors": null, + "generated": 0, "language": "cpp", "node_count": 4, "path": "namespaced.cpp", @@ -58,6 +65,7 @@ { "content_hash": "e4419194da0741856b7b23dbc977893cdfda9a926201018b685dce64efbd1f30", "errors": null, + "generated": 0, "language": "cpp", "node_count": 4, "path": "namespaced_member.cpp", @@ -66,6 +74,7 @@ { "content_hash": "3d4b5ad9e00d6934eea58bd6707b171b7a335458df91499966798385a5d09ad7", "errors": null, + "generated": 0, "language": "cpp", "node_count": 2, "path": "namespaced_member.hpp", @@ -74,6 +83,7 @@ { "content_hash": "e934b42dfe376e8b29355a6ed84d713d44ba9b6f898df4d774f6bda378562bb3", "errors": null, + "generated": 0, "language": "cpp", "node_count": 4, "path": "neg_interface.hpp", @@ -82,6 +92,7 @@ { "content_hash": "61ac8b93b7094d0633203791513f3394c7f76e2993a50d75b9f8e32454dcccf6", "errors": null, + "generated": 0, "language": "cpp", "node_count": 9, "path": "operators.cpp", @@ -90,6 +101,7 @@ { "content_hash": "0527736aa5807318919d35bb62e2c3f8dc4be0e333cf2e27553b89dc59006b74", "errors": null, + "generated": 0, "language": "cpp", "node_count": 4, "path": "template_method.cpp", @@ -98,6 +110,7 @@ { "content_hash": "e72bc5982add705d170ebd03d4a3db5286237e5b8ab662fc9ed35cd51da438c9", "errors": null, + "generated": 0, "language": "cpp", "node_count": 3, "path": "templated_call.cpp", @@ -106,6 +119,7 @@ { "content_hash": "5afecb82e36830d924845a28b9069f2fb7cc3d9b15d74f6bf6623fd737b3d265", "errors": null, + "generated": 0, "language": "c", "node_count": 2, "path": "ue_actor.h", @@ -114,6 +128,7 @@ { "content_hash": "fd0d7579d620457505815a1d6829820f5512859858153568086bdebddcd0ead2", "errors": null, + "generated": 0, "language": "c", "node_count": 7, "path": "union_agg.c", @@ -122,6 +137,7 @@ { "content_hash": "d0f696b07337c1d1fcda49b0222d9b43a5c45a3932ff58cee2cd87b8d68caf53", "errors": null, + "generated": 0, "language": "cpp", "node_count": 7, "path": "union_agg.cpp", @@ -130,6 +146,7 @@ { "content_hash": "96f43a0f8244169fcc8281ef0f62de430a43436f39853e254ec27a840ccbe7c7", "errors": null, + "generated": 0, "language": "objc", "node_count": 3, "path": "union_agg.mm", diff --git a/reference/golden/cpp/schema.sql b/reference/golden/cpp/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/cpp/schema.sql +++ b/reference/golden/cpp/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/cuda/colby.db b/reference/golden/cuda/colby.db index 0981683f1d8e1118cf8288ccddf1ac44a8a61d7c..2885fd315ab0ffd25af65af8845002546759843a 100644 GIT binary patch delta 869 zcmZozz}awsbAr628Uq3-1DPyPuF6CUd-f~Q}ItGjEE zf}ekgf?ueQkAjPe&2AU&MiB1_S?$&4LPj{Jd$5-13dQ!c45Jj0_x; zm)84pgOnWyYkS@Nzkd7wdd5HcTwp;ikoPtV8vN(od_mw3510c9&EE;MF}QlI|Rfk~NBbvmablR2Z>bVo-ZPi1Q`jaVN{yFN0F(NRh3OVSa-4>zr=JuB_<_qP_%P^!X;XHdbJXh3Zvrm1xid7 zK-D*un2Z?}rt>N@g|jHKi`!0rsLUiWy#Yk|T2n53o`t1t;o=TQMl=BhApPG7CUq^O=D$1ZLx&e$lNnU|7Uk(p8v zpO%@ES{x5gG+?gG^gvZ6aUHmzg1?^vSVE&9u_QxNA>6|?$W;L$ZL46o{frBf3AYh1 ae=q|F+e-%iXdZojjRA delta 760 zcmd5)PiWI{7|ri%e)*;8x}=NHid~yFscyP9n-v@)Hc5*I|8-at+zwi+2T!trha%Dq zJqmN=@Ueqb2VO)(4Xy~H-OYnHhk`g1RPZ{l6KgUB@uWw;(|h0h-sQb-wi}+k6~2+) zn&W;?)`$ErsxOR}(mlyws_;U%BB=BUJGyxO+!*D?ka8e8 zNN6sjW6p*VlELFPT%v{$ujSo>oWM^uWFtXHVi3|)7Gn+=xa7b9-aiNe9(5q&yDmCV z#6lTT*mYnZ(QqSJER|sp50_zxPqTOtzdMk?`7)@ut>O#MeSxI#OBsqJiDq!?n<*Zs zfYEtbfe#YiE5V5|xyFf1<>aY8Qy!9TOI7jj9j*O)M;&Jpo>3NsX>O2|kXbMi`y(P! m;y(Jdw_$QSUba9d2DUBOOLF)oV0yq3sM`K}{D&#-iTnVg0>#k) diff --git a/reference/golden/cuda/files.json b/reference/golden/cuda/files.json index e8c574ba..6eab1f22 100644 --- a/reference/golden/cuda/files.json +++ b/reference/golden/cuda/files.json @@ -2,6 +2,7 @@ { "content_hash": "3f2656febed2ea1c1ae2498e3361ad5d667edc05d4abf561a0b189eddfe4d113", "errors": null, + "generated": 0, "language": "cpp", "node_count": 5, "path": "kernel.cu", diff --git a/reference/golden/cuda/schema.sql b/reference/golden/cuda/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/cuda/schema.sql +++ b/reference/golden/cuda/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/erlang/colby.db b/reference/golden/erlang/colby.db index cb061c34c520aca072e2248816ea3ecf1b7ccdb6..557b35538d2cb0b0ab948a3f9a8c7d6ada414d78 100644 GIT binary patch delta 872 zcmc&yOH30{6rFe5>3rJqiqs64+P=%v`MQ;^wvikVvfK(*X{%C{k^wr$&eTbA8sOKiLKwROs3SbE_FC6C0=Ta%so$N{EQUm0O7>RKD zA?z`_#8no8yq<97^*&dR@xXNsKO+@v=dBET9xeD*AHUMqV=b(iJ-TCjkGVUo^9-Ih z>PZPZHDs6OoK3*8h~f2zvuS&^p;BvmduwNQWoH)sjQuW()$v?LeQ^tym)y%s=*=*9 zqNe;vKVa~P@p!bghTko_pw6X=i(-cVyAL`>`>EWA{+S_TEPWb-oD(?4%WN>Xg2ymJ z>j(rIE?TxMlkfw^0V5ebH`yEI#WuJQqMMzdpa2yTa2y3`B4HwxY6*y#U&#;6NT#cP zxW)!-Qnp2p;zpX5LAF=-&R2~YQs_+?ROF`%GPIlO_cF90LY)c>TK$~VLBA-_NQ>3r zP{2!<6$qL9Ck3MPo&pDHM1?T#GnI$YToe5)!vQ*_!anLyP4bEg0)3)_KQ!v)q&5l7 zH54ZD+DsuoGkmEqu1yW^UQG>p=-B{B&AUaCNs}58zB)2J8X<$Hll@7uM|Y6cm6zQR bw;y%lEW_Kj89d~O;qZUi;Y!y@SYv+yVPEeA delta 760 zcmZoTz}c{XbAr62Dgy#20hugNuJS|+d-?xdD(u2+C)jG)gjsj8Cb9fxnag~axsd52 zQ$3R)Bmd-s0+kz|eq`rVVq+H<7iVly-h7{fn^8zXS69I+*xyefv8X7ql1o#QeXx1%*jmGm?{~2m<%=_6!2kW zZd6pBuIk97!>Bkt$dRd(RfSDFSa-4>zr^$>j!a72pg`gP1yZ!qbU`O3mFbI|n1rUU zb7Nwg?(4*)2-KDD#AG~O&zVVX`T-{ z1AjD+KEDRnLN0#}!f|w$_&D0`6vecUm7SNVkU^Hwemc7Yla3%t5HZ>_JO)Ple5NS1 l>D3NQ%8V-0=Q}W&GpbI%4&o_;coNfv9f8SX5Qd@&Hvo{5%4Yxo diff --git a/reference/golden/erlang/files.json b/reference/golden/erlang/files.json index 518690bd..2a7be30a 100644 --- a/reference/golden/erlang/files.json +++ b/reference/golden/erlang/files.json @@ -2,6 +2,7 @@ { "content_hash": "56a7be5a3cae1e5ae0a456229c15af753d04217c4415d02eeee7ae7d1aa91c0b", "errors": null, + "generated": 0, "language": "erlang", "node_count": 9, "path": "m.erl", diff --git a/reference/golden/erlang/schema.sql b/reference/golden/erlang/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/erlang/schema.sql +++ b/reference/golden/erlang/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/go/colby.db b/reference/golden/go/colby.db new file mode 100644 index 0000000000000000000000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{}&$guK2$aqQM^k diff --git a/reference/golden/godot/files.json b/reference/golden/godot/files.json index 0ae0221d..f0dd8e7d 100644 --- a/reference/golden/godot/files.json +++ b/reference/golden/godot/files.json @@ -2,6 +2,7 @@ { "content_hash": "33a6ab1ac82701bd870b22dd52e8677fc23e4099d38947face8b931780fd20bc", "errors": null, + "generated": 0, "language": "godot_scene", "node_count": 0, "path": "combo_ui.tscn", @@ -10,6 +11,7 @@ { "content_hash": "6f5b810b12eeba2d908d628a74a55dd5da8997f2775681cc26c584650d7d5581", "errors": null, + "generated": 0, "language": "gdscript", "node_count": 2, "path": "effect_manager.gd", @@ -18,6 +20,7 @@ { "content_hash": "40f411be7a8b9048869b5a8902243a44fcb645c67e3c1d2fb05b0f20b5c7075c", "errors": null, + "generated": 0, "language": "gdscript", "node_count": 2, "path": "game_flow.gd", @@ -26,6 +29,7 @@ { "content_hash": "fca10c3b36f6310276b07105d034d82d7f54f132283b460939dd05b213b2abf7", "errors": null, + "generated": 0, "language": "godot_scene", "node_count": 0, "path": "main.tscn", @@ -34,6 +38,7 @@ { "content_hash": "b01662a4255e8445a808378889ccf8b38b49d012cd8ed933fa540b5f9e097d60", "errors": null, + "generated": 0, "language": "godot_project", "node_count": 0, "path": "project.godot", @@ -42,6 +47,7 @@ { "content_hash": "5410c79a7bb764595c01f175fb3533956a84c884801660428bc032b000a01131", "errors": null, + "generated": 0, "language": "gdscript", "node_count": 6, "path": "stage_manager.gd", diff --git a/reference/golden/godot/schema.sql b/reference/golden/godot/schema.sql index a2ec49ae..e528b87c 100644 --- a/reference/golden/godot/schema.sql +++ b/reference/golden/godot/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -100,8 +101,11 @@ END; CREATE INDEX idx_edges_kind ON edges(kind); CREATE INDEX idx_edges_source_kind ON edges(source, kind); CREATE INDEX idx_edges_target_kind ON edges(target, kind); +CREATE UNIQUE INDEX idx_edges_identity +ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); @@ -113,5 +117,3 @@ value TEXT NOT NULL, updated_at INTEGER NOT NULL ); CREATE TABLE sqlite_stat1(tbl,idx,stat); -CREATE UNIQUE INDEX idx_edges_identity -ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); diff --git a/reference/golden/kotlin/colby.db b/reference/golden/kotlin/colby.db index a4823371bdd053495f59cde277ff5237ea4336a5..d1b95116197c36e807a658d449b68afcc0457c04 100644 GIT binary patch delta 859 zcmc(dPfQa*6vlU6ce}g&!&Jd6H9)7k+kXnJ2+?XnYzYNTnpSBGQ4R#tDkVS+V8nQ! zjV2zk*~54u<=}znfw+NQ8pFY8qD13?gB}bX(DbM`6BFDv2991#oWsof=J&nBn{Ntb zv9KjRayh-s;Zlr}{Ug;<_=0Q4qMB>w6?2NKam!qo{lLzfbkh*Lh79_~?3GrNI!51l zF>dB1NkR|q=%Q#v+8Lq6e=|3mo10k3Wyz&PIyMv=CW&O4Br@?h8Hf!=Gx0PzWeEg$ z?F4Sq`z=)tyn+^WWVOqVLH&ti1V1Mm*eb9LcNLXg)$NzsR;Y`sSL^zZP)md@F}S23 zArG;A23dVYyAwDLF@m~6@nn+|AlsFqbrQuzD$8b-(d;VVpW^jQcpcHo%~W{1HWcnUMLiGZj1y6LNF z4t~NkU?ihg2EAKa?SX4Px)%Wjd8inLv&c)MQA4RT7lnXvEW4o-$+YT*+nmQNrMk2r zZlwtsWNSTap&s^_Lhs3-A~!9|5H{Q&W#~bK+7%dO-MrLCzbMd33-!&WKnLAaz-RE! z3Iyq61=?vq1;5}joF`GyNq1#9PUlrPN^PnEXH*dBQx)94$qruXkx;QYKby@h=Ch0A zH}ccD`SF9V(vWTRiU*|5gG-W3kOuJInpl_&kkN~=;TSo@eWbgxJpjGd({`L<1apnS RW3~|X|Az!C{paBY_Zx5^?dt#l delta 764 zcmd5)O=uHg6x{Fae!H7Z)7^B1O|@w@$wpIY5;X-y#OzP-;9rZug6*k#DhSeohai#` zJ$Mkb-NQR+v_}!CE^QD*Q-tC{@TMRZ1rC@a%c4#n)3d^+aEo8#r(hi#5GSg?qSYUMUY8;nQ8EmJ zT+IgWmh3y)q(7n^3hrs6>f9oIWG<;u zN#N)i(p=rB>VCUapbR&MIzWs0=!B|Lt6*i@ofr{k$uIVG_h<#w}#y|wNYZ%9fs51UxiHVz`u;4)wk9m+6Qj$@|?=B?ph6g(CsItW~wjllZ#e*{G!%}$5 z%oGn-!D_v%!UqNKSK#zswZ_Sk&Z*;FB{i?yRfgri_q6u!J+<61cuJ)hOmRt4LCJ=} q_#Y9G3ipv!--NN9c*%w=v9M{wev-pCA&`g< diff --git a/reference/golden/kotlin/files.json b/reference/golden/kotlin/files.json index aae630be..9a1632c2 100644 --- a/reference/golden/kotlin/files.json +++ b/reference/golden/kotlin/files.json @@ -2,6 +2,7 @@ { "content_hash": "bc5f142764204c3f0298334ebe62cf7e9b547694106085dcfe5ebff665e2cd65", "errors": null, + "generated": 0, "language": "kotlin", "node_count": 7, "path": "signatures.kt", diff --git a/reference/golden/kotlin/schema.sql b/reference/golden/kotlin/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/kotlin/schema.sql +++ b/reference/golden/kotlin/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/metal/colby.db b/reference/golden/metal/colby.db index 9d849d30f61baf4a88a627d98759d657a71f4977..e6873f51691588b70fc9d254ff2148b964cad172 100644 GIT binary patch delta 869 zcmc&yJxo(k6n^)#ukWWVw@}OjQ`_73UZGWJMTk}tA|(_wX<7v;QHBQ7DkVq^#fWjB zjcz7F^FpqZX-!SkhsuhqclV&WanJ>U7hGo0_7d`ZY} z2uq&UHfH}RMr!^8)nfRxXG>HqJC=u*5q5`NWW(k+=A2144Z$l&qA$#Lv7FE``o;+{ z3nxhux_eU>1S`^x^UeONnVHP Ss#&c;WhL(yRpPmGdyG8Q8P(ZNVEHcF0)fdHo+ z#xA{ITxX$;*CLLzcFr-VKXzQet7HvZc{9UaL?zGq>nGYqsFO9a%@zH7sJYL)%;06c zk=(=fEVB9vb|%4E-*OwecL)#wGL>7gw4pE9h;C zJ6V@j=z9zV=%vBlDwez9Qaj!50|oi05P=h@jYc8{QfVdv0pnZrLI;xRx)*M+ zK8rNcsReNhjmscgYis9gzKkpMwhSur(vl2eL;X&MZbYbEfibg}lX~eV1zKpn7HkT* zX+?o{ga4pFkUmi05Dlo{=RJn<2r9JFk1`yjITf0yO*P1CDhTwc3f}ffHz##VsNl@b zq%-r`^nB_{b~=+w?Hx@Wy6AZyNF94cl8BQ!;lDmHHyI#fXQIPVvQPJtuIlCh^jMGC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mu6@MZkEV@63|L6CBRP(B%pDglk+*iI4725(*1$R&`^Cg zQ*d5FCWj$J#s(oy8U|r0nM~4z|0oF$@l{-NIp~v{?3VsiG8>^0iliY0+wY+e$b}ST z`BMs-$l4?KZ$!H4CKq}QZUyhVN#Uyxt7o>Ek0z4X5H zjPhIMI*omo)reTqAL>#`(X(LUnz@bDBsc;!L>&Q4W~h?*hoPEO4AbeQVR+Cm2tqNb z9EL@+V@x6=@HI00EG*_4xs5I|m7<+g-Xxf$5ZC7d{jyf04{s89>taqTe|ZpmFK!m- zN&T~D=mMTH9!FBt%`$2Q0-1iA3Qj!@&E&!eEaD9l(8G@}kZz}iH6*0v7A%xz^Mt6A zatn15c;g_L)d}-C2w~38(zE{b^16xbm*DF~oWR;(;@5wNk1?mPZkYJVHPA30V)9-9c{vB$WFga)sC0pGf)~pt8M?<#=e5ReF`6BFdl2Q}Rig(-ApQUCcQiwkK23SSGV05zof7NG_Wy9N1bxss)1~HRvkh z9Cfp>cy!lojdA!=Wypo^p-e^wV}@n5a@PS-=-p?;5UMig2+gH4wxKo@$!@2Jrb>x( z1m_|Wk>o%wGGOpFS6L~Avk>A}5fvyB@uY!hQXAbO=V+QkqVMIbJw^;JixIVPeaRRE zg@I-)sWGT7_L@0IvvZCzlgg#(wc|D>q&9kmyC~xBMD`|XO2t(s>eeyGcqpCP8B0d! zy@i4rgI=Dd#a6hX=|Qoqo(5FG(IwA{jDQL{?aq=Zt(&FZX7vO*ke#KeCzC5soyiMa VO^uU$vIfmF8B0@xC-y+me*tZ4F3A7@ diff --git a/reference/golden/mini/files.json b/reference/golden/mini/files.json index 501106a4..d385493a 100644 --- a/reference/golden/mini/files.json +++ b/reference/golden/mini/files.json @@ -2,6 +2,7 @@ { "content_hash": "10857ef49b4fb2f611c10181f9fa4c955e86b1ec1a54b2a272b17ffb848598cd", "errors": null, + "generated": 0, "language": "typescript", "node_count": 3, "path": "src/app.ts", @@ -10,6 +11,7 @@ { "content_hash": "caebbaef45cf4da7e66dd1479300307d465c03a7a9be5c9e358877bcbc81efc8", "errors": null, + "generated": 0, "language": "typescript", "node_count": 5, "path": "src/math.ts", @@ -18,6 +20,7 @@ { "content_hash": "256033248f73c030955a522a62420fc54a5bdc1fc1c7aff58e55403e7b27cc3b", "errors": null, + "generated": 0, "language": "python", "node_count": 5, "path": "tools/greeter.py", diff --git a/reference/golden/mini/schema.sql b/reference/golden/mini/schema.sql index a2ec49ae..e528b87c 100644 --- a/reference/golden/mini/schema.sql +++ b/reference/golden/mini/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -100,8 +101,11 @@ END; CREATE INDEX idx_edges_kind ON edges(kind); CREATE INDEX idx_edges_source_kind ON edges(source, kind); CREATE INDEX idx_edges_target_kind ON edges(target, kind); +CREATE UNIQUE INDEX idx_edges_identity +ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); @@ -113,5 +117,3 @@ value TEXT NOT NULL, updated_at INTEGER NOT NULL ); CREATE TABLE sqlite_stat1(tbl,idx,stat); -CREATE UNIQUE INDEX idx_edges_identity -ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); diff --git a/reference/golden/nix/colby.db b/reference/golden/nix/colby.db index bb868d1f93b0ac47526511fe96aca9ef5f0154cf..08a0c9fd5a49ffcb6e533d4366174ddde27b055e 100644 GIT binary patch delta 1020 zcmc&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=;0tb=$MXSi@Km=nv!|!qMD9}K%*^t zV=<4NG?d3~DJ1*T^h3u0&E?TY!GdKxw+!f_Z+T2Z2c_(@7R+d%fHCt`0Y549AcLp+ z`KaKOeF7hEN%3ywjxy~0dvMnNJvgR5hR>Mn!AYSLG9+iQxAl(}K}Ps&WwC-|d+1UY cqY$G?77sw2-q|W@s{r|OR%ZXhF79*x1kE?@CIA2c diff --git a/reference/golden/nix/files.json b/reference/golden/nix/files.json index d3f47c55..17e4d2e0 100644 --- a/reference/golden/nix/files.json +++ b/reference/golden/nix/files.json @@ -2,6 +2,7 @@ { "content_hash": "7ea2d3f7da76e263d391b2ec6d7d99574db4c40cc9e4f33a5a305346c82ee3d5", "errors": null, + "generated": 0, "language": "nix", "node_count": 3, "path": "bar.nix", @@ -10,6 +11,7 @@ { "content_hash": "ed9b1d6a781e97666ec258cf392af57c8ab2cb1e818daac8ea099bef7e041a71", "errors": null, + "generated": 0, "language": "nix", "node_count": 15, "path": "default.nix", @@ -18,6 +20,7 @@ { "content_hash": "89378235fc3afa5147a2c9abeddc1fb5c31f736bb076c1ad13159b90791bce31", "errors": null, + "generated": 0, "language": "nix", "node_count": 4, "path": "foo.nix", diff --git a/reference/golden/nix/schema.sql b/reference/golden/nix/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/nix/schema.sql +++ b/reference/golden/nix/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/python/colby.db b/reference/golden/python/colby.db index a0826bdf3bd45deba7e67743d4d3cc84ecdfdd05..0da179b5a9685edb70b7f8d9245fda226b2b737c 100644 GIT binary patch delta 954 zcmc(dO-vI(7>0Mg?RNiYXA#U&19blitpXJxiY7!#C}`5O3atb%A(&PHkr2Ru(OB^3 zjLja#lPL#IdLV9~7h=$ZUPz2F9Q0r`1`J2NdBW{N;OND~Im~?TJl{KqcfPqiKex_5 z@%w71!=>A$YhN0RN|>vOzDVrMpCh)a#9F|So1ip zwAzI=25LAnBBjksQm3^fUBNGv6)bWtis?gn|JwT*b3I(o*wx0e^($Q7##t0LvFf#~ z*V2;LGe(Pnd5;em22q^(=6=doG+lM9_ev)~4BHg#(QvlUq5XRlZX(CKPxINNSoH4G zhr8LrZWe8aRp&ukpc&-&`hlkzey#)b+f2YM_tcvWxPrtr(8S^_ zam82$baGb%1F0mhL5tn}NrNV&5RVSME|ryA$u}J;$XszN(V?2G>QHO*FFG`kr#e)T zkO4u?Z+D(R^FH!bgJWdMfFq>Du;DEOc=Fr;wRX6gm78QVUp6wH&diRaX9us3jAf<< z4<^x(mE>{&neP(`srmPGMh|WH>r)DcJD43Fy*Dg5Y+L77=?Totom_F5? zseaMN(MeKmZeGqhEh|MCT6k0YZtclQbxysb8o_#PO}iiLxWp^Tr9c-@N;s!=Z6aE2 zZVZFxEQV%5v6x6aFD=k<1_(XNoMR<~E=6`m5-lXV7}r}7T0 zx5(SGV#a%G6hFivCJ&{DJUUX>A*f+62g$%V|B*ir@1RU>!hZJYQNl0v8JNt&AnC(X zd03#P5Gkdcv>L^YJS6;X?vk7PbOJ**n7C>~Cq6m`0-ms;kGW=T$Y8nvz1XthFwt?_ zEvyzGhQ|xg?~99(4F0eoinj_7#_l2$noJJ1n(dxu=Xte;@n$zmL6PPr*wn24Iehkt~Wi7!3Up5y^62*d|qBYA;^N cfk8~H=HL)X;(M1FE{kF~&o=HqO!1)qCzIOdC;$Ke diff --git a/reference/golden/python/files.json b/reference/golden/python/files.json index dc1e461b..c026afad 100644 --- a/reference/golden/python/files.json +++ b/reference/golden/python/files.json @@ -2,6 +2,7 @@ { "content_hash": "ffcdab43044b451a4dd403d4d74460128523d9fcba30dfe75e9a595a0f2c46db", "errors": null, + "generated": 0, "language": "python", "node_count": 3, "path": "consumers.py", @@ -10,6 +11,7 @@ { "content_hash": "6cebb328503cb6d3a66c76ade1e6da7f16dbd066c1689c41765ea55255d9d030", "errors": null, + "generated": 0, "language": "python", "node_count": 2, "path": "imported_types.py", @@ -18,6 +20,7 @@ { "content_hash": "dcee64febdb07e86597a805d2ca48d93a6c69a4c547247399c39e316c21827d2", "errors": null, + "generated": 0, "language": "python", "node_count": 17, "path": "same_file.py", diff --git a/reference/golden/python/schema.sql b/reference/golden/python/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/python/schema.sql +++ b/reference/golden/python/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/ruby/colby.db b/reference/golden/ruby/colby.db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y(bSQI}NAgTIsN`9PENetOw z;-U?Gcy|{FxX*@!=Q?FW7BfW{z?Kc;M8`G1u~>wD+*5?XKwOMu@v99{yi$ZPZY+7i zGfyA`__+vK5<|=X>zOI;EP>g4QG)jh-pRqi5mx0SG0d^49*YesHHq)$ diff --git a/reference/golden/ruby/files.json b/reference/golden/ruby/files.json index 0fbe400e..e840082d 100644 --- a/reference/golden/ruby/files.json +++ b/reference/golden/ruby/files.json @@ -2,6 +2,7 @@ { "content_hash": "3a65be1da08f0b766455700e321bd9edb858cc78e21915e8bfaf3e49b5364f22", "errors": null, + "generated": 0, "language": "ruby", "node_count": 5, "path": "logger.rb", @@ -10,6 +11,7 @@ { "content_hash": "053a1a3cfdfe31ecabb5071c79aadd1b5939b20403e8681efcc0b138076bde79", "errors": null, + "generated": 0, "language": "ruby", "node_count": 6, "path": "service.rb", diff --git a/reference/golden/ruby/schema.sql b/reference/golden/ruby/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/ruby/schema.sql +++ b/reference/golden/ruby/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/rust/colby.db b/reference/golden/rust/colby.db index 7e760535681421b2a5afc44b1ba880ed30aa9445..08bfca798d69c9442f1fcd466888fc57b7d21d5a 100644 GIT binary patch delta 907 zcmc(dKTH!*9LMkd+WT9|I|XuJfWF>cORLxuA&Mr%7Aas-TclK?3%^HYnNG`SETiw;FcNjxz|;;C4S3`7Sbsn{4fAq9iHc@(!= z{ZfeqzhFk>v^gRVTF>Om_$ArIF2TvLSJ0ZLR6cKR8zHBs^h2=rjK(l$F!&KRtXHyz z-Dz;Othk$iWf3EoeYtqEZ3t9t!}VF@(rWN&E-BUE{ry~VKZo{=rb-V)2P;-x0jZLL zTs#y;UvYjzDQuwkll++~8=)UDw23{TuByCPkfC1IrFAJG{5>ucqo#kD+6+ry7?5%U z&$Kf;4Bo^un4$Fqd=1we-yHMs3uXZ$6}`6U-TZntTIW%M2kr_!GnL=VowB{%xYOp~NO>Z8&2?}CS&_b{6wP4&0Qt_lm-|7A4n-7L>X0anLuFCh~ z0~YuDCEc&^3ytL?#dudSrLg!`yeWq1OL|$@6&~;#{2XjU144v3>uUYk=C&j!MM={% za@%Nq@%c%=o=)p0YZK%8%>4XJT^SjXoC9pIWh<{Jm_DbhUUeqbvDPE?JX?NBpX)D} zUlKTak*vlRQaPuS%?PoD;R~&uY@{USICh`qTI;IC`es2HSPJX|N(twTHO4i!Khkp* zf>(%Q>}kzLP1(~9-|9Bn-3HmoGOq?QPvxE|veqH*FG++8l0GlV=_H11 zFtKSvKR!7DBA&4!;kvHbkjG2~hOlG9QKI9nS7=rshNmi!65^7U#~(IC@oojexWDQO zZ(M;4;Z_CmWDv7nuWP1wyb5OfT@}76__zq?a;(Prq%g;(`?4&hJX9upe_!Orzb~?F zPr+*{1z?Vgks?YZ7!Caq5h-%t+}l`zsbRcP0)v>iQi1}p@S{hDM^Oxy-5dH3Q#|DV E2~-)$3IG5A diff --git a/reference/golden/rust/files.json b/reference/golden/rust/files.json index 4ac637ce..15f9aa96 100644 --- a/reference/golden/rust/files.json +++ b/reference/golden/rust/files.json @@ -2,6 +2,7 @@ { "content_hash": "8121cdd4bac4cf4e031fa69ca8b2ceea14f7f61e2357a339025afdcb51ea6585", "errors": null, + "generated": 0, "language": "rust", "node_count": 4, "path": "consumer.rs", @@ -10,6 +11,7 @@ { "content_hash": "32fd3f5a2c8b2054c3197394a04d39f75f8ad52de6afe38e76ec0e4ee7358960", "errors": null, + "generated": 0, "language": "rust", "node_count": 14, "path": "lib.rs", diff --git a/reference/golden/rust/schema.sql b/reference/golden/rust/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/rust/schema.sql +++ b/reference/golden/rust/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/solidity/colby.db b/reference/golden/solidity/colby.db index a786dde97b70a36e1d5b54a2dc258771f4822e36..a7cee4d547110f107f560095a91020b9f940116a 100644 GIT binary patch delta 912 zcmc(dKTK0m6vp2@?fXx;k3agT0ebu1E3^t!C~7q!QbIwKrd4Pq%0Mu!0wOVh5#vyZ z?pWV&ofHNq9f&Wq3n94Z;$jSg4n|{8al_3CU!Mj>7ZdMr@A>ZUe9L#v{E|4oA>Q|S zo0$Eh+ok)DGz!tvzD>#Cwz)^#AiK>jvQhUN_l(PO^}{R3ps&nUVL4@Cw8M)Dj#pI` z-MeLpqKwSrLT&JBZYnoDI-ARqv&nS4KR!T`sWeGu5(&~9?~7#;X>wEwg?RHYuD5!m zH5Qr#Gp1zCb4s7}M7e;UlT|DWZic;xmV9g9Tg{DdD{EKZ1nWn*wwntu_yG=BFBC8K zTm#v+;AsGsMT}rZ@@a3`QtcQ!YA2EG-=~lB8M#cWe$%_V`OPDY&VMQ&jptmFZNry%0dkpnbXJ=cxqmLC8s8kGTSxO0i&&=VH`QauT;MBoZvklkLqz0N?-VmXj%dk%GXkZ{eUD6GqSf|j;yEW1E99-eUem?I3RdqbapI6 ohR(zX;$$Cpk@nK-Ug(rNJa~{1xNQaxSA=o!KTNRHa|+hkUu^03Jpcdz delta 802 zcmd5)O=uHg5Z!M!-)?r(^xHIrM4B|4?8dgzWLr~EL`-%!c+hH#v4SnML{I8LTJR7= z(xOK}%O2(=(H=!aU2G6U)0+oxf`S+nRM2C*7L2=5{5k2-InA3lZy4UpYD-$ZDP2$P z$a23T&@XVABEA%hVM zblk9D0Ph|I0gqUa_EhIBC}7@(VQg8jkEpoq7dC82;$a&`11T|9z^@j>@tO@$94dRn zQ;#6S_{oL>Nuc5PdSZ$P%Ahx&m*Jg^cZx7K$tqk>jB;$D&tRkSEqNyR_iMKQ{hCc{ z9-dG!49i@S6j3a}c;pX@NRfN*JxBxQcjCnoXhg?G3HFdIzVeagqc}!Q?~(pP7pFqs E02Bn)z5oCK diff --git a/reference/golden/solidity/files.json b/reference/golden/solidity/files.json index d14c8068..84c0c027 100644 --- a/reference/golden/solidity/files.json +++ b/reference/golden/solidity/files.json @@ -2,6 +2,7 @@ { "content_hash": "bef3d1355e28323c5eaeeac93fd3693297706de47dd276566eee9d64a4568d6f", "errors": null, + "generated": 0, "language": "solidity", "node_count": 3, "path": "IERC20.sol", @@ -10,6 +11,7 @@ { "content_hash": "c8976b8cc5a7ea552da5c19efd79afa395873bd8a1253ebe9282b538e4c9a8e3", "errors": null, + "generated": 0, "language": "solidity", "node_count": 20, "path": "Token.sol", diff --git a/reference/golden/solidity/schema.sql b/reference/golden/solidity/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/solidity/schema.sql +++ b/reference/golden/solidity/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/terraform/colby.db b/reference/golden/terraform/colby.db index 1415c6536042325cba196aff74eab4f705ff3161..56723302466796c03cba264b1dbe2fac45b3970d 100644 GIT binary patch delta 869 zcmc(dKTK0W9LL}N+Sm7|Ems8cKq|ey_gY$oR&1lygh&YmO`29|D^Ui5X_Yoe48@3X zfJP@5Y#zxunRal}f%pPlh+)#j#TW)1j1E=NNjDP{e60pX7ZY!|`+a|(?+y3;-Eu`( z-V*M+y1dN(QjF64N2=w>Y1g)>T6QcCEh%<~U11~USLUKgH;usy$e>S5y3EjP^3xXAC$N6^O)!bZeetIF7C1(@q*jQ|wB$8>8$i(AhBsLn&#M9)c==XEl zVeHh0#Z4BxycTt2wR4V9{gLAWeoEG{l{Yi&MO1NZe(lz_g8i&fedhJ=!S*5ZDuY+` zR&o#93&`4Cvb%s~5yNZMrIgjMec5eZBX@R}YP(D5XYhAZY&_3VYptLy=E!Rxqy8QMa? z({|bP(KHV~U=}cv(Q|{|Dpx~rsh8G=KtUcVMBxPT(rDCBD$PZ~ZyYOb=tDBybi)nS zW06w*S^#&_gbcE^F?PO@%cMeY%b+4Rt;i5D+;3zEAwum6OqkuAG)O-v&`FmYn@xcp zx}iX?!QUwmpbr!{MExrGc$eWkf=XTVy$lCwQH2B4rW){?3Ictsg1dL7hm%4QDz)Y3 zvbn{4c5&)Tel}N}+WRz3>7?g9AocAvNisp2z;}ImVa87;&cw!JWFHTbf!fOv2wRWY Yaf;zBI}Dz*1+nixOt3b53ZAjQ0Bv6GdjJ3c delta 760 zcmd5)PiWI{7|riXeo30HOS%ZDtXtD2l}*-WqoN{WleBp7-$sjq+d-yYhKI3&hoaIA zy(#Dj<2y;+jv}H4R|IkGZ3l0Hf;bdZ*mb*3tjQF_lOFv}?|tukm-oK;c4YoRPn`d^6UH!UZpSSMQ(??&u*}Dumuf>6WQx1^`~FAgh+-LG)*J7 z4F97TC4G7>r=O^fpV6mlwduMvJS=$o<)rUQFDaO!=O{DYgmTn>sGO4*pU`Leb2%z- z3_VYpm#=rOcx@|31GKj8Z(Dn8Zi$hX{J4Hw?wKJ{|3WMUloG~UZd9Y;eP!1*d$ZeU zbsOZH6d>oTuMOGQ1p9%#1aF~E?!c(uQBDzd zA#GsRff16%iUU`v$!pb|mzNXx#eqyT3`q<_n#y3@1rt|X=)=dyfydJ>qyyKi3kA%V zU=Z6b93eXHgo~9D4B*KU3~?zzE8uq*5_q=+D)yHHVJ#5IAa0hRK$2*Mw}F}Bu`-yg z*Jb!5;iDp)9h0k!D5#7))nmy+(y}xz{=K7(fA6T}PQoiH#9)pYAVm~x7>WN85h*gC kgW8)gxeu?|U=S0VHXI^Zd>1k!WC>KA;647s6c0py0A!KO8~^|S diff --git a/reference/golden/terraform/files.json b/reference/golden/terraform/files.json index 549b157d..97aed078 100644 --- a/reference/golden/terraform/files.json +++ b/reference/golden/terraform/files.json @@ -2,6 +2,7 @@ { "content_hash": "7df7854f67b585b19f9fb67712ff48434fc209255e89d426d2036200cd4d960c", "errors": null, + "generated": 0, "language": "terraform", "node_count": 10, "path": "main.tf", diff --git a/reference/golden/terraform/schema.sql b/reference/golden/terraform/schema.sql index d36218fe..e528b87c 100644 --- a/reference/golden/terraform/schema.sql +++ b/reference/golden/terraform/schema.sql @@ -47,7 +47,8 @@ size INTEGER NOT NULL, modified_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, node_count INTEGER DEFAULT 0, -errors TEXT -- JSON array +errors TEXT, -- JSON array +generated INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE unresolved_refs ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -104,6 +105,7 @@ CREATE UNIQUE INDEX idx_edges_identity ON edges(source, target, kind, IFNULL(line, -1), IFNULL(col, -1)); CREATE INDEX idx_files_language ON files(language); CREATE INDEX idx_files_modified_at ON files(modified_at); +CREATE INDEX idx_files_generated ON files(path) WHERE generated = 1; CREATE INDEX idx_unresolved_from_node ON unresolved_refs(from_node_id); CREATE INDEX idx_unresolved_name ON unresolved_refs(reference_name); CREATE INDEX idx_unresolved_file_path ON unresolved_refs(file_path); diff --git a/reference/golden/typescript/colby.db b/reference/golden/typescript/colby.db index 2826b0122545ced92322a8dd628ff8e3b9b8bd16..dcf0c3481124cf741c7e29795264ce101e0958c3 100644 GIT binary patch delta 1083 zcmc(eO-vI(6vua7yW4J;?G(W*7-+Ycv2H$1HCi`4}KiH7{dV%M)}YXJg7HMxZ5_An->%3F!O)&dmoc|Gt+bI z^fG(jR#`(8hpb9{!BmnhCv7Vxh1p^rF+KDaJxjOf-|OSLw5|)@KoEVSHk0##G)6xS ztdB7Wf`IPbO0z77Qb&#D&TEm;$k^a`BrKls_jzpV;B;^aOpq;$f4^ zWk?;wRq1w9mWCQ*%3}$q&RIIsk1ZGQb8!)KMmuuD(cDCokvdMuCp% zIlD?BAA5Exw3pH`9VZuQb}FBFJs-=)U~k>JM4qk{GRM$f`Y_SQX{RdCyE}=@P6EAh zx95(^m~=GK;QfE4 zg7_tnIPEbTwQK2@$sGw4WG8bHw5Z;z5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