Implement the avatar and a preflight dry run
The avatar is now applied rather than deferred: BotFather's /setuserpic is a conversation in which you send a photo, so the file is uploaded and sent as a message. It is content addressed -- replacing the file is what triggers an update, and the digest is recorded only after BotFather confirms, so a failed upload retries rather than being remembered as done. The image is validated before the conversation starts, because an image rejected halfway leaves the bot registered without a picture. Adds `provision preflight`: spec, avatar, OpenBao reachability, credentials, session presence, salt and the resulting plan, checked in one run that writes nothing and never contacts Telegram. Every failure it reports is one that would otherwise surface after a phone number had been spent. Two bugs it found immediately. The avatar path is documented as repo-relative but resolved against the spec's own directory, so the real campaign spec failed to find its own asset. And the OpenBao error named both variables when only one was missing, sending the reader to check the one already set. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172sgCZEEDJcnQmr4SGDvKa Assistant: claude-code Assistant-Model: opus Assistant-Process: 1361245@bnt-lap001 Assistant-Session: b3b428ef-f3e6-4688-b091-01f71461d66a
This commit is contained in:
parent
014ee5c746
commit
7347bd6302
11 changed files with 661 additions and 46 deletions
|
|
@ -27,6 +27,7 @@ import (
|
|||
|
||||
const usage = `provision -- reconcile a Telegram presence with its declared spec
|
||||
|
||||
provision preflight --spec <path> check everything short of contacting telegram
|
||||
provision plan --spec <path> [--check] show what would change; writes nothing
|
||||
provision apply --spec <path> execute an approved plan
|
||||
|
||||
|
|
@ -54,6 +55,8 @@ func main() {
|
|||
err = cmdReconcile(os.Args[2:], false)
|
||||
case "apply":
|
||||
err = cmdReconcile(os.Args[2:], true)
|
||||
case "preflight":
|
||||
err = cmdPreflight(os.Args[2:])
|
||||
case "session":
|
||||
err = cmdSession(os.Args[2:])
|
||||
case "-h", "--help", "help":
|
||||
|
|
@ -99,7 +102,7 @@ func cmdReconcile(args []string, doApply bool) error {
|
|||
ctx := context.Background()
|
||||
|
||||
if *offline {
|
||||
p, err := plan.Compute(sp, digest, rs, offlineLive{})
|
||||
p, err := plan.Compute(*specPath, sp, digest, rs, offlineLive{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -125,7 +128,7 @@ func cmdReconcile(args []string, doApply bool) error {
|
|||
// No authenticator: reconciliation must never prompt. If the session is
|
||||
// gone, that is a runbook step, not something to paper over mid-run.
|
||||
return client.Run(ctx, nil, func(ctx context.Context, c *tgc.Client) error {
|
||||
p, err := plan.Compute(sp, digest, rs, tgc.Live{Ctx: ctx, Client: c, Resolved: rs})
|
||||
p, err := plan.Compute(*specPath, sp, digest, rs, tgc.Live{Ctx: ctx, Client: c, Resolved: rs})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue