Skip to content

Dropbox folder watcher with write-back (Shlok Chauhan) - #122

Open
theshloksschauhan wants to merge 2 commits into
superdocsapp:mainfrom
theshloksschauhan:extensions/shlok-chauhan-dropbox-watcher
Open

Dropbox folder watcher with write-back (Shlok Chauhan)#122
theshloksschauhan wants to merge 2 commits into
superdocsapp:mainfrom
theshloksschauhan:extensions/shlok-chauhan-dropbox-watcher

Conversation

@theshloksschauhan

Copy link
Copy Markdown

Name

Shlok Chauhan

Summary

  • Assigned S2 build: Dropbox folder watcher that nominates folders and treatments, runs SuperDocs upload/chat/approve/export, gates every write in a console, and files the export beside the source as {basename}.superdocs.{treatment}{ext}.
  • Survives Dropbox half-writes (content-hash debounce), never re-triggers on its own output (path + hash registry), preview mode spends zero SuperDocs operations, hourly budget is a hard stop.
  • 75 keyless pytest cases. Folder: extensions/theshloksschauhan/dropbox-folder-watcher. Built for the SuperDocs engineer task.

Test plan

  • docker-compose up -d --build then alembic upgrade head
  • cd backend && pytest (no live key)
  • Nominate /Clients/Acme/Inbox, drop a file, approve in the console, confirm sibling *.superdocs.* in Dropbox

Made with Cursor

theshloksschauhan and others added 2 commits August 20, 2026 21:29
Assigned S2 build for the SuperDocs engineer round: poll a nominated folder, gate edits, write the export beside the source without looping on our own output.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep only .env.template so secrets and machine-local DB files stay out of the public PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an “assigned S2” Dropbox folder watcher extension that polls nominated Dropbox folders, debounces half-writes via content-hash stability, runs the SuperDocs 4-call loop up to a human review gate, and writes back approved exports beside the source as *.superdocs.*. It includes a React review console, a FastAPI backend with durable job state in Postgres, and a substantial keyless pytest suite using fakes.

Changes:

  • Added backend data model + services for stability debounce, anti-loop protection, job state machine, worker execution, and budget enforcement (with Alembic migrations).
  • Added a React console for folder nomination, preview-mode toggle, mock-drop seeding, and human approve/reject.
  • Added extensive offline tests and submission/architecture documentation for the engineer task.

Reviewed changes

Copilot reviewed 75 out of 83 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
extensions/theshloksschauhan/dropbox-folder-watcher/TASK4_ONE_PAGE.md One-page summary of the build and trade-offs
extensions/theshloksschauhan/dropbox-folder-watcher/TASK4_FOUR_QUESTIONS.md Task submission “four questions” answers
extensions/theshloksschauhan/dropbox-folder-watcher/TASK.md Working agreements / guardrails for the task
extensions/theshloksschauhan/dropbox-folder-watcher/Task_3_Use_Cases.md Task 3 use cases / positioning notes
extensions/theshloksschauhan/dropbox-folder-watcher/SUBMISSION.md Consolidated submission + architecture diagram
extensions/theshloksschauhan/dropbox-folder-watcher/README.md Extension readme + quickstart + pointers
extensions/theshloksschauhan/dropbox-folder-watcher/PROGRESS.md Progress log / assumptions summary
extensions/theshloksschauhan/dropbox-folder-watcher/NOT_DOING.md Explicit scope cuts and rationale
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/vite.config.js Vite config for the console
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/main.jsx React entrypoint
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/index.css Console styling / layout / modal styles
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/components/SettingsModal.jsx UI for creating clients + nominating folders
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/components/MockDropModal.jsx UI for seeding a job without live tokens
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/components/JobViewer.jsx Review UI for proposed changes + approve/reject
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/assets/vite.svg Frontend asset
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/assets/react.svg Frontend asset
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/App.jsx Main console app (polling, preview toggle, navigation)
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/App.css Additional (currently unused) CSS file
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/src/api.js API base URL helper
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/public/icons.svg UI icon sprite sheet
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/public/favicon.svg Frontend favicon
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/package.json Frontend dependencies + scripts
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/index.html Frontend HTML shell + fonts
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/Dockerfile Frontend dev container
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/.oxlintrc.json Frontend lint configuration
extensions/theshloksschauhan/dropbox-folder-watcher/frontend/.gitignore Frontend ignores
extensions/theshloksschauhan/dropbox-folder-watcher/docker-compose.yml Local dev stack (db, api, daemon, frontend)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_worker.py Worker loop integration tests (fakes)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_watcher.py Watcher scan tests (anti-loop, debounce, filtering)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_superdocs_client.py SuperDocs client parsing + preview chokepoint tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_state_machine.py State machine + claim lease behavior tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_stability.py Stability debounce tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_isolation.py Path normalization + isolation tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_budget.py Hourly operation budget enforcement tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/test_antiloop.py Anti-loop layered checks tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/fixtures/fake_superdocs.py Fake SuperDocs client for keyless tests
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/fixtures/fake_dropbox.py Fake Dropbox client + canned metadata scenarios
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/fixtures/init.py Test fixtures package marker
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/conftest.py In-memory SQLite session fixture
extensions/theshloksschauhan/dropbox-folder-watcher/backend/tests/init.py Tests package marker
extensions/theshloksschauhan/dropbox-folder-watcher/backend/requirements.txt Backend Python dependencies
extensions/theshloksschauhan/dropbox-folder-watcher/backend/Dockerfile Backend container definition
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/worker.py Worker: prepare-for-review + complete-after-approval
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/watcher.py Watcher: folder scan + job creation pipeline
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/system_state.py Global runtime toggles (preview mode)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/superdocs_client.py SuperDocs 4-call client + double-JSON parse + preview guard
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/state_machine.py Valid transitions + atomic claim for queued/approved jobs
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/stability.py Content-hash + rev debounce stability detection
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/isolation.py Dropbox path normalization + root scoping
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/dropbox_client.py Dropbox SDK wrapper + webhook signature verification
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/budget.py Hourly ops budget accounting/enforcement
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/antiloop.py Anti-loop registry + checks + output registration
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/services/init.py Services package marker
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/superdocs_call.py SuperDocs call audit model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/operation_metric.py Operation metrics model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/known_output.py Known output registry model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/job.py Job model + status enum + constraints
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/folder_config.py FolderConfig model (treatment, debounce, budget, preview)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/event.py State transition event/audit model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/error.py Error tracking model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/dropbox_event.py Dropbox observation log model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/client.py Client/tenant model
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/base.py SQLAlchemy declarative base
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/models/init.py Models export list for Alembic imports
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/daemon.py Combined watcher/worker daemon loop
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/core/database.py Engine/session setup + context helpers
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/core/config.py Env-based config (DB/Dropbox/SuperDocs/worker settings)
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/core/init.py Core package marker
extensions/theshloksschauhan/dropbox-folder-watcher/backend/app/init.py App package marker
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic/versions/2026_08_20_002_proposed_changes.py Migration: add proposed_changes_json
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic/versions/2026_08_13_001_initial_schema.py Migration: initial schema
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic/versions/.gitkeep Versions dir placeholder
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic/script.py.mako Alembic template
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic/env.py Alembic env wiring to app settings/models
extensions/theshloksschauhan/dropbox-folder-watcher/backend/alembic.ini Alembic config
extensions/theshloksschauhan/dropbox-folder-watcher/backend/.env.template Template environment config
extensions/theshloksschauhan/dropbox-folder-watcher/ARCHITECTURE.md Architecture / pitfalls / rationale write-up
extensions/theshloksschauhan/dropbox-folder-watcher/.gitignore Extension-level ignore rules
Files not reviewed (1)
  • extensions/theshloksschauhan/dropbox-folder-watcher/frontend/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +101 to +109
# 2. Duplicate check — do we already have a job for this rev?
existing = (
db.query(Job)
.filter(
Job.folder_config_id == folder_config.id,
Job.source_rev == entry.rev,
)
.first()
)
Comment on lines +187 to +192
update(Job)
.where(
Job.id == job_id,
Job.status == JobStatus.APPROVED,
)
.values(
Comment on lines +24 to +26
--border:rgba(43,39,64,0.08);
--border-2:rgba(43,39,64,0.13);
}
Comment on lines +1 to +3
"""Runtime system toggles (in-memory; survives within a single process)."""

_global_preview_mode: bool = False
reason="Missing content_hash or rev — file may not be fully synced",
)

# Find the most recent prior observation for this path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants