Hold changelog entries for features customers cannot see
Your task
Customer-facing changelogs ship late and vague, so an agent drafts them from merged pull requests. Half your merges sit behind feature flags that customers cannot see yet, and the agent must never announce a change that is not live.
Write screen_changelog_entries(pr_records, flag_states): the rule your agent follows for each merged pull request.
pr_records(list of str): one per merge, writtenPR-ID|flag, whereflagis the feature flag guarding the change, ornoneif it is not behind a flag.flag_states(list of str): the live rollout of each flag, writtenflag=percent, for example"dark-mode=100".- Return one decision per record, in input order:
"publish","hold_partial","hold_off"or"hold_unlinked".
Rules, for each record:
- If it does not contain exactly one
|:"hold_unlinked". - Trim the PR id. Trim and lowercase the flag. If either is empty:
"hold_unlinked". - A flag of
none:"publish". - Otherwise, find the flag's rollout percent. Read only the states that contain exactly one
=and whose name, trimmed and lowercased, equals the flag. The trimmed value must be 1 to 3 digits (0 to 9 only), or the state is skipped. If several states qualify, use the lowest percent. If none does, the flag has no readable state. - No readable state, or 0:
"hold_off". 100 or more:"publish". Anything in between:"hold_partial".
Examples
screen_changelog_entries(pr_records: list[str], flag_states: list[str]) -> list[str]Example 1
Input
screen_changelog_entries(["PR-101|dark-mode", "PR-102|none", "PR-103|"], ["dark-mode=100"])Output
["publish", "publish", "hold_unlinked"]Example 2
Input
screen_changelog_entries(["PR-201|beta-search"], ["beta-search=25"])Output
["hold_partial"]Example 3
Input
screen_changelog_entries(["PR-301|ghost-flag", "PR-302|dark-mode"], ["dark-mode=100"])Output
["hold_off", "publish"]