Repository navigation
brief: reach (16) and library (17) sections from the finished scan database; golden masters re-blessed (Part of #8534) - #8546
Merged
Conversation
…can database; golden masters re-blessed The LLM brief gets two short sections after 15 (call resolution): 16 "Reach (Who Depends On What)" (the five most-called source files and the five most-included headers, from gitgalaxy reach) and 17 "Libraries (What The Repository Leans On)" (the eight external libraries with the most files, from gitgalaxy libsurface; a C or C++ library only if it is in the shipped table, a discovered one only when an import names it). They read the master database galaxyscope has just written, passed to generate_artifacts as scan_db; absent without one, and a failure to read never stops the brief. No table, no column; the only scan output that changes is llm.md (a 35-line insertion in both golden brief fixtures). Reading a WAL-mode database read-only creates -wal and -shm files, which the documented scan output must not contain (test_cli_contract caught it): the sensors now open the database immutable when no -wal file is beside it (nothing is mid-write) and read-only otherwise. Closes nothing; follows #8544 (header counts from stored imports) and #8532. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This changes scan output: the LLM brief (
<target>_galaxy_llm.md) gets two short sections, so both golden brief fixtures are re-blessed. After section 15 (function call resolution): 16. Reach (Who Depends On What) (the five most-called source files and the five most-included headers:gitgalaxy reach, wiki 08-24) and 17. Libraries (What The Repository Leans On) (the eight external libraries with the most files:gitgalaxy libsurface, wiki 08-25). They are read from the master databasegalaxyscopehas just written, which now reachesgenerate_artifactsasscan_db; both sections are absent when the scan wrote no database or there is nothing to say, and a failure to read never stops the brief. No table, no column, no change to any other output. Follows #8532, #8535, #8544; tracking issue #8534.What changed in scan output, and why it is safe
12. Scan Output Snapshots / LLM Briefin both fixtures: one 35-line insertion (sections 16 and 17) and nothing else moved (checked line by line againstHEAD).crucible_check.py: both legs FAIL before the bless with exactly that one difference each, PASS after (also re-checked after the rebase onto currentmain).scan_dbisNonewhen the scan wrote no database (--llm-onlyand the like), so those briefs are unchanged.Sample, fastapi (a Python repository):
and curl (C):
openssl 19 files, 452 sites, 231 API names,c-ares 9 / 51 / 27,wolfssl 9 / 135 / 86.A bug the gates caught, fixed here
tests/tools/test_cli_contract.py::test_a_clean_scan_exits_0_and_writes_the_documented_reportsfailed on the first full run: a clean scan leftrepo_galaxy_master.db-waland-shmin its output directory. Cause: a read-only open of a database in WAL mode creates those sidecar files. The sections open the master database after the scan finishes writing it, so every scan would have left them. The sensors now open it throughreach.open_scan_db:immutablewhen no-walfile is beside the database (nothing is mid-write; the writer's last close removes it), an ordinary read-only open otherwise (so a live write-ahead log is still read in full). This also stops the standalonegitgalaxy reachandlibsurfacefrom leaving files beside a user's database. Tests pin both cases (no sidecars after reading; a live-wal's rows are still seen).Honest note: after the fix the CLI contract test passed in 25 of 25 loaded runs and in the gate's own environment, and the full
affectedgate passed on a rerun, but one earlier gate run after the fix reported the same two files once and I could not reproduce it. CI runs this exact test; I will read it.Design choices in the libraries section
It is written for a model to read, so it favours a short list over a long one: a library in the shipped table (validated) is always listed; one only discovered is listed when an import names it (Python, Go, Java, Rust, JS); a C or C++ include never is unless it is in the table, because a directory or bare header is far more often a platform header the system-header list does not know (libuv shows
gnu/,hurd/,vm/,TargetConditionals.h) than a dependency. The command itself still lists everything. Possible callers show beside the reach count as "(+N possible)".Type of change
Class / Sibling gaps
Class: post-scan views the brief could carry from the finished master database. Handled here: reach and libraries. Sibling gaps: (1) the SARIF, SBOM and GPU outputs do not carry reach or libraries (the SBOM already lists dependencies from manifests); (2) the brief shows the top five or eight only, by design; the commands list everything; (3) a C or C++ dependency that is not in the shipped table does not appear in section 17 (adding it to the table is a one-line contribution); (4) delta (
--incremental) scans read the same database and are not specially handled; (5) the sections do not yet appear in the architecture brief doc published on thegeneratedbranch until its next run.CI checklist
python tests/tools/audit_check.pypassespython tests/tools/crucible_check.py: before the bless both legs differ only in the brief; after, both PASS (full precision and zero dependency)python tests/tools/pr_gates.py --fast: lint, audits, secrets, xray, gen-docs, derived, workflows, gauntlet pass;affectedpasses (3,603 tests in one process, and 589 s on the gate rerun);tests/tools/test_cli_contract.pypassestests/tools_recorders/test_brief_reach_libraries.py(6 tests: absent without a database, reach rows and the header count, libraries and the C filter, unreadable database never stops the brief,generate_artifactswiring, section order), 2 new sidecar tests,test_llm_recorder.py,test_reach_sensor.py,test_libsurface.pypasstests/tools/docs_read_by_tests.txtregenerated withchange_classifier.py --write(it was already stale onmain: cobolrt entries)Lessons for agents
mode=ro) of a WAL-mode database creates-waland-shmfiles beside it; anything that reads a scan's master database after the scan, or a user's, must open itimmutablewhen no-walfile exists (reach.open_scan_db), ortest_cli_contract.py::test_a_clean_scan_exits_0_and_writes_the_documented_reportsfails on the extra files.tests/tools/docs_read_by_tests.txtgoes stale whenevermainmoves a tool or test that names a doc: after a rebase runpython tests/tools/change_classifier.py --check, and--writewhen it says stale, before pushing (pr_gatesderivedgate).<target>_galaxy_llm.mdshould build the name in code: a literalX_galaxy_llm.mdin a test is picked up as a doc the tests read.🤖 Generated with Claude Code
https://claude.ai/code/session_018srRveGdV73aUiuqkipAic