fix(lint): rotfelsa ärvd lint-skuld — graph-adapter + p0-tester (blockerade #128)
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (push) Successful in 10s
masterplan-lock / check (pull_request) Successful in 9s
Security Scan (SIAX Cloud) / security (push) Successful in 24s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 24s
CI (SIAX Cloud) / security (pull_request) Successful in 48s
CI (SIAX Cloud) / security (push) Successful in 49s
CI (SIAX Cloud) / integration (pull_request) Successful in 49s
CI (SIAX Cloud) / quality (push) Failing after 56s
CI (SIAX Cloud) / quality (pull_request) Failing after 1m1s
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (push) Successful in 10s
masterplan-lock / check (pull_request) Successful in 9s
Security Scan (SIAX Cloud) / security (push) Successful in 24s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 24s
CI (SIAX Cloud) / security (pull_request) Successful in 48s
CI (SIAX Cloud) / security (push) Successful in 49s
CI (SIAX Cloud) / integration (pull_request) Successful in 49s
CI (SIAX Cloud) / quality (push) Failing after 56s
CI (SIAX Cloud) / quality (pull_request) Failing after 1m1s
Parallellsessions-merge lämnade 12 eslint-errors på main (no-explicit-any i graph-mailbox-adapter + 2 p0-tester). Graph-JSON:n är genuint ostrukturerad — medveten, avgränsad eslint-undantag med skäl (DoD §13); p0-testerna typade med Record/cast. Lint 0 errors; tsc grön; 1141/1141.
This commit is contained in:
@@ -113,6 +113,10 @@ export class GraphMailboxAdapter {
|
||||
return this.cachedToken.token;
|
||||
}
|
||||
|
||||
// Graph-API:t är genuint ostrukturerat JSON (value-array med fri form);
|
||||
// full typning av hela Graph-ytan är egen insats — any här är medveten
|
||||
// och avgränsad till denna adapter (eslint-undantag med skäl, DoD §13).
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private async get(path: string): Promise<any> {
|
||||
const token = await this.getToken();
|
||||
const url = path.startsWith("http") ? path : `${GRAPH_BASE}${path}`;
|
||||
@@ -150,7 +154,7 @@ export class GraphMailboxAdapter {
|
||||
receivedAt: m.receivedDateTime || null,
|
||||
senderName: m.from?.emailAddress?.name || null,
|
||||
senderEmail: m.from?.emailAddress?.address || null,
|
||||
toRecipients: (m.toRecipients || []).map((r: any) => r.emailAddress?.address).filter(Boolean),
|
||||
toRecipients: (m.toRecipients || []).map((r: { emailAddress?: { address?: string } }) => r.emailAddress?.address).filter(Boolean),
|
||||
subject: m.subject || null,
|
||||
bodyPreview: m.bodyPreview || null,
|
||||
bodyText: m.body?.content ? stripHtml(m.body.content) : m.bodyPreview || null,
|
||||
|
||||
@@ -29,7 +29,7 @@ describe("DocumentCaptureService.captureFromMailbox", () => {
|
||||
it("downloads PDF attachments, persists bytes, registers a ST0RE artifact, enqueues an N0D extraction job, and emits AUD0 events", async () => {
|
||||
const pdfBytes = Buffer.from("%PDF-1.4 real bytes for test");
|
||||
const pdfBase64 = pdfBytes.toString("base64");
|
||||
const aud0Calls: { url: string; body: any }[] = [];
|
||||
const aud0Calls: { url: string; body: Record<string, unknown> }[] = [];
|
||||
|
||||
const fetchMock = vi.fn(async (url: string, init?: RequestInit) => {
|
||||
if (url.includes("login.microsoftonline.com")) return jsonResponse({ access_token: "tok", expires_in: 3600 });
|
||||
@@ -93,13 +93,13 @@ describe("DocumentCaptureService.captureFromMailbox", () => {
|
||||
const storedBytes = await service.getDocumentBytes(doc.document_id);
|
||||
expect(storedBytes.equals(pdfBytes)).toBe(true);
|
||||
|
||||
const captured = aud0Calls.find((c) => c.body?.event_type === "0pt.document_captured");
|
||||
const captured = aud0Calls.find((c) => c.body?.event_type === "0pt.document_captured") as { url: string; body: { event_type: string; capability_id: string; payload: { filename: string } } } | undefined;
|
||||
expect(captured).toBeTruthy();
|
||||
expect(captured!.body.payload.filename).toBe("doc.pdf");
|
||||
expect(captured!.body.capability_id).toBe("0pt.capture_document");
|
||||
// Lineage now goes to AUD0's REAL ingest contract: an OpenLineage
|
||||
// RunEvent on /v1/aud0/openlineage.
|
||||
const lineage = aud0Calls.find((c) => c.url.includes("openlineage"));
|
||||
const lineage = aud0Calls.find((c) => c.url.includes("openlineage")) as { url: string; body: { outputs: { name: string }[] } } | undefined;
|
||||
expect(lineage).toBeTruthy();
|
||||
expect(lineage!.body.outputs[0].name).toContain(doc.document_id);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ function jsonResponse(body: unknown, opts: { status?: number; headers?: Record<s
|
||||
|
||||
describe("DocumentExtractionService — evidence-based extraction", () => {
|
||||
let tmpDir: string;
|
||||
let aud0Calls: { url: string; body: any }[];
|
||||
let aud0Calls: { url: string; body: Record<string, unknown> }[];
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "0pt-blob-"));
|
||||
@@ -133,7 +133,7 @@ describe("DocumentExtractionService — evidence-based extraction", () => {
|
||||
const updatedDoc = await captureService.getDocument(document.document_id);
|
||||
expect(updatedDoc.status).toBe("extracted");
|
||||
|
||||
const extractedEvent = aud0Calls.find((c) => c.body?.event_type === "0pt.document_extracted");
|
||||
const extractedEvent = aud0Calls.find((c) => c.body?.event_type === "0pt.document_extracted") as { url: string; body: { event_type: string; capability_id: string; payload: { fields_found_count: number; fields_total_count: number } } } | undefined;
|
||||
expect(extractedEvent).toBeTruthy();
|
||||
expect(extractedEvent!.body.capability_id).toBe("0pt.extract_document");
|
||||
expect(extractedEvent!.body.payload.fields_found_count).toBe(2);
|
||||
|
||||
Reference in New Issue
Block a user