Repository navigation
Add explicit naming isolation for generated configurations - #126
Conversation
ip332
left a comment
There was a problem hiding this comment.
Independent technical review — GO / approved for squash merge from a code-review perspective at 692b83189a8e6f1f53360d87b7b6c2de8fb5a699.
Inspected source-naming projection, CLI prefix validation, all backend integration points, CMake NAME_PREFIX and SCHEMA_ID_VARIABLE implementation, name-prefix regressions and public truck multi-configuration example. The prefixed-only injective C/C-storage naming appropriately preserves the existing unprefixed C API and #119's deferral. The implementation keeps canonical Schema IR/FQNs/record IDs/schema_id unchanged and allows format-1 gid to vary with emitted definitions. PR evidence includes 72/72 unchanged unprefixed outputs, all five rev A/B round trips, CMake 3.31.10/4.5.0 tests, and C99/C++/Python/Go checks. Verified GitHub Actions run 44870328220: Build and test (71/71 Linux), clang-tidy, coverage (66/66 selected), and Cortex-M all succeeded.
No merge-blocking defect found. Cortex-M zero linked flash/RAM delta is supported for tested workloads, not object-file byte identity; symbol/relocation changes and hardware/stack limitations are correctly disclosed. #119's unprefixed C symbol collisions and case-insensitive filesystem limitations remain separate and documented.
This is a positive technical-review COMMENT rather than a formal APPROVE, because the connected GitHub account is the PR author. No merge performed.
Closes #102
Several configurations can now coexist deliberately inside one application using explicit
--name-prefix NAME. All five variants support it: C++ owning, C99, C++ with C storage, Python and Go. The configuration name never supplies a prefix implicitly.Baseline:
85fd8123ac88e9b337ba3b18c57a30736dbf6452(A4.4 merge; all post-merge checks passed in run 44864087606).Implementation:
692b83189a8e6f1f53360d87b7b6c2de8fb5a699.Naming contract:
--name-prefix rev_arev_a::truck::engine, retaining per-namespacequarry_gen_<gid>inline namespacesrevq0a_truck_engine_EngineStatus_tand matching function/descriptor stemsquarry::cxx::revq0a_truck_engine_EngineStatusrev_a.truck.engine.schema, absolute imports and the new top-level package marker<caller go-import-prefix>/rev_a/truck/engine, with generated import references updated consistentlyAll paths gain a literal prefix directory. Guards, configuration/code identity metadata and optional C identity accessors use the prefix as a leading segment of #117's encoding. Portable identifier validation rejects empty/repeated/reserved prefixes and conflicts with any namespace's first canonical segment, including unselected namespaces.
The separately approved prefixed-only C correction uses #117's injective, case-preserving encoding for the prefix and canonical namespace segments before appending existing declaration/function suffixes. Prefixed enum constants preserve the encoded namespace's case. This distinguishes
rev_a+dep.enginefromrev+a_dep.engine, and case-only prefixes. Unprefixed spelling and #119's general migration remain deferred. Existing declaration/member naming restrictions remain in force. Case-sensitive source names do not remove case-insensitive filesystem limitations; use prefixes differing beyond case for a shared portable output tree.The naming projection never mutates Schema IR or canonical FQNs. Record IDs, schema_id, BRF/QBS bytes and runtime epochs remain unchanged. Generated-code identity still uses canonical namespace keys and the approved format-1 encoding/normalization; prefixes change emitted definitions and can therefore change gid. No historical
quarry_cfg_<schema_id>namespace is reintroduced, and no mandatory runtime allocation, initialization or hashing is added.The installed
quarry_generate_cpp()helper gainsNAME_PREFIXandSCHEMA_ID_VARIABLE. The latter queries the complete root at configure time without prefix/selection arguments. Full input inventories, build-time output verification, collision claims, one-compiler selection, diagnostics and the CMake 3.20...3.31 policy pin are preserved.Validation:
Pinned 72 unprefixed file hashes across seven default/compact language variants before editing the backends; every hash matches the baseline. The configured formatter also normalized touched backend source files; this changes no emitted baseline bytes.
New regressions check output inventories, full-versus-selected identical files, QBS minimal/reflective byte identity, schema_id/description independence, actual prefixed/unprefixed BRF equality, compact dependencies, validation failures, and negative mismatched-prefix / wrong-gid dependencies.
C99, C headers consumed as C++20, and C-storage C++ consumers execute the adversarial namespace/prefix pairs, case-only prefixes and escaped-q prefixes with enum fields. Callback linkage and identity-bearing names retain their existing contract.
Installed helper tests pass using CMake 4.5.0 and 3.31.10, including ordinary configure/build,
cmake -Pwithout a caller policy declaration, complete identity export, multiple calls sharing an output directory, collision rejection and malformed query diagnostics.The new public truck example compiles complete native trees for both revisions in one translation unit, imports both Python trees in one process, builds every generated Go package and runs both revisions in one binary. All five execute real encode/decode round trips. EngineStatus remains
0x00050001; B adds MirrorFold (folded: bool) at0x00030002. A's schema_id remains9200ca494f010801b830d0857cf66dde; B is806e9a4e11d0df71c4e5b51045f85010. Python/Go also compare against unprefixed wire-byte controls.The strict host C99 Cortex workload adapter compiles with default and compact storage. The new CI comparison measures prefixed versus unprefixed workloads under identical ARM toolchain/linker settings in Default, MinSizeRel and Debug, retaining actual symbol dumps and allocatable-byte/relocation reports. Local Docker is unavailable; the successful CI job supplies the ARM measurements.
Prefix flash/RAM delta is zero in all three configurations. Every linked ELF's five allocatable sections is byte-identical between naming modes. Object files are not claimed identical: function/data section names, relocation symbol targets and defined symbols change; ordinary ELF symbol-table metadata grows 133 B in Default/Debug and 98 B in MinSizeRel. Debug information changes too. Renamed generated compatibility-object paths are listed as unmatched by the existing comparison tool. Six raw ELF symbol dumps and the complete reports are retained in the Cortex-M CI artifact. The unprefixed candidate also has zero flash/RAM delta versus baseline. Stack/heap high-water marks and hardware execution are not measured.
Focused backend/naming/helper tests pass; coverage-instrumented C runtime consumer linkage is also validated. Pre-commit formatting/whitespace/YAML checks and
git diff --checkpass.scripts/quarry-validate validate HEADpassed 71/71 native CTest entries for the exact implementation commit, including the installed public examples and existing G1–G5 regression targets. The existing opt-in older/alternate-generator probes retain their normal skip behavior. Linux coverage passed 66/66 selected CTest entries and the baseline guard; the five pre-existing build/package exclusions remain unchanged. Cortex-M comparison results are recorded above. Full Linux GCC passed 71/71 CTest entries, plus the GCC LTO generated-identity step. All applicable checks pass in CI run 44870328220, including clang-tidy. Benchmarks are skipped by the existing pull-request policy. The PR is ready for independent review. Delivery usesscripts/quarry-validate validate HEADandscripts/quarry-validate push, with hooks enabled. Do not merge automatically. A5, A6, release publication and Stage B remain outside this PR.The CMake 3.31.10 configure/script checks were also repeated successfully using the committed local compiler. Existing Homebrew Abseil nullability warnings remain a native toolchain limitation; validation and configured hooks passed.