refactor(comments): hoist NOTE_TITLE to module level
The string "Comment text" is the dedup contract between
cli/comments.attach_callback, bib/sync._sync_notes, and the
upcoming migration script. Pull it out of the function-local scope
into a module constant so consumers can import it instead of
re-hardcoding the literal.
Surfaced by code review on commit 2f6e2d4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,11 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
_DEFAULT_ROOT = Path(".state/comments")
|
_DEFAULT_ROOT = Path(".state/comments")
|
||||||
|
|
||||||
|
# Title used for the single combined-md note attached per comment item.
|
||||||
|
# The migration script and bib/sync dedup also rely on this exact string —
|
||||||
|
# treat as a stable contract.
|
||||||
|
NOTE_TITLE = "Comment text"
|
||||||
|
|
||||||
|
|
||||||
def _build_bib_helpers(use_bib: bool, attach: bool):
|
def _build_bib_helpers(use_bib: bool, attach: bool):
|
||||||
"""Return ``(body_lookup, attach_callback)``.
|
"""Return ``(body_lookup, attach_callback)``.
|
||||||
@@ -65,8 +70,7 @@ def _build_bib_helpers(use_bib: bool, attach: bool):
|
|||||||
from rex.comments.render import render_combined_md
|
from rex.comments.render import render_combined_md
|
||||||
|
|
||||||
store = connect()
|
store = connect()
|
||||||
# Items that already have a "Comment text" note — keeps re-runs idempotent.
|
# Items that already have a NOTE_TITLE note — keeps re-runs idempotent.
|
||||||
NOTE_TITLE = "Comment text"
|
|
||||||
items_with_note: set[str] = {
|
items_with_note: set[str] = {
|
||||||
row[0]
|
row[0]
|
||||||
for row in store._con().execute(
|
for row in store._con().execute(
|
||||||
|
|||||||
Reference in New Issue
Block a user