Repository navigation
fix(config): coerce slack.allowed_users entries instead of dropping them - #18579
Conversation
9902c46 to
2737694
Compare
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: let an operator read back the Slack allowed-users list they saved, instead of an empty list — FIX.
[FIRST-PRINCIPLES-REVIEWED] f912db4 Description read[DESCRIPTION-READ] 7ef92f12fc21c6aee61f57426f0b733844082e6b2bf0383617aaa2d9f31ff17a That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix is in the loader where the entries were being dropped, it follows the existing Notes
[DESIGN-REVIEWED] f912db4 Description read[DESCRIPTION-READ] 758f25191e147a37be83f9f57e3e5acb0ad09524588a06c8f8e7b3d7cfb9a7cf That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
7ecb200 to
5d7d681
Compare
|
|
|
|
5d7d681 to
ae31a8f
Compare
|
Rebased onto fresh |
ae31a8f to
55d53ba
Compare
|
Rebased onto main to pull in #20902's acp census fix (0694e63), which updates the |
724dd65 to
21065ea
Compare
|
Thanks — the mismatch is real, and I've corrected the claims to match the code rather than changing the code (the behavior is the intended one). Fixed at head
The reproduced bug (#17841 — a Only the PR text and commit message changed — no code change, so the tree is identical to the head you reviewed. Over to you for a re-review. |
21065ea to
defc23d
Compare
|
Rebased onto main |
defc23d to
e9f3d87
Compare
e9f3d87 to
f722c49
Compare
|
Rebased onto main |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
Approve at f722c499fbe02ad3c6309c0be67f6a01067afdfb.
Both points of @bolichen97's change request (on 724dd65) are addressed on this head. The description no longer claims bare U… strings are converted, and test_junk_entries_are_ignored pins that they are ignored. The non-string slack_id drop is now stated as a deliberate tightening, with slack/gateway_runtime/orchestrator_init.py named as the reader whose set build it protects, and test_non_string_slack_id_is_dropped pins it. @bolichen97, please re-review when you can, since your review is what holds the merge.
Why it is worth merging: slack.allowed_users grants no access (Slack is owner-only), so coercing a user_id entry widens nothing. It only makes config get read back what was saved instead of [], using the same pattern as _validate_tracking_channels.
Please fix before the squash lands, since auto-merge is armed and the description becomes the commit body:
- The Goal says the dashboard Slack settings view shows the list. It does not expose
allowed_usersat all (dashboard/messaging_api/slack_settings.py:102-105, recorded inmessaging.md). Please drop that clause.
Minor:
config/sections_slack.py:297and the comments attest/test_config_loader_coercion.py:193and:232sayslack/gateway.pybuilds the id set; it isslack/gateway_runtime/orchestrator_init.py, as the description says.
What I ran on this head: test_config_loader_coercion.py passes (110 passed). Making _usable_id accept any truthy value reddens test_non_string_user_id_is_not_coerced and test_non_string_slack_id_is_dropped. Restoring the old inline filter in _build_slack_config reddens six tests, including test_user_id_key_is_coerced_to_slack_id_not_dropped and test_coerced_entry_survives_to_dict_round_trip. I did not run config get against a real config or start the Slack gateway. CI on this head: 77 pass, 16 skipped, 0 failing.
|
Holding: bolichen97's CHANGES_REQUESTED review (on 724dd65) is still active. A later approval does not clear it, so this needs bolichen97 to re-review or dismiss. The code is sound. KiroCrew/src/kiro_crew/config/sections_slack.py Lines 293 to 347 in f722c49 orchestrator_init.py from crashing (KiroCrew/src/kiro_crew/slack/gateway_runtime/orchestrator_init.py Lines 86 to 98 in f722c49 is_allowed_user admits only the owner (KiroCrew/src/kiro_crew/slack/handler_runtime/access.py Lines 245 to 254 in f722c49 cfg.slack.allowed_users feeds only the stale-prune log and the display-name fallback. Both points of the change request look addressed in the current description: the bare-string claim is gone, and the non-string drop is stated as Breaking: with its reader named. The 11 new tests drive KiroCrewConfig.load(), and the five coercion cases would fail on the old inline filter. GPT and Opus report no findings, Design and First Principles PASS, UX skipped. All checks on this head are green.
AI findings judged non-blocking:
Optional before the squash, since the description becomes the commit body: drop the dashboard clause from the Goal, and change To clear: bolichen97 re-reviews this head. Reviewed head: f722c49 — crew-pr-reviewer (r136) |
config get slack.allowed_users returned [] while config.json held a valid
list: the loader filtered allowed_users to entries with a truthy slack_id,
so a near-miss user_id key was dropped silently. The write looked
successful but read back empty, which reads as a failed save.
Add _validate_allowed_users, mirroring the sibling tracking_channels
validator: a canonical {slack_id, ...} entry passes through, a lone
user_id value is moved under slack_id with one warning, and anything else
(a bare string, a non-dict, an entry with no usable id) is ignored. The
kept slack_id must be a non-empty string: the gateway builds a set of
these ids at startup, so a non-string id would raise TypeError there. Wire
the helper into _build_slack_config and re-export it through the sections
facade.
Closes #17841
f722c49 to
f912db4
Compare
|
Addressed at head Reply to @buluoray's review (on
On @bolichen97's change request (on |
|
HOLD at f912db4. Blocker: @bolichen97's CHANGES_REQUESTED review (on 724dd65) is still the active review state. A later approval or comment does not clear it, so bolichen97 needs to re-review this head or dismiss the request. Both of its points look answered: the description no longer claims bare The code is sound. KiroCrew/src/kiro_crew/config/sections_slack.py Lines 307 to 361 in f912db4 KiroCrew/src/kiro_crew/slack/gateway_runtime/orchestrator_init.py Lines 88 to 99 in f912db4 KiroCrew/src/kiro_crew/slack/handler_runtime/access.py Lines 245 to 253 in f912db4 orchestrator_init.py. All checks on this head are green; GPT and Opus report no findings, Design and First Principles PASS, UX skipped.
AI findings judged non-blocking:
Minor, not blocking: the frozen Goal still names the dashboard Slack settings view, which hides To clear: bolichen97 approves or dismisses the change request. No PR code was run locally; this review read the diff, callers and CI. — crew-pr-reviewer (r141) |
bolichen97
left a comment
There was a problem hiding this comment.
Approving f912db4, which replaces my earlier change request. The claim mismatch I raised is fixed. The description no longer promises to convert bare U…/W… user-id strings, and it now lists the dropped non-string slack_id as a Breaking change, with the reason: orchestrator_init.py builds a set of these ids, so a list or dict id would crash gateway startup.
_validate_allowed_users checks typed fields and exact keys, with no regex. A canonical string slack_id entry passes through unchanged. A lone user_id is moved under slack_id with one warning. An empty slack_id falls through to user_id. Any other entry is ignored. TestSlackAllowedUsersLoad covers each case through the full load() path.
Readiness passed, and every check passes; each cancelled run has a newer pass. The Opus, GPT, First Principles and Design lanes report no blocking findings, and UX was skipped. The existing auto-merge stays as it is.
Problem / Motivation
Goal:
kirocrew config get slack.allowed_users(and the dashboard Slack settings view) shows the saved allowed-users list instead of an empty one.Reading
slack.allowed_usersback returned[]even whenconfig.jsonon disk held a valid entry. The save had persisted, so it looked like the save failed when it had not, and operators retried the save repeatedly chasing a value that was already stored. The sibling fieldslack.tracking_channels(same object-list shape) round-tripped fine, so this was specific toallowed_users.Why it matters
An operator cannot confirm their Slack user ID was saved through
config getor the dashboard, which erodes trust in the config commands and causes repeated no-op retries. The value is read-only broken (Slack delivery still works because the gateway reads the file directly), but a config read that silently discards a stored value is a correctness bug that misleads every operator who hits it.Not a goal
{"slack_id": "U...", "name": "..."}stays the shape the allowlist writer persists and every reader looks up.What changed (motivation → approach → change)
The load path built the Slack config by filtering
allowed_usersdown to entries carrying a truthyslack_idkey. The common near-miss — auser_idkey (the shape in the bug report) — matched nothing and was dropped, so the loaded list was empty andconfig getprinted[].tracking_channelsnever had this because it already ran through a_validate_tracking_channelshelper that coerces near-miss shapes rather than dropping them.The fix gives
allowed_usersa matching_validate_allowed_usershelper inconfig/sections_slack.py(beside its sibling_validate_tracking_channels). It keeps a canonical{"slack_id": ...}entry unchanged, moves a loneuser_idvalue underslack_id(keepingnameand other keys) with one warning per coercion, and ignores anything else — a bare string, a non-dict, or an entry with no usable id.config/section_builders.py's_build_slack_confignow calls it in place of the inline filter, andconfig/sections.py(the facade) re-exports the new helper so the builder imports it the same way it imports its sibling.The kept
slack_idmust be a non-empty string:slack/gateway_runtime/orchestrator_init.pybuilds asetof these ids at startup ({u["slack_id"] for u in cfg.slack.allowed_users}), so a non-string id (a list or dict from a hand-edited config) would raiseTypeError: unhashable typethere. Requiring a string id turns a startup crash into a dropped bad entry.Backwards compatibility
Breaking: a
slack.allowed_usersentry whoseslack_idis a non-string value (a list or dict, only reachable by hand-editingconfig.json) is now dropped at load instead of being carried through. The old inline filter kept it because it only checked truthiness; the gateway then crashed building its id set. This is a deliberate, narrow tightening — not a pure superset of the old loader.Everything a normal save produces is unaffected: a canonical string-
slack_identry loads exactly as before, and theuser_id-key near-miss now loads (coerced) instead of being dropped, which is the bug fix.Reader:
slack/gateway_runtime/orchestrator_init.py(builds theset[str]of allowed ids at startup) is the reader whose crash this tightening prevents; it now only ever sees hashable string ids.Tests
test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad(11 cases) exercises the fullKiroCrewConfig.load()path: canonicalslack_idpass-through; the issue'suser_id-key coercion (value moved toslack_id, other keys kept,slack_idordered first);slack_idwinning when both keys are present; an emptyslack_idfalling through touser_id; a non-stringslack_idand a non-stringuser_idboth dropped (the deliberate tightening); a bare string and other junk ignored; ato_dict()→load()round-trip; and the warning being emitted on coercion but not on a clean value.prove.pyconfirms the catch: reverting only the production change reddens the five coercion cases.Proof: PROVEN test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad::test_user_id_key_is_coerced_to_slack_id_not_dropped, test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad::test_user_id_coercion_keeps_other_keys_and_orders_slack_id_first, test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad::test_empty_slack_id_falls_through_to_user_id, test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad::test_non_string_slack_id_is_dropped, test/test_config_loader_coercion.py::TestSlackAllowedUsersLoad::test_coerced_entry_survives_to_dict_round_trip (head ae0702ce8ef4)
Manual verification
N/A — unit coverage exercises the real load path end to end, which is exactly the surface
config getreads through. The dashboard Slack settings view does not exposeallowed_users(dashboard/messaging_api/slack_settings.py), so this fix has no dashboard surface.Screenshots / video
Why no screenshot: backend-only change (config loader); no frontend or rendered surface is touched.
Sibling sweep
Sibling:
src/kiro_crew/config/sections_slack.py-- not affected -- its_validate_tracking_channelsalready coerces near-miss shapes and warns (it is the pattern this fix copies), and its ids are never hashed into aset, so the non-string tightening does not apply. No otherallowed_users-style object-list field uses a drop-on-filter load path, so the defect has no second site.Pattern harvest
Rule candidate: review-prompt
Pattern: an object-list config field whose loader filters on one required key silently drops near-miss entries, so
config getreads back[]while the file holds a value. A new list-of-object config field should coerce the common near-miss shapes (as the siblingtracking_channelsdoes) and warn, rather than filter-and-drop — and when a downstream reader hashes a field value, the loader must enforce that the kept value is the type the reader requires, rather than leaving a crash for startup.Related Issues
Closes #17841