Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: #8031 review: glued markers keep their claim; refused db_only lines stay unresolved; company verdict reads the approved commit

garrytan2ccb59a9a439
diff --git a/docs/storage-tiering.md b/docs/storage-tiering.md
index c56d5075c7..41bd94d4e3 100644
--- a/docs/storage-tiering.md
+++ b/docs/storage-tiering.md
@@ -35,7 +35,7 @@ storage:
Path requirements:
- Each directory must end with `/` for canonical form. The validator auto-normalizes missing trailing slashes (one-time info note shows what changed).
-- A tier may also be a one-line flow list, `db_only: [media/x/, 'media/articles/']`. A flow list split over several lines, a nested list, an unquoted value holding a space (a missing comma: `[a/ b/]`), or a `db_only` key outside `storage:`, resolves no directory: `gbrain storage status` names it, and until it is fixed a managed sync keeps every live page whose file is gone (held as `file_drift` with reason `storage_invalid`) instead of deleting it, because it cannot tell which pages are database-only (#8007). A tier overlap holds them the same way. A deprecated `supabase_only` list next to canonical keys is ignored (canonical keys win), so the pages under its directories that `db_only` does not also list are held the same way until you move those directories under `db_only`; `gbrain storage status` names them. `gbrain repair file-drift --prefer file` and `sync.apply_held_deletions` skip these pages while the config stays invalid. Fix `gbrain.yml`, commit it and sync again; the holds clear and each page is decided under the fixed config.
+- A tier may also be a one-line flow list, `db_only: [media/x/, 'media/articles/']`. A flow list split over several lines, a nested list, an unquoted value holding a space (a missing comma: `[a/ b/]`), or a `db_only` key outside `storage:`, resolves no directory (a refused `db_only` or `supabase_only` line counts even when another key resolves): `gbrain storage status` names it, and until it is fixed a managed sync keeps every live page whose file is gone (held as `file_drift` with reason `storage_invalid`) instead of deleting it, because it cannot tell which pages are database-only (#8007). A tier overlap holds them the same way. A deprecated `supabase_only` list next to canonical keys is ignored (canonical keys win), so the pages under its directories that `db_only` does not also list are held the same way until you move those directories under `db_only`; `gbrain storage status` names them. `gbrain repair file-drift --prefer file` and `sync.apply_held_deletions` skip these pages while the config stays invalid. Fix `gbrain.yml`, commit it and sync again; the holds clear and each page is decided under the fixed config.
- A directory cannot appear in both tiers — that's a tier-overlap error and `loadStorageConfig` throws `StorageConfigError`. Edit `gbrain.yml` to remove the overlap and try again.
- Any other key under `storage:` is ignored with a warning naming it (a typo such as `kep_db` used to be ignored silently).
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 526b711228..dca61b8783 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1369,8 +1369,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.507.0', id: 'search_quotes_transcript_rows', text: '`search`, `query` and `assemble_evidence` now return a row from a conversation page (type `conversation`, what transcript imports write) with `quoted: "transcript"` and its text wrapped as a quoted excerpt: a line naming the page as source material, then a code fence. Tool-call and function-call JSON inside (Gemini `functionCall` included), and XML-style `function_calls`, `invoke`, `tool_use` and `tool_call` blocks, become `[tool call: <name>, arguments omitted]`. Under `return_unit: auto` an explicit `token_budget` pays for the fence, so a conversation-heavy result can return fewer or shorter rows. Stored pages, ranking, scores and other page types are unchanged; read `quoted` to tell these rows apart, and `get_page` for the text as stored.' },
{ since: '0.60.511.0', id: 'storage_invalid_holds_8007', text: 'A managed sync no longer deletes a live page whose file is gone while gbrain.yml\'s storage section is invalid (tiers that overlap), declares `db_only` in a form that resolves no directory (a flow list split over lines, a key outside `storage:`), or lists a deprecated `supabase_only` next to canonical keys (which ignores it): it cannot tell which pages are database-only, so it keeps each such page and holds its path as `file_drift` with `meta.reason` `storage_invalid`. Run `gbrain storage status`, fix gbrain.yml, commit it and sync again; the holds clear and each page is decided under the fixed config. `gbrain repair file-drift --prefer file` and `sync.apply_held_deletions` skip these pages too.' },
{ since: '0.60.511.0', id: 'storage_flow_lists_8007', text: 'gbrain.yml storage tiers written as a one-line flow list (`db_only: [media/x/, \'archive/\']`, likewise `db_tracked` and `keep_db`) now take effect; they used to resolve nothing. After upgrading, directories declared that way are treated as declared: sync adds `db_only` ones to .gitignore and publishes new pages there database-only, and `keep_db` ones get database-wins writes. An explicit `db_only: []` declares no directory and no longer makes the sync baseline commit refuse.' },
- { since: 'TBD', id: 'storage_ignored_dirs_8015', text: 'When gbrain.yml lists a deprecated `supabase_only` next to canonical keys (which ignores it), a managed sync now holds only the missing-file pages under the ignored directories `db_only` does not already cover, and deletes other missing-file pages as usual; it used to hold every missing-file page of the source. `gbrain storage status` now names those directories, and the deprecation warning no longer points to a `gbrain doctor --fix` rename that does not exist.' },
- { since: 'TBD', id: 'company_db_only_keep_8014', text: 'A company-brain source now keeps a live page under a declared `storage.db_only` directory when its file is not in the approved manifest, and keeps every such page while its gbrain.yml storage section is invalid, as other managed sources do; it used to delete them.' },
+ { since: 'TBD', id: 'storage_ignored_dirs_8015', text: 'When gbrain.yml lists a deprecated `supabase_only` next to canonical keys (which ignores it), a managed sync now holds only the missing-file pages under the ignored directories `db_only` does not already cover, and deletes other missing-file pages as usual; it used to hold every missing-file page of the source. `gbrain storage status` now names those directories, and the deprecation warning no longer points to a `gbrain doctor --fix` rename that does not exist. A `db_only` or `supabase_only` line whose inline value the parser refuses (a missing comma, a nested list, a bare scalar) now counts as unresolved even when another key resolves, so missing-file pages are held rather than deleted.' },
+ { since: 'TBD', id: 'company_db_only_keep_8014', text: 'A company-brain source now keeps a live page under a declared `storage.db_only` directory when its file is not in the approved manifest, and keeps every such page while its gbrain.yml storage section is invalid, as other managed sources do; it used to delete them. The decision reads gbrain.yml at the approved commit, never the working tree.' },
{ since: 'TBD', id: 'redaction_marker_not_credential_7997', text: 'The transcript `labeled_credential` detector no longer reads an importer redaction marker (`login **<REDACTED:user-pattern>**`) as a typed user/password pair, so a correctly redacted page clears `gbrain transcripts audit-secrets`; a password written beside a marker is still found. The audit detector version moves to 3, so `gbrain doctor` asks for a fresh audit once.' },
];
diff --git a/src/core/persistence/sync-discovery.ts b/src/core/persistence/sync-discovery.ts
index 539345e925..a493df9cff 100644
--- a/src/core/persistence/sync-discovery.ts
+++ b/src/core/persistence/sync-discovery.ts
@@ -37,6 +37,7 @@ import { readBlobContents, readTreeBlobs, SYNC_READ_BOUND } from './sync-blobs.t
import { gitChildEnv } from '../git-env.ts';
import { readOriginEvidence } from './sync-origin-evidence.ts';
import { sourceDbOnlyVerdict } from './source-storage.ts';
+import { dbOnlyVerdict, storageConfigFromYaml, unresolvedDbOnlyIn } from '../storage-config.ts';
import { movedDriftHolds, prescreenSyncEntries, type SyncDriftSide } from './sync-prescreen.ts';
import { sliceEntries, type SyncSliceCursor, type SyncSliceState } from './sync-slices.ts';
@@ -375,14 +376,29 @@ async function dropUncommittedDeletes(gitRoot: string, tips: Array<string | null
return kept;
}
+/** #8014: a company source's db_only verdict, read from gbrain.yml at its approved commit, never the working tree. */
+function committedDbOnlyVerdict(gitRoot: string, commit: string, root: string): (slug: string) => boolean | 'unknown' {
+ const rel = relative(gitRoot, root).split(sep).join('/');
+ const path = rel ? `${rel}/gbrain.yml` : 'gbrain.yml';
+ try {
+ if (!syncGit(gitRoot, ['ls-tree', '--name-only', commit, '--', path]).trim()) return () => false;
+ const content = syncGit(gitRoot, ['show', `${commit}:${path}`]);
+ const config = storageConfigFromYaml(content, path);
+ if (unresolvedDbOnlyIn(content, config)) return () => 'unknown';
+ return slug => dbOnlyVerdict(slug, config);
+ } catch {
+ return () => 'unknown';
+ }
+}
+
/**
* #7324: a delete under a declared storage.db_only dir is retired (its database row is canonical). #8007: while gbrain.yml's
* storage section is invalid, whether a path is database-only is unknown, so its delete is retired too and named.
*/
-function retireDbOnlyDeletes(root: string, entries: readonly SyncEntry[], retired: Set<SyncEntry>): { storageInvalidKept?: string[] } {
+function retireDbOnlyDeletes(entries: readonly SyncEntry[], retired: Set<SyncEntry>, verdict: (slug: string) => boolean | 'unknown'): { storageInvalidKept?: string[] } {
const storageInvalidKept: string[] = [];
for (const entry of entries) {
- const dbOnly = entry.action === 'delete' && entry.slug ? sourceDbOnlyVerdict(root, entry.slug) : false;
+ const dbOnly = entry.action === 'delete' && entry.slug ? verdict(entry.slug) : false;
if (dbOnly) retired.add(entry);
if (dbOnly === 'unknown') storageInvalidKept.push(entry.path);
}
@@ -675,7 +691,7 @@ export async function discoverManagedSync(engine: BrainEngine, opts: SyncOpts, c
else winner.renameHeld = held;
}
}
- Object.assign(discovered, retireDbOnlyDeletes(root, selected, retired));
+ Object.assign(discovered, retireDbOnlyDeletes(selected, retired, company ? committedDbOnlyVerdict(gitRoot, target, root) : slug => sourceDbOnlyVerdict(root, slug)));
if (retired.size) discovered.entries = selected.filter(entry => !retired.has(entry));
if (collisions.length) discovered.slugCollisions = collisions;
// Identities and origin collisions were resolved over the whole target above; only the frozen manifest is cut.
diff --git a/src/core/persistence/sync-pass.ts b/src/core/persistence/sync-pass.ts
index fb090a4462..1073068c19 100644
--- a/src/core/persistence/sync-pass.ts
+++ b/src/core/persistence/sync-pass.ts
@@ -917,7 +917,7 @@ export async function readShadowLevel(engine: BrainEngine, input: { sourceId: st
}
return { sourceId, incarnation, root, gitRoot, scope, slugMode, mode, strict, head, baselineCommit, full: input.full === true, kind: kind.kind, kindBlockers: kind.blockers,
heldRenames: holds.flatMap(hold => hold.meta.rename_from ? [{ path: toGit(hold.path), rename: hold.meta.rename_from }] : []),
- releasableHolds: holds.filter(hold => !domain.has(toGit(hold.path)) || (!dbOnlyUnknown && hold.code === 'file_drift' && hold.meta.reason === 'storage_invalid' && (hold.slug === null || dbOnlyVerdict(hold.slug, storage) !== 'unknown'))).map(hold => hold.path),
+ releasableHolds: holds.filter(hold => !domain.has(toGit(hold.path)) || (!dbOnlyUnknown && hold.code === 'file_drift' && hold.meta.reason === 'storage_invalid' && (!hold.slug || dbOnlyVerdict(hold.slug, storage) !== 'unknown'))).map(hold => hold.path),
deletionCandidates: deletionCandidates(holds, path => domain.has(path) && !tree.has(path)
&& !(mode === 'working' && (untracked.has(path) || index.has(path))) && !readPresent(root, path, scope), toGit),
paths, reconcilable, ...(colon.refusals.size ? { fileRefusals: [...colon.refusals.values()] } : {}), timings_ms: timings, statements: statements + attestationStatements + 3,
diff --git a/src/core/secret-scan-labeled.ts b/src/core/secret-scan-labeled.ts
index 105e6528be..955f757d32 100644
--- a/src/core/secret-scan-labeled.ts
+++ b/src/core/secret-scan-labeled.ts
@@ -94,10 +94,11 @@ export const LABELED_CREDENTIAL_PATTERNS: readonly LabeledPattern[] = [
/**
* #7997: an importer redaction marker (`<REDACTED:kind>`) with its colon swapped, the same length, so the label
* patterns read it as one word. Its colon used to split it into a claimed `user:pass` pair, while a credential written
- * beside a marker (`login <REDACTED:user-pattern> / s3cret!`) still matches.
+ * beside a marker (`login <REDACTED:user-pattern> / s3cret!`) still matches. A marker glued to more text
+ * (`<REDACTED:x>s3cret!`) is left alone, so that text is still claimed as it was before.
*/
export function neutralizeRedactionMarkers(line: string): string {
- return line.includes('<REDACTED:') ? line.replace(/<REDACTED:(?=[A-Za-z0-9_-]{1,64}>)/g, '<REDACTED_') : line;
+ return line.includes('<REDACTED:') ? line.replace(/<REDACTED:(?=[A-Za-z0-9_-]{1,64}>[*_]{0,2}(?:[\s/:"'`.,;!?)\]}]|$))/g, '<REDACTED_') : line;
}
/** Cheap gate before the label regexes run on a line. */
diff --git a/src/core/storage-config.ts b/src/core/storage-config.ts
index 7b243aa651..0a97a93044 100644
--- a/src/core/storage-config.ts
+++ b/src/core/storage-config.ts
@@ -63,6 +63,18 @@ type RawStorage = {
supabase_only?: string[];
};
+/**
+ * The values of a one-line flow list (`[]`, `[dir/, 'other/']`), or null when `text` is not one the parser resolves: not a
+ * flow list, a nested list, or an unquoted value holding whitespace (a missing comma: `[a/ b/]`, #8015).
+ */
+function parseFlowList(text: string): string[] | null {
+ const flow = /^\[(.*)\]$/.exec(text);
+ if (!flow || /[[\]]/.test(flow[1]!)) return null;
+ const tokens = [...flow[1]!.matchAll(/\s*("[^"]*"|'[^']*'|[^,]*)\s*(?:,|$)/g)].map((m) => m[1]!.trim());
+ if (tokens.some((token) => !/^["']/.test(token) && /\s/.test(token))) return null;
+ return tokens.map((token) => token.replace(/^["']|["']$/g, '')).filter(Boolean);
+}
+
function parseStorageYaml(content: string, unknown: string[] = []): RawStorage | null {
const lines = content.split('\n').map((line) => line.replace(/\r$/, ''));
@@ -111,13 +123,8 @@ function parseStorageYaml(content: string, unknown: string[] = []): RawStorage |
const key = indented.slice(0, colon).trim();
if (STORAGE_KEYS.has(key)) {
currentList = key as keyof RawStorage;
- // Inline flow list on one line: `db_only: []` or `db_only: [dir/, 'other/']`.
- const flow = /^\[(.*)\]$/.exec(indented.slice(colon + 1).trim());
- // A nested list, or an unquoted value holding whitespace (a missing comma: `[a/ b/]`), resolves nothing (#8015).
- const tokens = flow && !/[[\]]/.test(flow[1]!) ? [...flow[1]!.matchAll(/\s*("[^"]*"|'[^']*'|[^,]*)\s*(?:,|$)/g)].map((m) => m[1]!.trim()) : null;
- if (tokens && !tokens.some((token) => !/^["']/.test(token) && /\s/.test(token))) {
- raw[currentList] = [...(raw[currentList] ?? []), ...tokens.map((token) => token.replace(/^["']|["']$/g, '')).filter(Boolean)];
- }
+ const values = parseFlowList(indented.slice(colon + 1).trim());
+ if (values) raw[currentList] = [...(raw[currentList] ?? []), ...values];
continue;
}
if (!unknown.includes(key)) unknown.push(key);
@@ -213,54 +220,7 @@ export function loadStorageConfig(repoPath?: string | null): StorageConfig | nul
// Read failure is a real error (not a "feature not configured" signal).
// Throwing here lets the caller decide whether to crash or fall back.
const content = readFileSync(yamlPath, 'utf-8');
-
- let raw: RawStorage | null;
- const unknown: string[] = [];
- try {
- raw = parseStorageYaml(content, unknown);
- } catch (error) {
- console.warn(
- `Warning: Failed to parse gbrain.yml: ${error instanceof Error ? error.message : String(error)}`,
- );
- return null;
- }
-
- // No storage section at all → null (with sanity warning).
- if (raw === null) {
- if (!_missingStorageWarned) {
- _missingStorageWarned = true;
- console.warn(
- `Warning: ${yamlPath} exists but has no storage configuration. ` +
- `Add a "storage:" section with db_tracked / db_only arrays, ` +
- `or remove gbrain.yml to suppress this warning.`,
- );
- }
- return null;
- }
-
- for (const key of unknown.filter(key => !_unknownKeysWarned.has(key))) {
- _unknownKeysWarned.add(key);
- console.warn(`Warning: ${yamlPath}: unknown storage key '${key}' is ignored; storage takes ${CANONICAL_STORAGE_KEYS.join(', ')} (see docs/storage-tiering.md).`);
- }
-
- const merged = normalizeStorageConfig(raw);
-
- // Empty storage section → return as-is but warn.
- if (merged.db_tracked.length === 0 && merged.db_only.length === 0 && !merged.keep_db?.length) {
- if (!_missingStorageWarned) {
- _missingStorageWarned = true;
- console.warn(
- `Warning: ${yamlPath} exists but has no storage configuration. ` +
- `Add a "storage:" section with db_tracked / db_only arrays, ` +
- `or remove gbrain.yml to suppress this warning.`,
- );
- }
- return merged;
- }
-
- // Normalize cosmetic issues + throw on semantic overlap (D7).
- // Throws StorageConfigError on overlap — propagates to the caller.
- return normalizeAndValidateStorageConfig(merged);
+ return storageConfigFromYaml(content, yamlPath);
}
export class StorageConfigError extends Error {
@@ -426,16 +386,75 @@ export function isKeepDbSlug(slug: string, keepDb: readonly string[]): boolean {
* `db_only: []` declares no directory and does not count.
*/
export function hasUnresolvedDbOnlyDeclaration(repoPath: string, config: StorageConfig | null): boolean {
- if (config && config.db_only.length > 0) return false;
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- repoPath is the registered local source root and the file name is a constant; this only reads its gbrain.yml
const yamlPath = join(repoPath, 'gbrain.yml');
- const yamlContent = existsSync(yamlPath) ? readFileSync(yamlPath, 'utf-8') : '';
- return yamlContent.split('\n').some((line) => {
+ return unresolvedDbOnlyIn(existsSync(yamlPath) ? readFileSync(yamlPath, 'utf-8') : '', config);
+}
+
+/**
+ * `hasUnresolvedDbOnlyDeclaration` over gbrain.yml's content. #8015: a db_only or supabase_only key whose inline value
+ * the parser refuses counts even when another key resolved, so a partly read declaration never answers "not db_only".
+ */
+export function unresolvedDbOnlyIn(content: string, config: StorageConfig | null): boolean {
+ const keys = content.split('\n').flatMap((line) => {
const trimmed = line.trim();
- if (trimmed.startsWith('#')) return false;
- const key = /^(db_only|supabase_only)\s*:(.*)$/.exec(trimmed.replace(/\s+#.*$/, ''));
- return key !== null && key[2]!.replace(/\s+/g, '') !== '[]';
+ const key = trimmed.startsWith('#') ? null : /^(db_only|supabase_only)\s*:(.*)$/.exec(trimmed.replace(/\s+#.*$/, ''));
+ return key ? [key[2]!.trim()] : [];
});
+ if (keys.some((value) => value !== '' && parseFlowList(value) === null)) return true;
+ if (config && config.db_only.length > 0) return false;
+ return keys.some((value) => value.replace(/\s+/g, '') !== '[]');
+}
+
+/** gbrain.yml content as `loadStorageConfig` reads it (`label` names the file in warnings); throws on overlapping tiers. */
+export function storageConfigFromYaml(content: string, yamlPath: string): StorageConfig | null {
+ let raw: RawStorage | null;
+ const unknown: string[] = [];
+ try {
+ raw = parseStorageYaml(content, unknown);
+ } catch (error) {
+ console.warn(
+ `Warning: Failed to parse gbrain.yml: ${error instanceof Error ? error.message : String(error)}`,
+ );
+ return null;
+ }
+
+ // No storage section at all → null (with sanity warning).
+ if (raw === null) {
+ if (!_missingStorageWarned) {
+ _missingStorageWarned = true;
+ console.warn(
+ `Warning: ${yamlPath} exists but has no storage configuration. ` +
+ `Add a "storage:" section with db_tracked / db_only arrays, ` +
+ `or remove gbrain.yml to suppress this warning.`,
+ );
+ }
+ return null;
+ }
+
+ for (const key of unknown.filter(key => !_unknownKeysWarned.has(key))) {
+ _unknownKeysWarned.add(key);
+ console.warn(`Warning: ${yamlPath}: unknown storage key '${key}' is ignored; storage takes ${CANONICAL_STORAGE_KEYS.join(', ')} (see docs/storage-tiering.md).`);
+ }
+
+ const merged = normalizeStorageConfig(raw);
+
+ // Empty storage section → return as-is but warn.
+ if (merged.db_tracked.length === 0 && merged.db_only.length === 0 && !merged.keep_db?.length) {
+ if (!_missingStorageWarned) {
+ _missingStorageWarned = true;
+ console.warn(
+ `Warning: ${yamlPath} exists but has no storage configuration. ` +
+ `Add a "storage:" section with db_tracked / db_only arrays, ` +
+ `or remove gbrain.yml to suppress this warning.`,
+ );
+ }
+ return merged;
+ }
+
+ // Normalize cosmetic issues + throw on semantic overlap (D7).
+ // Throws StorageConfigError on overlap — propagates to the caller.
+ return normalizeAndValidateStorageConfig(merged);
}
/**
diff --git a/test/company-brain-runtime.test.ts b/test/company-brain-runtime.test.ts
index 0dd5d634e5..f873d5eb04 100644
--- a/test/company-brain-runtime.test.ts
+++ b/test/company-brain-runtime.test.ts
@@ -267,6 +267,7 @@ describe('#8014: a company source keeps database-only pages its manifest lacks',
const cases: Array<[string, string, { kept: boolean; stray: boolean }]> = [
['a declared db_only page stays and a stray page outside db_only is deleted', 'storage:\n db_only: [archive/]\n', { kept: true, stray: false }],
['an invalid gbrain.yml (tiers that overlap) keeps every page whose file is missing', 'storage:\n db_only:\n - archive/\n db_tracked:\n - archive/\n', { kept: true, stray: true }],
+ ['an uncommitted gbrain.yml does not count: the approved commit decides', 'storage:\n db_only: [archive/]\n', { kept: false, stray: false }],
];
for (const [name, yml, expected] of cases) test(name, async () => withEnv({ GBRAIN_HOME: home }, async () => {
for (const engine of engines) {
@@ -281,7 +282,8 @@ describe('#8014: a company source keeps database-only pages its manifest lacks',
}
const live = async (slug: string) => (await engine.executeRaw<{ live: boolean }>('SELECT deleted_at IS NULL AS live FROM pages WHERE source_id=$1 AND slug=$2', [sourceId, slug]))[0]?.live;
writeFileSync(join(root, 'gbrain.yml'), yml);
- git(root, 'add', '.'); git(root, 'commit', '-qm', 'Synthetic storage tiers');
+ if (name.startsWith('an uncommitted')) writeFileSync(join(root, 'README.md'), '# Excluded scaffolding, edited\n');
+ git(root, 'add', name.startsWith('an uncommitted') ? 'README.md' : '.'); git(root, 'commit', '-qm', 'Synthetic storage tiers');
await performSync(engine, { sourceId });
expect({ kept: await live('archive/kept'), stray: await live('notes/stray') }).toEqual(expected);
}
diff --git a/test/secret-scan-redaction-marker-7997.test.ts b/test/secret-scan-redaction-marker-7997.test.ts
index e3e75081b9..969e15804e 100644
--- a/test/secret-scan-redaction-marker-7997.test.ts
+++ b/test/secret-scan-redaction-marker-7997.test.ts
@@ -27,6 +27,7 @@ const MARKERS: Array<[string, string]> = [
['a marker after a password label', 'password: <REDACTED:labeled_credential>'],
['a marker pair joined by a colon', 'login <REDACTED:user-pattern>:<REDACTED:user-pattern>'],
['a marker pair joined by a slash', 'login <REDACTED:user-pattern> / <REDACTED:labeled_credential>'],
+ ['a marker ending a sentence', 'login: <REDACTED:labeled_credential>.'],
];
const BESIDE: Array<[string, string]> = [
@@ -37,6 +38,13 @@ const BESIDE: Array<[string, string]> = [
['a login pair before a marker on the same line', `login alice-example / ${PW} <REDACTED:secret>`],
];
+/** A marker glued to more text is no single word: as before the fix, that text is claimed (taking part of the marker with it). */
+const GLUED: Array<[string, string]> = [
+ ['a password glued onto a marker user', `login <REDACTED:user-pattern>${PW}`],
+ ['a password glued onto a bold marker', `login: **<REDACTED:secret>**${PW}`],
+ ['a password glued onto a marker after a user name', `creds alice<REDACTED:x>${PW}`],
+];
+
describe('#7997: importer redaction markers and labeled_credential', () => {
for (const [name, line] of MARKERS) test(`${name} is no credential`, () => {
expect(scanText(line, LANE)).toEqual([]);
@@ -50,6 +58,11 @@ describe('#7997: importer redaction markers and labeled_credential', () => {
for (const marker of line.match(/<REDACTED:[a-z_-]+>/g) ?? []) expect(out).toContain(marker);
});
+ for (const [name, line] of GLUED) test(`${name} is still claimed`, () => {
+ expect(scanText(line, LANE).map(f => f.pattern)).toEqual(['labeled_credential']);
+ expect(redactFindings(line, LANE).text).not.toContain(PW);
+ });
+
test('re-redacting an imported transcript that already holds markers changes nothing', () => {
const session = (text: string): ParsedSession => ({ meta: { harness: 'codex', sessionId: 'marker-0001', startedAt: '2026-10-30T09:00:00.000Z' },
messages: [{ role: 'user', timestamp: '2026-10-30T09:00:00.000Z', text }] });
diff --git a/test/storage-config.test.ts b/test/storage-config.test.ts
index 63d6dfa1b8..1bbde458da 100644
--- a/test/storage-config.test.ts
+++ b/test/storage-config.test.ts
@@ -207,6 +207,20 @@ describe('loadStorageConfig — real-disk loader', () => {
}
});
+ test('#8015: a db_only or supabase_only list the parser refuses stays unresolved even when another key resolved', () => {
+ try {
+ for (const yml of ['storage:\n db_only: [private/]\n supabase_only: [archive/ old/]\n', 'storage:\n db_only: [archive/ old/]\n supabase_only:\n - private/\n',
+ 'storage:\n db_only:\n - private/\n supabase_only: [[archive/]]\n', 'storage:\n db_only: [private/]\n supabase_only: archive/\n']) {
+ writeFileSync(join(tmp, 'gbrain.yml'), yml);
+ expect({ yml, unresolved: hasUnresolvedDbOnlyDeclaration(tmp, loadStorageConfig(tmp)) }).toEqual({ yml, unresolved: true });
+ }
+ writeFileSync(join(tmp, 'gbrain.yml'), 'storage:\n db_only: [private/]\n supabase_only: []\n');
+ expect(hasUnresolvedDbOnlyDeclaration(tmp, loadStorageConfig(tmp))).toBe(false);
+ } finally {
+ cleanup();
+ }
+ });
+
test('#8007/#8015: the dirs of a deprecated supabase_only list ignored next to canonical keys, minus those db_only covers, are unknown to delete decisions', () => {
try {
writeFileSync(join(tmp, 'gbrain.yml'), 'storage:\n db_only: [private/]\n supabase_only:\n - archive/\n');