aglinxinyuan opened a new issue, #6259:
URL: https://github.com/apache/texera/issues/6259
### Task Summary
Add `workflow-compilation-utils.spec.ts` covering the two pure helpers in
`workflow-compilation-utils.ts`: `areAllPortSchemasEqual` and
`addCompilationError`.
## Background
`frontend/src/app/common/util/workflow-compilation-utils.ts` exports two
pure functions used by the compilation-state pipeline; neither is tested.
```ts
export function areAllPortSchemasEqual(schemas: (PortSchema | undefined)[]):
boolean {
if (schemas.length <= 1) return true;
return schemas.every(schema => isEqual(schemas[0], schema));
}
export function addCompilationError(
currentState: CompilationStateInfo, operatorId: string, errorMessage:
string, errorDetails?: string
): CompilationStateInfo { ... } // returns a new Failed state with the
error merged in
```
## Behavior to pin
| Function | Contract |
| --- | --- |
| `areAllPortSchemasEqual` | `true` for length ≤ 1; `true` when all schemas
deep-equal (incl. all-`undefined`); `false` on any mismatch |
| `addCompilationError` | result `state === CompilationState.Failed` |
| `addCompilationError` | new error is keyed under `operatorId`; prior
errors are preserved only when the input state was already `Failed` |
| `addCompilationError` | `operatorOutputPortSchemaMap` is `{}` when the
input state was `Uninitialized`, otherwise carried over |
`PortSchema`, `CompilationState`, `CompilationStateInfo` come from
`workspace/types/workflow-compiling.interface`. Follow
`size-formatter.util.spec.ts` in `common/util/` as the style template (`ng
test`).
## Scope
- New spec:
`frontend/src/app/common/util/workflow-compilation-utils.spec.ts`.
- No production-code changes.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]