Skip to content

feat: add document review workflow - #9

Merged
Deathcharge merged 4 commits into
mainfrom
codex/workspace-0-2-document-review
Aug 11, 2026
Merged

feat: add document review workflow#9
Deathcharge merged 4 commits into
mainfrom
codex/workspace-0-2-document-review

Conversation

@Deathcharge

@Deathcharge Deathcharge commented Aug 10, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds bounded cross-file UTF-8 search with exact Unicode source spans and line navigation
  • adds UTF-8 multi-file import, current-document download, create-only writes, and collision-safe replacement
  • adds dependency-free safe basic Markdown preview plus tab-scoped draft recovery and explicit external-change handling
  • hardens explicit Host validation, bearer-token comparison, filesystem accounting, atomic creation, and responsive/accessibility behavior
  • pins CI actions to immutable revisions and smoke-tests the installed wheel outside the checkout
  • updates Samsarix 0.2.0 packaging, product documentation, market boundary, changelog, and release evidence

Why

Samsarix Workspace's strongest independent use case is a small local document/artifact review workspace—not a faux IDE. This milestone completes that job while preserving plain local files, no OS shell, no code execution, no cloud dependency, and no frontend supply chain.

User impact

Users can import a bounded set of notes, logs, configuration, code, or AI-generated text; search and navigate matches; safely preview Markdown; recover one tab draft; resolve external edits; and save or download the result.

Validation

  • Ruff lint and format: pass
  • mypy strict: pass (6 source files)
  • pytest: 56 passed, 1 expected Windows FIFO skip, 90.87% branch-aware coverage
  • Node syntax and workflow YAML parse: pass
  • headed Chromium: Unicode search selected exact astral span at UTF-16 offsets 19–27, immediate duplicate Ctrl+S issued one PUT, real download succeeded, and console had zero errors/warnings
  • isolated build and Twine metadata: pass for wheel and sdist
  • clean wheel install outside the checkout: exact import/package/CLI version, packaged assets, and pip check pass
  • pip-audit 2.10.0: no known vulnerabilities after disposable bootstrap-tool updates; unpublished local package skipped as expected
  • targeted dangerous-sink search: no findings

Artifact digests are recorded in docs/PRODUCTIZATION.md. Publication and hosted deployment remain explicitly out of scope.

Signed-off-by: Deathcharge <ward.andrew32@gmail.com>
Signed-off-by: Deathcharge <ward.andrew32@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Deathcharge, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 66173f87-4ccd-4420-b9b4-eaf610327eca

📥 Commits

Reviewing files that changed from the base of the PR and between 9e97cdb and 7c4e574.

📒 Files selected for processing (13)
  • .github/workflows/ci.yml
  • CONTRIBUTING.md
  • docs/API_REFERENCE.md
  • docs/PRODUCTIZATION.md
  • samsarix_workspace/api.py
  • samsarix_workspace/cli.py
  • samsarix_workspace/shell.py
  • samsarix_workspace/static/app.js
  • samsarix_workspace/workspace.py
  • tests/test_api.py
  • tests/test_cli.py
  • tests/test_shell.py
  • tests/test_workspace.py

Summary by CodeRabbit

  • New Features
    • Added workspace file search with filtering, case sensitivity, result limits, and match previews.
    • Added document import, download, and Markdown preview.
    • Added draft recovery and dialogs for handling unsaved changes and edit conflicts.
    • Added safer file creation and clearer conflict responses.
  • Security
    • Added trusted-host validation and stricter bearer-token requirements.
  • Documentation
    • Updated setup, API, security, and usage guides for the 0.2.0 release.
  • Release
    • Published version 0.2.0 with expanded document-review capabilities.

Walkthrough

The 0.2.0 release adds bounded workspace search, browser document import and preview, downloads, draft recovery, conflict handling, trusted-host validation, atomic file creation, updated documentation, tests, CI, and release metadata.

Changes

Document review release

Layer / File(s) Summary
Workspace search and atomic file operations
samsarix_workspace/workspace.py, tests/test_workspace.py
The workspace adds bounded UTF-8 search, match previews, resource metrics, workspace IDs, directory validation, safer metadata handling, and atomic create_only writes.
API security and serving configuration
samsarix_workspace/api.py, samsarix_workspace/cli.py, .env.example, docs/API_REFERENCE.md, docs/GETTING_STARTED.md, SECURITY.md, tests/test_api.py, tests/test_cli.py
The API and CLI add trusted-host validation, ASCII token checks, search and create-only file contracts, environment configuration, and wildcard-binding rules.
Browser document review workflow
samsarix_workspace/static/*, README.md, docs/GETTING_STARTED.md
The browser interface adds search, import, Markdown preview, downloads, draft recovery, edit-conflict actions, accessible controls, and responsive styling.
Shell command dispatch and validation
samsarix_workspace/shell.py, tests/test_shell.py
The shell stores its allowlisted handlers once, supports short output limits, and delegates directory validation to the workspace.
0.2.0 release records and verification
pyproject.toml, samsarix_workspace/__init__.py, .github/workflows/ci.yml, CHANGELOG.md, ROADMAP.md, docs/PRODUCTIZATION.md, CONTRIBUTING.md
The project version, build configuration, CI actions, release records, setup paths, and productization status now describe 0.2.0.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Reviewer
  participant Browser
  participant API
  participant Workspace
  Reviewer->>Browser: Search workspace or open document
  Browser->>API: Request search or file content
  API->>Workspace: Execute bounded operation
  Workspace-->>API: Return matches or file state
  API-->>Browser: Return JSON response
  Browser-->>Reviewer: Render results, preview, or conflict action
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding a document review workflow.
Description check ✅ Passed The description directly explains the document review features, security changes, documentation updates, and validation results.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/workspace-0-2-document-review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Deathcharge <ward.andrew32@gmail.com>
@Deathcharge
Deathcharge marked this pull request as ready for review August 11, 2026 05:49

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 12

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 55-56: Update the wheel smoke-test steps in the CI workflow to
execute from outside the repository checkout, preventing the editable
installation from resolving the source package. Assert that the output of the
samsarix-workspace CLI version command matches the installed samsarix-workspace
package version, rather than checking command success alone.
- Around line 23-25: Update the workflow steps using actions/checkout@v7 and
actions/setup-python@v7 to reference their full immutable commit SHAs, covering
all three `@v7` occurrences. Add persist-credentials: false to the
actions/checkout step.

In `@CONTRIBUTING.md`:
- Around line 8-9: Update the clone command in the contributor setup
instructions to use the canonical repository owner instead of the YOUR_USERNAME
placeholder, while keeping the subsequent directory change aligned with the
actual repository name.

In `@samsarix_workspace/api.py`:
- Around line 351-357: Update the write_file API documentation in
API_REFERENCE.md to explicitly describe guard precedence: for an existing path,
create_only returns already_exists before expected_etag validation; for a
missing path, any non-null expected_etag returns edit_conflict.

In `@samsarix_workspace/cli.py`:
- Around line 122-124: Update the wildcard_bind validation to reject
--allowed-host values that permit every host, including "*" and unsupported
wildcard forms beginning with "*.". Preserve acceptance of explicit host entries
and continue requiring at least one valid allowed host when binding to 0.0.0.0
or ::.
- Around line 121-127: Update host normalization in the CLI configuration and
request validation flow so configured and incoming hosts are compared
case-insensitively, and bracketed IPv6 authorities such as [::1]:8765 normalize
to ::1 rather than being split at the first colon. Preserve wildcard and
explicit allowed-host behavior, and add regression coverage for mixed-case
hostnames and bracketed IPv6 inputs.

In `@samsarix_workspace/shell.py`:
- Around line 105-106: Validate max_output_chars in VirtualShell.__init__ and
reject negative values before _bounded performs truncation; preserve the
existing behavior for zero and positive limits.

In `@samsarix_workspace/static/app.js`:
- Around line 578-590: Update downloadFile so URL.revokeObjectURL(url) runs in a
later task after link.click(), such as via setTimeout, rather than
synchronously. Keep the existing download setup and toast behavior unchanged.
- Around line 338-347: Update focusSearchMatch to convert the matched line’s
prefix and span from code-point offsets to JavaScript UTF-16 offsets before
calling setSelectionRange. Account for astral characters in preceding lines when
computing the absolute start, and in the matched text when computing the end,
while preserving the existing bounds clamping and editor focus behavior.
- Around line 440-467: Add a saving flag to the state object and have saveFile
return immediately when a save is already in progress. Set the flag before
invoking persistFile and clear it when the save completes, including failure
paths, so concurrent Ctrl+S actions cannot issue duplicate PUT requests.

In `@samsarix_workspace/workspace.py`:
- Around line 318-328: Update search_text() to use an internal bounded-read
helper with the remaining max_scan_bytes budget instead of unbounded
self.read_file(entry.path). Have the helper read at most the remaining budget
plus one byte, detect truncation before decoding, and account scanned_bytes
using the actual bytes read rather than entry.size; preserve existing handling
for binary, oversized, and read failures.

In `@tests/test_api.py`:
- Around line 96-98: Update the rejected /healthz test around client.get and the
status assertion to remove the exact response-text check, while retaining the
400 status assertion and verifying that the health route did not execute.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 53453b6f-f092-46b6-aa0b-97dc95377edc

📥 Commits

Reviewing files that changed from the base of the PR and between 1a62b06 and 9e97cdb.

📒 Files selected for processing (23)
  • .env.example
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • ROADMAP.md
  • SECURITY.md
  • docs/API_REFERENCE.md
  • docs/GETTING_STARTED.md
  • docs/PRODUCTIZATION.md
  • pyproject.toml
  • samsarix_workspace/__init__.py
  • samsarix_workspace/api.py
  • samsarix_workspace/cli.py
  • samsarix_workspace/shell.py
  • samsarix_workspace/static/app.css
  • samsarix_workspace/static/app.js
  • samsarix_workspace/static/index.html
  • samsarix_workspace/workspace.py
  • tests/test_api.py
  • tests/test_cli.py
  • tests/test_shell.py
  • tests/test_workspace.py

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread samsarix_workspace/api.py
Comment thread samsarix_workspace/cli.py Outdated
Comment thread samsarix_workspace/static/app.js
Comment thread samsarix_workspace/static/app.js
Comment thread samsarix_workspace/static/app.js
Comment thread samsarix_workspace/workspace.py Outdated
Comment thread tests/test_api.py Outdated
Signed-off-by: Deathcharge <ward.andrew32@gmail.com>
@Deathcharge

Copy link
Copy Markdown
Owner Author

Addressed all 12 review threads in 7c4e574. Regression evidence includes 56 passing tests (plus one expected Windows FIFO skip), strict Ruff/mypy checks, bounded stale-metadata search coverage, mixed-case and bracketed-IPv6 Host coverage, immutable CI action pins, installed-wheel smoke testing outside the checkout, and headed Chromium proof for one-PUT duplicate Ctrl+S handling, exact astral-character selection, successful download, and a clean console. All review threads are resolved and all four CI matrix jobs are green.

@Deathcharge
Deathcharge merged commit bcafd5f into main Aug 11, 2026
5 checks passed
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.

1 participant