Closes the gaps and the one security finding from the second end-to-end
CLI test (E2E_STASH_REPORT.md), plus the H1 boot-regression found while
re-reviewing those fixes.
Security
- S6: reserved-path validation (`check_reserved`) now case-folds before
comparing, so `/API/v2/x`, `/HEALTHZ`, `/Admin/x` are rejected like
their lowercase forms. Request-time matching stays case-sensitive.
- S10: "public route != public data" callout in sdk-shape.md (script_gate
skips authz when the principal is anonymous).
Observability / features
- G1: trigger executions now write `execution_logs`. Migration 0043 adds
a `source` column (CHECK mirrors ExecutionSource/OutboxSourceKind,
DEFAULT 'http' backfills history); a shared `build_execution_log` helper
in executor-core; dispatcher logging for outbox triggers + queue
consumers (skips sync-HTTP rows the orchestrator already logs). `pic
logs` gains a source column + `--source` filter.
- G5: dev-only in-memory email capture under PICLOUD_DEV_MODE with no SMTP
(email::send succeeds locally), readable at GET /api/v1/admin/dev/emails
(Owner/Admin only; route mounted only in capture mode).
- G6: generalized the Rhai in-place-mutation footgun note (trim/replace/
make_upper/make_lower/crop/truncate/pad return ()).
- G2/G3/G4 (CLI): `pic members`, `pic files`, `pic queues`, read-only
`pic kv` (+ new kv_api.rs); `pic deploy --timeout/--memory/--kind/
--sandbox`; first-class `pic triggers create-{docs,files,pubsub,queue,
email}` wrappers. All new client path segments percent-encoded via seg().
H1 regression fix (found in re-review)
- The S6 change also runs in `compile_routes`, which compiles every stored
route at boot and on each route CRUD. A single stored route the new
validation rejects (creatable while the S6 gap existed) made the whole
compile Err and aborted startup. `compile_routes` is now lenient: it
skips an un-compilable row with a warning instead of bricking boot
(route creation still validates separately). Migration 0044 sweeps
pre-existing reserved-path routes on upgrade (WHERE mirrors
check_reserved exactly). Added regression tests for both.
Verified: cargo fmt, clippy --all-targets --all-features -D warnings, the
schema_snapshot test, and the new S6/lenient-compile unit tests all pass;
boot-resilience and G1/G5 confirmed live.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
63 lines
2.0 KiB
Rust
63 lines
2.0 KiB
Rust
//! `pic queues ls | show` — read-only queue inspection (G2).
|
|
//!
|
|
//! Wraps the read-only `/api/v1/admin/apps/{id}/queues*` surface (no
|
|
//! purge/requeue — that is v1.2). Gated on `AppLogRead` server-side.
|
|
|
|
use anyhow::Result;
|
|
|
|
use crate::client::Client;
|
|
use crate::config;
|
|
use crate::output::{KvBlock, OutputMode, Table};
|
|
|
|
pub async fn ls(app: &str, mode: OutputMode) -> Result<()> {
|
|
let creds = config::resolve()?;
|
|
let client = Client::from_creds(&creds)?;
|
|
let queues = client.queues_list(app).await?;
|
|
let mut table = Table::new(["queue", "total", "pending", "claimed"]);
|
|
for q in queues {
|
|
table.row([
|
|
q.queue_name,
|
|
q.total.to_string(),
|
|
q.pending.to_string(),
|
|
q.claimed.to_string(),
|
|
]);
|
|
}
|
|
table.print(mode);
|
|
Ok(())
|
|
}
|
|
|
|
pub async fn show(app: &str, queue_name: &str, mode: OutputMode) -> Result<()> {
|
|
let creds = config::resolve()?;
|
|
let client = Client::from_creds(&creds)?;
|
|
let q = client.queue_get(app, queue_name).await?;
|
|
let mut block = KvBlock::new();
|
|
block
|
|
.field("queue", q.queue_name)
|
|
.field("total", q.total.to_string())
|
|
.field("pending", q.pending.to_string())
|
|
.field("claimed", q.claimed.to_string());
|
|
match q.consumer {
|
|
Some(c) => {
|
|
block
|
|
.field("consumer_script", c.script_name)
|
|
.field("consumer_script_id", c.script_id.to_string())
|
|
.field("consumer_trigger_id", c.trigger_id)
|
|
.field(
|
|
"visibility_timeout_secs",
|
|
c.visibility_timeout_secs.to_string(),
|
|
)
|
|
.field(
|
|
"last_fired_at",
|
|
c.last_fired_at
|
|
.map(|t| t.to_rfc3339())
|
|
.unwrap_or_else(|| "-".to_string()),
|
|
);
|
|
}
|
|
None => {
|
|
block.field("consumer", "(none registered)");
|
|
}
|
|
}
|
|
block.print(mode);
|
|
Ok(())
|
|
}
|