feat(git): Hinweis im Account-Panel, Startlog, Fehlersuche und Betriebs-Compose (#30)
- Panel zeigt bei 503/G10 und 403/G07 einen Hinweis statt sich auszublenden; ohne Login unsichtbar - Startlog: Info-Zeile bei aktivem Backend (kid, Allowlist), ohne Secrets - docs/git: Abschnitt Fehlersuche / nachträglich aktivieren - docs/deploy: compose.yaml-Vorlage für das veröffentlichte Image, Verlinkung aus README/FORK/auth/storage - Dev-Compose reicht HB_ASSET_* durch Refs #30 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3b83125771
commit
f96dec267b
17 files changed
+439
-181
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { classifyListError, NOTICES } from '../../client/fork/git/panelState.js';
|
||||
|
||||
describe('Git-Panel: Zustand aus dem Listen-Fehler (FLW-258)', ()=>{
|
||||
test('503 G10: Hinweis „nicht aktiviert“ mit Verweis auf docs/git', ()=>{
|
||||
const r = classifyListError({ status: 503, HBErrorCode: 'G10' });
|
||||
expect(r).toEqual({ state: 'notice', notice: NOTICES.disabled });
|
||||
expect(r.notice).toMatch(/nicht aktiviert.*docs\/git/);
|
||||
});
|
||||
test('403 G07: Hinweis „Nur mit OIDC-Anmeldung verfügbar“', ()=>{
|
||||
expect(classifyListError({ status: 403, HBErrorCode: 'G07' })).toEqual({ state: 'notice', notice: 'Nur mit OIDC-Anmeldung verfügbar.' });
|
||||
});
|
||||
test('401 (nicht angemeldet): Panel bleibt unsichtbar', ()=>{
|
||||
expect(classifyListError({ status: 401, HBErrorCode: '04' })).toEqual({ state: 'hidden' });
|
||||
});
|
||||
test('andere Fehler (G05-503, 500, Netzwerk): Panel mit Fehlermeldung, kein Hinweis', ()=>{
|
||||
expect(classifyListError({ status: 503, HBErrorCode: 'G05' }).state).toBe('error');
|
||||
expect(classifyListError({ status: 500 }).state).toBe('error');
|
||||
expect(classifyListError(new Error('offline')).state).toBe('error');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createGitBackend } from '../../server/fork/git/index.js';
|
||||
import { configureGitHooks } from '../../server/fork/git/hooks.js';
|
||||
|
||||
const KEY = Buffer.alloc(32, 7).toString('base64');
|
||||
const boot = (env)=>{
|
||||
const logger = { warn: jest.fn(), info: jest.fn(), error: jest.fn() };
|
||||
createGitBackend({ getStorage: ()=>({}), api: {}, splitTextStyleAndMetadata: ()=>({}), env, logger });
|
||||
configureGitHooks(undefined);
|
||||
return logger;
|
||||
};
|
||||
|
||||
describe('Git-Backend: Startlog (FLW-258)', ()=>{
|
||||
test('ohne Schlüssel: Warnung, keine Info-Zeile', ()=>{
|
||||
const l = boot({});
|
||||
expect(l.warn).toHaveBeenCalledWith(expect.stringMatching(/deaktiviert.*HB_GIT_TOKEN_KEY/));
|
||||
expect(l.info).not.toHaveBeenCalled();
|
||||
});
|
||||
test('mit Schlüssel: Info mit kid und Allowlist, ohne Secrets', ()=>{
|
||||
const l = boot({ HB_GIT_TOKEN_KEY: KEY, HB_GIT_ALLOWED_HOSTS: 'git.example.org' });
|
||||
expect(l.warn).not.toHaveBeenCalled();
|
||||
const line = l.info.mock.calls[0][0];
|
||||
expect(line).toMatch(/aktiv \(kid=[0-9a-f]{8}.*Host-Allowlist: ja/);
|
||||
expect(line).not.toContain(KEY);
|
||||
});
|
||||
test('ohne Allowlist: „nein“', ()=>{
|
||||
expect(boot({ HB_GIT_TOKEN_KEY: KEY }).info.mock.calls[0][0]).toMatch(/Host-Allowlist: nein/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user