Add minimal UCNS-only backend edcmbone_backend, archive original backend to backend_old - #105
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new minimal “UCNS-only” backend package (edcmbone-backend / edcmbone_backend) intended to model delivered output plus an explicit unresolved-continuation boundary (Hmmm), while preserving the prior, larger backend implementation under backend_old/.
Changes:
- Added
backend/src/edcmbone_backendimplementingBoundaryObject,Hmmm, and boundary creation/merge/serialization helpers. - Added contract tests under
backend/tests/asserting UCNS-only imports and keyHmmm/merge behaviors. - Archived the prior backend implementation into
backend_old/and simplifiedbackend/README.md+backend/pyproject.tomlto reflect the new package.
Reviewed changes
Copilot reviewed 8 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ucns.py | Adds a top-level UCNS compatibility shim that re-exports ucns_v04 symbols. |
| backend/tests/test_backend_contracts.py | Adds contract tests for import hygiene and boundary/Hmmm behaviors. |
| backend/src/edcmbone_backend/init.py | Implements the new minimal UCNS-backed boundary object API. |
| backend/README.md | Replaces prior README content with minimal backend-focused documentation. |
| backend/pyproject.toml | Renames/simplifies backend packaging config to build edcmbone-backend. |
| backend_old/src/edcmbone/ucns/ucns_v04.py | Archives the prior UCNS v0.4 engine implementation under backend_old/. |
| backend_old/src/edcmbone/ucns/closed_tokens.py | Archives prior closed-token UCNS encoder implementation. |
| backend_old/src/edcmbone/ucns/init.py | Exposes archived UCNS encoder surface from backend_old. |
| backend_old/src/edcmbone/parser/turns_rounds.py | Archives prior transcript parser implementation. |
| backend_old/src/edcmbone/parser/init.py | Exposes archived parser surface from backend_old. |
| backend_old/src/edcmbone/metrics/stats.py | Archives prior metric/stat primitives. |
| backend_old/src/edcmbone/metrics/risk.py | Archives prior risk proxy implementations. |
| backend_old/src/edcmbone/metrics/projection.py | Archives prior Layer 1→3 projection logic. |
| backend_old/src/edcmbone/metrics/orthogonality.py | Archives prior orthogonality/axis model implementation. |
| backend_old/src/edcmbone/metrics/matrix.py | Archives prior A-matrix/projection/alerts registry. |
| backend_old/src/edcmbone/metrics/compute.py | Archives prior metric vector computation module. |
| backend_old/src/edcmbone/metrics/init.py | Exposes archived metrics surface from backend_old. |
| backend_old/src/edcmbone/compress.py | Archives prior codec/compression tooling. |
| backend_old/src/edcmbone/canon/loader.py | Archives prior canon loader. |
| backend_old/src/edcmbone/canon/data/markers_v1.json | Archives prior behavioral markers dataset. |
| backend_old/src/edcmbone/canon/data/bones_punct_v1.json | Archives prior punctuation canon dataset. |
| backend_old/src/edcmbone/canon/data/bones_affixes_v1.json | Archives prior affix canon dataset. |
| backend_old/src/edcmbone/canon/data/init.py | Archives canon data package marker. |
| backend_old/src/edcmbone/canon/init.py | Exposes archived canon surface from backend_old. |
| backend_old/src/edcmbone/init.py | Exposes archived full edcmbone surface from backend_old. |
| backend_old/README.md | Preserves the original README under backend_old/. |
| backend_old/pyproject.toml | Preserves original packaging metadata for the archived backend. |
| backend_old/LICENSE | Preserves MPL-2.0 license text for the archived backend. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| requires-python = ">=3.8" | ||
| dependencies = [] | ||
| keywords = ["AI", "measurement", "structural fidelity", "cognitive accessibility", "NLP", "EDCM"] | ||
| classifiers = [ | ||
| "Development Status :: 3 - Alpha", | ||
| "Intended Audience :: Developers", | ||
| "Intended Audience :: Science/Research", | ||
| "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
| "Topic :: Text Processing :: Linguistic", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/The-Interdependency/edcmbone" | ||
| Repository = "https://github.com/The-Interdependency/edcmbone" | ||
| Issues = "https://github.com/The-Interdependency/edcmbone/issues" | ||
|
|
||
| [tool.pytest.ini_options] | ||
| testpaths = ["../Tests", "../tests"] | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/edcmbone"] | ||
| include = [ | ||
| "src/edcmbone/canon/data/**/*.json", | ||
| ] | ||
| packages = ["src/edcmbone_backend"] | ||
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f3f2fdacd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| [tool.pytest.ini_options] | ||
| testpaths = ["tests"] |
There was a problem hiding this comment.
Update the root test workflow with the backend move
In the checked CI workflow .github/workflows/ci.yml, the test job still runs pytest from the repo root after pip install -e ./backend, so pytest uses the root pytest.ini (testpaths = tests) rather than this backend-local setting. Those root tests still load backend/src/edcmbone/... directly, for example tests/test_metric_orthogonality_v02.py loads backend/src/edcmbone/metrics/__init__.py, but this commit deletes that tree; running pytest -q now stops during collection with FileNotFoundError/ImportError. Please update the root workflow/tests or keep the old import paths available.
Useful? React with 👍 / 👎.
| # call: tests.test_backend_contracts.test_boundary_objects_are_ucns_backed | ||
| # === END CONTRACTS === | ||
|
|
||
| import ucns |
There was a problem hiding this comment.
Include the UCNS shim in the packaged backend
When edcmbone-backend is installed or imported outside the repository root, this import cannot resolve: the new ucns.py shim lives at the repo root, while backend/pyproject.toml packages only src/edcmbone_backend and declares no ucns dependency. I reproduced this by importing with only /workspace/edcmbone/backend/src on PYTHONPATH, which raises ModuleNotFoundError: No module named 'ucns'; CI from the repo root masks this because the root directory is on sys.path.
Useful? React with 👍 / 👎.
|
|
||
| def make_boundary(delivered, unresolved=None): | ||
| """Create a UCNS-backed boundary object from delivered and unresolved text.""" | ||
| return BoundaryObject(delivered, hmmm(unresolved), _anchor(0 if unresolved else 1)) |
There was a problem hiding this comment.
Normalize unresolved text before choosing the UCNS face
When callers pass unresolved input that changes truthiness after _coerce_text (for example whitespace-only text from a form, or 0 that becomes '0'), the Hmmm payload and the UCNS carrier disagree: whitespace is stripped to the fallback hmmm: text but gets face 0, while 0 is preserved as unresolved text but gets face 1. Since the carrier is what makes these boundary objects comparable/mergeable, choose the face from the coerced unresolved text rather than the raw argument.
Useful? React with 👍 / 👎.
| name = "edcmbone-backend" | ||
| version = "0.2.0" |
There was a problem hiding this comment.
Refresh the generated manifest after changing package metadata
The checked workflow .github/workflows/manifest-check.yml still runs python .agents/skills/manifest/generate.py --root . --pyproject backend/pyproject.toml --check, and after this package rename/version change the generated block in CLAUDE.md still says package edcmbone version 0.1.0. I ran that exact check and it exits with [manifest] CLAUDE.md manifest block is stale or missing, so this PR will fail the manifest CI until the generated block is refreshed or the workflow is updated.
Useful? React with 👍 / 👎.
| def merge_boundaries(left, right): | ||
| """Compose two boundaries while preserving both delivered and hmmm text.""" | ||
| return BoundaryObject( | ||
| "\n".join(part for part in (left.delivered, right.delivered) if part), |
There was a problem hiding this comment.
Keep fallback hmmm text out of merged unresolved data
When two boundaries that have no explicit unresolved constraint are merged, this line treats both Hmmm objects as truthy and passes their fallback str() values into a new Hmmm, so serialize_boundary(merge_boundaries(...))['hmmm']['unresolved'] becomes two copies of the fallback prose instead of staying empty like it does for each input boundary. That makes downstream consumers unable to distinguish a real unresolved constraint from the automatic fallback marker after merges.
Useful? React with 👍 / 👎.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f151725502
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return BoundaryObject( | ||
| "\n".join(part for part in (left.delivered, right.delivered) if part), | ||
| hmmm(unresolved), | ||
| ucns.multiply(left.ucns_object, right.ucns_object), |
There was a problem hiding this comment.
Recompute the merged boundary face from unresolved state
When a boundary with unresolved text is merged with a complete boundary, this multiplication XORs faces [0] and [1] into [1], the same face emitted by make_boundary(..., unresolved=None), while merged.hmmm.unresolved is still non-empty. Since serialize_boundary() exposes ucns.faces, callers comparing boundary carriers can no longer tell that the merged object still carries an unresolved constraint; recompute the carrier from the merged unresolved text or otherwise keep the face semantics aligned after merges.
Useful? React with 👍 / 👎.
|
@codex[agent] resolve conflicts and repair bad code |
Co-authored-by: erinepshovel-code <250928284+erinepshovel-code@users.noreply.github.com>
|
Summary
Testing
Committed changes on the current branch with commit |
Motivation
ucnsand which treats unresolved constraints as explicit boundary objects rather than silently resolving them.hmmm) so unresolved work is preserved as data and composable via UCNS carriers.edcmboneimplementation by moving it tobackend_oldto keep history and larger functionality available.Description
src/edcmbone_backendimplementingBoundaryObject,Hmmm,make_boundary,merge_boundaries, andserialize_boundary, plus helper functions_coerce_textand_anchor, and set__version__ = "0.2.0".ucns.pycompatibility shim that re-exportsucns_v04symbols used by the backend.backend_old/(moving the prioredcmbonepackage and its data) and updatebackend/README.mdandpyproject.tomlto reflect the new package nameedcmbone-backendand simplified build/test settings.backend/tests/test_backend_contracts.pythat assert the package only importsucns, thatHmmmpreserves unresolved text and always provides a fallback, and that boundary objects carry normalizedUCNSObjectcarriers and merge correctly.Testing
pytest backend/tests/test_backend_contracts.py, which exercises import inspection and object behavior, and all tests passed.Hmmmpreservation/fallback, andUCNSbacking/merge, and they succeeded.Codex Task