Repository navigation
Conversation
…fusal of a map project oclapi2 builds this refusal itself, so a policy had no way to add to its body, as it can to its own. By default the body goes out as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVzyaMUV7QSvivXit7
…r an organization's project, is tested too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVzyaMUV7QSvivXit7
|
Codex review, pass 1 (codex-cli 0.169.0, commit 5e199e9) Verdict: findings, 1 finding.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "full",
"commit": "5e199e96",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P2",
"tag": null,
"file": "core/map_projects/tests/tests.py",
"line": 370,
"claim": "The new test covers the permission refusal with the same user as actor and owner. It leaves the refusal under the row locks and the distinct-owner argument untested.",
"scenario": "Two authorized requests to create a project under the same organization pass the permission check while one slot remains. After the first request takes that slot, the second must return a 403 completed by the policy with the organization as owner. The test starts at capacity on a personal route, so it would still pass if the locked check skipped completion or the hook received the actor in place of the organization.",
"action": "Add an organization-scoped POST test with a policy that reports available capacity on the first check and exhausted capacity on the second. Assert that the 403 includes the policy's contribution and that the hook received the acting user and the organization as separate arguments.",
"lines_delta": null,
"confidence": "high"
}
]
} |
|
Pass 1 (commit 79bdfaa):
|
|
Codex review, pass 2 (codex-cli 0.169.0, commit 79bdfaa) Verdict: clean. Earlier: F1.1 resolved findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "79bdfaab",
"verdict": "clean",
"prior": [
{
"id": "F1.1",
"status": "resolved"
}
],
"findings": []
} |
|
Simplification review (a fresh Claude subagent, commit 79bdfaa) Verdict: clean. findings.json{
"reviewer": "claude subagent",
"perspective": "simplify",
"mode": "full",
"commit": "79bdfaab",
"verdict": "clean",
"prior": [],
"findings": []
} |
snyaggarwal
left a comment
There was a problem hiding this comment.
Verdict: approve. Merge order for OpenConceptLab/ocl_online#785: this one first, then OpenConceptLab/ocl_online_api#133, then OpenConceptLab/oclmap#146. Each part falls back on its own, so any order is safe. This order just lets the create refusal carry the notice as soon as the Mapper starts asking for one.
Open core: clean. complete_refusal() is a replaceable checkpoint. oclapi2 builds only its existing neutral body (detail, error_code, limit, used), and by default it sends that body unchanged. No limit or upgrade wording is composed here, and the test policy adds only a neutral added key. This makes the existing debt easier to move, and it doesn't add to it.
Contract check across the three PRs:
- The body keeps
error_code: mapper_projects_limit_reachedand gains only what the policy adds. The private implementation addsnotice/quota/linksin the shape oclmap'sgetNotice()already reads for the other refusals. - The no-access case (
limit: null) passes through unchanged. Both the permission and the re-check under the row locks go throughcheck_map_project_capacity(), so both refusals get the same treatment, and the second new test covers the organization owner. - On an open install the default returns the body as it is, so the response is the same as on master.
Nothing blocking. One optional note for later, not this PR: the checkpoint covers only this refusal. The other refusals oclapi2 builds itself in the Mapper views can go through it when they move under ocl_online#532.
Codex's F1.1 (untested lock path and distinct owner) is fixed in 79bdfaa. CI is green.
Linked Issue
Advances OpenConceptLab/ocl_online#785
What this changes
A capability policy can now add to the refusal of a new map project.
A policy builds the body of its own refusals, so it can add keys to them. This refusal is one oclapi2 builds itself, so a policy couldn't.
CapabilityPolicy.complete_refusal(user, capability_id, body, owner=None)is the checkpoint for that:check_map_project_capacity()asks it for the body it sends, both in the permission and again under the row locks.By default the body goes out as it is, so with the default policy every response is the same as before.
How it was checked
Two new tests with a policy that adds a key: a personal project refused by the permission, and an organization's project whose last place is taken between the two checks. The tests of
core.map_projectsandcore.capabilitiespass, and Pylint is clean.Order
It can be released before or after the other parts of OpenConceptLab/ocl_online#785: a policy that doesn't define the method gets the default, and one that does is simply asked.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qVzyaMUV7QSvivXit7