Skip to content

fix: readfile() config binding for single-quote-safe registry (#112, based on #144)#185

Merged
fujibee merged 3 commits into
mainfrom
fix/112-squote-readfile
Jun 22, 2026
Merged

fix: readfile() config binding for single-quote-safe registry (#112, based on #144)#185
fujibee merged 3 commits into
mainfrom
fix/112-squote-readfile

Conversation

@fujibee

@fujibee fujibee commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #112 — the shared team-registry scripts bound config.json into sqlite3 via a .param set :json '<config>' dot-command, and the sqlite3 shell tokenizer doesn't honour SQL '' escaping, so any config value containing a single quote (e.g. a project path or agent name with an apostrophe) broke identity resolution and join.

Based on @mvanhorn's #144 — their commit is carried here as the base (credited), rebased onto current main and reconciled with #180 (the sqlite CRLF fix, which had landed on the same identities.sh / join.sh / whoami.sh / test_team.bats in the meantime).

Changes

Tests

Full bats suite green on macOS/Linux (358 pass; the only failure is the pre-existing test_watch.bats watermark flake). The single-quote regression tests (whoami: resolves project paths / team and agent names containing single quotes, incl. O'Brien) pass. No .param set remains in the registry scripts.

Supersedes #144. Fixes #112. Refs #180, #140.

Co-authored-by: mvanhorn mvanhorn@gmail.com

mvanhorn and others added 2 commits June 21, 2026 13:26
…#112 single-quote fix

#144 fixed the .param set single-quote bug in identities/join/whoami but
scoped around the shared agmsg_registered_projects helper (overriding it
locally instead). Fix the shared helper itself the same way — readfile() +
json_valid guard, path/type interpolated with '' escaping — and drop the
local overrides so all registry reads go through one corrected path.
The #112 readfile()-based binding passed Git Bash paths (/d/a/agmsg/...)
straight to sqlite3.exe's readfile(), a native binary that can't open them —
readfile() returned NULL, identity resolution found nothing, and whoami
reported not_joined on Windows (caught by the powershell launcher smoke on the
windows-latest required leg). Add agmsg_sql_readfile_path() to storage.sh
(cygpath -w on Windows, mirroring delivery.sh's sql_readfile_path) and route the
four registry readfile() sites through it. resolve-project.sh sources storage.sh
so its scan — reached by actas-claim.sh and friends that don't source it
directly — has the helper too. No-op off Windows (cygpath absent).
@fujibee fujibee merged commit c40f21c into main Jun 22, 2026
5 of 6 checks passed
@fujibee fujibee deleted the fix/112-squote-readfile branch June 22, 2026 00:04
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.

Shared registry helpers can't bind single-quote values (.param set tokenizer ignores SQL '' escaping)

2 participants