Running as unit: run-p722594-i25887534.scope; invocation ID: 6f4ce06d5ad241fba3805a1783fb50df bun test v1.4.4 (38afee6c8) student-tests/openobserve-account-workflow.test.ts: 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); ^ error: expect(received).toEqual(expected) [ - "positive:ingest", - "deny:ingest", - "positive:query", - "deny:query", "publish", ] - Expected - 4 + Received + 0 at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:4:167) (fail) saved native200 and403 accounts publish only after both account controls [15.30ms] 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:5:191) (fail) positive HTTP401 cannot publish derived credentials [0.26ms] 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:5:191) (fail) positive HTTP503 cannot publish derived credentials [0.06ms] 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:5:191) (fail) positive HTTP201 cannot publish derived credentials [0.06ms] 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:6:198) (fail) unexpected deny HTTP200 cannot publish derived credentials [0.14ms] 1 | import{expect,test}from"bun:test";import{createAccountWorkflow,type Account,type Principal}from"../scripts/openobserve-accounts"; 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:6:198) (fail) unexpected deny HTTP503 cannot publish derived credentials [0.05ms] 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 7 | for(const patch of [{user:"vp7-owner@example.invalid"},{user:"foreign@example.invalid"},{token:""},{token:"bad\nvalue"}])test(`invalid saved query shape ${Object.keys(patch)[0]} cannot publish or probe`,async()=>{const p=ports(),saved=accounts();saved.query={...saved.query,...patch};await expect(createAccountWorkflow(p)(saved)).rejects.toThrow("OPENOBSERVE_ACCOUNT_INVALID_RESPONSE");expect(p.events).toEqual([])}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:7:339) (fail) invalid saved query shape user cannot publish or probe [0.13ms] 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 7 | for(const patch of [{user:"vp7-owner@example.invalid"},{user:"foreign@example.invalid"},{token:""},{token:"bad\nvalue"}])test(`invalid saved query shape ${Object.keys(patch)[0]} cannot publish or probe`,async()=>{const p=ports(),saved=accounts();saved.query={...saved.query,...patch};await expect(createAccountWorkflow(p)(saved)).rejects.toThrow("OPENOBSERVE_ACCOUNT_INVALID_RESPONSE");expect(p.events).toEqual([])}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:7:339) (fail) invalid saved query shape user cannot publish or probe [0.04ms] 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 7 | for(const patch of [{user:"vp7-owner@example.invalid"},{user:"foreign@example.invalid"},{token:""},{token:"bad\nvalue"}])test(`invalid saved query shape ${Object.keys(patch)[0]} cannot publish or probe`,async()=>{const p=ports(),saved=accounts();saved.query={...saved.query,...patch};await expect(createAccountWorkflow(p)(saved)).rejects.toThrow("OPENOBSERVE_ACCOUNT_INVALID_RESPONSE");expect(p.events).toEqual([])}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:7:339) (fail) invalid saved query shape token cannot publish or probe [0.04ms] 2 | const accounts=()=>({ingest:{user:"vp7-ingest@example.invalid",token:"SyntheticIngestToken-123"},query:{user:"vp7-query@example.invalid",token:"SyntheticQueryToken-123"}}); 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 7 | for(const patch of [{user:"vp7-owner@example.invalid"},{user:"foreign@example.invalid"},{token:""},{token:"bad\nvalue"}])test(`invalid saved query shape ${Object.keys(patch)[0]} cannot publish or probe`,async()=>{const p=ports(),saved=accounts();saved.query={...saved.query,...patch};await expect(createAccountWorkflow(p)(saved)).rejects.toThrow("OPENOBSERVE_ACCOUNT_INVALID_RESPONSE");expect(p.events).toEqual([])}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:7:339) (fail) invalid saved query shape token cannot publish or probe [0.03ms] 3 | function ports(positive=200,deny=403){const events:string[]=[];return{events,positive:async(name:Principal)=>{events.push("positive:"+name);return positive},deny:async(name:Principal)=>{events.push("deny:"+name);return deny},publish:async(_accounts:Record)=>{events.push("publish")}}} 4 | test("saved native200 and403 accounts publish only after both account controls",async()=>{const p=ports();await createAccountWorkflow(p)(accounts());expect(p.events).toEqual(["positive:ingest","deny:ingest","positive:query","deny:query","publish"])}); 5 | for(const status of [401,503,201])test(`positive HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_POSITIVE_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 6 | for(const status of [200,503])test(`unexpected deny HTTP${status} cannot publish derived credentials`,async()=>{const p=ports(200,status);await expect(createAccountWorkflow(p)(accounts())).rejects.toThrow(`OPENOBSERVE_CREDENTIAL_INGEST_DENY_HTTP_${status}`);expect(p.events).not.toContain("publish")}); 7 | for(const patch of [{user:"vp7-owner@example.invalid"},{user:"foreign@example.invalid"},{token:""},{token:"bad\nvalue"}])test(`invalid saved query shape ${Object.keys(patch)[0]} cannot publish or probe`,async()=>{const p=ports(),saved=accounts();saved.query={...saved.query,...patch};await expect(createAccountWorkflow(p)(saved)).rejects.toThrow("OPENOBSERVE_ACCOUNT_INVALID_RESPONSE");expect(p.events).toEqual([])}); 8 | test("extra owner slot never reaches credential publication",async()=>{const p=ports();await expect(createAccountWorkflow(p)({...accounts(),owner:{user:"vp7-owner@example.invalid",token:"owner-slot"}} as any)).rejects.toThrow("OPENOBSERVE_ACCOUNT_SLOTS_INVALID");expect(p.events).toEqual([])}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/mnt/data/home/bench-saves/mtuci-vp7-security-20261115/student-tests/openobserve-account-workflow.test.ts:8:219) (fail) extra owner slot never reaches credential publication [0.13ms] (pass) workflow requires explicit native and publishing ports [0.05ms] 1 pass 11 fail 12 expect() calls Ran 12 tests across 1 file. [21.00ms]