overleaf-comments-export 0.22.0__tar.gz → 0.22.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/PKG-INFO +1 -1
  2. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/anchors.py +15 -1
  3. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/PKG-INFO +1 -1
  4. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/pyproject.toml +1 -1
  5. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_anchors_sections.py +44 -0
  6. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/LICENSE +0 -0
  7. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/README.md +0 -0
  8. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/__init__.py +0 -0
  9. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/__main__.py +0 -0
  10. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/annotate.py +0 -0
  11. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/client.py +0 -0
  12. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/docorder.py +0 -0
  13. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/doctor.py +0 -0
  14. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/export.py +0 -0
  15. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/filenames.py +0 -0
  16. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/gui.py +0 -0
  17. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/highlight.py +0 -0
  18. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/model.py +0 -0
  19. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/pdfannotate.py +0 -0
  20. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/render.py +0 -0
  21. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/sections.py +0 -0
  22. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export/since.py +0 -0
  23. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/SOURCES.txt +0 -0
  24. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/dependency_links.txt +0 -0
  25. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/entry_points.txt +0 -0
  26. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/requires.txt +0 -0
  27. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/overleaf_comments_export.egg-info/top_level.txt +0 -0
  28. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/setup.cfg +0 -0
  29. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_annotate.py +0 -0
  30. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_cancel.py +0 -0
  31. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_client.py +0 -0
  32. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_docorder.py +0 -0
  33. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_doctor.py +0 -0
  34. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_errors_and_auth.py +0 -0
  35. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_export.py +0 -0
  36. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_export_wiring.py +0 -0
  37. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_extension_parity.py +0 -0
  38. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_filenames.py +0 -0
  39. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_floats.py +0 -0
  40. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_gui.py +0 -0
  41. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_highlight.py +0 -0
  42. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_output_host.py +0 -0
  43. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_pdfannotate.py +0 -0
  44. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_render.py +0 -0
  45. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_replies_and_changes.py +0 -0
  46. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_response_letter.py +0 -0
  47. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_review_fixes.py +0 -0
  48. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_schema_parity.py +0 -0
  49. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_since.py +0 -0
  50. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_stable_output.py +0 -0
  51. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_stress.py +0 -0
  52. {overleaf_comments_export-0.22.0 → overleaf_comments_export-0.22.1}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: overleaf-comments-export
3
- Version: 0.22.0
3
+ Version: 0.22.1
4
4
  Summary: Export comment threads and tracked changes from an Overleaf project to Markdown + JSON, optimized for AI-agent consumption.
5
5
  Author-email: Shivang Gupta <47645533+Mangluu@users.noreply.github.com>
6
6
  License: MIT
@@ -35,9 +35,23 @@ def resolve_anchor(
35
35
  If text[offset:offset+len(anchored_text)] matches anchored_text, we trust it.
36
36
  Otherwise, search +/- search_window characters for the anchored text and
37
37
  re-anchor. If still not found, return the original offset's coords and
38
- mark stale=True."""
38
+ mark stale=True.
39
+
40
+ A comment can also be attached to a position rather than to a range, and
41
+ Overleaf sends those with no anchored text at all. Nothing has moved and
42
+ there is nothing to check, so they are not stale. They used to fall
43
+ through to the stale branch because both searches need text to look for:
44
+ on one real paper that flagged 74 of 131 comments as pointing at text
45
+ that had changed when not one of them did, which buries the few that
46
+ genuinely have."""
39
47
  text = doc.text
40
48
  n = len(anchored_text)
49
+
50
+ if n == 0:
51
+ # No text to verify against, and no evidence the position is wrong.
52
+ safe = min(max(offset, 0), max(0, len(text) - 1))
53
+ line, col = offset_to_line_col(doc.line_starts, safe)
54
+ return safe, line, col, False
41
55
  if n > 0 and 0 <= offset <= len(text) - n and text[offset : offset + n] == anchored_text:
42
56
  line, col = offset_to_line_col(doc.line_starts, offset)
43
57
  return offset, line, col, False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: overleaf-comments-export
3
- Version: 0.22.0
3
+ Version: 0.22.1
4
4
  Summary: Export comment threads and tracked changes from an Overleaf project to Markdown + JSON, optimized for AI-agent consumption.
5
5
  Author-email: Shivang Gupta <47645533+Mangluu@users.noreply.github.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "overleaf-comments-export"
7
- version = "0.22.0"
7
+ version = "0.22.1"
8
8
  description = "Export comment threads and tracked changes from an Overleaf project to Markdown + JSON, optimized for AI-agent consumption."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -104,3 +104,47 @@ def test_nearest_heading_before_first_returns_none():
104
104
  starts = build_line_starts(text)
105
105
  hs = find_headings(text, starts)
106
106
  assert nearest_heading(hs, 1) is None
107
+
108
+
109
+ def test_a_comment_on_a_position_is_not_stale():
110
+ """Overleaf lets a comment attach to a point rather than a selection, and
111
+ sends those with no anchored text. Nothing has moved and there is nothing
112
+ to check against, so calling them stale is a false alarm. One real paper
113
+ had 74 of 131 comments flagged that way when none of them had moved, which
114
+ hides the ones that genuinely did."""
115
+ from overleaf_comments_export.anchors import build_line_starts, resolve_anchor
116
+ from overleaf_comments_export.model import DocText
117
+
118
+ text = "\\section{Method}\nWe crossed three sensory environments.\n"
119
+ doc = DocText(doc_id="d", pathname="p.tex", text=text,
120
+ line_starts=build_line_starts(text), headings=[])
121
+
122
+ at = text.index("three")
123
+ offset, line, col, stale = resolve_anchor(doc, at, "")
124
+ assert stale is False, "an empty anchor was reported as stale"
125
+ assert offset == at, "the position was moved even though nothing was wrong"
126
+ assert line == 2
127
+
128
+
129
+ def test_an_empty_anchor_beyond_the_file_is_still_bounded():
130
+ from overleaf_comments_export.anchors import build_line_starts, resolve_anchor
131
+ from overleaf_comments_export.model import DocText
132
+
133
+ text = "short\n"
134
+ doc = DocText(doc_id="d", pathname="p.tex", text=text,
135
+ line_starts=build_line_starts(text), headings=[])
136
+ offset, _, _, stale = resolve_anchor(doc, 9999, "")
137
+ assert 0 <= offset < len(text)
138
+ assert stale is False
139
+
140
+
141
+ def test_text_that_really_moved_is_still_stale():
142
+ """The fix must not stop reporting the ones that matter."""
143
+ from overleaf_comments_export.anchors import build_line_starts, resolve_anchor
144
+ from overleaf_comments_export.model import DocText
145
+
146
+ text = "alpha beta gamma\n"
147
+ doc = DocText(doc_id="d", pathname="p.tex", text=text,
148
+ line_starts=build_line_starts(text), headings=[])
149
+ _, _, _, stale = resolve_anchor(doc, 0, "text that is gone")
150
+ assert stale is True