Skip to content

WS-ARCH-001-02E: expose ART admission consumption capability - #323

Merged
abiorh-claw merged 15 commits into
mainfrom
codex/ws-arch-001-02e-art-admission-binding-api
Aug 12, 2026
Merged

WS-ARCH-001-02E: expose ART admission consumption capability#323
abiorh-claw merged 15 commits into
mainfrom
codex/ws-arch-001-02e-art-admission-binding-api

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Chunk

WS-ARCH-001-02E — ART ready-admission consumption and binding public capability (L1).

Goal

Expose one hidden, deny-by-default ART capability that consumes an exact verified ready admission into one TASK-supplied immutable Submission identity and provider-neutral artifact binding.

Human-approved intent

Continue the reviewed WS-ARCH-001 02A–02I boundary repair sequence. This PR completes only 02E; it does not begin 02F or activate product behavior.

What changed

  • Added immutable SubmissionAdmissionConsumptionPort request/result/error contracts under artifacts.api.
  • Added ART-owned transaction service with concealment authorization, exact final authority facts, full TASK/ART lineage validation, replay, terminal stale outcomes, and transaction-scoped binding serialization.
  • Reused generic ArtifactBinding; removed the obsolete submission binding seam from artifact_operations.
  • Added durable consumed Submission version via Alembic 0002_admission_version while keeping generic binding scope_version independent.
  • Added focused unit, architecture, PostgreSQL concurrency/rollback, and schema-head proof.
  • Reconciled current state, chunk state, canonical specs, behavior ownership, and hosted test-lane registration.

Why it changed

TASK must later compose Submission creation with ART admission consumption without importing ART persistence or allowing a raw authorization context/provider operation to cross the durable boundary.

Design chosen

The public port carries immutable IDs/facts only. ART locks its admission, evidence, and content; compares the typed TASK public context; consumes self-sufficient exact authority facts; serializes the generic binding scope using a PostgreSQL transaction advisory lock; then atomically binds and terminally consumes or stales the admission.

Alternatives rejected

  • No TASK ORM/repository imports.
  • No parallel Submission-specific binding aggregate.
  • No reuse of ArtifactBinding.scope_version as Submission lifecycle version.
  • No public route, AUTH activation, provider I/O, compatibility seam, or Submission creation.

Scope control

The diff is limited to the 02E contract, exact CI registrations, one forward migration, focused tests, and required durable documentation. No dependencies or CI thresholds changed.

Product behavior

No live product behavior is activated. Production default authorization denies and no route reaches this capability.

Acceptance criteria proof

  • Exact immutable public facts and stable errors: focused API/unit tests.
  • TASK public capability only: module-boundary validation and architecture tests.
  • Exact ART lineage/final authority: unit assertions over complete facts.
  • Terminal uniqueness/replay/rollback: PostgreSQL test covers same-admission concurrency, different-admission/same-Submission race, version 2, and rollback.
  • Provider-neutral/no I/O: implementation contains no artifact-store/provider call.
  • Legacy seam removal: architecture regression test.

Tests/checks run

  • Ruff over changed ART, tests, migration: pass.
  • Focused behavior/architecture: 33 passed; changed subsystem coverage 94.5% before final hardening and 91.6% after final terminal branch (>=90%).
  • CI custody: 140 tests passed.
  • Alembic graph unit proof: pass.
  • Behavior ownership and module-boundary validators: pass.
  • Stale artifact contract and Markdown link scans: pass.
  • git diff --check: pass.
  • Full PostgreSQL/Alembic/repository coverage suite: delegated to GitHub Actions because the local machine has no WORKSTREAM_TEST_DATABASE_URL and full local execution is prohibitively slow.

Test delta

Added test_artifact_bindings.py and test_artifact_bindings_db.py; updated architecture and Alembic contract tests. No tests were skipped, removed, or weakened.

CI integrity

Only exact new production targets and test modules were registered. No workflow, threshold, skip, package script, or gate semantics were weakened. CI-integrity review passed.

Reviewer results

Architecture, security, product/ops, QA, senior engineering, CI integrity, docs, and test-delta reviews pass after addressing exact replay, complete authority facts, ART corruption vs stale semantics, version persistence, schema proof, concurrency serialization, and terminal losing-admission behavior. Reuse review is the final internal confirmation.

External review

Pending GitHub Actions and CodeRabbit on this exact head.

Remaining risks

The focused PostgreSQL race test uses a compact isolated schema containing the relevant binding uniqueness/check constraints; hosted Alembic tests separately prove the real current-head consumed-version column and terminal constraint.

Follow-up work

WS-ARCH-001-02F may add the TASK-owned immutable Submission command and hidden composed transaction only after this PR merges. 02G–02I remain later boundaries.

Human review focus

Review exact authority facts, stale reasons, advisory-lock scope, admission terminal states, migration constraint, and absence of TASK persistence/provider ownership in ART.

Human merge ownership

A human maintainer owns the merge decision. Codex will not merge this PR.

Summary by CodeRabbit

  • New Features

    • Added controlled submission-admission processing with exact validation of task and artifact context.
    • Successful processing creates a submission binding and records the admission as consumed.
    • Matching retries safely replay the existing result, while conflicting or stale requests are rejected.
  • Bug Fixes

    • Improved protection against duplicate processing, concurrent submissions, invalid lineage, and partial updates.
  • Documentation

    • Updated architecture and artifact-storage documentation to describe the revised admission lifecycle.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e3658df-693f-4e70-9f8e-f2b41ec57d28

📥 Commits

Reviewing files that changed from the base of the PR and between b8a0705 and e9d43fd.

📒 Files selected for processing (10)
  • .agent-loop/CURRENT_STATE.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/CHUNK_MAP.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/chunks/WS-ARCH-001-02E-art-admission-binding-api.md
  • backend/alembic/env.py
  • backend/alembic/versions/0002_submission_admission_consumed_version.py
  • backend/tests/authorization/guide_compilation/test_migration_contract.py
  • backend/tests/conftest.py
  • backend/tests/projects/guide_compilation/test_migration_contract.py
  • backend/tests/test_alembic.py
  • backend/tests/test_artifact_bindings_db.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/CHUNK_MAP.md
  • .agent-loop/CURRENT_STATE.md
  • backend/tests/test_artifact_bindings_db.py
  • backend/alembic/versions/0002_submission_admission_consumed_version.py
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/chunks/WS-ARCH-001-02E-art-admission-binding-api.md
  • backend/tests/test_alembic.py

📝 Walkthrough

Walkthrough

This change adds a deny-only ART capability that validates submission admission lineage, creates immutable bindings, records consumption state, and supports replay, concurrency, rollback, and migration verification. Initiative records mark 02E complete and 02F as the next boundary.

Changes

ART admission consumption

Layer / File(s) Summary
Contracts and persistence
.agent-loop/.../evidence/*, backend/app/modules/artifacts/api/*, backend/app/modules/artifacts/models.py, backend/alembic/..., docs/spec_artifact_storage_service.md
Adds immutable admission-consumption contracts, stable errors, admission version storage, terminal-state constraints, migration support, and the replacement capability port.
Consumption service
backend/app/modules/artifacts/submission_bindings.py, .ci/behavior-ownership/*, backend/scripts/behavior_ownership.py
Validates authorization, lineage, replay, conflicts, transaction scope, and concurrency before creating a binding and consuming an admission.
Migration and behavior verification
backend/tests/test_alembic.py, backend/tests/test_artifact_architecture.py, backend/tests/test_artifact_bindings.py, backend/tests/test_artifact_bindings_db.py, backend/scripts/run_test_lanes.py
Verifies schema upgrades, fail-closed behavior, state transitions, replay, concurrency, rollback, and transaction ownership.
Boundary and initiative records
.agent-loop/CURRENT_STATE.md, .agent-loop/initiatives/..., docs/architecture_data_model.md
Records 02E completion, route isolation, verification coverage, and the 02F next boundary.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TASK
  participant SubmissionAdmissionConsumptionService
  participant ARTDatabase
  participant AUTH
  TASK->>SubmissionAdmissionConsumptionService: provide immutable Submission and lineage facts
  SubmissionAdmissionConsumptionService->>AUTH: authorize admission consumption
  SubmissionAdmissionConsumptionService->>ARTDatabase: lock records and validate lineage
  SubmissionAdmissionConsumptionService->>AUTH: consume validated authority
  SubmissionAdmissionConsumptionService->>ARTDatabase: create binding and mark admission consumed
Loading

Possibly related PRs

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the completed 02E change: exposing the ART admission consumption capability.
Description check ✅ Passed The description thoroughly covers intent, scope, design, tests, acceptance evidence, risks, follow-up work, and review ownership.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-arch-001-02e-art-admission-binding-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.agent-loop/CURRENT_STATE.md:
- Line 31: Define and consistently use the established module-level or
hidden-capability term instead of “public capability” for WS-ARCH-001-02E.
Update `.agent-loop/CURRENT_STATE.md` lines 31-31 and
`.agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/CHUNK_MAP.md`
lines 12-13, preserving the explicit statement that the capability is
route-unreachable.

In
@.agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/chunks/WS-ARCH-001-02E-art-admission-binding-api.md:
- Around line 108-109: Update the documented focused test lane to include the
authoritative architecture checks from shared_foundations_a and
shared_foundations_b in backend/scripts/run_test_lanes.py, specifically the
route-isolation and module-boundary tests; alternatively, explicitly state that
those shared lanes provide the required coverage.

In `@backend/alembic/versions/0002_submission_admission_consumed_version.py`:
- Around line 13-33: The drop_constraint and create_check_constraint calls for
ck_submission_bundle_admissions_terminal_shape must both pass
terminal_shape=True, matching the active naming convention so the existing
constraint is dropped and recreated with the expected physical name.

In `@backend/tests/test_alembic.py`:
- Around line 123-126: Update the constraint query in the migration test around
the definition lookup to restrict results to the submission_bundle_admissions
table, joining or filtering through pg_constraint.conrelid and the table
identity. Keep the existing constraint-name filter and ensure the fetched
definition is specifically for that table’s migrated admission constraint.

In `@backend/tests/test_artifact_bindings_db.py`:
- Around line 47-66: The concurrency test must use the production-equivalent
admission and binding schema, including the terminal-shape check, partial unique
consumer index, and foreign-key constraints; update the schema setup at
backend/tests/test_artifact_bindings_db.py:47-66 to run Alembic or reproduce all
relevant constraints. At backend/tests/test_artifact_bindings_db.py:145-149,
make both competing admissions reuse the same task_context and submission
version, varying only admission identity and admission-owned evidence.

In `@backend/tests/test_artifact_bindings.py`:
- Around line 61-63: Replace the vague persisted ART admission lifecycle values
with subsystem-specific names across the API, model, migration, service, and
tests. Update the fixture’s admission.status in
backend/tests/test_artifact_bindings.py:61-63, the result and admission
assertions in backend/tests/test_artifact_bindings.py:169-178, and PostgreSQL
outcome assertions in backend/tests/test_artifact_bindings_db.py:142-192 to use
the renamed values consistently.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b66850bc-b0f9-4fa3-adb7-6360f142cb4b

📥 Commits

Reviewing files that changed from the base of the PR and between 1350dac and b8a0705.

📒 Files selected for processing (20)
  • .agent-loop/CURRENT_STATE.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/CHUNK_MAP.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/STATUS.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/chunks/WS-ARCH-001-02E-art-admission-binding-api.md
  • .agent-loop/initiatives/WS-ARCH-001-modular-monolith-boundaries/evidence/WS-ARCH-001-02E-admission-binding-manifest.md
  • .ci/behavior-ownership/partition.v1.json
  • backend/alembic/versions/0002_submission_admission_consumed_version.py
  • backend/app/interfaces/artifact_operations.py
  • backend/app/modules/artifacts/api/__init__.py
  • backend/app/modules/artifacts/api/submission_admission.py
  • backend/app/modules/artifacts/models.py
  • backend/app/modules/artifacts/submission_bindings.py
  • backend/scripts/behavior_ownership.py
  • backend/scripts/run_test_lanes.py
  • backend/tests/test_alembic.py
  • backend/tests/test_artifact_architecture.py
  • backend/tests/test_artifact_bindings.py
  • backend/tests/test_artifact_bindings_db.py
  • docs/architecture_data_model.md
  • docs/spec_artifact_storage_service.md
💤 Files with no reviewable changes (1)
  • backend/app/interfaces/artifact_operations.py

Comment thread .agent-loop/CURRENT_STATE.md Outdated
Comment on lines +13 to +33
op.drop_constraint(
"ck_submission_bundle_admissions_terminal_shape",
"submission_bundle_admissions",
type_="check",
)
op.add_column(
"submission_bundle_admissions",
sa.Column("consumed_by_submission_version", sa.Integer(), nullable=True),
)
op.create_check_constraint(
"ck_submission_bundle_admissions_terminal_shape",
"submission_bundle_admissions",
"(status='ready' and consumed_at is null and consumed_by_submission_id is null "
"and consumed_by_submission_version is null and stale_at is null and stale_reason is null) "
"or (status='consumed' and consumed_at is not null and "
"consumed_by_submission_id is not null and consumed_by_submission_version > 0 "
"and stale_at is null and stale_reason is null) or "
"(status='stale' and consumed_at is null and consumed_by_submission_id is null "
"and consumed_by_submission_version is null and stale_at is not null "
"and octet_length(stale_reason) between 1 and 500)",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm the SQLAlchemy naming convention and how sibling migrations name check constraints.
set -uo pipefail

fd -t f 'env.py' backend/alembic --exec sed -n '1,120p'

echo '--- naming_convention declarations ---'
rg -n -C4 'naming_convention' --type=py backend

echo '--- terminal_shape references ---'
rg -n -C3 'terminal_shape' --type=py backend

echo '--- drop_constraint / create_check_constraint usage in migrations ---'
rg -n -C2 'drop_constraint\(|create_check_constraint\(' backend/alembic

Repository: Flow-Research/workstream

Length of output: 7775


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- naming convention ---'
sed -n '1,45p' backend/app/db/base.py

echo '--- migration 0001 constraint creation ---'
fd -t f '0001_v01_baseline.py' backend/alembic/versions --exec rg -n -C4 'submission_bundle_admissions|terminal_shape|CheckConstraint|create_check_constraint' {}

echo '--- migration 0002 complete ---'
cat -n backend/alembic/versions/0002_submission_admission_consumed_version.py

echo '--- Alembic constraint tests ---'
sed -n '80,150p' backend/tests/test_alembic.py

echo '--- sibling migration constraint naming ---'
rg -n -C3 'drop_constraint|create_check_constraint' backend/alembic/versions

Repository: Flow-Research/workstream

Length of output: 799


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

base = Path("backend/app/db/base.py").read_text()
m = re.search(r"NAMING_CONVENTION\s*=\s*(\{.*?\})", base, re.S)
print("NAMING_CONVENTION literal:")
print(m.group(1) if m else "not found")

migration = Path("backend/alembic/versions/0002_submission_admission_consumed_version.py").read_text()
for call in ("op.drop_constraint", "op.create_check_constraint"):
    pos = migration.find(call)
    print(f"{call}:")
    print(migration[pos: migration.find(")", pos) + 1] if pos >= 0 else "not found")

print("Expected physical name under ck_%(table_name)s_%(constraint_name)s:")
print("ck_submission_bundle_admissions_terminal_shape")
print("Expanded name if the supplied name already contains the prefix:")
print("ck_submission_bundle_admissions_ck_submission_bundle_admissions_terminal_shape")
PY

Repository: Flow-Research/workstream

Length of output: 1199


🏁 Script executed:

#!/bin/bash
set -u

echo '--- candidate baseline migrations ---'
fd -t f . backend/alembic/versions | sort | head -40

echo '--- constraint references in migrations and tests ---'
rg -n -C4 'submission_bundle_admissions|terminal_shape|drop_constraint|create_check_constraint' backend/alembic backend/tests

echo '--- installed SQLAlchemy/Alembic availability ---'
python3 - <<'PY'
for name in ("sqlalchemy", "alembic"):
    try:
        module = __import__(name)
        print(name, getattr(module, "__version__", "version unavailable"), getattr(module, "__file__", "path unavailable"))
    except Exception as exc:
        print(name, type(exc).__name__, str(exc))
PY

Repository: Flow-Research/workstream

Length of output: 50381


🌐 Web query:

Alembic op.create_check_constraint naming convention constraint_name op.drop_constraint logical name

💡 Result:

In Alembic, when using constraint naming conventions (specifically those that include the %(constraint_name)s token), the library automatically applies the convention to the string passed to operations like op.create_check_constraint and op.drop_constraint [1][2][3]. If you pass a logical name to these methods, Alembic treats it as the input for the %(constraint_name)s token within your configured convention [1][4]. Consequently, the actual constraint name generated or targeted in the database will be the result of the full naming convention expansion, rather than the logical name you provided [1][2]. To avoid this behavior and ensure the constraint is treated by its exact, literal name, you must use the op.f construct [1][5][3]. 1. Using op.f: This wrapper tells Alembic that the string has already been processed and should be used as-is, bypassing the automatic application of the naming convention [5][3]. Example for dropping a constraint: op.drop_constraint(op.f("your_logical_name"), "table_name", type_="check") [1][3] 2. Without op.f: If your naming convention is {"ck": "ck_%(table_name)s_%(constraint_name)s"} and you call op.drop_constraint("my_check", "users", type_="check"), Alembic will attempt to drop a constraint named ck_users_my_check [1][2]. For operations like op.create_check_constraint, using op.f on the name ensures that the constraint is created with the exact name you provide, which is often required to maintain consistency with existing database schemas or to avoid unintended naming conflicts [5].

Citations:


🏁 Script executed:

#!/bin/bash
set -u

echo '--- candidate baseline migrations ---'
fd -t f . backend/alembic/versions | sort | head -40

echo '--- relevant constraint references ---'
rg -n -C4 'submission_bundle_admissions|terminal_shape|drop_constraint|create_check_constraint' backend/alembic backend/tests

echo '--- installed package availability ---'
python3 - <<'PY'
for name in ("sqlalchemy", "alembic"):
    try:
        module = __import__(name)
        print(name, getattr(module, "__version__", "unknown"))
    except Exception as exc:
        print(name, type(exc).__name__, str(exc))
PY

Repository: Flow-Research/workstream

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- migration filenames ---'
fd -t f . backend/alembic/versions | sort | sed -n '1,80p'

echo '--- relevant files from prior log ---'
rg -n -m 40 '0001|0002_submission|0035_project|0036_art|terminal_shape|drop_constraint|create_check_constraint' /tmp/coderabbit-shell-logs/shell-output-hulEB2

echo '--- sibling migration snippets ---'
for file in $(fd -t f . backend/alembic/versions | sort | rg '/0035_|/0036_'); do
  echo "### $file"
  rg -n -C8 'drop_constraint|create_check_constraint|op\.f\(' "$file" || true
done

echo '--- focused Alembic tests ---'
rg -n -C8 'terminal_shape|0002|constraint' backend/tests/test_alembic.py | sed -n '1,240p'

Repository: Flow-Research/workstream

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- dependency versions ---'
rg -n -C2 '^(alembic|SQLAlchemy|sqlalchemy)' pyproject.toml requirements*.txt backend/requirements*.txt 2>/dev/null || true

echo '--- Alembic implementation references ---'
curl -fsSL https://raw.githubusercontent.com/sqlalchemy/alembic/main/alembic/operations/ops.py |
  rg -n -C8 'class DropConstraintOp|def drop_constraint|class CreateCheckConstraintOp|def create_check_constraint' |
  sed -n '1,260p'

echo '--- Alembic naming documentation ---'
curl -fsSL https://raw.githubusercontent.com/sqlalchemy/alembic/main/docs/build/naming.rst |
  rg -n -C8 'drop_constraint|create_check_constraint|op\.f|constraint_name' |
  sed -n '1,260p'

Repository: Flow-Research/workstream

Length of output: 9165


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- migration filenames ---'
fd -t f . backend/alembic/versions | sort | sed -n '1,80p'

echo '--- relevant log lines ---'
rg -n -m 40 '0001|0002_submission|0035_project|0036_art|terminal_shape|drop_constraint|create_check_constraint' /tmp/coderabbit-shell-logs/shell-output-hulEB2

echo '--- sibling migration snippets ---'
for file in $(fd -t f . backend/alembic/versions | sort | rg '/0035_|/0036_'); do
  echo "### $file"
  rg -n -C8 'drop_constraint|create_check_constraint|op\.f\(' "$file" || true
done

echo '--- focused Alembic tests ---'
rg -n -C8 'terminal_shape|0002|constraint' backend/tests/test_alembic.py | sed -n '1,240p'

Repository: Flow-Research/workstream

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- dependency versions ---'
rg -n -C2 '^(alembic|SQLAlchemy|sqlalchemy)' pyproject.toml requirements*.txt backend/requirements*.txt 2>/dev/null || true

echo '--- Alembic operation implementation ---'
curl -fsSL https://raw.githubusercontent.com/sqlalchemy/alembic/main/alembic/operations/ops.py |
  rg -n -C8 'class DropConstraintOp|def drop_constraint|class CreateCheckConstraintOp|def create_check_constraint' |
  sed -n '1,260p'

echo '--- Alembic naming documentation ---'
curl -fsSL https://raw.githubusercontent.com/sqlalchemy/alembic/main/docs/build/naming.rst |
  rg -n -C8 'drop_constraint|create_check_constraint|op\.f|constraint_name' |
  sed -n '1,260p'

Repository: Flow-Research/workstream

Length of output: 9164


Pass terminal_shape to both Alembic operations.

The active convention expands the current name to ck_submission_bundle_admissions_ck_submission_bundle_admissions_terminal_shape. The drop then misses the existing constraint, and the create produces the wrong physical name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/alembic/versions/0002_submission_admission_consumed_version.py`
around lines 13 - 33, The drop_constraint and create_check_constraint calls for
ck_submission_bundle_admissions_terminal_shape must both pass
terminal_shape=True, matching the active naming convention so the existing
constraint is dropped and recreated with the expected physical name.

Source: Learnings

Comment thread backend/tests/test_alembic.py
Comment thread backend/tests/test_artifact_bindings_db.py
Comment on lines +61 to +63
admission = SimpleNamespace(
id=str(request.admission_id),
status="ready",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Replace vague persisted ART admission lifecycle values.

ready, consumed, and stale are persisted ART admission lifecycle values. These names do not identify the ART admission subsystem. Define subsystem-specific values in the API, model, migration, service, and tests before release.

  • backend/tests/test_artifact_bindings.py#L61-L63: initialize the fixture with the renamed ART admission lifecycle value.
  • backend/tests/test_artifact_bindings.py#L169-L178: update result and admission assertions for the renamed lifecycle value.
  • backend/tests/test_artifact_bindings_db.py#L142-L192: update PostgreSQL outcome assertions for the renamed lifecycle values.

As per coding guidelines: “Use subsystem- or actor-specific names for workflow states, persisted tokens, API enum values, roles, and lifecycle names instead of vague labels.”

📍 Affects 2 files
  • backend/tests/test_artifact_bindings.py#L61-L63 (this comment)
  • backend/tests/test_artifact_bindings.py#L169-L178
  • backend/tests/test_artifact_bindings_db.py#L142-L192
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_artifact_bindings.py` around lines 61 - 63, Replace the
vague persisted ART admission lifecycle values with subsystem-specific names
across the API, model, migration, service, and tests. Update the fixture’s
admission.status in backend/tests/test_artifact_bindings.py:61-63, the result
and admission assertions in backend/tests/test_artifact_bindings.py:169-178, and
PostgreSQL outcome assertions in
backend/tests/test_artifact_bindings_db.py:142-192 to use the renamed values
consistently.

Source: Coding guidelines

@abiorh-claw
abiorh-claw self-requested a review August 12, 2026 10:16
@abiorh-claw
abiorh-claw merged commit ccef963 into main Aug 12, 2026
11 checks passed
@abiorh-claw
abiorh-claw deleted the codex/ws-arch-001-02e-art-admission-binding-api branch August 12, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants