mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-11 23:32:31 +00:00
client-reliability-7: notify the current feed on live video updates
This commit is contained in:
1 parent
4e90434992
commit
fecf42948f
8 files changed
+331
-2
No files matched your search
@@ -0,0 +1,55 @@
|
||||
# Item7 live feed consumer notification
|
||||
|
||||
```yaml
|
||||
test_integrity_note:
|
||||
change_type: ["new_tests"]
|
||||
scenarios:
|
||||
- id: SCN-cold-live-feed
|
||||
given: "actual service cold cache and controlled eligible/ineligible subscription arrivals"
|
||||
when: "two live batches arrive"
|
||||
then: "consumer,events and persisted cache expose same full ordered eligible snapshots"
|
||||
- id: SCN-latest-feed-consumer
|
||||
given: "one live relay subscription and successive loadVideos consumers"
|
||||
when: "consumer switches then becomes event-only"
|
||||
then: "only latest consumer receives live updates;event-only updates still emit and persist"
|
||||
- id: SCN-replaced-feed-subscription
|
||||
given: "live subscription is force-replaced then cleared"
|
||||
when: "old controlled callbacks arrive after unsubscribe"
|
||||
then: "no stale callback effects;current subscription notifies and persists normally"
|
||||
- id: SCN-live-deletion
|
||||
given: "two cached videos"
|
||||
when: "deletion-only,mixed deletion+addition,and final deletion arrive"
|
||||
then: "consumer gets reduced,updated and empty full snapshots;deleted metadata and persistence preserved"
|
||||
- id: SCN-live-consumer-throw
|
||||
given: "consumer throws on first live arrival"
|
||||
when: "two live batches arrive"
|
||||
then: "service events,persistence and later callback delivery remain intact"
|
||||
- id: SCN-warm-live-feed
|
||||
given: "persistent warm cache and empty in-memory input"
|
||||
when: "load then live arrival"
|
||||
then: "optimistic data survives without empty flash;live snapshot includes old and new entries"
|
||||
- id: SCN-event-only-filtered-feed
|
||||
given: "no onVideos consumer"
|
||||
when: "empty,ineligible,then eligible updates arrive"
|
||||
then: "empty/ineligible updates do not notify/cache;eligible update emits and persists without consumer"
|
||||
observable_outcomes:
|
||||
- "real loadVideos callback values,service events,shared map and localStorage snapshots"
|
||||
- "latest callback ownership,unsubscribe lifecycle and no stale effects"
|
||||
determinism_controls:
|
||||
- "controlled nostrClient.subscribeVideos boundary;actual service filter/cache/persistence/emitter"
|
||||
- "fixed videos/order,isolated shared state/storage;global network guards;no sleeps/retries/public traffic"
|
||||
- "teardown restores globals/map/subscription/storage and verifies owned subscriptions close"
|
||||
anti_cheat_rationale:
|
||||
prevents:
|
||||
- "event-only/source-string assertion mistaken for actual consumer delivery"
|
||||
- "notify delta or stale first consumer instead of current full-list consumer"
|
||||
- "lose deletion/event/persistence on callback exceptions or no consumer"
|
||||
- "filter bypass or optimistic cache flash"
|
||||
relaxation:
|
||||
did_relax_any_assertion: false
|
||||
if_true_explain_spec_basis: ""
|
||||
```
|
||||
|
||||
Nine isolated runtime loader mutants all naturally exit1/0cancel and restore at process termination: missing-live kills scenarios1-6;delta-only kills1/4/5/6;ignore-deletions kills4;uncaught-consumer kills5;first-consumer kills2;late-callback kills3;event-only-drop kills2/7;retained-on-clear kills3;filter-bypass kills1/7. No source file changed during mutation runs; no arbitrary sleeps/retries/relaxed assertions. Outputs `/tmp/item7-mutant-*.log` and `/tmp/item7-mutants.json`.
|
||||
|
||||
Scope is service notification contract with controlled client IO;not real wire parser/signing/relay/bootstrap/DOM/mobile proof. QA measured actual app failure independently and owns postlanding qualification. Existing suites are unchanged.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Item7 ready evidence
|
||||
|
||||
- Baseline4e90434992471c3c6b40b017c6eae133aec92b62;filed386cc60e source unchanged. `env -u NODE_TEST_CONTEXT NODE_ENV=test node tests/nostr-service-live-feed-notification.test.mjs` beforeproductedit naturalexit1:4fail1pass/0cancel/0skip (`/tmp/item7-before.log`);cached0→eligiblefull3/persisted3 but consumer receives only cache0. Deletion/warm/throw scenarios also fail;ineligible/event-only controls pass.
|
||||
- First8line closed-over callback addition5/5 passed;then latest-consumer/force/clear controls failnaturally,5pass2fail/0cancel (`/tmp/item7-first-callback-controls.log`). Revised service19added lines (loadVideos+constructor/clear state)7/7 naturalexit0,0fail/cancel/skip (`/tmp/item7-owned-after.log`). No existing tests changed.
|
||||
- `python3 /tmp/item7-mutants.py`:9/9 isolated source-loader mutants each naturalexit1,0cancelled,named assertions;no disk source mutation. Summary `/tmp/item7-mutants.json`,outputs `/tmp/item7-mutant-*.log`;mapping unique integrity note.
|
||||
- Five focused files executed sequentially with `env` NODE_TEST_CONTEXT removed,NODE_ENV=test,each `node --import ./tests/test-helpers/setup-localstorage.mjs <file>` and existing60s/file diagnostic bound. New7+access-ready4+access5+service6+channelcache5=27pass,all5processesexit0 (`/tmp/item7-focused.log`). Access5 prints five TAP ok lines but has pre-existing forced-exit afterhook/no final summary;not edited. Otherfiles0fail/cancel/skip.
|
||||
- `env -u NODE_TEST_CONTEXT npm run lint` naturalexit0,11stages (`/tmp/item7-lint.log`). `git diff --check` exit0.
|
||||
- No live network,signer/protocol changes,full/build/browser run. Fake client only controls subscription/cache input and existing access boundary;actual service filter/cache/emitter/persistence. Cleanup restores shared app map/subscription/storage/globals and closes owned subscriptions. Service moderation disabled in fixture to avoid unrelated singleton refresh side effects.
|
||||
- QA owns actual app retest and dispatch preview rebuild. Waiting explicit full normal slot;single unchanged normal gate authoritative full candidate run,no duplicate full solely for logs. Live relay/signing/real peers/core/mobile remain unverified by these service tests.
|
||||
Reference in new issue
Block a user