Skip to content

All fixes - #378

Merged
vsilent merged 52 commits into
devfrom
all-fixes
Nov 24, 2026
Merged

vsilent merged 52 commits into
devfrom
all-fixes

Conversation

@vsilent

@vsilent vsilent commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

robotizeit and others added 30 commits November 16, 2026 12:45
Bug 41 quoted a real catalogue row verbatim, which put a third-party
vendor's personal name into a public repository. The row is what makes the
defect legible, so it stays - with the name replaced by `<vendor>`.

Co-Authored-By: Claude Opus 5 <[email protected]>
…nts (39)

The validator scanned raw text, so a variable that appears exclusively inside
a YAML comment failed the whole stack — and every pipeline gating on
`stacker secrets validate` with it. References are now collected from parsed
scalars (keys and values), which drops comments naturally while still
counting block-scalar content where '#' is literal text; unparseable YAML
falls back to the old raw scan.

Co-Authored-By: Claude Opus 5 <[email protected]>
The two commands disagreed on their own surface: `stacker logs` took only
--service/--tail with no positional app, `stacker agent logs` took a
positional <APP> and rejected --lines/--tail, so the same intent had to be
taught twice and neither command accepted the other's spelling.

Both forms now work on both commands: `stacker logs` takes a positional app
(sugar for --service, conflicting with it) and --lines as an alias of --tail;
`stacker agent logs` accepts --lines and --tail as aliases of --limit.
Regression tests cover every accepted form and the positional/--service
conflict.

Co-Authored-By: Claude Opus 5 <[email protected]>
…t a success (54)

`stacker sync` synchronizes the project configuration only — it never
carries the server-side compose, the one the agent writes before every app
deploy. With the generated compose deleted outright it still printed
'✓ Project synchronized ... ✓ Stacker database acknowledged', so a compose
that was wrong platform-side stayed wrong and nothing pointed at the only
repair (a full deploy).

Per the entry's expected outcome: the run now states what it covers
(configuration from stacker.yml) and what it does not (the server-side
compose — `stacker deploy` regenerates and pushes it), and with no compose
on disk the summary is a warning (`⚠ ... no compose was present to sync`),
not a plain success. JSON output carries `compose_present` and the coverage
lines.

Also from the same session: the `stacker monitor` no-alerts error named a
`notify:` key that exists nowhere — it names `target:`, the key the code
and the reference actually use.

Tests: summary warns without a compose and succeeds with one; scope lines
point at `stacker deploy` when the compose is missing; the monitor message
names `target:` and never `notify: target`.

Co-Authored-By: Claude Opus 5 <[email protected]>
…e defaults (12, 33)

`stacker install <template>` wrote only stacker.yml. A template whose file
set ships `scripts/` and `.env.example` therefore installed into a project
that could not deploy: the referenced `./scripts/...` did not exist (empty
directory at best), and every `\${VAR}` whose value is a `.env.example`
default failed with 'Environment variable not found'.

Two halves, as the entries' fix directions ask:

- install materializes `latest_version.config_files` next to stacker.yml
  (scripts/, config files) and seeds `.env` from `.env.example` when `.env`
  does not exist yet; existing files are never overwritten (#33, #12)
- the `.\${VAR}` resolver treats `.env.example` as defaults under the env
  file — the deploy honours a template default even without install's .env
  (#12's second option)

Tests: materialization writes scripts + seeds .env and refuses to overwrite;
the resolver fills placeholders from .env.example with the env file
overriding. Full suite green except the pre-existing flaky
`tests/agent_sweep.rs`.

Co-Authored-By: Claude Opus 5 <[email protected]>
docs(bugs): 41 and 45 marked fixed - the code landed earlier
The submit webhook is dispatched from a detached `tokio::spawn`, so it
reaches the wiremock some time after the submit response. The test slept a
fixed 200 ms and then asserted — under CI load (right after the long build)
the spawn had not landed yet and the suite failed at random with "Submit
should send marketplace webhook" (seen on PR #361's CI; the branch touches
only secrets.rs).

The same race was already fixed in tests/marketplace_admin_review.rs with a
bounded poll — this applies the identical pattern here: poll for 5 s, fail
only if the webhook truly never arrives.

Co-Authored-By: Claude Opus 5 <[email protected]>
…uess (53)

`stacker deployment state` synthesized both paths from `<project>-<id>`,
and the compose one matched nothing on the host — docker reported
/home/trydirect/project/docker-compose.yml (its own
com.docker.compose.project.config_files label) while the report claimed
/home/trydirect/<project>-<id>/docker-compose.yml. The env path was right,
which made the wrong one harder to spot; explain topology printed a third.

The agent already forwards every container's labels in its snapshot — the
paths docker reports travel in `com.docker.compose.project.config_files`
and `com.docker.compose.project.environment_files`. The state now prefers
those and falls back to the synthesis when the snapshot carries no labelled
container; the report notes when the compose and env directories differ.

The topology half of the entry (`--deployment`) was fixed with #55.

Tests: label extraction from the aggregate and single-app report shapes, and
the no-labels fallback. Full suite green except the pre-existing flaky
`tests/agent_sweep.rs` (and admin_jwt flakes under the machine's disk
event — green in isolation).

Co-Authored-By: Claude Opus 5 <[email protected]>
fix(secrets): secrets validate ignores ${VAR} mentioned only in comments (39)
fix(cli): give logs and agent logs one teachable interface (40)
fix(sync): sync states its coverage, and no compose is a warning not a success (54)
fix(install): materialize the template's file set and its .env.example defaults (12, 33)
test(marketplace): wait for the submit webhook instead of sleeping 200ms
…s-53

fix(deployment): report the compose/env paths docker reports, not a guess (53)
One cleanup change, no behaviour change. cargo clippy --fix absorbed the
mechanical majority (redundant format!/println! references, immediately
dereferenced borrows, the build.rs:37 useless conversion) across 45 files.
The rest by hand: detached /// blocks that documented nothing became plain
comments; the copied static APP / async fn app test scaffolding carries
\#[allow(dead_code)]; the audit validator's identical severity branches
collapsed and its two script-body regexes moved out of the per-file loop
into LazyLock statics; Settings::default() plus field assignment became a
struct literal; the unused derive_builder dependency left Cargo.toml.

Three spans hold a std Mutex across .await in tests/marketplace_mine.rs on
purpose - the tests share one test user and must not interleave, each on
its own single-threaded runtime - so they carry
\#[allow(clippy::await_holding_lock)] with the reason. The large Err
variants are prost/tonic-generated and tungstenite::Error in a test
helper: allowed locally, not reshaped. cargo fmt --all cleared the rest.

Verified: cargo fmt --all -- --check clean, cargo clippy --all-targets --
-D warnings passes on a clean tree, full suite 2416 passed / 7 failed
(only the pre-existing tests/agent_sweep.rs family) / 7 ignored.

Co-Authored-By: Claude Opus 5 <[email protected]>
chore: make the fmt and clippy gates pass (36)
robotizeit and others added 21 commits November 21, 2026 12:42
…agree (28)

Install printed project #818 and the deploy that followed resolved #817 for
one project. The chain: a project's identity is (user, name) - the deploy
chain resolves-or-creates by name and syncs metadata into the row it found -
but install inserted a fresh project row on every call, and the CLI's
find_project_by_name took the first name match out of the unsorted /project
list, so a duplicate name resolved to the older row. Spelling made it worse:
install stored sanitize_project_name(name) while the deploy chain matched
and created raw stacker.yml names (My N8n vs my_n8n).

Install now resolves-or-creates like the deploy chain - the existing row is
reused and synced, not duplicated - and name resolution compares after
sanitize_project_name and picks the newest of legacy duplicates
deterministically, in both the CLI and the install-side lookup.

Tests (red first): installing twice under one name reported #1 and #2; now
it reports one id and one row, and a different name stays separate. Unit
tests pin the sanitized matching and the duplicate pick.

Co-Authored-By: Claude Opus 5 <[email protected]>
Two test-infrastructure flakes the honest full run (cargo test
--no-fail-fast) surfaced; plain cargo test had hidden them by stopping at
agent_sweep.

Fixture seeding upserts rows with two unique keys (creator_user_id and
public_slug). Parallel tests seeding the same row had the speculative insert
resolve its conflict on the index not named in ON CONFLICT, which surfaces
as a hard duplicate-key error instead of the upsert - the marketplace suites
failed at random under load. One process-wide seed lock makes it
deterministic.

The rating suite shares one template and asserts on rating counts and
averages, so tests observed each other's writes depending on order. The
suite now runs serialized and seed_template resets the template's ratings
and product link, giving each test a clean slate.

Verified: marketplace_template_rating 6/6 runs green (was flaky every other
run), marketplace_public_vendor_profile green.

Co-Authored-By: Claude Opus 5 <[email protected]>
The branches merged since #369 brought new fmt debt into
console/commands/cli/{marketplace,monitor,sync}.rs. cargo fmt --all is
clean again.

Co-Authored-By: Claude Opus 5 <[email protected]>
…-id-28

fix(install): one project per (user, name) - install reuses, lookups agree (28)
A local deploy printed '✓ Local deployment started successfully' for docker
compose accepting the files, then '✗ Timeout waiting for containers' when
nothing was actually serving, then invited the user to deploy this to
production - success and a timeout in the same breath, and the exit code
said success.

The deploy spinner now reports the mechanical step ('docker compose accepted
the files') and the health check decides the headline: ready prints the
success headline, a timeout is a failed deploy ('Local deployment failed -
containers never became ready') that exits non-zero and notifies failure
through the same verdict machinery a watched remote deploy gets. It still
claims the active deployment target on purpose - the broken stack on this
machine is the current state and stacker logs must resolve it - and the line
after the verdict is how to see why (stacker logs, not stacker status). No
upsell after a failure; the suggestion block is indented like everything
around it.

Red first: tests/cli_deploy_local_readiness.rs drives the CLI against a
stub docker whose compose ps never reports running containers and pins the
whole expected outcome (failure exit, stacker logs advice, no upsell). On
the unfixed code it reproduces the bug report's screenshot verbatim.
STACKER_LOCAL_WATCH_TIMEOUT_SECS (default 120s) keeps the test fast.

Co-Authored-By: Claude Opus 5 <[email protected]>
…dict-50

fix(deploy): the readiness result decides a local deploy's verdict (50)
…(61)

57-60 were recorded on dev only (693f0a4) and were missing here: 57-58 the
deploy-app incident and its proposal, 59 agent install leaving the lock on
the previous deployment, 60 the pre-flight check that never runs. Carried
over verbatim.

61 is the reported slowness after the 2026-11-21 deployment: agent commands
sit out their whole poll timeout when the resolved deployment's agent is
offline. Measured here: agent status 1:04.68 in stream-project with
list_containers commands queued since 2026-11-19; deployments list 2.12s;
deployment use 0.019s; docker ps 0.05s. The waits are
agent.rs:233-245 (poll, no early exit), agent.rs:31 (60s default) and
agent.rs:877-879 (deploy-app 300s - the 'took 5m10s' of the hello stream).
Unreproduced halves of the report are marked as guesses in the entry.

Co-Authored-By: Claude Opus 5 <[email protected]>
docs(bugs): carry 57-60 over from dev, file the slow agent waits (61)
…its states (61)

stacker deploy --target local took 2:06 on a healthy stack and ended in
'Timeout waiting for containers'. The readiness check ran docker compose ps
without -p, while the deploy creates the project with -p
(local_compose_project_name): compose without -p looks in the project named
after the compose file's directory (.stacker) and reports nothing. Verified
live - ps with the compose file alone prints no containers, with -p hello
prints both running ones. So the check saw total == 0 on every poll, never
became ready, waited out the 120s, and could show no container states at
all - which is why the wait looked like a bare spinner.

ps now passes the deploy's project name (print_container_summary too), and
while waiting the poll shows what every container is doing -
'app: starting - postgres: running (healthy)' - with 'last seen: ...' on the
timeout line. Same command in ~/work/stream-rehearsal/hello: 2:06.44 -> 2.4s,
'All 2/2 containers running'.

Red first: the stub docker in tests/cli_deploy_local_readiness.rs now reports
containers only for the right -p project (real compose behaviour); both e2e
tests fail on the old code and pass on the new, plus unit tests for the ps
arguments and the state display.

Co-Authored-By: Claude Opus 5 <[email protected]>
…d-states-61

fix(deploy): the local readiness check sees its own stack, and shows its states (61)
The model was spread across behaviour and bug records (51/55/57/59/61) and
never stated anywhere - which is how a reinstalled agent ends up invisible
to stacker agent status. docs/DEPLOYMENT_LIFECYCLE.md now states it:
deployment = identity and isolation unit (Vault scope, agent token, terraform
workspace, agent registration - all keyed by deployment_hash); what creates
a deployment (deploy, agent install today) and what mutates one (deploy-app,
agent link); how commands resolve theirs; who writes the lock and who does
not; the heartbeat rule that defines an offline agent. Linked from
APP_DEPLOYMENT.md and CHEATSHEET.md.

Step 1 of the plan agreed with Vasili: docs first, then fail-fast messaging,
then agent install recording its deployment, then idempotent install.

Co-Authored-By: Claude Opus 5 <[email protected]>
…use (61, 60)

#61: an agent command to a deployment whose agent is not polling its queue
sat in queued until the full poll deadline (60s default, 300s deploy-app) and
then failed with a timeout - the measured 1:04 agent status and the hello
stream's 5m10s are exactly that. The command is now refused before it is
enqueued, with the true cause and the one command that fixes it (naming the
newest deployment of the same project).

Evidence, not impatience, as Vasili pointed out: a slow but alive agent must
never lose its chance at a late answer. The refusal fires only where an
answer cannot come - no agent registered, or a heartbeat stale under the
platform's own 5-minute rule (src/routes/agent/snapshot.rs:531-543). A fresh
registration with no heartbeat yet is 'starting' and waits normally; a
command that has started running is never cut off; if the agent goes quiet
while nothing has picked the command up, the wait stops early with the same
honest refusal.

#60: when the agent refuses a command, the warning says so. The pre-flight
check reported 'agent could not verify active connections' for a flat
refusal ('program check_connections is not allowed') and sent readers to the
network; it now prints the agent's own words.

Red first: tests/cli_agent_offline_fast_fail.rs drives the CLI against a
mock API - the stale-heartbeat case fails on the old code with 'timed out
(last status: queued)' and on the new one refuses immediately with
'stacker deployment use <hash>'; the refusal case fails on the old wording.
Unit tests pin the reachability rule including the 299/301s threshold.

Co-Authored-By: Claude Opus 5 <[email protected]>
agent install created a deployment with its own agent registration and
printed 'Deployment ID: 1547' while the deployment lock kept naming 1546 -
so the very next stacker agent status resolved the previous deployment and
waited out its timeout against an agent that no longer runs. The install now
writes the lock for the deployment it created, the way a deploy does: the
existing lock is updated (its server/ssh fields came from the deploy and are
still true), the hash goes in, and the context line names it.

The pin in stacker.yml is never rewritten - pinning is the user's deliberate
act (55) - but when it points at the previous deployment that is said out
loud, with the one command that moves it.

Red first: tests/cli_agent_install_records_lock.rs drives the CLI against a
mock API (project, server, deploy, deployment lookup) and fails on the old
code with 'the install must write one lock'; it also pins the stale-pin
notice and the copyable fix line.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ection of 58)

agent install means 'make sure an agent is here', not 'cut a new release'.
When the project already has a deployment and this machine can reach the
server, the install now re-registers the agent on it via POST
/api/v1/agent/link - which creates or returns the registration
(src/routes/agent/link.rs:89-127) - and the deployment hash does not change,
so every later command keeps working. That is also the architectural fit:
the agent gets its token in the deployment's own Vault scope and terraform
is not touched at all (the workspace is the deployment's, and a plan cannot
be replayed across deployments).

The deploy path stays for the first install, for servers this machine cannot
reach, and behind the new --new-deployment flag (mirroring deploy-app
--new-app from #58). Installing through a deploy records the created
deployment's lock (the previous commit) and says so; re-registering prints
'the deployment is unchanged'.

Red first: tests/cli_agent_install_reregisters.rs drives the CLI against a
mock API with a stub ssh binary - the existing-deployment case fails on the
old code (it queued a deploy and would have created a second deployment)
and re-registers on the new one; the --new-deployment case pins the escape
hatch.

Co-Authored-By: Claude Opus 5 <[email protected]>
docs: deployment lifecycle & agent identity, in one place
fix(agent): commands tell the truth about deployments (61, 60, 59)
feat(agent): install re-registers on the existing deployment (59, direction of 58)
All four are in (PRs #368, #373, #375, #376): deploy-app refuses guessed
names and offers --new-app; agent install records its deployment and
re-registers on an existing one instead of cutting a new release; commands
no agent can pick up are refused immediately with the fix line; and the
local deploy's readiness check sees its own stack (2:06 -> 2.4s) and shows
container states while it waits. Each entry gets its Fixed block with How
to verify. Entry 60 is marked for the CLI half only - the platform/agent
disagreement over check_connections belongs to the status panel agent and
is called out as still open. DEPLOYMENT_LIFECYCLE.md's 'In flight' becomes
'Landed'.

Co-Authored-By: Claude Opus 5 <[email protected]>
docs(bugs): 57, 59, 60, 61 fixed - the agent-identity work has landed
@gitguardian

gitguardian Bot commented Nov 24, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
40550784 Triggered Generic Password c07ed35 src/cli/config_parser.rs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@vsilent
vsilent merged commit f6f778f into dev Nov 24, 2026
9 of 10 checks passed
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.

2 participants