mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-27 23:58:51 +00:00
* feat(dsh): connect registry accounts and manage namespace skills and members Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): use the patched ZIP reader for skill packages Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): bind owned skill actions to the published version ID Signed-off-by: dongmucat <1127093059@qq.com> * fix(auth): handle context-prefixed registry requests consistently Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): address account isolation and upload review findings Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): recover changed upload targets and clear private detail caches Signed-off-by: dongmucat <1127093059@qq.com> * refactor(dsh): keep registry authentication inside the plugin Signed-off-by: dongmucat <1127093059@qq.com> * test(dsh): canonicalize temporary profile roots across platforms Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): clear expired accounts during detail reads Signed-off-by: dongmucat <1127093059@qq.com> * fix(auth): include DSH permissions in default personal tokens Signed-off-by: dongmucat <1127093059@qq.com> * fix(web): refresh token form analytics manifest Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): organize account dialogs and preserve modal focus Signed-off-by: dongmucat <1127093059@qq.com> * fix(ci): pin DSH browser checks to supported Ubuntu Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): unify workbench appearance and source navigation Signed-off-by: dongmucat <1127093059@qq.com> * test(dsh): wait for runtime readiness before availability install Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): align namespace pages with the account prototype Signed-off-by: dongmucat <1127093059@qq.com> * test(dsh): use monotonic clocks for fixture deadlines Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): expose namespace member management actions Add a direct member-management entry, explain disabled role and state restrictions, and preserve keyboard focus after membership changes. Exercise add, role change and removal through the real account components. Signed-off-by: dongmucat <1127093059@qq.com> * feat(dsh): support drag and drop skill uploads Use one validated file selection flow for dropping and browsing ZIPs. Show selected file details, protect in-flight uploads and confirmation revisions, and cover keyboard, busy and invalid-file behavior in Chromium. Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): right-align the catalog upload action Signed-off-by: dongmucat <1127093059@qq.com> * feat(dsh): persist Windows account credentials securely Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): remove saved accounts reliably on Windows Unicode paths Signed-off-by: dongmucat <1127093059@qq.com> * test(organizations): isolate committed portal fixtures Signed-off-by: dongmucat <1127093059@qq.com> * fix(auth): preserve token lifecycle state during usage updates Signed-off-by: dongmucat <1127093059@qq.com> * fix(skills): enforce caller-aware deletion across CLI endpoints Signed-off-by: dongmucat <1127093059@qq.com> * fix(dsh): submit account writes once and refresh registry views Signed-off-by: dongmucat <1127093059@qq.com> * chore(db): reserve unpublished token migration after upstream V128 Signed-off-by: dongmucat <1127093059@qq.com> --------- Signed-off-by: dongmucat <1127093059@qq.com>
46 lines
2.5 KiB
TypeScript
46 lines
2.5 KiB
TypeScript
import { expect, test } from 'bun:test';
|
|
import { QueryClient } from '@tanstack/react-query';
|
|
import { invalidateRegistrySkill, queryHasSource, readCacheOptions } from '../src/client/read-cache.js';
|
|
|
|
test('logout removes direct and compound private query keys for only the old source', () => {
|
|
const client = new QueryClient();
|
|
const revision = 'old-source';
|
|
const oldIdentity = JSON.stringify(['session', revision, 'team', 'skill', '1.0']);
|
|
const nextIdentity = JSON.stringify(['session', 'new-source', 'team', 'skill', '1.0']);
|
|
const keys = [
|
|
['account-owned', revision, 'team', 0],
|
|
['skillhub-module', oldIdentity, 'reviews', 0],
|
|
['skillhub-files', oldIdentity, 'detail-token'],
|
|
['skillhub-file', oldIdentity, 'detail-token', 'private.md'],
|
|
['skillhub-module', nextIdentity, 'reviews', 0],
|
|
];
|
|
for (const key of keys) client.setQueryData(key, 'private fixture');
|
|
client.removeQueries({ predicate: query => queryHasSource(query.queryKey, revision) });
|
|
for (const key of keys.slice(0, 4)) expect(client.getQueryData(key)).toBeUndefined();
|
|
expect(client.getQueryData<string>(keys[4]!)).toBe('private fixture');
|
|
expect(queryHasSource(['module', '[malformed'], revision)).toBe(false);
|
|
expect(queryHasSource(['module', 'prefix-old-source-suffix'], revision)).toBe(false);
|
|
client.clear();
|
|
});
|
|
|
|
test('a skill write refreshes its Registry views without evicting unrelated cached results', async () => {
|
|
const client = new QueryClient();
|
|
const versions = (source: string, slug: string) => ['skillhub-module', JSON.stringify(['session', source, 'team', slug, '1.0']), 'versions', 0];
|
|
const affected = [
|
|
['account-owned', 'source', 'team', 0], ['account-team', 'source', 'team', ''],
|
|
['skillhub-catalog', 'source', '', 'newest', ''], ['skillhub-detail', 'source', 'team', 'example', '1.0'],
|
|
versions('source', 'example'),
|
|
];
|
|
const unaffected = [
|
|
['skillhub-catalog', 'another-source', '', 'newest', ''], ['account-team', 'source', 'other-team', ''],
|
|
['skillhub-detail', 'source', 'team', 'other', '1.0'], versions('another-source', 'example'), versions('source', 'other'),
|
|
];
|
|
let generation = 1;
|
|
const read = (queryKey: unknown[]) => client.fetchQuery({ ...readCacheOptions, queryKey, queryFn: () => generation });
|
|
for (const key of [...affected, ...unaffected]) expect(await read(key)).toBe(1);
|
|
generation++;
|
|
invalidateRegistrySkill(client, 'source', 'team', 'example');
|
|
for (const key of affected) expect(await read(key)).toBe(2);
|
|
for (const key of unaffected) expect(await read(key)).toBe(1);
|
|
client.clear();
|
|
});
|