Fix char/byte offset mix in Handoff::Document#complete #1423
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#1423
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
completecomputesoffset = @frontmatter.begin(1) + @completed_line.begin(0)(character offsets) and passes it tobyteslice(byte offsets). With a multi-byte character in the frontmatter beforecompleted_at:, the stamped file loses a newline and keeps a stray:; it is then unparseable. No test fails because tests use ASCII text.Reproduce
From
plugins/os:With
project: cafe(ASCII) the output is correct.Approach
Required work:
[],length) for both, or byte offsets (MatchData#byteoffset) for both.Documenttest from a string with a non-ASCII character in the frontmatter beforecompleted_at:.Acceptance criteria
project: caféand an emptycompleted_at:, whencomplete(now)runs, then the result equals the input with only that line replaced bycompleted_at: <stamp>.Document.newparses it, thencompleted_atreturns the stamp.Owner sketch
Handoff::Documentkeeps the fix. Optional: a small frontmatter-line object owns the line's span, so readers stop doing[1]/begin(1)arithmetic.Origin
completepasses a character offset tobyteslice(plugins/os/lib/handoff/document.rb:35) ← DESIGNVERDICT: CREATE