Bootstrap from artifact if no local DB exists for this project. */
| 9938 | |
| 9939 | /* Bootstrap from artifact if no local DB exists for this project. */ |
| 9940 | static void try_artifact_bootstrap(const char *project_name, const char *repo_path) { |
| 9941 | char db_buf[CBM_SZ_1K]; |
| 9942 | project_db_path(project_name, db_buf, sizeof(db_buf)); |
| 9943 | if (cbm_file_size(db_buf) < 0 && cbm_artifact_exists(repo_path)) { |
| 9944 | cbm_log_info("index.artifact_bootstrap", "project", project_name); |
| 9945 | /* An imported artifact is trusted for graph CONTENT as-is — nothing |
| 9946 | * verifies that its nodes/edges describe the code they claim to. What |
| 9947 | * has been limiting the blast radius is mechanical, not a check: every |
| 9948 | * imported row carries the EXPORTER's mtime, so the first incremental |
| 9949 | * run re-parses ~everything and auto-scrubs a poisoned artifact at a |
| 9950 | * clone time the producer cannot predict. That exposure is transient |
| 9951 | * and self-healing. |
| 9952 | * |
| 9953 | * cbm_artifact_reconcile_hashes deliberately trades part of that away |
| 9954 | * for the speed the artifact is supposed to deliver (#885): rows it |
| 9955 | * restamps are no longer re-parsed, so poisoned nodes for those files |
| 9956 | * persist until the file changes — a DURABLE exposure gated on a |
| 9957 | * producer-written marker. It stays acceptable only because the marker |
| 9958 | * alone never suffices: each restamped row must additionally be proven |
| 9959 | * unchanged by the LOCAL git against a commit present in this clone. |
| 9960 | * Read the trade-off note in artifact.h before widening it. |
| 9961 | * |
| 9962 | * Best-effort: a -1 return leaves every row foreign and falls back to |
| 9963 | * today's behavior, so a failure here can never fail the import. */ |
| 9964 | if (cbm_artifact_import(repo_path, db_buf) == 0) { |
| 9965 | (void)cbm_artifact_reconcile_hashes(repo_path, db_buf, project_name); |
| 9966 | } |
| 9967 | } |
| 9968 | } |
| 9969 | |
| 9970 | /* Cap on excluded dir paths listed in the response — keep it compact on large |
| 9971 | * repos (node_modules / vendor / etc. can produce many skip points). The full |
no test coverage detected