Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pyre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
pip install pyre-check

- name: Run Pyre (generate SARIF)
run: pyre check --output-format sarif > pyre-results.sarif
continue-on-error: true
run: pyre --output sarif --source-directory src --source-directory auth check > pyre-results.sarif

- name: Upload Pyre results to GitHub Code Scanning
if: always()
Comment thread
Pmaster-dev marked this conversation as resolved.
Expand Down
269 changes: 269 additions & 0 deletions docs/openapi/automation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
openapi: 3.1.0
info:
title: Pmaster Automation API
version: 0.1.0
description: Shared automation contracts for the Pmaster-dev and pinkycollie ecosystem.
servers:
- url: /
description: Base URL resolved by each deployment environment
tags:
- name: Automation
- name: Runs
paths:
/automation/events/trigger:
post:
tags: [Automation]
summary: Trigger automation runs for an event
operationId: triggerAutomationEvent
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TriggerEventRequest'
responses:
'200':
description: Trigger processed
content:
application/json:
schema:
type: object
properties:
runs:
type: array
items:
$ref: '#/components/schemas/RunResult'
required: [runs]
/automation/definitions:
get:
tags: [Automation]
summary: List automation definitions
operationId: listAutomationDefinitions
responses:
'200':
description: Current definitions
content:
application/json:
schema:
type: object
properties:
definitions:
type: array
items:
$ref: '#/components/schemas/AutomationDefinition'
required: [definitions]
/automation/definitions/{name}:
put:
tags: [Automation]
summary: Create or replace an automation definition
operationId: upsertAutomationDefinition
parameters:
- $ref: '#/components/parameters/AutomationName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationDefinition'
responses:
'200':
description: Definition stored
delete:
tags: [Automation]
summary: Remove an automation definition
operationId: deleteAutomationDefinition
parameters:
- $ref: '#/components/parameters/AutomationName'
responses:
'204':
description: Definition removed
'404':
description: Definition not found
/automation/definitions/{name}/enable:
post:
tags: [Automation]
summary: Enable a definition
operationId: enableAutomationDefinition
parameters:
- $ref: '#/components/parameters/AutomationName'
responses:
'204':
description: Definition enabled
/automation/definitions/{name}/disable:
post:
tags: [Automation]
summary: Disable a definition
operationId: disableAutomationDefinition
parameters:
- $ref: '#/components/parameters/AutomationName'
responses:
'204':
description: Definition disabled
/automation/runs:
get:
tags: [Runs]
summary: List run history
operationId: listAutomationRuns
parameters:
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
default: 50
responses:
'200':
description: Run history entries
content:
application/json:
schema:
type: object
properties:
runs:
type: array
items:
$ref: '#/components/schemas/RunResult'
required: [runs]
/automation/stats:
get:
tags: [Runs]
summary: Get aggregate automation stats
operationId: getAutomationStats
responses:
'200':
description: Aggregate counters by status
content:
application/json:
schema:
$ref: '#/components/schemas/AutomationStats'
components:
parameters:
AutomationName:
name: name
in: path
required: true
schema:
type: string
schemas:
TriggerEventRequest:
type: object
properties:
event_type:
type: string
payload:
description: Event payload forwarded to automation steps.
type: object
additionalProperties: true
nullable: true
Comment on lines +155 to +159
metadata:
Comment on lines +153 to +160

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Payload type mismatch 🐞 Bug ≡ Correctness

TriggerEventRequest.payload is constrained to an object in the OpenAPI contract, but the
automation engine accepts arbitrary payload types (and the repo’s own example passes a string). This
makes the contract reject valid events or forces clients to wrap non-object payloads, diverging from
current runtime behavior.
Agent Prompt
## Issue description
The OpenAPI schema for `TriggerEventRequest.payload` is `type: object`, but the implementation treats payload as `Any` and examples pass strings. This makes the contract incompatible with the current engine usage.

## Issue Context
- `TriggerEvent.payload` is typed as `Any`.
- Quick-start uses `payload="world"` (a string).

## Fix approach
Update `TriggerEventRequest.payload` to accept any JSON value (object/array/string/number/boolean/null). In OpenAPI 3.1 (JSON Schema 2020-12), express this using `anyOf` (or omit `type` entirely) rather than forcing `type: object`.

## Fix Focus Areas
- docs/openapi/automation.yaml[150-164]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

type: object
additionalProperties: true
default: {}
required: [event_type]
AutomationDefinition:
type: object
properties:
name:
type: string
triggers:
type: array
items:
type: string
steps:
type: array
description: Ordered component names to execute in sequence.
items:
type: string
variables:
type: array
description: Variable names resolved from the runtime variable registry.
items:
type: string
default: []
description:
type: string
default: ''
enabled:
type: boolean
default: true
required: [name, triggers, steps]
RunStatus:
type: string
enum: [pending, running, success, failed, skipped]
ComponentOutput:
type: object
properties:
component:
type: string
success:
type: boolean
result:
nullable: true
Comment on lines +202 to +203
error:
type: string
nullable: true
Comment on lines +204 to +206
metadata:
type: object
additionalProperties: true
default: {}
required: [component, success]
RunResult:
type: object
properties:
run_id:
type: string
trigger:
type: object
properties:
event_type:
type: string
event_id:
type: string
timestamp:
type: string
format: date-time
required: [event_type, event_id, timestamp]
status:
$ref: '#/components/schemas/RunStatus'
outputs:
type: array
items:
$ref: '#/components/schemas/ComponentOutput'
started_at:
type: string
format: date-time
nullable: true
Comment on lines +234 to +237
finished_at:
type: string
format: date-time
nullable: true
Comment on lines +238 to +241
duration_ms:
type: number
nullable: true
Comment on lines +242 to +244
error:
type: string
nullable: true
Comment on lines +245 to +247
required: [run_id, trigger, status, outputs]
Comment on lines +234 to +248

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Oas3.1 nullable keyword 🐞 Bug ⚙ Maintainability

The OpenAPI document declares openapi: 3.1.0 but uses nullable: true in multiple schemas, which
reduces interoperability with JSON-Schema-based OpenAPI 3.1 tooling. This can lead to
clients/validators treating fields as non-nullable or failing validation depending on the toolchain.
Agent Prompt
## Issue description
`docs/openapi/automation.yaml` declares OpenAPI 3.1.0 while using `nullable: true` across schemas. In 3.1, schemas are JSON Schema; nullability is typically expressed via unions (e.g., `anyOf` including `{ "type": "null" }`), improving portability across validators/generators.

## Issue Context
Affected examples include `started_at`, `finished_at`, `duration_ms`, `error`, and others.

## Fix approach
Replace `nullable: true` usages with JSON Schema unions:
- For a nullable string: `anyOf: [{type: string}, {type: "null"}]`
- For `date-time`: include `format: date-time` on the string branch
- For nullable numbers: `anyOf: [{type: number}, {type: "null"}]`
- For payload/result where type is flexible: model explicitly with `anyOf` branches or use an unconstrained schema plus explicit null allowance.

## Fix Focus Areas
- docs/openapi/automation.yaml[150-164]
- docs/openapi/automation.yaml[195-211]
- docs/openapi/automation.yaml[234-248]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

AutomationStats:
type: object
properties:
total_runs:
type: integer
minimum: 0
automations:
type: integer
minimum: 0
components:
type: integer
minimum: 0
variables:
type: integer
minimum: 0
by_status:
type: object
additionalProperties:
type: integer
minimum: 0
required: [total_runs, automations, components, variables, by_status]
74 changes: 74 additions & 0 deletions docs/pinkycollie-ecosystem-inventory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# pinkycollie + Pmaster-dev ecosystem inventory

## Objective

Maintain `pinkycollie` product repos and `Pmaster-dev` infrastructure repos as one coordinated ecosystem with shared CI/CD, API contracts, and automation flows.

## Ecosystem snapshot

| Org | Key repos | Current role |
|---|---|---|
| `pinkycollie` | `pinkflow`, `deaf-first-platform`, `mbtq-dev`, `NegraRosa`, `VR4Deaf` | Product/application layer with broad TS + Python footprint |
| `Pmaster-dev` | `server`, `docs`, `actions`, `electron`, `.github` | Infrastructure/automation layer, reusable tooling, shared contracts |

## Layer 1 — single source of truth for templates

- Keep `Pmaster-dev/.github` as the org template hub:
- shared `CODEOWNERS`
- reusable workflows in `ci/` and `deployments/`
- shared pre-commit config
- Mirror the same model in `pinkycollie` using `pinkycollie/pinkflow` as the workflow hub.
- Replace duplicated per-repo workflows with reusable `workflow_call` workflows.

## Layer 2 — standardized pipeline lifecycle

Standard stage order for every repo:

`[Scan/Lint] → [Build] → [Test] → [Security] → [Deploy/Publish]`

Target mapping:

- Scan: `pr-security.yml`, `semgrep.yml`, `codeql.yml`
- Lint: `pylint.yml`, `super-linter.yml`
- Build: `rust-ci.yml`, `nextjs.yml`, `deploy-marketing-site.yml`
- Test: `vitest`, `pytest`
- Deploy: `github-pages.yml`, `deploy.yml`, `release.yml`

## Layer 3 — framework instances to align

| Instance | Pmaster-dev | pinkycollie |
|---|---|---|
| API server | `server/src/automation` | `pinkflow/webapp/backend` |
| API docs | `docs/openapi/` | `pinkflow/API.md` (migrate to OpenAPI) |
| Desktop client | `electron` | — |
| CI action | `actions/action.yml` | `pinkflow/.github/workflows/PinkFlow-pipeline.yml` |
| Marketing/docs site | — | `pinkflow/marketing-site/` |
| Web app | — | `pinkflow/webapp/frontend/` |
| Auth layer | — | `Nextjs-DeafAUTH` |

## Layer 4 — integration method rule

- Default to **REST** for user-initiated synchronous CRUD flows.
- Use **Webhook** for asynchronous automation events (CI, release, cross-repo signals).
- Defer **gRPC/tRPC** until latency/throughput needs justify protocol expansion.

## Layer 5 — cross-org webhook bridge

Reference flow:

`Pmaster-dev/* push/release` → `Pmaster-dev/actions` → dispatch/webhook to `pinkycollie/pinkflow` → update workflow state → run downstream checks → report status back to source PR/check.

## Layer 6 — versioned artifacts

- Machine-readable contracts: `docs/openapi/*.yaml`
- Human-readable operational docs: `pinkflow/docs/`, `pinkflow/workflow-system/docs/`
- Agent/system context: `pinkflow/context/agents.md`
- Cross-org map (this file): `docs/pinkycollie-ecosystem-inventory.md`

## Priority sequence

1. Commit this ecosystem inventory document in `Pmaster-dev/server`.
2. Publish shared automation OpenAPI contracts under `docs/openapi/`.
3. Refactor duplicated `pinkflow` workflows into reusable `workflow_call` units.
4. Wire webhook bridge from `Pmaster-dev/actions` to `pinkflow/waitthenecho`.
5. Standardize framework package versions (Next.js/React) across frontend repos.
Binary file modified src/automation/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file modified src/automation/__pycache__/components.cpython-312.pyc
Binary file not shown.
Binary file modified src/automation/__pycache__/engine.cpython-312.pyc
Binary file not shown.
Binary file modified src/automation/__pycache__/variables.cpython-312.pyc
Binary file not shown.
Binary file added src/handoff/__pycache__/handoff.cpython-312.pyc
Binary file not shown.
Loading