Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

62 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Per-crate SanitizerCoverage flag scoping for the parser-parity grind.
Cargo applies `RUSTFLAGS` (and `CARGO_ENCODED_RUSTFLAGS`) to every rustc
invocation it makes, including dependency proc macros and build scripts.
`-C passes=sancov-module` ends up instrumenting those crates too. Their
binaries call `__sanitizer_cov_trace_pc_guard*`, which is only defined in
`insightsql_parser_rs::cov` and isn't linked into anything else, so they SIGSEGV
on macOS (or fail to link on Linux).
Used as `RUSTC_WRAPPER`, cargo invokes this script as
`cov-rustc-wrapper.py rustc <args>`. We inspect the args for the
`--crate-name` cargo always passes, and if it's anything other than our
parser crate, we strip the sancov-related `-C` flags before re-execing rustc.
For our crate, everything passes through unchanged so the sancov pass runs
and our `cov.rs` callbacks get linked.
See "Coverage-instrumented build" in `rust/insightsql/parser/README.md`.
"""
import os
import sys
# The single crate we actually want instrumented. Everything else (deps, proc
# macros, build scripts) gets the sancov flags stripped.
TARGET_CRATE = "insightsql_parser_rs"
# `-C` flag VALUES that introduce or configure the SanitizerCoverage pass.
# These have to be stripped as `(-C, VALUE)` pairs; matched on the VALUE half.
SANCOV_PREFIXES = (
"passes=sancov-module",
"llvm-args=-sanitizer-coverage",
)
def main() -> None:
args = sys.argv[1:]
crate_name: str | None = None
for i, a in enumerate(args):
if a == "--crate-name" and i + 1 < len(args):
crate_name = args[i + 1]
break
if crate_name == TARGET_CRATE:
os.execvp(args[0], args)
filtered: list[str] = []
i = 0
while i < len(args):
a = args[i]
if a == "-C" and i + 1 < len(args) and any(args[i + 1].startswith(p) for p in SANCOV_PREFIXES):
i += 2
continue
filtered.append(a)
i += 1
os.execvp(filtered[0], filtered)
if __name__ == "__main__":
main()