Skip to content

feat(tools): inventory saved compilation databases without tools - #13375

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
StoneDC:b43/compdb-inventory
Oct 30, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
StoneDC:b43/compdb-inventory

Conversation

@StoneDC

@StoneDC StoneDC commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Inventory saved compilation databases as JSON grouped by raw directory/file strings, without invoking a compiler, Ninja, CMake or Git.

Address the output-loss review: preserve the optional output field whenever it is present in a compile record. Two otherwise identical actions producing a.o and b.o now remain distinguishable in the emitted inventory. Keep arguments-over-command precedence, raw record order, optional-field absence and an explicitly empty output value. The shared compilation_database parser is reused unchanged.

The Clang compilation database specification describes output as optional metadata distinguishing processing modes. A new real-CLI regression covers identical arguments with different outputs, command-form output, Unicode, both command forms, missing/empty output, and unchanged input bytes/mtime with empty PATH and nonexistent compiler names.

Paths remain raw strings rather than normalized aliases. variants counts raw records, not semantically deduplicated invocations. No command is parsed as a shell program or executed, and unknown metadata is outside this inventory's reported fields.

Tested

Exact tested head eeb248013b42624cc036dc3c6472d7a2f4e93578 on recorded main 9f748f4d8e36ce3714f3b95f3386316e110a9b22; previous published head 7f1064d3231879102362ba4b51a478e146499905. Both are ancestors. The two original regression methods remain unchanged.

Windows 11 / Python 3.14.3 and 3.12.14 / CMake 4.3.1 / MinGW GCC 15.2 configuration, and Ubuntu 26.04 / WSL / Python 3.14.4 and isolated 3.12.16 / CMake 4.2.3 / GCC 15.2 configuration. Linux uses exact committed source archives.

  • Configure Ninja Release with BUILD_TESTING=ON and ANYPS5_RELINKER_ONLY=ON, then ctest --test-dir <build> -R '^tools_compdb_inventory$' -V: 1 registered CTest / 3 methods pass in each of the four OS/interpreter configurations, zero skips.
  • The real CLI runs with empty PATH, so compiler/build/Git availability cannot make it pass. The fixture asserts the complete emitted records including all output distinctions, plus source bytes/mtime and directory contents.
  • Remove only the two lines retaining output, keeping current tests and all other production code: the new record-equality assertion fails under both interpreters on both OSes. Import/setup failures are excluded. Restored production passes.
  • Current-main conventions with this full description, whitespace, Python 3.9 grammar, script registration and skip-policy audits pass. No timeout was raised.

These are focused Python/tool tests; CMake configuration is not a native build. No actual Python 3.9/3.11, local macOS, full product build, title/PS5/GPU or compiler execution is claimed. New-head hosted CI starts after publication; prior-head results are not substituted.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 674 CMakeLists.txt
PR 1835 CMakeLists.txt
PR 3786 CMakeLists.txt
PR 5021 CMakeLists.txt
PR 7642 CMakeLists.txt
PR 9539 CMakeLists.txt
PR 10897 CMakeLists.txt
PR 11104 CMakeLists.txt
PR 12862 CMakeLists.txt

@adriadam10 adriadam10 self-assigned this Oct 30, 2026

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 7f1064d. The focused suite passes 2/2 on Windows/Python 3.12; py_compile, conventions, git diff --check and current-main merge-tree checks are clean.

One blocking data-loss case remains in the new inventory format. A JSON compilation database may carry the optional output field specifically to distinguish different processing modes of the same input. compilation_database() preserves that field, but compile_database_inventory.py discards it and retains only arguments/command. With two valid entries for the same directory/file and identical arguments but outputs a.o and b.o, the tool currently emits variants: 2 followed by two byte-for-byte identical records, so the inventory cannot tell what made the compile actions distinct.

Please preserve output in each emitted record when present (and add a regression with same directory/file/arguments but different outputs). That also makes the variants count interpretable for this standard case. The existing arguments-over-command precedence can stay.

AI-assisted review.

@StoneDC

StoneDC commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@malekaifa Fixed at eeb248013b42624cc036dc3c6472d7a2f4e93578 on recorded main 9f748f4d8e36ce3714f3b95f3386316e110a9b22.

Each emitted compile record now retains output whenever present, so identical directory/file/arguments with a.o versus b.o remain distinguishable. Arguments-over-command precedence and raw record order are unchanged. The Clang format specification explicitly identifies this optional field as distinguishing processing modes.

The new real-CLI regression asserts the complete inventory for those two outputs, command-form/Unicode output, both command forms together, and missing versus explicitly empty output. It also verifies input bytes/mtime and directory contents are unchanged, with empty PATH and nonexistent compiler names.

Registered tools_compdb_inventory CTest: 3/3 methods pass on Windows/Linux with Python 3.12/3.14, zero skips in all four configurations. Removing only output retention makes the new record-equality assertion fail on both OSes and both interpreters; no import/setup failure is counted. Both original methods remain unchanged. Conventions with the full body, whitespace, Python 3.9 grammar, registration and skip-policy checks pass.

Hosted checks at 2026-10-30T16:14:54+00:00 (UTC): 3 pending; no failures. Current-head checks. These are Python/tool tests, without a native/full build or compiler execution claim. Please re-review this exact fixed head.

AI-assisted: yes.

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed fixed exact head eeb2480 independently on Windows 11 / Python 3.12.

The requested blocking case is resolved: records now retain the optional compilation-database output field whenever present while preserving arguments-over-command precedence. The added regression covers identical directory/file/arguments with distinct a.o and b.o outputs, command-form output, Unicode output, missing output, and explicitly empty output.

Validation on this exact head: tools/tests/test_compile_database_inventory.py 3/3 OK; py_compile, conventions and git diff --check pass. Current-main merge-tree check is clean. I also checked the newer main history for tools/check_compile.py, tools/compile_database_inventory.py, and its test: there is no net source/test delta that changes this reviewed behavior.

Hosted relinker/Windows jobs are still queued at this review time, so this approval does not claim them. No native/title/GPU validation is applicable to the Python inventory behavior reviewed here.

AI-assisted review.

@adriadam10
adriadam10 merged commit 56fbc6d into boykopovar:main Oct 30, 2026
13 of 14 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked that records now keep the optional output field next to arguments/command (arguments-over-command precedence and order unchanged) and that the new regression pins a.o/b.o, Unicode, missing and empty outputs, so it fails without the change; confirmed by @malekaifa on Windows; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants