Repository navigation
Add inactive retained video projection contract #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| -- Test-only setup. Never part of retained-video.sql or a hosted migration. | ||
| CREATE SCHEMA video_fixture; | ||
| CREATE TABLE video_fixture.state(data jsonb); | ||
| GRANT USAGE ON SCHEMA video_fixture TO service_role; | ||
| GRANT SELECT ON video_fixture.state TO service_role; | ||
| CREATE FUNCTION video_fixture.seed() RETURNS jsonb LANGUAGE plpgsql AS $$ | ||
| DECLARE owner_id uuid:='10000000-0000-4000-8000-000000000001'; actor uuid:='10000000-0000-4000-8000-000000000002'; | ||
| outsider uuid:='10000000-0000-4000-8000-000000000003'; req jsonb; subject uuid; resource uuid; link uuid; | ||
| source uuid:=gen_random_uuid(); dependency uuid:=gen_random_uuid(); snapshot uuid:=gen_random_uuid(); version uuid:=gen_random_uuid(); | ||
| e jsonb; manifest jsonb; state jsonb; | ||
| BEGIN | ||
| IF current_database() NOT IN ('video_normal','video_compat') | ||
| OR inet_server_addr() IS NOT NULL | ||
| OR current_setting('listen_addresses') <> '' | ||
| OR current_setting('video_fixture.expected_data_directory',true) IS DISTINCT FROM current_setting('data_directory') | ||
| OR current_setting('video_fixture.expected_socket_directory',true) IS DISTINCT FROM current_setting('unix_socket_directories') THEN | ||
| RAISE EXCEPTION 'Video fixture seeding is test-only' USING ERRCODE='42501'; | ||
| END IF; | ||
| TRUNCATE public.accounts,public.context_resources,public.context_sources CASCADE; | ||
| TRUNCATE video_fixture.state,public.account_organization_ids; | ||
| INSERT INTO public.accounts(id,name) VALUES(owner_id,'Fixture owner'),(actor,'Fixture member'),(outsider,'Fixture outsider'); | ||
| INSERT INTO public.account_organization_ids(account_id,organization_id) VALUES(actor,owner_id); | ||
| req:=public.create_context_video_request(owner_id,actor,'AbCdEfGhI_1','locator'); | ||
| SELECT resource_id,(output->'subjectIds'->>0)::uuid INTO resource,subject FROM public.context_requests WHERE id=(req->>'id')::uuid; | ||
| SELECT id INTO link FROM public.context_resource_links WHERE resource_id=resource AND subject_id=subject AND relation='identity'; | ||
| e:=jsonb_build_object('requestId',req->>'id','ownerId',owner_id,'videoSubjectId',subject,'videoId','AbCdEfGhI_1', | ||
| 'mediaVersion','upload-1','durationSeconds',120,'variant','unknown','title',E' Café 🎵\nTitle ','description',E'Original\n description ', | ||
| 'channel',jsonb_build_object('id','channel-1','name','Uploader'), | ||
| 'performers',jsonb_build_array(jsonb_build_object('name','Observed performer','sourceVersionIds',jsonb_build_array(version))), | ||
| 'identity',jsonb_build_object('state','unresolved','reason','No recording identity established'), | ||
| 'sources',jsonb_build_array(jsonb_build_object('versionId',snapshot,'videoId','AbCdEfGhI_1','mediaVersion','upload-1','retrievedAt','2026-11-18T00:00:00Z'), | ||
| jsonb_build_object('versionId',version,'videoId','AbCdEfGhI_1','mediaVersion','upload-1','retrievedAt','2026-11-18T00:00:00Z')), | ||
| 'captions',jsonb_build_object('state','available','sourceVersionIds',jsonb_build_array(version),'segments',jsonb_build_array(jsonb_build_object('startSeconds',0,'endSeconds',10,'language','en','text','Retained words'))), | ||
| 'analysis',jsonb_build_object('state','unavailable','reason','Analysis not retained')); | ||
| manifest:=jsonb_build_object('contextVideo',jsonb_build_object('contractVersion','retained-video-evidence-v1','requestId',req->>'id','videoSubjectId',subject,'videoId','AbCdEfGhI_1','mediaVersion','upload-1')); | ||
| INSERT INTO public.context_sources(id,owner_id,source_url,kind) VALUES(source,owner_id,'fixture:snapshot','provider_metadata'),(dependency,owner_id,'fixture:captions','provider_metadata'); | ||
| INSERT INTO public.context_source_versions(id,owner_id,source_id,fingerprint,content,media_manifest,retrieved_at) | ||
| VALUES(snapshot,owner_id,source,encode(sha256(convert_to(e::text,'UTF8')),'hex'),e,manifest,'2026-11-18T00:00:00Z'), | ||
| (version,owner_id,dependency,repeat('a',64),jsonb_build_object('captions','Retained words'),manifest,'2026-11-18T00:00:00Z'); | ||
| state:=jsonb_build_object('owner',owner_id,'actor',actor,'outsider',outsider,'request',req->>'id','subject',subject,'resource',resource,'link',link,'source',source,'dependency',dependency,'snapshot',snapshot,'version',version,'evidence',e); | ||
| INSERT INTO video_fixture.state VALUES(state); | ||
| RETURN state; | ||
| END $$; | ||
| REVOKE ALL ON FUNCTION video_fixture.seed() FROM PUBLIC,anon,authenticated,service_role; | ||
| CREATE FUNCTION video_fixture.raise_fault() RETURNS trigger LANGUAGE plpgsql AS $$ | ||
| BEGIN RAISE EXCEPTION 'fixture write fault'; END $$; | ||
16 changes: 16 additions & 0 deletions
16
proposals/context-retained-video-2131/qualification-bootstrap.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| -- Synthetic legacy prerequisites only, inside the owned disposable cluster. | ||
| CREATE ROLE service_role BYPASSRLS; | ||
| CREATE ROLE anon; | ||
| CREATE ROLE authenticated; | ||
| CREATE SCHEMA storage; | ||
| CREATE TABLE storage.buckets(id text PRIMARY KEY,name text,public boolean,file_size_limit bigint); | ||
| CREATE TABLE storage.objects(id uuid PRIMARY KEY,bucket_id text); | ||
| CREATE TABLE public.accounts(id uuid PRIMARY KEY DEFAULT gen_random_uuid(),name text); | ||
| CREATE TABLE public.songs(isrc text PRIMARY KEY,name text,album text); | ||
| CREATE TABLE public.song_identifiers(song text,platform text,identifier_type text,value text); | ||
| CREATE TABLE public.account_artist_ids(account_id uuid,artist_id uuid); | ||
| CREATE TABLE public.catalogs(id uuid PRIMARY KEY,name text,updated_at timestamptz DEFAULT now()); | ||
| CREATE TABLE public.account_catalogs(account uuid,catalog uuid); | ||
| CREATE TABLE public.account_organization_ids(account_id uuid,organization_id uuid,updated_at timestamptz DEFAULT now(),PRIMARY KEY(account_id,organization_id)); | ||
| GRANT USAGE ON SCHEMA public TO service_role; | ||
| GRANT SELECT ON public.account_organization_ids TO service_role; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.