Skip to content

fix(cli): framework build's force option is documented but never read #558

Description

@blafourcade

Problem

FrameworkBuildOptions.force is declared and documented as controlling overwrite behaviour:

/** When true, overwrite existing files at canonical flat paths. Only meaningful in flat mode. */
readonly force?: boolean;

Nothing reads it. FrameworkBuildUseCase.execute() destructures only sourceDir and outDir. The field has writers and zero readers.

What actually drives FlatBuildStrategy.checkCollision is a constructor parameter (flat-build-strategy.ts:32, used at lines 273 and 320), threaded through createFrameworkBuildUseCase in deps.ts.

So aidd framework build --flat --force does work, but not through the options object. Anyone debugging a force-related problem would find force being passed to execute() and reasonably conclude it was wired.

Same shape as #464: a documented surface that does not do what it says.

Second problem: the real wiring is untested

Nothing verifies that the user's --force reaches FlatBuildStrategy at all. Making deps.ts ignore the caller's flag breaks no test.

A test that constructs FlatBuildStrategy directly with a literal true does not close this, because it would still pass if deps.ts stopped threading the flag.

Not a data-loss risk

For the record, since it looked like one: runBuild in ensure-built-marketplace-use-case.ts passes force: true unconditionally, which suggested user files could be overwritten. It cannot. That call has exactly two callers, one passing the .aidd/cache/built/<marketplace>/<target> cache dir and one passing a tmpdir() path deleted immediately before the build. Neither is user-authored content, so forcing an overwrite there is cache invalidation — and the flag was inert anyway.

Expected

  • the dead option removed, so the type surface stops claiming a capability it does not have;
  • a test at the factory level pinning both sides of the real flag: FlatTargetExistsError without --force, overwrite with it;
  • a test pinning that runBuild's outDir stays inside the aidd cache or tmp, so pointing it at a user directory fails loudly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions