Context
PR for #330 unified scoring constants across the canonical schema and both SDKs by extracting them into the cq-schema package (schema/scoring.values.json is the single source of truth). The Go and Python SDKs both now read constants directly from cq-schema, and cq.scoring (in cq-sdk) is the canonical Python implementation of the relevance and confidence-adjustment functions.
server/backend/src/cq_server/scoring.py is currently a hand-mirrored copy of the same logic (constants and calculate_relevance body), drifting independently from the SDK. It exists in the server purely as duplication, not as deliberate divergence.
Task
Delete server/backend/src/cq_server/scoring.py and have the server import from the SDK directly.
- Update
server/backend/src/cq_server/app.py (and any other server modules) to import apply_confirmation, apply_flag, and calculate_relevance from cq.scoring instead of .scoring.
- Delete
server/backend/src/cq_server/scoring.py.
- Bump
cq-sdk dependency in server/backend/pyproject.toml to a version that exposes the cq-schema-backed constants.
- Add a schema-oracle test under
server/backend/tests/ that validates server-serialised KnowledgeUnits against cq_schema.load_schema("knowledge_unit") — same pattern as sdk/python/tests/test_schema_oracle.py.
- Run
make test-server-backend and make lint-server-backend.
Out of scope
- The first
cq-schema PyPI release and the subsequent cq-sdk release that depends on it; this issue depends on both happening first.
- Any change to scoring algorithm semantics.
Context
PR for #330 unified scoring constants across the canonical schema and both SDKs by extracting them into the
cq-schemapackage (schema/scoring.values.jsonis the single source of truth). The Go and Python SDKs both now read constants directly fromcq-schema, andcq.scoring(incq-sdk) is the canonical Python implementation of the relevance and confidence-adjustment functions.server/backend/src/cq_server/scoring.pyis currently a hand-mirrored copy of the same logic (constants andcalculate_relevancebody), drifting independently from the SDK. It exists in the server purely as duplication, not as deliberate divergence.Task
Delete
server/backend/src/cq_server/scoring.pyand have the server import from the SDK directly.server/backend/src/cq_server/app.py(and any other server modules) to importapply_confirmation,apply_flag, andcalculate_relevancefromcq.scoringinstead of.scoring.server/backend/src/cq_server/scoring.py.cq-sdkdependency inserver/backend/pyproject.tomlto a version that exposes the cq-schema-backed constants.server/backend/tests/that validates server-serialised KnowledgeUnits againstcq_schema.load_schema("knowledge_unit")— same pattern assdk/python/tests/test_schema_oracle.py.make test-server-backendandmake lint-server-backend.Out of scope
cq-schemaPyPI release and the subsequentcq-sdkrelease that depends on it; this issue depends on both happening first.