§22 S2: collection-scoped list/get/propose endpoints

Refactor the project-scoped serve/propose internals into collection-grained
helpers (_list_rfcs_for_collection, _get_rfc_for_collection,
_propose_into_collection); add routes under
/api/projects/<id>/collections/<cid>/rfcs[/<slug>|/propose]. Propose writes
the entry under the target collection's <subfolder>/rfcs via a new rfcs_dir
param on bot.open_idea_pr. Default-collection routes preserved as wrappers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-05 13:05:58 -07:00
parent 91b0fb358c
commit f57d4080dc
3 changed files with 149 additions and 22 deletions
+7 -3
View File
@@ -175,12 +175,16 @@ class Bot:
file_contents: str,
pr_title: str,
pr_description: str,
rfcs_dir: str = "rfcs",
) -> dict:
"""Per §9.1: open a meta-repo PR adding one file under rfcs/.
"""Per §9.1: open a meta-repo PR adding one file under `<rfcs_dir>/`.
One file per PR keeps idea submissions atomic and conflict-free.
The PR title and the file-add commit subject share §9.2's fixed
pattern; callers compose `pr_title` as `Propose: <Title>`.
pattern; callers compose `pr_title` as `Propose: <Title>`. §22 S2:
`rfcs_dir` carries the target collection's `<subfolder>/rfcs` so a
propose into a named collection writes under its subfolder; it
defaults to `rfcs` (the default collection / shipped behaviour).
"""
branch = f"propose/{slug}"
await self._gitea.create_branch(org, meta_repo, branch, from_branch="main")
@@ -189,7 +193,7 @@ class Bot:
created = await self._gitea.create_file(
org,
meta_repo,
f"rfcs/{slug}.md",
f"{rfcs_dir}/{slug}.md",
content=file_contents,
message=commit_message,
branch=branch,