Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: pin the app-removal and archive/delete log lines (#12979)

[._.]/ Adam Eivy8f073bc9f24b
diff --git a/server/services/apps.test.js b/server/services/apps.test.js
index 6939c028cf..88a57d13af 100644
--- a/server/services/apps.test.js
+++ b/server/services/apps.test.js
@@ -382,6 +382,17 @@ describe('deleteApp', () => {
expect(persisted.apps[PORTOS_APP_ID]).toMatchObject({ name: 'PortOS' });
});
+ it('logs the removed app id once the registry write lands', async () => {
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {});
+ try {
+ readJSONFile.mockResolvedValue({ apps: { [PORTOS_APP_ID]: { name: 'PortOS' }, 'app-1': { name: 'Example App' } } });
+ await expect(deleteApp('app-1')).resolves.toBe(true);
+ expect(log).toHaveBeenCalledWith('🗑️ Removed app app-1 from registry');
+ } finally {
+ log.mockRestore();
+ }
+ });
+
it('protects the PortOS baseline record', async () => {
await expect(deleteApp(PORTOS_APP_ID)).resolves.toBe(false);
expect(readJSONFile).not.toHaveBeenCalled();
diff --git a/server/services/dataManager.archive.test.js b/server/services/dataManager.archive.test.js
index 479efa8988..6137ed60c2 100644
--- a/server/services/dataManager.archive.test.js
+++ b/server/services/dataManager.archive.test.js
@@ -312,6 +312,32 @@ describe('health archive/import coordination (#10698)', () => {
}
});
+describe('archive and delete operations leave a log line (#12979)', () => {
+ it('logs the health archive counts and the deleted archive name', async () => {
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {});
+ try {
+ await seedHealth();
+ const result = await archiveCategory('health', { daysToKeep: 365 });
+ const archiveName = basename(result.archivePath);
+ expect(log).toHaveBeenCalledWith(`📦 Archived data/health to ${archiveName}: 1 days, 1 removed, 0 retained, 0 already absent`);
+ await deleteBackup(archiveName);
+ expect(log).toHaveBeenCalledWith(`🗑️ Deleted backup archive ${archiveName}`);
+ } finally {
+ log.mockRestore();
+ }
+ });
+
+ it('does not log a refused delete', async () => {
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {});
+ try {
+ await expect(deleteBackup('state.json')).rejects.toMatchObject({ code: 'INVALID_FILENAME' });
+ expect(log).not.toHaveBeenCalledWith(expect.stringContaining('Deleted backup archive'));
+ } finally {
+ log.mockRestore();
+ }
+ });
+});
+
describe('backup directory shared with the backup service state (#11781)', () => {
it('lists and deletes only archive-shaped names, never state.json', async () => {
const backup = join(root, 'backup');