Skip to content

Break readProjectConfig into per-resource helpers for fault isolation #232

@Paveltarno

Description

@Paveltarno

Problem

readProjectConfig() eagerly reads all resources (entities, functions, agents) via Promise.all. If any single resource has invalid data on disk (e.g., a malformed agent config file), the entire function throws — blocking every command, including ones that don't need that resource.

For example, if I have an invalid agent configuration file, base44 entities push fails even though it only needs entities.

Current behavior

readProjectConfig()
├── reads config.jsonc ✓
├── Promise.all([
│     entityResource.readAll(...)    ✓
│     functionResource.readAll(...)  ✓
│     agentResource.readAll(...)     ✗ ← invalid file
│   ])
└── throws SchemaValidationError   ← ALL commands fail

Commands and what they actually need

Command What it reads
entities push entities only
agents push agents only
agents pull project metadata only (configPath, agentsDir)
functions deploy functions only
site deploy project metadata only (root, site config)
deploy everything (entities, functions, agents, site)
types generate everything (entities, functions, agents, project root)

Desired behavior

Each command should only read the resources it needs. Invalid agent configs should not block entities push. Invalid entity files should not block agents push.

The deploy and types generate commands still need all resources — those should continue to fail if any resource is invalid.

Scope

  • Extract a function that reads just the project config file (no resources)
  • Add per-resource reader helpers that can be called independently
  • Refactor existing readProjectConfig to compose these helpers (no breaking change)
  • Update individual commands to use only the readers they need
  • Update tests to cover the new isolation behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions