GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — id(outbox): a parseable torn tail is accepted, then merged into the next record — Outbox::open only drops unterminated final lines that fail to parse · Issue #1620 · developing-today/code

id(outbox): a parseable torn tail is accepted, then merged into the next record — Outbox::open only drops unterminated final lines that fail to parse #1620

New issue
Copy link
New issue
Copy link
Closed
#2877
Closed
id(outbox): a parseable torn tail is accepted, then merged into the next record — Outbox::open only drops unterminated final lines that fail to parse#1620
#2877
Copy link
Assignees
dezren39
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Problem

Outbox::open (pkgs/id/src/envelope_outbox.rs:130) only drops a torn final line when it fails to parse. A crash that cuts an append after the record's closing } but before its \n leaves a parseable unterminated final line — and open accepts it as a committed record. The next commit() then appends the following record directly onto that same line, producing one line containing two JSON objects; on the next open that line is complete (newline-terminated) and corrupt, so open errors out and the envelope outbox is bricked until a human edits the file by hand.

Evidence (verified this run on main 1658679c)

  • src/envelope_outbox.rs:141-157: the replay loop iterates text.split_inclusive('\n'); on parse success it applies the record and does kept += line.len() (line 146) regardless of whether the line ends with \n. The torn-tail drop is only the Err(_) if !complete => break arm (line 148). If the unterminated fragment parses, kept == text.len(), so no truncation happens and the file keeps its missing trailing newline.
  • src/envelope_outbox.rs:278-289 (commit): appends serde_json::to_string(&record) + '\n' with OpenOptions::append — no leading newline is written, so the next record is concatenated onto the unterminated line.
  • Sibling stores treat any unterminated final line as torn, parseable or not, because an append that never got its newline was never durably committed:
    • src/artifact.rs:565-583 (ArtifactLog::open): "A final line cut short by a crash was never synced, so it is dropped and the file is truncated to the last complete line" — implemented as rfind('\n') truncation before parsing.
    • src/directory.rs:512-526 (the id(directory): a torn final line in directory.jsonl bricks the directory — Directory::replay refuses the crash-torn tail that ArtifactLog (loaded in the same open) drops and truncates #1521 fix): drops the torn final fragment "parseable or not", warns, and truncates.
  • The existing test a_torn_last_line_is_dropped_and_not_mixed_into_the_next_record (src/envelope_outbox.rs:523) covers only an unparseable fragment ({"op":"queued","target"). The parseable-fragment case — its exact title scenario, "not mixed into the next record" — is untested and currently fails by construction: fragment {"op":"queued",...} + appended record = {"op":...}{"op":...}\n, which no longer parses as a single record (demonstrated with a JSON parse of the concatenated line this run).
  • Accepting the fragment also breaks the durability contract: commit does write_all then sync_data (line 285-288); a crash between the data write and the sync can leave exactly this parseable-but-unterminated tail for a record that was never acknowledged.

Why it matters

The outbox is the durable delivery queue for envelopes/artifacts. One unlucky crash turns it into a file that loads once (silently accepting an unacknowledged record), then permanently fails to load after the next enqueue/withdraw/record — with a "line N is corrupt" error that gives no hint the real cause was a torn tail two restarts earlier.

Related but distinct: #1499 (petnames) and #1522 (groups) cite the Outbox as the correct sibling for refusing torn tails; neither covers this parseable-unterminated acceptance in the Outbox itself. #1521 (directory, closed) established the "drop parseable or not" policy this issue asks the Outbox to match.

Acceptance criteria

  • Outbox::open drops an unterminated final line whether or not it parses, truncates the file to the last complete (newline-terminated) line, matching ArtifactLog::open / directory replay semantics.
  • After such a recovery, a subsequent commit() appends cleanly: reopening the outbox succeeds and contains exactly the pre-crash complete records plus the new one.
  • A corrupt complete (newline-terminated) line still fails the load (existing test a_corrupt_complete_line_stops_the_load keeps passing).
  • New regression test: final line is a complete JSON record missing only its trailing \n; open drops it (the record's envelope is not present), the file is truncated, a following enqueue round-trips through a reopen.
  • Existing outbox tests pass, including a_torn_last_line_is_dropped_and_not_mixed_into_the_next_record.

Activity

Next
  1. developing-today commented on Oct 28, 2026

    @developing-today
    developing-todayBot
    on Oct 28, 2026 – with developing.today
    Contributor
    More actions

    CODE-644

  2. dezren39
    added
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 28, 2026
  3. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, slug new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-10-28T08:05Z
    • Found via: filed this run
    • Task: Filed after verifying on main 1658679c that Outbox::open (pkgs/id/src/envelope_outbox.rs:141-157) accepts a parseable unterminated final line (kept += line.len() on parse success, torn-drop only on parse error), so the next commit() append merges two records onto one line and bricks the outbox on the following open — unlike ArtifactLog (artifact.rs:565-583) and directory replay (id(directory): a torn final line in directory.jsonl bricks the directory — Directory::replay refuses the crash-torn tail that ArtifactLog (loaded in the same open) drops and truncates #1521), which drop any unterminated tail parseable or not. Dedup: id: a torn final line in petnames.jsonl bricks the whole world — Petnames::open refuses the crash-torn tail that FileJournal and Outbox drop and truncate #1499/id(groups): a torn final line in groups.jsonl bricks every group command — GroupLog::open refuses the crash-torn tail that FileJournal and Outbox drop and truncate #1522 cite the Outbox as the correct sibling for unparseable tails; neither covers this variant.
    • Expectation: effort/xs small-fix — drop + truncate any unterminated final line in Outbox::open, plus a regression test with a complete-JSON-but-unterminated final line; queued for the repo worker via a repo-task/v1 packet.
    • Links: packet enqueued to queue repo-health-code-pilot this run
  4. github-actions
    assigned
    dezren39
    on Oct 28, 2026
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Oct 28, 2026
  6. 56 remaining items

  7. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Oct 31, 2026
  8. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code), Lane A shift
    • Session / ID: queue task 1737 (repo-health-code-pilot), parked 2026-10-31T02:27Z for 20m
    • Found via: queue claim (park resume)
    • Task: PR 2877 parked on CI for new head 7fe044a (fmt fix): id-check run 41159335501 queued at park time; Codex re-review requested on the PR.
    • Expectation: resume = run's basic tier complete with rustfmt no longer naming envelope_outbox.rs and test shards passing -> merge PR 2877, close id(outbox): a parseable torn tail is accepted, then merged into the next record — Outbox::open only drops unterminated final lines that fail to parse #1620, complete task fixed_merged. Known pre-existing noise: store_traits test-unit failure (clean main 41143371468), clippy cache-download infra failures, rustfmt diffs in other files.
    • Links: PR fix(id): drop a parseable torn tail in Outbox::open (#1620) #2877 · run https://github.com/developing-today/code/actions/runs/41159335501
  9. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 31, 2026
  10. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    agent-note:v1 — task 1737 resumed by lane E. Verdict on PR #2877 @ 7fe044a: Codex review clean (no findings). id-check run 41159335501: test shards 0 and 3 pass; rustfmt-check log does NOT name envelope_outbox.rs (only pre-existing main debt: tag.rs, peers.rs, event_store/sync.rs, web/mod.rs, world_store.rs, world_ssh.rs, groups/tests.rs); test-shard-1 FAILED as infra — job died mid-compile after 5m21s (02:32:45–02:38:06Z) with no test output. Change verified directly on the exact head in the laptop worktree: cargo test envelope_outbox 9/9 pass, incl. the new a_parseable_torn_last_line_is_also_dropped. Prior head passed shards 0-3 in CI; this head differs only by a rustfmt wrap in the same file. Other red legs (biome, web-fmt, test-web-unit, clippy, treefmt, cargo-fmt) are pre-existing on clean main. Merging under the standing rule (unrelated infra failures + change verified sound).

  11. dezren39
    added a commit that references this issue on Oct 31, 2026

    Merge pull request #2877 from developing-today/queue/1737-1620-outbox…

    1dd7cde
  12. dezren39
    closed this as completedin #2877on Oct 31, 2026
  13. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Oct 31, 2026
  14. dezren39
    added 2 commits that reference this issue on Nov 1, 2026

    fix(id/petname): drop a parseable torn final line in Petnames::open (#…

    f606d09

    fix(id/petname): drop a parseable torn final line in Petnames::open (#…

    1661784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.