-- Cloud Codex - Seed Data -- -- Generates ~60 documents across multiple archives and users -- for testing search, browse and pagination. -- -- All passwords resolve to "password" -- -- All Rights Reserved to Cloud City Computing, LLC 2026 -- https://cloudcitycomputing.com DELETE FROM favorites; DELETE FROM comment_replies; DELETE FROM comments; DELETE FROM versions; DELETE FROM logs; DELETE FROM archives; DELETE FROM archive_repos; DELETE FROM squad_invitations; DELETE FROM squad_members; DELETE FROM permissions; DELETE FROM squads; DELETE FROM user_invitations; DELETE FROM sessions; DELETE FROM password_reset_tokens; DELETE FROM two_factor_codes; DELETE FROM oauth_accounts; DELETE FROM users; DELETE FROM workspaces; -- ========================= -- Workspaces -- ========================= -- owner_id is set once the users below exist; alice is seeded after this row. INSERT INTO workspaces (name) VALUES ('Acme Corporation'); SET @workspace_id = LAST_INSERT_ID(); -- ========================= -- Users (password = "password" for all) -- ========================= INSERT INTO users (name, email, password_hash, is_admin) VALUES ('alice', 'alice@acme.com', '$2b$10$Sd3GKFmu8.CRz86c3jQI5u3f.Lju4H3Ez5SSjTJjRAqMW9w0OLg5u', TRUE); INSERT INTO users (name, email, password_hash) VALUES ('bob', 'bob@acme.com', '$2b$10$Sd3GKFmu8.CRz86c3jQI5u3f.Lju4H3Ez5SSjTJjRAqMW9w0OLg5u'), ('carol', 'carol@acme.com', '$2b$10$Sd3GKFmu8.CRz86c3jQI5u3f.Lju4H3Ez5SSjTJjRAqMW9w0OLg5u'), ('dave', 'dave@acme.com', '$2b$10$Sd3GKFmu8.CRz86c3jQI5u3f.Lju4H3Ez5SSjTJjRAqMW9w0OLg5u'), ('eve', 'eve@acme.com', '$2b$10$Sd3GKFmu8.CRz86c3jQI5u3f.Lju4H3Ez5SSjTJjRAqMW9w0OLg5u'); SELECT @alice_id := id FROM users WHERE email = 'alice@acme.com'; SELECT @bob_id := id FROM users WHERE email = 'bob@acme.com'; SELECT @carol_id := id FROM users WHERE email = 'carol@acme.com'; SELECT @dave_id := id FROM users WHERE email = 'dave@acme.com'; SELECT @eve_id := id FROM users WHERE email = 'eve@acme.com'; UPDATE workspaces SET owner_id = @alice_id WHERE id = @workspace_id; -- ========================= -- Squads -- ========================= INSERT INTO squads (workspace_id, name, created_by) VALUES (@workspace_id, 'Engineering', @alice_id), (@workspace_id, 'Design', @carol_id), (@workspace_id, 'Operations', @dave_id); SELECT @eng_squad := id FROM squads WHERE name = 'Engineering'; SELECT @des_squad := id FROM squads WHERE name = 'Design'; SELECT @ops_squad := id FROM squads WHERE name = 'Operations'; -- ========================= -- Squad Members -- ========================= INSERT INTO squad_members (squad_id, user_id, role, can_read, can_write, can_create_log, can_create_archive) VALUES (@eng_squad, @alice_id, 'owner', TRUE, TRUE, TRUE, TRUE), (@eng_squad, @bob_id, 'member', TRUE, TRUE, TRUE, FALSE), (@eng_squad, @eve_id, 'member', TRUE, TRUE, TRUE, FALSE), (@des_squad, @carol_id, 'owner', TRUE, TRUE, TRUE, TRUE), (@des_squad, @alice_id, 'member', TRUE, TRUE, TRUE, FALSE), (@ops_squad, @dave_id, 'owner', TRUE, TRUE, TRUE, TRUE), (@ops_squad, @bob_id, 'member', TRUE, TRUE, FALSE, FALSE), (@ops_squad, @eve_id, 'member', TRUE, FALSE, FALSE, FALSE); -- ========================= -- Permissions -- ========================= INSERT INTO permissions (user_id, create_squad, create_archive, create_log) VALUES (@alice_id, TRUE, TRUE, TRUE), (@bob_id, FALSE, TRUE, TRUE), (@carol_id, FALSE, TRUE, TRUE), (@dave_id, FALSE, TRUE, TRUE), (@eve_id, FALSE, FALSE, TRUE); -- ========================= -- Archives -- ========================= INSERT INTO archives (squad_id, name, created_by, read_access, write_access) VALUES (@eng_squad, 'Platform API', @alice_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @bob_id, @eve_id)), (@eng_squad, 'Cloud Infrastructure', @bob_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @bob_id)), (@eng_squad, 'Mobile App', @alice_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @bob_id, @eve_id)), (@des_squad, 'Brand Guidelines', @carol_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @carol_id)), (@des_squad, 'Website Redesign', @carol_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @carol_id)), (@ops_squad, 'Incident Runbooks', @dave_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @dave_id, @bob_id)), (@ops_squad, 'Onboarding', @dave_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @dave_id)), (@eng_squad, 'Data Pipeline', @eve_id, JSON_ARRAY(@alice_id, @bob_id, @carol_id, @dave_id, @eve_id), JSON_ARRAY(@alice_id, @eve_id, @bob_id)); SELECT @arch_api := id FROM archives WHERE name = 'Platform API'; SELECT @arch_infra := id FROM archives WHERE name = 'Cloud Infrastructure'; SELECT @arch_mobile := id FROM archives WHERE name = 'Mobile App'; SELECT @arch_brand := id FROM archives WHERE name = 'Brand Guidelines'; SELECT @arch_web := id FROM archives WHERE name = 'Website Redesign'; SELECT @arch_run := id FROM archives WHERE name = 'Incident Runbooks'; SELECT @arch_onb := id FROM archives WHERE name = 'Onboarding'; SELECT @arch_data := id FROM archives WHERE name = 'Data Pipeline'; -- ========================= -- Logs — Platform API -- ========================= INSERT INTO logs (archive_id, title, html_content, created_by, created_at) VALUES (@arch_api, 'API Overview', '
The Platform API provides RESTful endpoints for managing resources across the Acme ecosystem. All requests require authentication via Bearer tokens.
https://api.acme.com/v2
All endpoints enforce a rate limit of 1,000 requests per minute per API key. Exceeding this limit returns HTTP 429. Use exponential backoff for retries.
For batch operations, prefer the bulk endpoints documented in the Batch Operations section.
', @alice_id, '2025-11-01 09:00:00'), (@arch_api, 'Authentication Guide', 'The API supports two authentication methods: API keys and OAuth 2.0 bearer tokens.
Generate API keys from the Developer Console. Include the key in the X-API-Key header. Keys can be scoped to specific resources and rotated without downtime.
For user-context operations, use the authorization code flow. Redirect users to /oauth/authorize with your client ID and requested scopes. Token expiry is 3600 seconds.
Available scopes: read:resources, write:resources, admin:workspace, read:analytics.
All error responses follow a consistent JSON structure with error, message, and details fields.
Include a request_id header value when contacting support about specific errors.
List endpoints use cursor-based pagination for consistency and performance. Each response includes a next_cursor field when more results are available.
limit — Number of results per log (1–100, default 25)cursor — Opaque cursor from previous responsesort — Field to sort by (depends on endpoint)GET /v2/archives?limit=10&cursor=eyJpZCI6NDJ9
Do not construct cursors manually — always use the value returned by the API.
', @bob_id, '2025-11-08 11:15:00'), (@arch_api, 'Webhooks Configuration', 'Configure webhooks to receive real-time notifications when resources change. Webhooks deliver POST requests with a JSON payload signed using HMAC-SHA256.
Register webhook URLs in the Developer Console under Settings → Webhooks. Select which events to subscribe to (e.g., resource.created, resource.updated, resource.deleted).
Validate the X-Signature-256 header against the payload using your webhook secret. Requests that fail verification should be rejected with HTTP 401.
Failed deliveries are retried up to 5 times with exponential backoff over 24 hours.
', @alice_id, '2025-11-12 16:45:00'), (@arch_api, 'Batch Operations', 'For high-throughput use cases, the API provides batch endpoints that accept arrays of operations in a single request.
POST /v2/batch
Send a JSON array of operation objects, each with method, path, and optional body. Maximum 100 operations per batch.
Returns an array of results in the same order. Each result has status, body, and headers. Partial failures are possible — check each result individually.
Batch requests consume rate limit quota equal to the number of operations.
', @eve_id, '2025-11-18 08:30:00'), (@arch_api, 'SDK Quick Start', 'Official SDKs are available for JavaScript, Python, Go, and Ruby. Install via your language''s package manager.
npm install @acme/platform-sdk
import { AcmeClient } from ''@acme/platform-sdk'';\nconst client = new AcmeClient({ apiKey: process.env.ACME_API_KEY });\nconst archives = await client.archives.list({ limit: 10 });pip install acme-platform
from acme import AcmeClient\nclient = AcmeClient(api_key=os.environ[''ACME_API_KEY''])\narchives = client.archives.list(limit=10)',
@bob_id, '2025-12-01 09:00:00');
-- =========================
-- Logs — Cloud Infrastructure
-- =========================
INSERT INTO logs (archive_id, title, html_content, created_by, created_at) VALUES
(@arch_infra, 'Architecture Overview',
'Our infrastructure runs on a multi-region Kubernetes cluster deployed across three availability zones. The architecture follows a microservices pattern with service mesh for inter-service communication.
All services are containerized and deployed via Helm charts managed in the infrastructure monorepo.
', @bob_id, '2025-10-15 10:00:00'), (@arch_infra, 'Kubernetes Cluster Setup', 'Production clusters run Kubernetes 1.29 with containerd as the runtime. Node pools are segmented by workload type.
Each squad gets a dedicated namespace with resource quotas. Cross-namespace traffic is controlled via NetworkPolicies.
', @bob_id, '2025-10-22 11:45:00'), (@arch_infra, 'CI/CD Pipeline', 'We use GitHub Actions for CI and ArgoCD for continuous deployment to Kubernetes. Every pull request triggers a full test suite, linting, security scan, and container build.
Production deploys require manual approval after staging validation passes. Canary deployments roll out to 10% of traffic before full promotion.
', @alice_id, '2025-11-03 14:20:00'), (@arch_infra, 'Monitoring & Alerting', 'Observability is built on the Prometheus + Grafana + Loki stack. Every service exposes metrics on /metrics and structured JSON logs.
Critical alerts route to LogrDuty. Warning alerts go to Slack #ops-alerts. Alert fatigue is managed via weekly triage and rule tuning.
', @dave_id, '2025-11-10 09:30:00'), (@arch_infra, 'Disaster Recovery Plan', 'The DR plan targets an RPO of 1 hour and RTO of 4 hours for critical services. Database replication ensures near-real-time failover.
DNS failover is automated via health checks. Database promotion requires a manual confirmation step to prevent split-brain scenarios. Full runbook in the Incident Runbooks archive.
', @dave_id, '2025-11-20 16:00:00'), (@arch_infra, 'Terraform Module Guide', 'Infrastructure is provisioned via reusable Terraform modules stored in infra/modules/. Each module has its own README, input variables, and output values.
vpc — VPC with public/private subnets, NAT gatewayseks-cluster — Managed Kubernetes cluster with node groupsrds — Aurora MySQL cluster with read replicass3-bucket — Encrypted bucket with lifecycle rulesPin module versions in your workspace main.tf. Run terraform plan in CI before any apply.
The Acme mobile app is built with React Native targeting iOS and Android from a single codebase. State management uses Zustand with React Query for server state.
React Navigation with a bottom tab navigator and stack navigators per tab. Deep linking is configured for push notification routing.
Critical data is cached in SQLite via WatermelonDB. Sync runs on app foreground and network reconnect events.
', @alice_id, '2025-11-05 08:00:00'), (@arch_mobile, 'Push Notifications', 'Notifications are delivered via Firebase Cloud Messaging (FCM) for Android and APNs for iOS. The backend sends notification payloads to our unified notification service.
Users control notification preferences per category in Settings → Notifications.
', @eve_id, '2025-11-15 13:00:00'), (@arch_mobile, 'Release Workflow', 'Releases follow a two-week sprint cycle. Release branches are cut on Thursday, QA runs Friday through Monday, and submission happens Tuesday.
Format: MAJOR.MINOR.PATCH. Major bumps require stakeholder sign-off. Minor bumps for feature releases. Patch for hotfixes.
iOS: submitted via Xcode Cloud. Android: submitted via the Play Console API from CI. Both platforms require passing automated screenshot tests before submission.
', @alice_id, '2025-12-02 15:30:00'), (@arch_mobile, 'Accessibility Guidelines', 'All new screens must meet WCAG 2.1 AA standards. This document covers the key requirements for mobile accessibility.
Run the Accessibility Inspector (iOS) and Accessibility Scanner (Android) before every PR.
', @carol_id, '2025-12-10 10:00:00'); -- ========================= -- Logs — Brand Guidelines -- ========================= INSERT INTO logs (archive_id, title, html_content, created_by, created_at) VALUES (@arch_brand, 'Logo Usage', 'The Acme logo is our most recognizable brand asset. Consistent usage builds trust and recognition.
Maintain clear space equal to the height of the "A" in Acme on all sides. Never place the logo closer than this to other elements.
Do not stretch, rotate, add effects, change colors, or place on busy backgrounds.
', @carol_id, '2025-10-20 09:00:00'), (@arch_brand, 'Color Palette', 'Our brand colors create a cohesive visual identity across all touchpoints.
Grey scale from #F8FAFC (lightest) to #0F172A (darkest). Use for backgrounds, borders, and secondary text.
', @carol_id, '2025-10-25 11:30:00'), (@arch_brand, 'Typography', 'Consistent typography reinforces brand identity and ensures readability across platforms.
Line height: 1.5 for body, 1.3 for headings. Letter spacing: -0.01em for headings, normal for body.
', @carol_id, '2025-11-01 14:00:00'), (@arch_brand, 'Illustration Style', 'Illustrations bring warmth and personality to our brand. They are used in onboarding flows, empty states, error logs, and marketing materials.
Use illustrations sparingly in product UI — they should enhance, not distract. Maximum one illustration per screen. Marketing logs can use larger hero illustrations.
', @carol_id, '2025-11-15 16:30:00'), (@arch_brand, 'Voice & Tone', 'Our brand voice is consistent. Our tone adapts to the situation.
Meeting date: October 28, 2025. Attendees: Alice, Carol, Dave.
Phase 1 (Design): Nov 1 – Nov 30. Phase 2 (Development): Dec 1 – Jan 31. Phase 3 (QA & Launch): Feb 1 – Feb 28.
', @carol_id, '2025-10-28 14:00:00'), (@arch_web, 'Information Architecture', 'The new site structure organizes content into four top-level sections with consistent navigation patterns.
Persistent top nav with mega-menu dropdowns. Mobile: hamburger menu with accordion sections. Footer mirrors top nav structure with additional legal links.
', @carol_id, '2025-11-05 10:00:00'), (@arch_web, 'Performance Budget', 'Performance targets ensure the redesigned site delivers a fast experience across devices and networks.
Lighthouse CI runs on every PR and blocks merging if scores drop below 90.
', @alice_id, '2025-11-12 09:30:00'), (@arch_web, 'Component Library Spec', 'The redesign introduces a shared component library built on React with Tailwind CSS. Components are documented in Storybook.
Button — primary, secondary, ghost, danger variantsCard — standard, interactive, feature highlightModal — centered overlay with backdrop blurInput — text, email, password, search with validation statesTable — sortable columns, pagination, row selectionColors, spacing, radii, and shadows are defined as CSS custom properties generated from a shared token config.
', @carol_id, '2025-11-20 15:00:00'), (@arch_web, 'SEO Migration Plan', 'Migrating URLs requires careful redirect mapping to preserve search rankings and avoid broken links.
All existing URLs are mapped to new equivalents in a CSV file. Cloudflare Workers handle 301 redirects. The mapping covers 847 existing logs.
Severity: Critical. On-call: Infrastructure squad.
File incident report within 24 hours. Schedule root cause analysis meeting.
', @dave_id, '2025-10-18 08:00:00'), (@arch_run, 'High CPU Alert', 'Severity: Warning → Critical if sustained. On-call: Infrastructure squad.
kubectl top pods --sort-by=cpukubectl delete pod <name>Severity: High. On-call: Infrastructure squad.
kubectl logs -n cert-manager deploy/cert-managerkubectl delete certificate acme-tls -n productionkubectl get certificate -n productionCertificate expiry alerts are set at 30, 14, and 7 days. Investigate any 30-day alert immediately.
', @dave_id, '2025-11-08 10:00:00'), (@arch_run, 'Memory Leak Investigation', 'Severity: Warning. On-call: Application squad.
kill -USR2 <pid>--prof outputSeverity: Warning → High if lag grows. On-call: Data squad.
kafka-consumer-groups.sh --describe --group <name>If lag exceeds 100,000 or grows faster than consumers can process, escalate to Critical.
', @eve_id, '2025-12-04 09:00:00'); -- ========================= -- Logs — Onboarding -- ========================= INSERT INTO logs (archive_id, title, html_content, created_by, created_at) VALUES (@arch_onb, 'Welcome to Acme', 'Congratulations on joining the squad. This guide will help you get set up and productive as quickly as possible.
This guide walks through setting up your local development environment on macOS or Linux.
git clone git@github.com:acme/platform.gitnpm installcp .env.example .envdocker compose up -dnpm run devhttp://localhost:3000Code review is how we maintain quality and share knowledge. Every change goes through review before merging.
Clear communication keeps the squad aligned and productive. Here''s how we work.
Write things down. Link to documents. Don''t assume everyone was in the room.
', @dave_id, '2025-11-01 09:00:00'), (@arch_onb, 'Security Training', 'All squad members must complete security training within their first two weeks. Security is everyone''s responsibility.
Review the OWASP Top 10. Never commit secrets. Use environment variables. Run npm audit regularly.
The data pipeline ingests events from production services, transforms them, and loads into the analytics data warehouse.
Average throughput: 50,000 events/second. Peak: 200,000 events/second during major launches. Daily data volume: ~2 TB uncompressed.
', @eve_id, '2025-11-01 08:00:00'), (@arch_data, 'Schema Registry', 'All Kafka messages are serialized with Avro and validated against schemas in Confluent Schema Registry. This ensures backward compatibility across producer and consumer versions.
<domain>.<entity>.<action>event_id, timestamp, and version fieldsSchema changes go through PR review. CI validates compatibility before merge. Breaking changes require a new topic version.
', @eve_id, '2025-11-08 13:00:00'), (@arch_data, 'dbt Model Guide', 'We use dbt (data build tool) to transform raw data into clean analytical models in Snowflake.
staging/ — 1:1 with source tables, light cleaning onlyintermediate/ — business logic transformationsmarts/ — final tables consumed by BI tools and APIsstg_<source>__<entity>int_<entity>_<verb>fct_<entity> or dim_<entity>Every model must have unique and not_null tests on primary keys. Run dbt test locally before pushing.
Data quality is monitored at every stage of the pipeline to catch issues before they reach dashboards.
Great Expectations runs nightly validation suites. Failures trigger Slack alerts and block downstream dbt runs. Anomaly detection flags statistical outliers in key metrics.
', @bob_id, '2025-12-01 14:00:00'), (@arch_data, 'Analytics Event Catalog', 'This catalog documents all tracked user events and their properties. Use this as a reference when adding new analytics or building reports.
log_viewed — url, referrer, session_id, user_idbutton_clicked — button_name, log, contextform_submitted — form_name, field_count, successsearch_performed — query, result_count, filtersdocument_created — doc_id, archive_id, word_countdocument_exported — doc_id, format, word_countPropose new events via PR to the tracking plan repo. Include event name, description, properties with types, and sample payload.
', @eve_id, '2025-12-10 10:30:00'), (@arch_data, 'Backfill Procedures', 'When pipeline bugs cause data gaps or incorrect transformations, a backfill reprocesses historical data.
Always use INSERT OVERWRITE for idempotency. Never delete-then-insert — if the backfill fails mid-way, you''ll have data loss. Log all backfill operations to the audit table.
Our rate limiter uses a sliding window algorithm implemented in Redis. Each API key gets a separate counter with a 60-second window.
We use a sorted set per key with timestamps as scores. On each request: add current timestamp, remove entries older than the window, count remaining entries. If count exceeds limit, return 429.
X-RateLimit-Limit — Maximum requests per windowX-RateLimit-Remaining — Requests remainingX-RateLimit-Reset — Unix timestamp when window resetsEnterprise customers can request custom limits via their account manager.
', @alice_id, '2025-12-20 09:00:00'), (@arch_infra, 'Secrets Management', 'All secrets (API keys, database passwords, certificates) are stored in HashiCorp Vault and injected into pods via the Vault Agent sidecar.
For local development, use vault kv get to retrieve values into your .env. Never commit secrets to Git. Pre-commit hooks scan for common secret patterns.
Performance directly impacts user retention. These guidelines help keep the app fast and responsive.
React.memo and useMemo for expensive rendersProfile regularly with Flipper and the React DevTools Profiler.
', @alice_id, '2025-12-28 10:00:00'), (@arch_web, 'Analytics Integration', 'The redesigned website uses a privacy-first analytics approach with Plausible Analytics as the primary tool.
The Plausible script is loaded asynchronously and weighs under 1 KB. No cookies are set, so no consent banner is required under GDPR.
Signup Started — user opens signup modalSignup Completed — account created successfullyCTA Clicked — tracks which call-to-action buttons drive engagementDoc Downloaded — whitepaper or resource downloadsPlausible dashboard is shared with marketing and product. Custom goals track conversion funnels.
', @carol_id, '2026-01-05 11:00:00'), (@arch_run, 'API Gateway Troubleshooting', 'Severity: Critical. On-call: Infrastructure squad.
kubectl get pods -n istio-systemIf gateway is completely down, bypass via direct service NodePort as a temporary measure.
', @dave_id, '2026-01-10 08:30:00'), (@arch_onb, 'Benefits Overview', 'Acme offers comprehensive benefits to support your health, wealth, and well-being.
Monthly Snowflake spend has grown 40% quarter-over-quarter. This document outlines optimization opportunities.
Implementing all recommendations: estimated 35% reduction in monthly compute costs and 20% reduction in storage costs. Total annual savings: ~$48,000.
', @eve_id, '2026-01-20 14:00:00'); -- ========================= -- Capture log IDs for comments, versions, favorites -- ========================= SELECT @log_api_overview := id FROM logs WHERE title = 'API Overview'; SELECT @log_auth_guide := id FROM logs WHERE title = 'Authentication Guide'; SELECT @log_error_handling := id FROM logs WHERE title = 'Error Handling'; SELECT @log_pagination := id FROM logs WHERE title = 'Pagination Patterns'; SELECT @log_webhooks := id FROM logs WHERE title = 'Webhooks Configuration'; SELECT @log_batch_ops := id FROM logs WHERE title = 'Batch Operations'; SELECT @log_arch_overview := id FROM logs WHERE title = 'Architecture Overview'; SELECT @log_k8s_setup := id FROM logs WHERE title = 'Kubernetes Cluster Setup'; SELECT @log_cicd := id FROM logs WHERE title = 'CI/CD Pipeline'; SELECT @log_monitoring := id FROM logs WHERE title = 'Monitoring & Alerting'; SELECT @log_dr_plan := id FROM logs WHERE title = 'Disaster Recovery Plan'; SELECT @log_app_arch := id FROM logs WHERE title = 'App Architecture'; SELECT @log_push_notif := id FROM logs WHERE title = 'Push Notifications'; SELECT @log_color_palette := id FROM logs WHERE title = 'Color Palette'; SELECT @log_typography := id FROM logs WHERE title = 'Typography'; SELECT @log_perf_budget := id FROM logs WHERE title = 'Performance Budget'; SELECT @log_component_lib := id FROM logs WHERE title = 'Component Library Spec'; SELECT @log_db_failover := id FROM logs WHERE title = 'Database Failover'; SELECT @log_high_cpu := id FROM logs WHERE title = 'High CPU Alert'; SELECT @log_welcome := id FROM logs WHERE title = 'Welcome to Acme'; SELECT @log_dev_setup := id FROM logs WHERE title = 'Development Environment Setup'; SELECT @log_code_review := id FROM logs WHERE title = 'Code Review Guidelines'; SELECT @log_pipeline_arch := id FROM logs WHERE title = 'Pipeline Architecture'; SELECT @log_dbt_guide := id FROM logs WHERE title = 'dbt Model Guide'; SELECT @log_data_quality := id FROM logs WHERE title = 'Data Quality Framework'; SELECT @log_rate_limit := id FROM logs WHERE title = 'Rate Limiting Deep Dive'; SELECT @log_secrets_mgmt := id FROM logs WHERE title = 'Secrets Management'; SELECT @log_seo_migration := id FROM logs WHERE title = 'SEO Migration Plan'; -- ========================= -- Squad Invitations (pending, accepted, declined) -- ========================= -- Dave invited carol to Ops — pending INSERT INTO squad_invitations (squad_id, invited_by, invited_user_id, role, can_read, can_write, can_create_log, status, created_at) VALUES (@ops_squad, @dave_id, @carol_id, 'member', TRUE, TRUE, TRUE, 'pending', '2026-04-10 09:00:00'); -- Alice invited dave to Engineering — pending INSERT INTO squad_invitations (squad_id, invited_by, invited_user_id, role, can_read, can_write, can_create_log, can_create_archive, status, created_at) VALUES (@eng_squad, @alice_id, @dave_id, 'member', TRUE, TRUE, TRUE, FALSE, 'pending', '2026-04-08 14:30:00'); -- Carol invited bob to Design — accepted INSERT INTO squad_invitations (squad_id, invited_by, invited_user_id, role, can_read, can_write, status, created_at, responded_at) VALUES (@des_squad, @carol_id, @bob_id, 'member', TRUE, TRUE, 'accepted', '2026-03-15 10:00:00', '2026-03-15 12:30:00'); -- Alice invited carol to Engineering — declined INSERT INTO squad_invitations (squad_id, invited_by, invited_user_id, role, can_read, can_write, status, created_at, responded_at) VALUES (@eng_squad, @alice_id, @carol_id, 'member', TRUE, FALSE, 'declined', '2026-02-20 11:00:00', '2026-02-21 09:15:00'); -- ========================= -- User Invitations (pending platform invites) -- ========================= INSERT INTO user_invitations (email, token, invited_by, expires_at, accepted, created_at) VALUES ('frank@acme.com', 'aabbccdd11223344556677889900aabb11223344556677889900aabbccdd1122', @alice_id, '2026-04-20 00:00:00', FALSE, '2026-04-06 10:00:00'), ('grace@acme.com', 'ffeeddcc11223344556677889900aabb11223344556677889900aabbccddeeff', @alice_id, '2026-04-25 00:00:00', FALSE, '2026-04-10 14:00:00'), ('henry@acme.com', '00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff', @dave_id, '2026-04-22 00:00:00', FALSE, '2026-04-08 09:00:00'), ('iris@partner.com','aabb00112233445566778899ccddeeff00112233445566778899aabbccddeeff', @carol_id, '2026-03-01 00:00:00', TRUE, '2026-02-15 11:00:00'); -- ========================= -- Versions — version history for select documents -- ========================= -- API Overview: 3 published versions showing evolution UPDATE logs SET version = 3 WHERE id = @log_api_overview; INSERT INTO versions (log_id, version, title, notes, html_content, created_by, created_at) VALUES (@log_api_overview, 1, 'Initial draft', 'First version of the API overview document.', 'The Platform API provides RESTful endpoints for managing resources.
https://api.acme.com/v1
The Platform API provides RESTful endpoints for managing resources across the Acme ecosystem. All requests require authentication via Bearer tokens.
https://api.acme.com/v2
All endpoints enforce a rate limit of 500 requests per minute per API key.
', @alice_id, '2025-12-15 10:30:00'), (@log_api_overview, 3, 'Increased rate limit to 1000/min', 'Updated rate limit from 500 to 1000 requests per minute after capacity upgrade.', 'The Platform API provides RESTful endpoints for managing resources across the Acme ecosystem. All requests require authentication via Bearer tokens.
https://api.acme.com/v2
All endpoints enforce a rate limit of 1,000 requests per minute per API key. Exceeding this limit returns HTTP 429. Use exponential backoff for retries.
For batch operations, prefer the bulk endpoints documented in the Batch Operations section.
', @bob_id, '2026-02-01 14:00:00'); -- Architecture Overview: 2 versions UPDATE logs SET version = 2 WHERE id = @log_arch_overview; INSERT INTO versions (log_id, version, title, notes, html_content, created_by, created_at) VALUES (@log_arch_overview, 1, 'Initial architecture doc', NULL, 'Our infrastructure runs on a Kubernetes cluster. The architecture follows a microservices pattern.
Our infrastructure runs on a multi-region Kubernetes cluster deployed across three availability zones. The architecture follows a microservices pattern with service mesh for inter-service communication.
All services are containerized and deployed via Helm charts managed in the infrastructure monorepo.
', @bob_id, '2026-01-20 11:00:00'); -- CI/CD Pipeline: 2 versions UPDATE logs SET version = 2 WHERE id = @log_cicd; INSERT INTO versions (log_id, version, title, notes, html_content, created_by, created_at) VALUES (@log_cicd, 1, 'Original CI/CD docs', NULL, 'We use GitHub Actions for CI and manual deployments to Kubernetes.
Production deploys require SSH access to the cluster.
', @alice_id, '2025-11-03 14:20:00'), (@log_cicd, 2, 'Added ArgoCD and canary deploys', 'Migrated from manual deploys to ArgoCD with canary strategy.', 'We use GitHub Actions for CI and ArgoCD for continuous deployment to Kubernetes. Every pull request triggers a full test suite, linting, security scan, and container build.
Production deploys require manual approval after staging validation passes. Canary deployments roll out to 10% of traffic before full promotion.
', @alice_id, '2026-01-10 09:00:00'); -- Database Failover Runbook: 2 versions UPDATE logs SET version = 2 WHERE id = @log_db_failover; INSERT INTO versions (log_id, version, title, notes, html_content, created_by, created_at) VALUES (@log_db_failover, 1, 'Initial runbook', 'First version of the database failover runbook.', 'Severity: Critical.
Severity: Critical. On-call: Infrastructure squad.
File incident report within 24 hours. Schedule root cause analysis meeting.
', @dave_id, '2026-03-05 10:00:00'); -- Component Library Spec: 2 versions UPDATE logs SET version = 2 WHERE id = @log_component_lib; INSERT INTO versions (log_id, version, title, notes, html_content, created_by, created_at) VALUES (@log_component_lib, 1, 'Initial component list', NULL, 'Shared React components for the website redesign.
ButtonCardInputThe redesign introduces a shared component library built on React with Tailwind CSS. Components are documented in Storybook.
Button — primary, secondary, ghost, danger variantsCard — standard, interactive, feature highlightModal — centered overlay with backdrop blurInput — text, email, password, search with validation statesTable — sortable columns, pagination, row selectionColors, spacing, radii, and shadows are defined as CSS custom properties generated from a shared token config.
', @carol_id, '2026-02-14 11:00:00'); -- ========================= -- Comments — across various documents -- ========================= -- API Overview: active discussion INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_api_overview, @bob_id, 'Should we mention the new v3 beta endpoints here? Some enterprise customers are already testing them.', 'question', 'open', 45, 110, 'RESTful endpoints for managing resources across the Acme ecosystem', '2026-03-20 10:15:00'), (@log_api_overview, @eve_id, 'The 1000 req/min limit feels low for our largest customers. Can we add a note about enterprise tier limits?', 'suggestion', 'open', 280, 340, 'rate limit of 1,000 requests per minute', '2026-03-22 14:30:00'), (@log_api_overview, @carol_id, 'Typo: "Per API key" should clarify whether this is per key or per account.', 'comment', 'resolved', 340, 360, 'per API key', '2026-02-10 09:00:00'); SELECT @comment_api_v3 := id FROM comments WHERE log_id = @log_api_overview AND user_id = @bob_id AND tag = 'question'; SELECT @comment_api_rate := id FROM comments WHERE log_id = @log_api_overview AND user_id = @eve_id AND tag = 'suggestion'; SELECT @comment_api_typo := id FROM comments WHERE log_id = @log_api_overview AND user_id = @carol_id AND status = 'resolved'; UPDATE comments SET resolved_by = @alice_id, resolved_at = '2026-02-10 11:30:00' WHERE id = @comment_api_typo; -- Authentication Guide: security review INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_auth_guide, @dave_id, 'We should add a note about token rotation best practices. Customers keep using expired tokens and filing support tickets.', 'suggestion', 'open', 200, 270, 'Token expiry is 3600 seconds', '2026-03-25 11:00:00'), (@log_auth_guide, @alice_id, 'Consider adding PKCE flow documentation for mobile/SPA clients — authorization code flow alone is insecure for public clients.', 'issue', 'open', 150, 200, 'authorization code flow', '2026-04-01 09:30:00'); -- Architecture Overview: review comments INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_arch_overview, @eve_id, 'We should update this to mention the new edge caching layer we deployed in Q1.', 'suggestion', 'open', NULL, NULL, NULL, '2026-04-02 10:00:00'), (@log_arch_overview, @dave_id, 'The Istio version should be pinned here — we''re on 1.20 and it matters for NetworkPolicy behavior.', 'note', 'open', 120, 155, 'Service mesh (Istio)', '2026-03-18 14:00:00'); -- CI/CD Pipeline: process discussion INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_cicd, @bob_id, 'The canary percentage should be configurable per service. Some services handle 10% fine, others need 1%.', 'suggestion', 'open', 350, 420, 'Canary deployments roll out to 10% of traffic', '2026-03-28 16:00:00'), (@log_cicd, @alice_id, 'Integration tests are flaky ~5% of the time — we should note the retry policy.', 'issue', 'resolved', 180, 230, 'Integration tests (with test database)', '2026-01-15 10:00:00'); SELECT @comment_cicd_flaky := id FROM comments WHERE log_id = @log_cicd AND user_id = @alice_id AND status = 'resolved'; UPDATE comments SET resolved_by = @bob_id, resolved_at = '2026-01-20 11:00:00' WHERE id = @comment_cicd_flaky; -- Monitoring dashboard comments INSERT INTO comments (log_id, user_id, content, tag, status, created_at) VALUES (@log_monitoring, @alice_id, 'Can we add an SLO dashboard section? We track SLOs but they are not documented here.', 'suggestion', 'open', '2026-04-05 09:00:00'), (@log_monitoring, @bob_id, 'LogrDuty → PagerDuty? Is this a typo or do we actually use LogrDuty?', 'question', 'open', '2026-04-08 11:30:00'); -- Database Failover runbook comments INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_db_failover, @bob_id, 'We should add the specific AWS CLI commands for manual failover so on-call doesn''t have to look them up under pressure.', 'suggestion', 'open', 250, 320, 'initiate manual failover via AWS Console', '2026-03-10 08:45:00'), (@log_db_failover, @alice_id, 'After the March 3 incident, we discovered the health check interval was too long. Note the updated 10s interval.', 'note', 'resolved', NULL, NULL, NULL, '2026-03-06 09:00:00'); SELECT @comment_db_healthcheck := id FROM comments WHERE log_id = @log_db_failover AND user_id = @alice_id AND tag = 'note'; UPDATE comments SET resolved_by = @dave_id, resolved_at = '2026-03-07 14:00:00' WHERE id = @comment_db_healthcheck; -- Performance Budget discussion INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_perf_budget, @bob_id, 'Initial JS budget of 150 KB gzipped might be tight with the new analytics SDK. Can we get an exemption or find a lighter alternative?', 'issue', 'open', 200, 250, 'Initial JS: < 150 KB gzipped', '2026-04-01 15:00:00'), (@log_perf_budget, @carol_id, 'Font budget is fine — we''re at 82 KB with the current subset. Confirmed with latest build.', 'note', 'resolved', 270, 310, 'Fonts: < 100 KB', '2026-03-15 10:00:00'); SELECT @comment_perf_font := id FROM comments WHERE log_id = @log_perf_budget AND user_id = @carol_id AND tag = 'note'; UPDATE comments SET resolved_by = @carol_id, resolved_at = '2026-03-15 10:05:00' WHERE id = @comment_perf_font; -- Color Palette feedback INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_color_palette, @alice_id, 'The contrast ratio between Acme Blue and white background is 3.8:1 which barely passes AA for large text. Should we darken it slightly?', 'issue', 'open', 80, 130, 'Acme Blue — #2CA7DB', '2026-03-30 11:00:00'), (@log_color_palette, @eve_id, 'Love the palette! Can we add a dark mode variant column?', 'suggestion', 'open', NULL, NULL, NULL, '2026-04-03 09:30:00'); -- Code Review Guidelines INSERT INTO comments (log_id, user_id, content, tag, status, created_at) VALUES (@log_code_review, @eve_id, 'Should we add a section about reviewing AI-generated code? Becoming more common on our PRs.', 'suggestion', 'open', '2026-04-09 10:00:00'), (@log_code_review, @dave_id, '"Review within one business day" — should this be shorter for critical bugfix PRs?', 'question', 'open', '2026-04-10 14:00:00'); -- Data Quality Framework INSERT INTO comments (log_id, user_id, content, tag, status, selection_start, selection_end, selected_text, created_at) VALUES (@log_data_quality, @eve_id, 'Great Expectations is being deprecated in favor of GX Cloud. We should plan the migration.', 'issue', 'open', 250, 300, 'Great Expectations runs nightly validation suites', '2026-04-07 09:00:00'); -- dbt Model Guide INSERT INTO comments (log_id, user_id, content, tag, status, created_at) VALUES (@log_dbt_guide, @bob_id, 'We also need conventions for snapshot models. Several teams have started using them inconsistently.', 'suggestion', 'open', '2026-03-25 16:00:00'); -- ========================= -- Comment Replies -- ========================= -- Reply thread on API v3 question INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES (@comment_api_v3, @alice_id, 'Good point. Let''s add a "Beta Endpoints" callout box at the top. I''ll draft something this week.', '2026-03-20 11:00:00'), (@comment_api_v3, @eve_id, 'The v3 beta is currently opt-in only. We should note that endpoints may change without notice.', '2026-03-20 14:30:00'), (@comment_api_v3, @bob_id, 'Agreed. I''ll also add the beta header requirement: X-API-Version: 3-beta', '2026-03-21 09:00:00'); -- Reply thread on API rate limit INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES (@comment_api_rate, @alice_id, 'Enterprise customers can already request custom limits. We should document the process here.', '2026-03-22 15:00:00'), (@comment_api_rate, @bob_id, 'I can add the enterprise rate limit tiers: 5K, 10K, and 25K per minute.', '2026-03-23 10:00:00'); -- Reply on resolved API typo INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES (@comment_api_typo, @alice_id, 'Fixed — clarified it''s per API key, not per account. Each key has its own counter.', '2026-02-10 11:30:00'); -- Reply on CI/CD canary INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES ((SELECT id FROM comments WHERE log_id = @log_cicd AND user_id = @bob_id AND tag = 'suggestion'), @alice_id, 'Makes sense. Let''s add a canary_percentage field to our ArgoCD app configs.', '2026-03-29 09:00:00'), ((SELECT id FROM comments WHERE log_id = @log_cicd AND user_id = @bob_id AND tag = 'suggestion'), @dave_id, '+1, the payment service definitely needs a smaller canary window.', '2026-03-29 10:30:00'); -- Reply on architecture edge caching INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES ((SELECT id FROM comments WHERE log_id = @log_arch_overview AND user_id = @eve_id), @bob_id, 'I can add that section. The Cloudflare Workers cache layer handles about 60% of read traffic now.', '2026-04-02 11:00:00'); -- Reply on DB failover CLI commands INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES ((SELECT id FROM comments WHERE log_id = @log_db_failover AND user_id = @bob_id AND tag = 'suggestion'), @dave_id, 'Great idea. I''ll add the full aws rds failover-db-cluster command with our cluster-id.', '2026-03-10 10:00:00'), ((SELECT id FROM comments WHERE log_id = @log_db_failover AND user_id = @bob_id AND tag = 'suggestion'), @alice_id, 'Also add the verification command to check the new primary''s endpoint.', '2026-03-10 11:30:00'); -- Reply on code review AI INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES ((SELECT id FROM comments WHERE log_id = @log_code_review AND user_id = @eve_id), @alice_id, 'Yes! Key concern: reviewers need to treat AI code with extra scrutiny for security and correctness.', '2026-04-09 11:30:00'), ((SELECT id FROM comments WHERE log_id = @log_code_review AND user_id = @eve_id), @bob_id, 'We should require authors to label which parts were AI-assisted in the PR description.', '2026-04-09 14:00:00'); -- Reply on performance budget JS size INSERT INTO comment_replies (comment_id, user_id, content, created_at) VALUES ((SELECT id FROM comments WHERE log_id = @log_perf_budget AND user_id = @bob_id AND tag = 'issue'), @carol_id, 'Let''s evaluate Plausible''s lightweight script vs the current SDK. It''s under 1 KB.', '2026-04-01 16:00:00'), ((SELECT id FROM comments WHERE log_id = @log_perf_budget AND user_id = @bob_id AND tag = 'issue'), @alice_id, 'We could also defer the analytics SDK to after first paint — won''t affect LCP.', '2026-04-02 09:00:00'); -- ========================= -- Favorites -- ========================= INSERT INTO favorites (user_id, log_id, created_at) VALUES (@alice_id, @log_api_overview, '2026-01-05 10:00:00'), (@alice_id, @log_cicd, '2026-01-12 14:00:00'), (@alice_id, @log_component_lib, '2026-02-20 09:00:00'), (@alice_id, @log_code_review, '2025-10-20 15:00:00'), (@bob_id, @log_arch_overview, '2025-11-01 10:00:00'), (@bob_id, @log_k8s_setup, '2025-11-05 11:00:00'), (@bob_id, @log_rate_limit, '2025-12-22 09:00:00'), (@bob_id, @log_dbt_guide, '2026-01-15 10:00:00'), (@carol_id, @log_color_palette, '2025-10-30 09:00:00'), (@carol_id, @log_typography, '2025-11-05 10:00:00'), (@carol_id, @log_perf_budget, '2025-11-15 14:00:00'), (@carol_id, @log_component_lib, '2025-11-25 09:00:00'), (@dave_id, @log_db_failover, '2025-10-20 08:00:00'), (@dave_id, @log_high_cpu, '2025-10-28 14:00:00'), (@dave_id, @log_secrets_mgmt, '2025-12-23 15:00:00'), (@dave_id, @log_monitoring, '2025-11-12 10:00:00'), (@dave_id, @log_welcome, '2025-10-12 09:00:00'), (@eve_id, @log_pipeline_arch, '2025-11-05 08:00:00'), (@eve_id, @log_data_quality, '2025-12-05 14:00:00'), (@eve_id, @log_push_notif, '2025-11-18 13:00:00'), (@eve_id, @log_webhooks, '2025-11-15 17:00:00'), (@eve_id, @log_batch_ops, '2025-12-01 09:00:00');