mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
chore: clean up template migration fallout
This commit is contained in:
parent
12ada82b53
commit
db07f136f2
9 changed files with 26 additions and 25 deletions
|
|
@ -6,7 +6,7 @@ graph = "14-search-imagegen.fabro"
|
|||
provider = "daytona"
|
||||
|
||||
[sandbox.env]
|
||||
GEMINI_API_KEY = "${env.GEMINI_API_KEY}"
|
||||
GEMINI_API_KEY = "{{ env.GEMINI_API_KEY }}"
|
||||
|
||||
[sandbox.daytona.snapshot]
|
||||
name = "imagegen-tools-v3"
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ fn spawn_worker_control_stream(
|
|||
std::thread::Builder::new()
|
||||
.name("fabro-worker-control".to_string())
|
||||
.spawn(move || {
|
||||
read_worker_control_stream_blocking(StdBufReader::new(std::io::stdin()), event_tx);
|
||||
read_worker_control_stream_blocking(StdBufReader::new(std::io::stdin()), &event_tx);
|
||||
})
|
||||
.context("failed to spawn worker control reader thread")?;
|
||||
Ok(())
|
||||
|
|
@ -135,7 +135,7 @@ fn spawn_worker_control_stream(
|
|||
|
||||
fn read_worker_control_stream_blocking<R>(
|
||||
mut reader: R,
|
||||
event_tx: mpsc::UnboundedSender<WorkerControlStreamEvent>,
|
||||
event_tx: &mpsc::UnboundedSender<WorkerControlStreamEvent>,
|
||||
) where
|
||||
R: StdBufRead,
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ fn read_worker_control_stream_blocking<R>(
|
|||
loop {
|
||||
line.clear();
|
||||
match reader.read_line(&mut line) {
|
||||
Ok(0) => {
|
||||
Ok(0) | Err(_) => {
|
||||
let _ = event_tx.send(WorkerControlStreamEvent::Eof);
|
||||
break;
|
||||
}
|
||||
|
|
@ -153,10 +153,6 @@ fn read_worker_control_stream_blocking<R>(
|
|||
break;
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
let _ = event_tx.send(WorkerControlStreamEvent::Eof);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -722,7 +718,7 @@ mod tests {
|
|||
std::io::Cursor::new(
|
||||
b"{\"v\":1,\"type\":\"run.cancel\"}\n{\"v\":1,\"type\":\"interview.answer\",\"qid\":\"q-1\",\"answer\":{\"kind\":\"yes\"}}\n",
|
||||
),
|
||||
event_tx,
|
||||
&event_tx,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
//!
|
||||
//! - A literal non-secret value (storage root, scheduler limit, integration
|
||||
//! slug, feature flag), OR
|
||||
//! - An [`InterpString`] containing `${env.NAME}` tokens. `InterpString`'s
|
||||
//! - An [`InterpString`] containing `{{ env.NAME }}` tokens. `InterpString`'s
|
||||
//! default serialization preserves the *unresolved* template form, so the
|
||||
//! wire payload surfaces `"Bearer ${env.TOKEN}"` instead of the resolved
|
||||
//! wire payload surfaces `"Bearer {{ env.TOKEN }}"` instead of the resolved
|
||||
//! secret value. No additional redaction pass is needed.
|
||||
//!
|
||||
//! Any future field that carries a raw secret in-band (without env
|
||||
|
|
@ -160,7 +160,7 @@ _version = 1
|
|||
[server.auth.web.providers.github]
|
||||
enabled = true
|
||||
client_id = "Iv1.abcdef"
|
||||
client_secret = "${env.GITHUB_OAUTH_SECRET}"
|
||||
client_secret = "{{ env.GITHUB_OAUTH_SECRET }}"
|
||||
"#,
|
||||
);
|
||||
let redacted = redact_for_api(&settings);
|
||||
|
|
@ -240,10 +240,10 @@ slug = "fabro-app"
|
|||
_version = 1
|
||||
|
||||
[server.storage]
|
||||
root = "${env.FABRO_STORAGE_ROOT}"
|
||||
root = "{{ env.FABRO_STORAGE_ROOT }}"
|
||||
|
||||
[server.integrations.slack]
|
||||
default_channel = "${env.SLACK_CHANNEL}"
|
||||
default_channel = "{{ env.SLACK_CHANNEL }}"
|
||||
"#,
|
||||
);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ default_channel = "${env.SLACK_CHANNEL}"
|
|||
.storage
|
||||
.and_then(|storage| storage.root)
|
||||
.map(|value| value.as_source()),
|
||||
Some("${env.FABRO_STORAGE_ROOT}".to_string())
|
||||
Some("{{ env.FABRO_STORAGE_ROOT }}".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
server
|
||||
|
|
@ -264,7 +264,7 @@ default_channel = "${env.SLACK_CHANNEL}"
|
|||
.and_then(|integrations| integrations.slack)
|
||||
.and_then(|slack| slack.default_channel)
|
||||
.map(|value| value.as_source()),
|
||||
Some("${env.SLACK_CHANNEL}".to_string())
|
||||
Some("{{ env.SLACK_CHANNEL }}".to_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ pub struct RunLayer {
|
|||
///
|
||||
/// Relative paths inside the `file` variant are resolved against the
|
||||
/// directory of the config file that declared them at load time (see
|
||||
/// `fabro_config::resolve_goal_file_paths`). `${env.NAME}` interpolation is
|
||||
/// `fabro_config::resolve_goal_file_paths`). `{{ env.NAME }}` interpolation is
|
||||
/// supported inside the `file` path; env-tokenized relative paths stay
|
||||
/// unresolved until consume time and are then resolved against the run's
|
||||
/// effective working directory.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::error::FabroError;
|
||||
use crate::transforms::{
|
||||
FileInliningTransform, ImportTransform, ModelResolutionTransform,
|
||||
StylesheetApplicationTransform, TemplateTransform, Transform,
|
||||
|
|
@ -11,10 +12,7 @@ use super::types::{Parsed, TransformOptions, Transformed};
|
|||
///
|
||||
/// Returns `Transformed` with a graph for post-transform adjustments
|
||||
/// (e.g. goal override) before validation.
|
||||
pub fn transform(
|
||||
parsed: Parsed,
|
||||
options: &TransformOptions,
|
||||
) -> Result<Transformed, crate::error::FabroError> {
|
||||
pub fn transform(parsed: Parsed, options: &TransformOptions) -> Result<Transformed, FabroError> {
|
||||
let Parsed { graph, source } = parsed;
|
||||
|
||||
// Built-in transforms (PreambleTransform moved to engine execution time)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use std::sync::Arc;
|
|||
|
||||
use fabro_graphviz::graph::{AttrValue, Graph};
|
||||
|
||||
use crate::error::FabroError;
|
||||
use crate::file_resolver::FileResolver;
|
||||
|
||||
use super::Transform;
|
||||
|
|
@ -38,7 +39,7 @@ impl FileInliningTransform {
|
|||
}
|
||||
|
||||
impl Transform for FileInliningTransform {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, crate::error::FabroError> {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, FabroError> {
|
||||
let mut graph = graph;
|
||||
|
||||
// Inline @file refs in node prompts
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
use fabro_graphviz::graph::{AttrValue, Graph};
|
||||
|
||||
use crate::error::FabroError;
|
||||
|
||||
use super::Transform;
|
||||
|
||||
/// Resolves model aliases to canonical IDs and infers the provider from the model catalog.
|
||||
pub struct ModelResolutionTransform;
|
||||
|
||||
impl Transform for ModelResolutionTransform {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, crate::error::FabroError> {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, FabroError> {
|
||||
let mut graph = graph;
|
||||
for node in graph.nodes.values_mut() {
|
||||
let model = node
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
use fabro_graphviz::graph::{AttrValue, Graph};
|
||||
|
||||
use crate::error::FabroError;
|
||||
|
||||
use super::Transform;
|
||||
|
||||
/// For nodes whose fidelity is not `Full`, prepend a context mode preamble to the prompt.
|
||||
pub struct PreambleTransform;
|
||||
|
||||
impl Transform for PreambleTransform {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, crate::error::FabroError> {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, FabroError> {
|
||||
use crate::context::keys::Fidelity;
|
||||
|
||||
let mut graph = graph;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
use fabro_graphviz::graph::Graph;
|
||||
|
||||
use crate::error::FabroError;
|
||||
|
||||
use super::Transform;
|
||||
use super::stylesheet::{apply_stylesheet, parse_stylesheet};
|
||||
|
||||
|
|
@ -7,7 +9,7 @@ use super::stylesheet::{apply_stylesheet, parse_stylesheet};
|
|||
pub struct StylesheetApplicationTransform;
|
||||
|
||||
impl Transform for StylesheetApplicationTransform {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, crate::error::FabroError> {
|
||||
fn apply(&self, graph: Graph) -> Result<Graph, FabroError> {
|
||||
let mut graph = graph;
|
||||
let stylesheet_text = graph.model_stylesheet().to_string();
|
||||
if stylesheet_text.is_empty() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue