mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 00:51:31 +01:00
/ship's review no longer stops when Capy's drive sync database grows past 100 MB (GST-3359) (#4606)
The review's download sweep now ignores Capy's own drive sync database (`state.db` and its SQLite side files under `~/.capy/drive-engine`). Why: that database grew past 100 MB during a review stage on a Capy machine, the sweep took it for a reader's download, and the pass blocked every later stage while the file existed. Nothing to do: any other download of 100 MB or more, under `~/.capy/drive-engine` or `~/.capy/work` included, still counts. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/adversarial-native#1 reader=adversarial-native
This commit is contained in:
1 parent
baef51fe0e
commit
cc0896560a
5 files changed
+74
-2
No files matched your search
+4
-1
@@ -47,6 +47,8 @@ export interface StageSweep {
|
||||
/** The workspace (the checkout's parent), home and the temp dir, or GSTACK_SWEEP_ROOTS (path-delimited; tests); drives are never walked. */
|
||||
export const defaultRoots = (checkout: string) => process.env.GSTACK_SWEEP_ROOTS?.split(path.delimiter).filter(Boolean) ?? [path.dirname(checkout), os.homedir(), os.tmpdir()];
|
||||
export const defaultSkip = () => [path.join(os.homedir(), '.capy', 'drive')];
|
||||
/** Capy's drive sync engine database under ~/.capy/drive-engine grows on its own (GST-3359); the folder is still walked and nothing else in it is exempt. */
|
||||
const ENGINE_DB = /^state\.db(?:-wal|-shm|-journal)?$/;
|
||||
|
||||
/**
|
||||
* A remote URL with nothing that can carry a credential: userinfo removed and a query read as `?<redacted>`
|
||||
@@ -116,6 +118,7 @@ export function inventory(roots: readonly string[], checkout: string, skip: read
|
||||
const inv: Inventory = { at: now, roots: roots.map(r => realOr(r)), repos: {}, big: {}, ignored: {} };
|
||||
const deadline = Date.now() + SWEEP_BUDGET_MS;
|
||||
const home = realOr(checkout);
|
||||
const engine = realOr(path.join(os.homedir(), '.capy', 'drive-engine')) + path.sep;
|
||||
const seen = new Set<string>();
|
||||
let entries = 0;
|
||||
const walk = (dir: string, depth: number) => {
|
||||
@@ -136,7 +139,7 @@ export function inventory(roots: readonly string[], checkout: string, skip: read
|
||||
}
|
||||
for (const d of list) {
|
||||
const p = path.join(dir, d.name);
|
||||
if (d.isFile()) { try { const s = fs.statSync(p); if (s.size >= BIG_BYTES) inv.big[p] = s.size; } catch { /* gone */ } continue; }
|
||||
if (d.isFile()) { if (ENGINE_DB.test(d.name) && dir.startsWith(engine)) continue; try { const s = fs.statSync(p); if (s.size >= BIG_BYTES) inv.big[p] = s.size; } catch { /* gone */ } continue; }
|
||||
if (d.isDirectory() && !SKIP.has(d.name) && depth < SWEEP_DEPTH) walk(p, depth + 1);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user