Skip to content

Report the task ID the index will actually store - #41

Merged
fohara merged 1 commit into
mainfrom
fix/add-reports-wrong-id
Aug 9, 2026
Merged

fohara merged 1 commit into
mainfrom
fix/add-reports-wrong-id

Conversation

@fohara

@fohara fohara commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Stacked on #39, which is stacked on #40.

What was wrong

lash add "Ship v0.7.0 release notes" -l docs printed
ship-v0-7-0-release-notes while the index stored
ship-v070-release-notes-docs. Anything that copied the printed ID
(lash show, lash complete, @depends-on) failed, and a @depends-on
written against it dangled, which #27's dangling-reference check then rejected.

Two derivations existed and disagreed three ways:

  1. v0.7.0 became v0-7-0 in the emitter (punctuation to separator) and v070
    in the parser (punctuation deleted). Same input, two normalizations.
  2. The parser slugged the raw checkbox title, so an inline #docs was folded
    into the identity as a -docs suffix. A task's ID should not change because
    someone added a label.
  3. Only the parser truncated at 40 characters, so long titles were reported in
    full and stored short.

The fix

lash_types::task::synthesize_task_id is now the one derivation, called by
both the parser and lash add. It strips inline labels before slugging and
truncates, so both sides agree on all three points.

That still leaves the numeric suffix the parser appends to break a collision,
which the emitter cannot know about. So the creation service re-reads the file
it just wrote and reports the ID the parser assigned to the task at that line.
If the re-read fails, the emitter's ID is kept rather than failing a write that
already succeeded.

parse_inline_labels and the new label stripping share one predicate,
label::is_inline_label, so a title loses exactly the words that parsing turns
into labels.

Behaviour change on upgrade

Synthesized IDs for existing tasks change where a title held an inline label or
punctuation inside a word:

  • implement-authentication-security becomes implement-authentication
  • design-requestresponse-schemas becomes design-request-response-schemas

A @depends-on written against an old synthesized ID needs updating. Explicit
@id: values are untouched. Four CLI snapshots are updated to match; every
changed line is one of those two cases.

Tests

Four integration tests: all three discrepancies in one title, truncation of a
long title, the numeric collision suffix, and the reported ID resolving as a
--depends-on target. All four were confirmed to fail without the fix.

@fohara
fohara force-pushed the fix/add-reports-wrong-id branch from 4013ad1 to 91a39fd Compare August 9, 2026 15:46
@fohara
fohara force-pushed the fix/depends-on-line-count branch from f35bede to dc5d83c Compare August 9, 2026 15:46
Base automatically changed from fix/depends-on-line-count to main August 9, 2026 16:02
`lash add "Ship v0.7.0 release notes" -l docs` printed
`ship-v0-7-0-release-notes` while the index stored
`ship-v070-release-notes-docs`. Anything that copied the printed ID
(`lash show`, `lash complete`, `@depends-on`) failed, and a
`@depends-on` written against it dangled, which the dangling-reference
check then rejected.

Two derivations existed and disagreed three ways. `v0.7.0` became
`v0-7-0` in the emitter (punctuation to separator) and `v070` in the
parser (punctuation deleted). The parser slugged the raw checkbox title,
so an inline `#docs` was folded into the identity as a `-docs` suffix.
And only the parser truncated at 40 characters.

`lash_types::task::synthesize_task_id` is now the one derivation, called
by both. It strips inline labels before slugging, because a task's
identity should not change when someone tags it, and it truncates, so
both sides agree on long titles.

That still leaves the numeric suffix the parser appends to break a
collision, which the emitter cannot know about. So the creation service
re-reads the file it just wrote and reports the ID the parser assigned to
the task at that line. If the re-read fails the emitter's ID is kept
rather than failing a write that already succeeded.

`parse_inline_labels` and the new label stripping share one predicate,
`label::is_inline_label`, so a title loses exactly the words that parsing
turns into labels.

Behaviour change on upgrade: synthesized IDs for existing tasks change
where a title held an inline label or punctuation inside a word.
`implement-authentication-security` becomes `implement-authentication`
and `design-requestresponse-schemas` becomes
`design-request-response-schemas`. A `@depends-on` written against an old
synthesized ID needs updating. Explicit `@id:` values are untouched. Four
CLI snapshots are updated to match; every changed line is one of those
two cases.

Tests: four integration tests covering all three discrepancies in one
title, truncation of a long title, the numeric collision suffix, and the
reported ID resolving as a `--depends-on` target. All four fail without
the fix.
@fohara
fohara force-pushed the fix/add-reports-wrong-id branch from 91a39fd to a5b7b11 Compare August 9, 2026 16:05
@fohara
fohara merged commit c6afbc7 into main Aug 9, 2026
21 checks passed
@fohara
fohara deleted the fix/add-reports-wrong-id branch August 9, 2026 16:16
@fohara fohara mentioned this pull request Aug 9, 2026
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