Found: set-meta <name> json is listed as a record of <name>.meta and breaks Names readers #88

Merged
city-root merged 1 commit from worker/rexcity-0rff7 into main 2026-11-12 13:30:27 +00:00
Contributor

state.Store.Names listed every <x>.json file, so set-meta <name> json (file <name>.meta.json) showed up as a record named <name>.meta, and Record on it failed with invalid character.

Names now skips a file whose name, without .json, ends in .meta or holds .meta.: those are the files metaPath makes for a key ending in json. Metadata stays where it was on disk, so no migration. A session whose own name ends in .meta or holds .meta. is no longer listed; gc's names do not.

Verified: TestMetadataNamedJSONIsNoRecord (sets json and state.json, expects only worker listed, Forget still drops the keys; it failed before); go vet and go test over cmd/, internal/, packs/; the v2 changelog check. A fragment is in .changelog/.

Bead: rexcity-0rff7

`state.Store.Names` listed every `<x>.json` file, so `set-meta <name> json` (file `<name>.meta.json`) showed up as a record named `<name>.meta`, and `Record` on it failed with `invalid character`. `Names` now skips a file whose name, without `.json`, ends in `.meta` or holds `.meta.`: those are the files `metaPath` makes for a key ending in `json`. Metadata stays where it was on disk, so no migration. A session whose own name ends in `.meta` or holds `.meta.` is no longer listed; gc's names do not. Verified: `TestMetadataNamedJSONIsNoRecord` (sets `json` and `state.json`, expects only `worker` listed, `Forget` still drops the keys; it failed before); `go vet` and `go test` over `cmd/`, `internal/`, `packs/`; the v2 changelog check. A fragment is in `.changelog/`. Bead: rexcity-0rff7
fix: Names skips a metadata key's file (rexcity-0rff7)
All checks were successful
test / changelog (pull_request) Successful in 6s
image / image (pull_request) Successful in 10s
test / go (pull_request) Successful in 1m45s
40b53a0148
set-meta <name> json writes <name>.meta.json, a file Names listed as the record of '<name>.meta', so a reader that went on to Record that name failed with 'invalid character'. A name never ends in .meta or holds .meta. as a record's file: metaPath makes those only for keys. Names now skips them. The metadata keeps its place on disk, so nothing already written moves.

Validation: TestMetadataNamedJSONIsNoRecord (fails before the change); go vet and go test over cmd, internal and packs; the changelog check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Review of 40b53a0148 for rexcity-0rff7. Checks of the head: success.

Verdict

pass

Findings

  • [minor] internal/state/state.go:623: isMetaFile hides any record whose name ends in .meta or contains .meta.. That cannot be avoided while metadata and records share one directory, and the description says so. gc's session names turn dots into __ (forgejo__reviewer), so no gc name hits it today. Moving metadata into a directory of its own, as views were moved into views/, would remove the collision for good. That is not needed for this fix.

Verified

  • Read the work bead, the PR description and the whole diff (3 files, +35/−2), checked against main's REVIEW.md and README.md. It does what the bead asks, keeping metadata out of what Names reads, and nothing else. The change is internal, so no README section is needed, and the description is there.
  • Forget still removes <name>.meta.json and <name>.meta.state.json through its <name>.meta.* glob, and the test covers this. .city-panes.*, .rig-panes.* and views/ are unaffected.
  • Merged the head into main at c4423b2 in a clean clone: no conflicts. The forge reports the PR as mergeable.
  • Ran on the merge, with the city's variables removed: go vet ./... (darwin, and also GOOS=linux GOARCH=amd64): ok. go test ./...: all packages ok, packs included. go test -race ./internal/state/ ./internal/rpp/: ok.
  • TestMetadataNamedJSONIsNoRecord with main's state.go swapped in: it fails, listing worker.meta and worker.meta.state. With the fix it passes, so the test checks the bug it names.
  • Changelog check: built cmd/changelog from the action's tag v2 (v2.0.1, c19d67d) and ran it as the workflow does (-warn missing-fragment -base main): exit 0, no findings. The fragment .changelog/state-meta-json-no-record.md contains only ### Fixed and its bullet.
Review of 40b53a0148437e3e094f1a0119edf42fcfae316b for rexcity-0rff7. Checks of the head: success. ### Verdict pass ### Findings - [minor] internal/state/state.go:623: `isMetaFile` hides any record whose name ends in `.meta` or contains `.meta.`. That cannot be avoided while metadata and records share one directory, and the description says so. gc's session names turn dots into `__` (`forgejo__reviewer`), so no gc name hits it today. Moving metadata into a directory of its own, as views were moved into `views/`, would remove the collision for good. That is not needed for this fix. ### Verified - Read the work bead, the PR description and the whole diff (3 files, +35/−2), checked against main's REVIEW.md and README.md. It does what the bead asks, keeping metadata out of what `Names` reads, and nothing else. The change is internal, so no README section is needed, and the description is there. - `Forget` still removes `<name>.meta.json` and `<name>.meta.state.json` through its `<name>.meta.*` glob, and the test covers this. `.city-panes.*`, `.rig-panes.*` and `views/` are unaffected. - Merged the head into main at c4423b2 in a clean clone: no conflicts. The forge reports the PR as mergeable. - Ran on the merge, with the city's variables removed: `go vet ./...` (darwin, and also GOOS=linux GOARCH=amd64): ok. `go test ./...`: all packages ok, `packs` included. `go test -race ./internal/state/ ./internal/rpp/`: ok. - `TestMetadataNamedJSONIsNoRecord` with main's `state.go` swapped in: it fails, listing `worker.meta` and `worker.meta.state`. With the fix it passes, so the test checks the bug it names. - Changelog check: built `cmd/changelog` from the action's tag v2 (v2.0.1, c19d67d) and ran it as the workflow does (`-warn missing-fragment -base main`): exit 0, no findings. The fragment `.changelog/state-meta-json-no-record.md` contains only `### Fixed` and its bullet.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/rexcity!88
No description provided.