Skip to content

Commit ca07af6

Browse files
committed
fix(collab): mirror the owner's deriveddata- prefix rule
The owner hides any `deriveddata-*` name (isIgnoredProjectDirName falls back to a startsWith check), but the push only carried the `.env` prefix, so Xcode's prefixed derived-data directories still fanned out to every member mirror. Send the rule directory-scoped, matching how the owner applies it and leaving a regular file that happens to start with the prefix as ordinary project content.
1 parent e01efc7 commit ca07af6

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

apps/daemon/src/collab/vela-cli-resource-adapter.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,21 @@ const MEMBER_MIRROR_EXCLUDED_ENTRIES = [
7373
'terraform.tfstate',
7474
'terraform.tfstate.backup',
7575
] as const;
76-
const MEMBER_MIRROR_EXCLUDED_PREFIXES = ['.env'] as const;
76+
/**
77+
* Name prefixes a snapshot skips.
78+
*
79+
* `.env` is secret-bearing, so it is bare and matches any entry type — a
80+
* `.env.local` file and a stray `.envrc` directory are equally unwelcome in a
81+
* member mirror.
82+
*
83+
* `deriveddata-` mirrors the owner-side rule (`isIgnoredProjectDirName` treats
84+
* any `deriveddata-*` name as hidden) and is directory-scoped for the same
85+
* reason the generated-tree names are: a regular file starting with that
86+
* prefix is ordinary project content. See
87+
* {@link MEMBER_MIRROR_PUSH_EXCLUDED_ENTRIES} for the trailing-slash contract
88+
* and why it degrades safely on a Vela that predates it.
89+
*/
90+
const MEMBER_MIRROR_EXCLUDED_PREFIXES = ['.env', 'deriveddata-/'] as const;
7791

7892
/**
7993
* Every entry name a `vela resource push` snapshot skips.

apps/daemon/tests/vela-cli-resource-adapter.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ describe('createVelaCliResourceAdapter', () => {
132132
...EXPECTED_PUSH_EXCLUDE_ARGS,
133133
'--exclude-prefix',
134134
'.env',
135+
'--exclude-prefix',
136+
'deriveddata-/',
135137
]);
136138
});
137139

@@ -155,6 +157,21 @@ describe('createVelaCliResourceAdapter', () => {
155157
expect(calls[0]![prefixAt + 1]).toBe('.env');
156158
});
157159

160+
it('carries the owner-side deriveddata- prefix rule, directory-scoped', async () => {
161+
const { run, calls } = recordingRun({ push: JSON.stringify({ version: 1 }) });
162+
const adapter = createVelaCliResourceAdapter({ ...OPTS, run });
163+
await adapter.publish({ projectId: 'p1', reason: 'edit' });
164+
165+
const prefixes = calls[0]!.flatMap((arg, i) =>
166+
arg === '--exclude-prefix' ? [calls[0]![i + 1]!] : []);
167+
// The owner hides any `deriveddata-*` DIRECTORY; a regular file starting
168+
// with that prefix is ordinary content and must still reach members.
169+
expect(prefixes).toContain('deriveddata-/');
170+
expect(prefixes).not.toContain('deriveddata-');
171+
// `.env` stays bare: a secret is unwelcome as a file or a directory.
172+
expect(prefixes).toContain('.env');
173+
});
174+
158175
it('scopes generated-tree exclusions to directories so same-named files still sync', async () => {
159176
const { run, calls } = recordingRun({ push: JSON.stringify({ version: 1 }) });
160177
const adapter = createVelaCliResourceAdapter({ ...OPTS, run });
@@ -196,6 +213,8 @@ describe('createVelaCliResourceAdapter', () => {
196213
...EXPECTED_PUSH_EXCLUDE_ARGS,
197214
'--exclude-prefix',
198215
'.env',
216+
'--exclude-prefix',
217+
'deriveddata-/',
199218
'--metadata-json',
200219
JSON.stringify({ name: 'Launch Deck', metadata: { kind: 'deck' } }),
201220
]);

0 commit comments

Comments
 (0)