Skip to content

docs: SKILL/docs round-3 sync — python-docx redline caveats, get_paragraph, WorkspaceLockedError, session EditResult transit (ISSUES.md #49) - #64

Merged
pablospe merged 4 commits into
mainfrom
task/90f0d765-SKILL-docs-round-3-sync--works
Jul 22, 2026
Merged

pablospe merged 4 commits into
mainfrom
task/90f0d765-SKILL-docs-round-3-sync--works

Conversation

@pablospe

@pablospe pablospe commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Round-3 documentation sync (ISSUES.md #49, referenced as plain text on purpose — repo-local issue list, not a GitHub issue): audits and fixes false/stale claims in skills/docx/SKILL.md and docs/api.md, and documents APIs that shipped without docs. Docs-only diff; no library code touched.

SKILL.md

  • python-docx redline blindness: decision-tree caution + warning blockquote — paragraph.text silently drops everything inside w:ins/w:del (a redlined doc reads as mangled prose with no error); read redlined docs with docx_editor or pandoc --track-changes=all. Also: never carry paragraph indexes between libraries — python-docx excludes table-cell paragraphs, P{n} refs include them, so numbering diverges at the first table.
  • Basic Usage exit comment: replaced the false "workspace preserved for inspection … error messages print the exact path" claim. The kept workspace holds only state already flushed by save(); unsaved edits live in memory and are lost. Rescue idiom documented (catch inside the with block, doc.save("rescue.docx")) including its side effect: the rescue save flags the workspace, so the next open() of the source raises WorkspaceSyncError.
  • Concurrency: "Editing in parallel", Limitations, and the error table now describe the advisory lock (WorkspaceLockedError with pid/lock_path, same-process detection, stale-lock reclaim, force_recreate=True takeover) instead of the stale "two processes share one workspace and overwrite each other" claim.
  • get_paragraph(): walkthrough snippet + ParagraphIndexError recovery hint.
  • Revision ids: documented as w:id attributes stored in the XML — stable across save/close/reopen (groups are not).
  • Session mode: eval of an edit returns EditResult as a bare JSON string (str subclass) — group_id/revision_ids lost in transit; keep the result kernel-side and eval a dict projection. status is a point-in-time snapshot.
  • Creation snippet: bulleted/numbered list examples (List Bullet/List Number).

docs/api.md

  • New get_paragraph(index) reference entry (house format, cross-linked).
  • workspace_path: preserved workspace holds the last save() flush only.

Verification

Every changed claim was verified by execution against this worktree's library (probe scripts: redline blindness output, P-count divergence 4 vs 2 on a table doc, get_paragraph parity + bounds errors, WorkspaceLockedError with live pid, revision-id stability across reopen, exception-path workspace contents, rescue-idiom WorkspaceSyncError follow-up, session envelope for an eval'd edit).

Gates: pytest 1200 passed / 2 skipped, ruff check + ruff format --check clean, ty check exit 0 (7 pre-existing tests/-only warnings), mkdocs build --strict clean.

Summary by CodeRabbit

  • Documentation
    • Clarified that workspace data reflects the last saved state, while unsaved edits remain in memory.
    • Documented the new Document.get_paragraph(index) API, including usage, return values, and errors.
    • Expanded DOCX workflow guidance for tracked changes, paragraph selection, recovery, revisions, session mode, error handling, and concurrent editing.
    • Added examples for creating bulleted and numbered lists.

…graph, WorkspaceLockedError, session EditResult transit (ISSUES.md #49)

SKILL.md:
- Decision tree + structure-navigation warning: python-docx is blind to
  tracked changes (paragraph.text silently drops w:ins/w:del content) and
  its paragraph numbering diverges from P{n} refs at the first table cell
- Creation snippet: List Bullet / List Number style examples
- Basic Usage exit comment: replaced the false workspace-preservation
  claim — the kept workspace holds only state flushed by save(); unsaved
  edits are lost; rescue idiom documented incl. the WorkspaceSyncError it
  leaves on the next open() of the source
- Track-changes walkthrough: get_paragraph() snippet; error table gains
  WorkspaceLockedError row and get_paragraph recovery hint
- Revision groups: revision ids are w:id attributes and survive reopen
- Session mode: eval of an edit returns EditResult as a bare JSON string
  (group_id/revision_ids lost in transit; use a kernel-side projection);
  status is a point-in-time snapshot
- Editing in parallel / Limitations: advisory lock semantics replace the
  stale "share one workspace and overwrite each other" claim

docs/api.md:
- New get_paragraph(index) entry
- workspace_path: preserved workspace holds last save() flush only
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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

Run ID: f988a337-85f6-4bf0-b93a-99087b561f8d

📥 Commits

Reviewing files that changed from the base of the PR and between d22162a and b93f7d0.

📒 Files selected for processing (2)
  • docs/api.md
  • skills/docx/SKILL.md
📝 Walkthrough

Walkthrough

Documentation updates clarify workspace persistence, add the Document.get_paragraph(index) API reference, and expand docx-editor workflow guidance for tracked changes, recovery, revisions, sessions, errors, and concurrent document access.

Changes

Documentation contracts

Layer / File(s) Summary
API reference updates
docs/api.md
Clarifies that workspace_path reflects the last saved state and documents Document.get_paragraph(index), its return value, and out-of-range exception.
Document workflow guidance
skills/docx/SKILL.md
Adds guidance for tracked changes, paragraph indexing, list creation, paragraph retrieval, and workspace behavior after exceptions.
Runtime behavior contracts
skills/docx/SKILL.md
Documents stable revision IDs, expanded error recovery, session-mode result handling, and advisory locking for parallel access.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit flips pages, tidy and bright,
Saved paths hold memory flushed right.
Paragraphs hop by number and name,
Redlines and locks join the game.
Sessions keep secrets, revisions stay true—
Documentation sprouts fresh carrots anew!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the documentation-focused changes and names several of the key updates in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/90f0d765-SKILL-docs-round-3-sync--works

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.

@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: 1

🤖 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 `@skills/docx/SKILL.md`:
- Line 754: Update the ParagraphIndexError recovery guidance in the error table
to return a usable paragraph reference by recommending doc.get_paragraph(i).ref,
including an explicit empty-document case, or list_paragraphs(start=i, limit=1)
so indexes beyond the default 200-item window can be found.
🪄 Autofix (Beta)

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

Run ID: 10280559-f0a3-4621-b13b-7a8c287e5b05

📥 Commits

Reviewing files that changed from the base of the PR and between 1ace4be and d22162a.

📒 Files selected for processing (2)
  • docs/api.md
  • skills/docx/SKILL.md

Comment thread skills/docx/SKILL.md
| `TextNotFoundError` | `search_text`, `paragraph_ref`, `paragraph_preview`, `occurrence`, `total_occurrences` | Use `paragraph_preview` to pick a substring that actually appears; if `total_occurrences` is set, retry with an `occurrence` < `total_occurrences`. |
| `AmbiguousTextError` | `search_text`, `paragraph_ref`, `paragraph_preview`, `total_occurrences` | The target matched more than once with no `occurrence` given. Enumerate with `find_all()` and pick, or pass an explicit `occurrence` (0-based). |
| `ParagraphIndexError` | `index`, `total_paragraphs` | Clamp to `1..total_paragraphs` or call `list_paragraphs()` to pick a valid ref. |
| `ParagraphIndexError` | `index`, `total_paragraphs` | Clamp to `1..total_paragraphs` and retry with `get_paragraph(i)`, or call `list_paragraphs()` to pick a valid ref. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make ParagraphIndexError recovery return a usable paragraph reference.

At Line 754, get_paragraph(i) returns ParagraphInfo, while edit/search methods generally require its .ref; additionally, the default list_paragraphs() window cannot locate indexes above 200. Recommend doc.get_paragraph(i).ref (with an explicit empty-document case) or list_paragraphs(start=i, limit=1).

🧰 Tools
🪛 SkillSpector (2.3.11)

[warning] 749: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 749: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 751: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 759: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 760: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 761: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 975: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 981: [MP2] Context Window Stuffing: Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Remediation: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.

(Memory Poisoning (MP2))


[warning] 1066: [PE2] Sudo/Root Execution: Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Remediation: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.

(Privilege Escalation (PE2))


[warning] 1068: [PE2] Sudo/Root Execution: Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Remediation: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.

(Privilege Escalation (PE2))


[warning] 1069: [PE2] Sudo/Root Execution: Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Remediation: Avoid sudo/root unless strictly required. Prefer least-privilege patterns. If elevation is needed, document the justification and scope.

(Privilege Escalation (PE2))

🤖 Prompt for 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.

In `@skills/docx/SKILL.md` at line 754, Update the ParagraphIndexError recovery
guidance in the error table to return a usable paragraph reference by
recommending doc.get_paragraph(i).ref, including an explicit empty-document
case, or list_paragraphs(start=i, limit=1) so indexes beyond the default
200-item window can be found.

pablospe added 3 commits July 22, 2026 18:59
…ck-aware session bullet, P{i} placeholder

Multi-reviewer findings on PR #64:
- The rescue-idiom parenthetical wrongly claimed the catch-inside flow
  leaves a diverged workspace; verified by execution that a swallowed
  exception exits the block normally (workspace cleaned up, next open()
  clean) while a re-raise after the rescue save keeps it flagged and the
  next open() raises WorkspaceSyncError — text now describes both paths
- Session-mode --session-file bullet still said the same document
  'shares one workspace'; now states the second open raises
  WorkspaceLockedError, matching the rewritten Editing-in-parallel section
- P{n} placeholder aligned to the house P{i} convention

Skipped (red-team verdict LOW/optional): callout blockquote format
…aming, docx_editor prose form

- The 'unsaved edits are LOST, next open() succeeds' claim was false for
  a document's first add_comment: comment-part scaffolding is copied into
  the workspace and the dirty flag set before any save(), so the next
  open() of the source raises WorkspaceSyncError instead (verified by
  execution: unsaved comment + exception → WorkspaceSyncError; unsaved
  replace + exception → clean open). Scoped the claim to tracked-change
  edits and documented the comment caveat in SKILL.md and the api.md
  workspace_path entry
- rescue.docx → rescued.docx, matching the established example filename
  for this recovery scenario (SKILL.md error table, session bullet,
  api.md exception example)
- docx-editor → docx_editor for the library-as-actor prose form
…ocs-round-3-sync--works

# Conflicts:
#	skills/docx/SKILL.md
@pablospe
pablospe merged commit 12ae649 into main Jul 22, 2026
8 checks passed
@pablospe
pablospe deleted the task/90f0d765-SKILL-docs-round-3-sync--works branch July 22, 2026 17:33
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.8%. Comparing base (1ace4be) to head (b93f7d0).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #64   +/-   ##
=====================================
  Coverage   95.8%   95.8%           
=====================================
  Files         11      11           
  Lines       3898    3898           
  Branches     776     776           
=====================================
  Hits        3736    3736           
  Misses        75      75           
  Partials      87      87           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pablospe added a commit that referenced this pull request Aug 28, 2026
…#76)

* feat: report revision types accept_all cannot resolve (ISSUES.md #64)

accept_all/reject_all walk w:ins/w:del only, so a redline whose revisions
are format changes or moves returned a bare 0 and read as "there was
nothing to accept". They now return a ResolveResult (an int subclass
carrying .unhandled/.unhandled_types), warn with UnhandledRevisionWarning
when adjudication is incomplete, and list_unhandled_revisions() names the
marks that are still pending.

Adds count_revision_elements()/RevisionCensus and a corpus-harness
--census mode recording which revision types real producers emit.

* fix: don't count marks recorded inside a change record as pending

A w:tcPrChange records the cell's previous w:tcPr, which is CT_TcPrInner and
so may legally hold a w:cellIns/w:cellDel/w:cellMerge. Those describe state
that is already gone, but the unhandled scan descended into the record and
reported them as extra pending revisions. iter_revision_elements now takes
skip_change_records, which _unhandled_elements uses; count_revision_elements
stays a raw inventory and documents the difference.

Also: extract _parse_w_date instead of a third copy of the w:date parse;
correct the "excluded from every filtered call" author rule, which the
author="Unknown" test contradicted; move the SKILL.md honesty check next to
the call it inspects, since it read a result four calls stale; drop the
incorrect ECMA sub-numbers; label the census error count by part rather than
file and stop truncating it silently.

* fix: correct the change-record schema note and pin the handled-path gap

The rationale for CHANGE_RECORD_TAGS claimed only w:tcPrChange's recorded
subtree can hold revision marks. Two more can: a paragraph-mark w:rPrChange
records CT_ParaRPrOriginal, which opens with EG_ParaRPrTrackChanges, and
w:pPrChange records CT_PPrBase, whose w:numPr admits w:ins/w:numberingChange.

Only the pending-revision path skips those subtrees; list_revisions and
accept_all still walk every w:ins/w:del, so a historical w:del recorded in a
change record is listed and resolved like a live one. That is pre-existing,
and is now pinned by an xfail(strict=True) test so ISSUES.md #68 inherits it
rather than rediscovering it.

Also: guard CHANGE_RECORD_TAGS against drifting out of the property-change
family; group w:trPrChange with the property changes in the warning docstring;
stop labelling every w:rPr context as a paragraph mark, since a change
record's recorded rPr shares the tag; report files whose census never ran
instead of counting them as revision-free; build the location context only
when list_unhandled_revisions has rows; name the author scope in the warning.
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