log cleanup

This commit is contained in:
2026-03-27 19:19:27 -04:00
parent 930d0513cd
commit 76467a6fed
4 changed files with 24 additions and 18 deletions

0
agreego.sql Normal file
View File

View File

@ -45,7 +45,7 @@ impl MockExecutor {
#[cfg(test)] #[cfg(test)]
impl DatabaseExecutor for MockExecutor { impl DatabaseExecutor for MockExecutor {
fn query(&self, sql: &str, _args: Option<&[Value]>) -> Result<Value, String> { fn query(&self, sql: &str, _args: Option<&[Value]>) -> Result<Value, String> {
println!("DEBUG SQL QUERY: {}", sql); println!("JSPG_SQL: {}", sql);
MOCK_STATE.with(|state| { MOCK_STATE.with(|state| {
let mut s = state.borrow_mut(); let mut s = state.borrow_mut();
s.captured_queries.push(sql.to_string()); s.captured_queries.push(sql.to_string());
@ -66,7 +66,7 @@ impl DatabaseExecutor for MockExecutor {
} }
fn execute(&self, sql: &str, _args: Option<&[Value]>) -> Result<(), String> { fn execute(&self, sql: &str, _args: Option<&[Value]>) -> Result<(), String> {
println!("DEBUG SQL EXECUTE: {}", sql); println!("JSPG_SQL: {}", sql);
MOCK_STATE.with(|state| { MOCK_STATE.with(|state| {
let mut s = state.borrow_mut(); let mut s = state.borrow_mut();
s.captured_queries.push(sql.to_string()); s.captured_queries.push(sql.to_string());

View File

@ -259,13 +259,7 @@ impl Merger {
}; };
if let Some(compiled_edges) = schema.obj.compiled_edges.get() { if let Some(compiled_edges) = schema.obj.compiled_edges.get() {
println!(
"Compiled Edges keys for relation {}: {:?}",
relation_name,
compiled_edges.keys().collect::<Vec<_>>()
);
if let Some(edge) = compiled_edges.get(&relation_name) { if let Some(edge) = compiled_edges.get(&relation_name) {
println!("FOUND EDGE {} -> {:?}", relation_name, edge.constraint);
if let Some(relation) = self.db.relations.get(&edge.constraint) { if let Some(relation) = self.db.relations.get(&edge.constraint) {
let parent_is_source = edge.forward; let parent_is_source = edge.forward;

View File

@ -67,7 +67,10 @@ impl<'a> Compiler<'a> {
if let Some(items) = &node.schema.obj.items { if let Some(items) = &node.schema.obj.items {
let mut resolved_type = None; let mut resolved_type = None;
if let Some(family_target) = items.obj.family.as_ref() { if let Some(family_target) = items.obj.family.as_ref() {
let base_type_name = family_target.split('.').next_back().unwrap_or(family_target); let base_type_name = family_target
.split('.')
.next_back()
.unwrap_or(family_target);
resolved_type = self.db.types.get(base_type_name); resolved_type = self.db.types.get(base_type_name);
} else if let Some(base_type_name) = items.obj.identifier() { } else if let Some(base_type_name) = items.obj.identifier() {
resolved_type = self.db.types.get(&base_type_name); resolved_type = self.db.types.get(&base_type_name);
@ -89,7 +92,10 @@ impl<'a> Compiler<'a> {
} }
// 3. Fallback for root execution of standalone non-entity arrays // 3. Fallback for root execution of standalone non-entity arrays
Err("Cannot compile a root array without a valid entity reference or table mapped via `items`.".to_string()) Err(
"Cannot compile a root array without a valid entity reference or table mapped via `items`."
.to_string(),
)
} }
fn compile_reference(&mut self, node: Node<'a>) -> Result<(String, String), String> { fn compile_reference(&mut self, node: Node<'a>) -> Result<(String, String), String> {
@ -452,7 +458,6 @@ impl<'a> Compiler<'a> {
}, },
}; };
let (val_sql, val_type) = self.compile_node(child_node)?; let (val_sql, val_type) = self.compile_node(child_node)?;
if val_type != "abort" { if val_type != "abort" {
@ -515,7 +520,13 @@ impl<'a> Compiler<'a> {
// Determine if the property schema resolves to a physical Database Entity // Determine if the property schema resolves to a physical Database Entity
let mut bound_type_name = None; let mut bound_type_name = None;
if let Some(family_target) = prop_schema.obj.family.as_ref() { if let Some(family_target) = prop_schema.obj.family.as_ref() {
bound_type_name = Some(family_target.split('.').next_back().unwrap_or(family_target).to_string()); bound_type_name = Some(
family_target
.split('.')
.next_back()
.unwrap_or(family_target)
.to_string(),
);
} else if let Some(lookup_key) = prop_schema.obj.identifier() { } else if let Some(lookup_key) = prop_schema.obj.identifier() {
bound_type_name = Some(lookup_key); bound_type_name = Some(lookup_key);
} }
@ -536,7 +547,10 @@ impl<'a> Compiler<'a> {
} }
if let Some(col) = poly_col { if let Some(col) = poly_col {
if let Some(alias) = type_aliases.get(table_to_alias).or_else(|| type_aliases.get(&node.parent_alias)) { if let Some(alias) = type_aliases
.get(table_to_alias)
.or_else(|| type_aliases.get(&node.parent_alias))
{
where_clauses.push(format!("{}.{} = '{}'", alias, col, type_name)); where_clauses.push(format!("{}.{} = '{}'", alias, col, type_name));
} }
} }
@ -710,8 +724,6 @@ impl<'a> Compiler<'a> {
) -> Result<(), String> { ) -> Result<(), String> {
if let Some(prop_ref) = &node.property_name { if let Some(prop_ref) = &node.property_name {
let prop = prop_ref.as_str(); let prop = prop_ref.as_str();
println!("DEBUG: Eval prop: {}", prop);
let mut parent_relation_alias = node.parent_alias.clone(); let mut parent_relation_alias = node.parent_alias.clone();
let mut child_relation_alias = base_alias.to_string(); let mut child_relation_alias = base_alias.to_string();