refactor: use ForgeConfig to build Environment#2698
Conversation
tusharmath
commented
Mar 26, 2026
- refactor(config): adopt forge_config in domain and services
- refactor(auth): remove auth logic and config fields
crates/forge_repo/src/forge_repo.rs
Outdated
| )); | ||
|
|
||
| let config_repository = Arc::new(ForgeConfigRepository::new()); | ||
| let config_repository = Arc::new(ForgeConfigRepository::new(infra.clone())); |
There was a problem hiding this comment.
Compilation Error: Parameter mismatch
This line calls ForgeConfigRepository::new(infra.clone()), passing an infra parameter. However, the new() method shown in forge_repo/src/app_config.rs (line 122) has the signature:
pub fn new() -> Self {
Self { cache: Arc::new(Mutex::new(None)) }
}The method does not accept any parameters, but this call is passing infra.clone(). This will fail to compile with an error like "this function takes 0 arguments but 1 argument was supplied".
Fix: Either update the ForgeConfigRepository::new() signature to accept the infra parameter:
pub fn new(infra: Arc<F>) -> Self {
Self { cache: Arc::new(Mutex::new(None)), infra }
}Or remove the parameter from this call if it's not needed:
let config_repository = Arc::new(ForgeConfigRepository::new());| let config_repository = Arc::new(ForgeConfigRepository::new(infra.clone())); | |
| let config_repository = Arc::new(ForgeConfigRepository::new()); |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
crates/forge_infra/src/app_config.rs
Outdated
| service_url: Url::parse(fc.services_url.as_str()) | ||
| .unwrap_or_else(|_| Url::parse("http://api.forgecode.dev").unwrap()), |
There was a problem hiding this comment.
Security vulnerability: The fallback URL uses http:// instead of https://, creating an unencrypted connection if services_url parsing fails. This is inconsistent with the default in .forge.toml which uses https://api.forgecode.dev/.
service_url: Url::parse(fc.services_url.as_str())
.unwrap_or_else(|_| Url::parse("https://api.forgecode.dev").unwrap()),Changing to HTTPS ensures secure communication even when the config parsing fails.
| service_url: Url::parse(fc.services_url.as_str()) | |
| .unwrap_or_else(|_| Url::parse("http://api.forgecode.dev").unwrap()), | |
| service_url: Url::parse(fc.services_url.as_str()) | |
| .unwrap_or_else(|_| Url::parse("https://api.forgecode.dev").unwrap()), |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
20098dd to
91b6acd
Compare
ForgeConfig to build Environment
crates/forge_api/src/forge_api.rs
Outdated
| impl< | ||
| A: Services, | ||
| F: CommandInfra + EnvironmentInfra + SkillRepository + AppConfigRepository + GrpcInfra, | ||
| F: CommandInfra + EnvironmentInfra + SkillRepository + EnvironmentInfra + GrpcInfra, |
There was a problem hiding this comment.
Duplicate trait bound EnvironmentInfra appears twice in the same trait bound list. This should only appear once.
// Should be:
F: CommandInfra + EnvironmentInfra + SkillRepository + GrpcInfra,The duplicate EnvironmentInfra appears to be a copy-paste error when replacing AppConfigRepository with EnvironmentInfra.
| F: CommandInfra + EnvironmentInfra + SkillRepository + EnvironmentInfra + GrpcInfra, | |
| F: CommandInfra + EnvironmentInfra + SkillRepository + GrpcInfra, |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
| impl<F: EnvironmentInfra + EnvironmentInfra + FileReaderInfra + FileWriterInfra + HttpInfra> | ||
| ForgeProviderRepository<F> |
There was a problem hiding this comment.
Duplicate trait bound EnvironmentInfra appears twice. This should only appear once.
// Should be:
impl<F: EnvironmentInfra + FileReaderInfra + FileWriterInfra + HttpInfra>
ForgeProviderRepository<F>| impl<F: EnvironmentInfra + EnvironmentInfra + FileReaderInfra + FileWriterInfra + HttpInfra> | |
| ForgeProviderRepository<F> | |
| impl<F: EnvironmentInfra + FileReaderInfra + FileWriterInfra + HttpInfra> | |
| ForgeProviderRepository<F> |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.