Repository navigation
Refactor: Flatten authbridge/ into the repo root - #1134
Conversation
`authbridge/` holds 1,005 of 1,061 tracked files and separates nothing from nothing — it dates from when this repo was kagenti-extensions and held more than one extension. The level shows up in the public install URL, in all 12 Go module paths, and in 36 workflow references plus 6 dependabot module directories. Design decisions, settled before writing: structural only (no package or binary renamed), a forwarding shim at the old install path, a flat docs/ union, and the README/CLAUDE collisions resolved inside the sweep in separate commits. One constraint is load-bearing: the installer may change its published one-liner but may not break any existing invocation. Three findings the design turns on, each verified against the tree rather than assumed: - The `replace` directives, `go.work` use list, and Dockerfile COPY paths all survive untouched, because the subtree moves up together and those paths are relative to it. - The import rewrite is a safe one-segment prefix strip: imports read `cortex/authbridge/`, the install URL reads `cortex/main/authbridge/`, so a substitution on the former cannot touch the latter. - Four images build from `context: ./authbridge` today, which excludes the repo root. After the flatten they build from `context: .`, and there is no root .dockerignore — so Docker would ship .git (196MB) and .worktrees (861MB on a dev machine) to the daemon on every build. A root .dockerignore is therefore part of the change, not a follow-up. Self-review added two things I had missed. The flatten has to land LAST: all three open PRs from the same audit (rossoctl#1124, rossoctl#1125, rossoctl#1126) touch files it moves, and a 1,005-file rename against an open PR produces conflicts not worth resolving by hand. And install-demo.sh needs no shim of its own — its old URL has zero references in-repo and zero across public GitHub, and it is already a shim for an older name. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Review pushed back on the forwarding shim, and the pushback was right. Two of the three justifications did not survive checking. The `--ref=` machinery never needed it. install.sh fetches another ref's copy of itself, and that copy lives in that ref's own tree — moving the file on main cannot change what a tag contains. Every existing release keeps working regardless. What `--ref` needs is a two-path lookup in the NEW installer so refs from both eras resolve, which is a separate mechanism I had conflated with the shim. "14 external references" was misleading as I first reported it. Every reference to main/authbridge/install.sh across public GitHub is inside the rossoctl org: 8 in this repo, 2 in rossoctl/rossoctl's current docs (coordinated PR), and 3 in rossoctl/.github's versioned_docs for 0.7 and 0.8. No third parties at all. So the shim protected exactly one case: a reader following archived v0.7/v0.8 docs. That is now accepted rather than mitigated, and the failure mode is stated from measurement instead of guesswork — curl exits 56 with 49 bytes on stderr, then sh reads empty stdin and exits 0, so an interactive user sees the 404 but a scripted caller sees success having installed nothing. Accepting it beats the alternative: a permanent file at authbridge/install.sh re-creates the directory this change exists to delete, and there is no falsifiable condition for ever removing it, because raw.githubusercontent.com exposes no fetch telemetry. That is the same unfalsifiable-criterion trap already sitting in install-demo.sh's comment. Consequence worth noting in the target layout: no authbridge/ directory survives at all now. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Six tasks. Task 1 changes install.sh's --ref lookup before the move, because it is correct either way and is the only genuinely test-first piece. Task 2 is the mechanical sweep, driven by a committed script so a 1,005-file rename is reviewed by re-running it. Tasks 3 and 4 resolve the README and CLAUDE.md collisions as prose. Task 5 publishes the new URL and regenerates the demo asset. Task 6 retires the script. Writing the plan surfaced two things the spec had missed, both now in the spec as well: Seven fixed-depth upward paths break and no substitution can see them, because they climb OUT of the moving subtree rather than within it — readme-demo's generator output path and staleness assertion, plus five in the github-issue demo Makefiles. Each loses exactly one '../'. The readme-demo pair is the dangerous one: unfixed, the generator writes above the repository root. The demo SVG cannot be regenerated later. CI's readme-demo job regenerates it and compares against the committed asset, and the asset renders the install one-liner — so changing the one-liner fails that job until the asset follows in the same change. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The Task 2 sweep would have rewritten install.sh's --ref fallback URL. That fallback deliberately PROBES the old location, so the substitution would make both lookup paths identical and silently break --ref for every pre-flatten tag — no error, just a quiet degrade to main's script. install.sh is now excluded from that rule and its two usage comments are hand-edited instead. Task 5 Step 1 also duplicated work the sweep already does across four files. It is now a verification step, so an implementer does not read a no-op diff as a failure. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
install.sh fetches another ref's copy of itself to honour --ref=, at a path that
is about to change. Try ${ref}/install.sh first and fall back to
${ref}/authbridge/install.sh on a clean 404 only, so refs from either side of
the flatten resolve and a pinned pre-flatten tag keeps running its own script
instead of silently degrading to main's.
Correct before the move as well as after: the new path simply 404s today and the
fallback finds the current one, which is why this lands first and separately.
A transport failure still dies rather than falling back, the distinction the
existing code is careful about, preserved here.
Test harness (install_test.sh): with_bootstrap now takes a second HTTP code for
the legacy path (http_new, http_legacy), since testing a two-path lookup needs
per-URL codes. Updated all 8 existing call sites for the new signature, 2 more
than the originating plan called out: the local-file cases used the same old
4-positional form and would otherwise silently misalign. Added 3 checks: the
brief's two new-path/legacy-path cases (corrected their expected output to
REEXECED, since any 200 exits the extracted bootstrap block before it could
print script=/version=, exactly like the pre-existing 200 check already relies
on), plus one covering the transport-error-never-falls-back safety property
that the brief's two cases do not actually exercise against the prior
single-fetch code.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
Task 1's review found a fourth legacy path reference in install.sh that the plan
accounted for nowhere: an advisory URL inside the abctl service version-mismatch
die, interpolating a tag as ${REPO}/${version}/authbridge/install.sh. Correct
for a pre-flatten tag, a 404 for a post-flatten one, and unable to do a two-path
lookup because it is printed advice rather than a fetch.
Not a Task 1 defect — untouched by that diff and outside its scope — so it is
routed to Task 5, where install.sh's other user-facing strings are hand-edited.
The fix deletes the URL guess rather than repairing it. Task 1 made --ref=
resolve either layout, so the advice can delegate to that mechanism: --ref=${version}
is correct in both eras with no version boundary to encode, and stays correct if
the layout changes again.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
rossoctl#1124 deleted a package and nine symbols, so the import-rewrite surface shrank: 460 Go files / 1,019 occurrences became 423 / 909. File count moved 1,005 -> 1,006 (this plan and its spec are themselves under authbridge/docs/ and move with it). The sweep is count-independent, so nothing about the mechanism changes — but a brief carrying numbers that do not match the tree invites an implementer to assume something else is wrong too. Also re-verified on the rebased tree, unchanged: 12 go.mod files, 36 workflow references, 6 dependabot module directories, and all seven fixed-depth upward paths. One earlier grep of mine reported readme-demo/main.go clean; that was a bad pattern (filepath.Join uses separate quoted segments, not a slash path), not a changed file. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
authbridge/ held 1,006 of 1,061 tracked files and separated nothing from
nothing: it dates from when this repo was kagenti-extensions and held more than
one extension. The level was carried by the public install URL, all 12 Go module
paths, 36 workflow references and 6 dependabot module directories.
Driven by scripts/flatten-authbridge.sh, committed here so review is re-run it
and diff rather than reading 1,006 renames. Run with BSD sed (/usr/bin/sed, the
`sed -i ''` spelling) because the script runs under /bin/sh, where sed is
/usr/bin/sed even on a machine whose interactive shell aliases sed to gsed.
Three things needed no edit, because the subtree moved together and they point
within it: the replace directives' relative paths, go.work's use list, and the
Dockerfile COPY paths. Verified rather than assumed — a podman build of
cmd/authbridge-proxy/Dockerfile with context: . succeeds and the image runs.
Seven fixed-depth paths did need an edit, because they climb OUT of the subtree
and no substitution on 'authbridge/' can see them. Each lost one '../':
scripts/readme-demo/main.go:22 generator output path
scripts/readme-demo/staleness_test.go the staleness assertion
demos/github-issue/rbac/Makefile:59 AGENT_EXAMPLES_DIR (5 -> 4)
demos/github-issue/rbac/Makefile:63 VENV (4 -> 3)
demos/github-issue/aiac/Makefile:43 VENV (4 -> 3)
scripts/profile-tags/guards_test.go:15 repoRoot (3 -> 2)
install_test.sh:513 WORKFLOW (drops the /..)
The last two are not in the plan's list and were found by running the gates.
Both failed loudly, which is the only reason they are here: guards_test.go's
repoRoot walked one level too high and scanned a SIBLING WORKTREE, reporting
retired plugin tags from another branch; install_test.sh's WORKFLOW pointed
above the repo root, so the release-binaries.yaml assertions silently took
their "missing" branch.
Conversely, two paths the plan lists as needing an edit must NOT be edited:
the '-r ../../../requirements.txt' hints in both github-issue Makefiles.
requirements.txt moved from authbridge/ to the root at the same time those
Makefiles moved up, so the relative distance is unchanged; the suggested
'../../requirements.txt' would name demos/requirements.txt, which does not
exist. Verified by resolving every one of the nine candidates on disk.
Beyond the mechanical sweep, these break on the move and the script's patterns
cannot see them (no trailing slash, or a file type outside its glob list):
.gitignore not in the script's glob list at all. The root-level
binary spellings needed a LEADING SLASH, not just the
segment dropped: a bare `abctl` has no separator, so
git would match it at any depth, including the package
directory cmd/abctl. Without this, `git add -A` stages
66MB of built binaries -- it did, once, here.
.github/CODEOWNERS `authbridge/ @maintainers` matched nothing; `*` covers
it now, so the redundant rule is gone.
ci.yaml `find authbridge -name go.mod` -> `find .`; otherwise
the tidy gate finds zero modules and exits 1.
dependabot-tidy.yml same find, plus the `authbridge/**/go.{mod,sum}` path
filters, which would never again trigger the workflow.
security-scans.yaml Bandit's `for dir in authbridge tests`, and Trivy's
skip-dirs: 'authbridge/demos' (no trailing slash, so
the demos/ rule missed it).
.pre-commit-config `files: ^authbridge/` would have silenced ruff
entirely. Inverted to `exclude: ^tests/` rather than
dropped, because the root tests/ tree was never in
scope and does not lint or format clean; dropping the
filter fails the hook on pre-existing findings. The
Makefile's ruff target now matches that scope.
local-build-and-test three `cd "${SCRIPT_DIR}/authbridge"`.
install_test.sh the fake-curl stub at line 321 deliberately keys on
the LEGACY '*/authbridge/install.sh' to test the --ref
fallback. The sweep rewrote it to '*/install.sh',
which matches both URLs, so the stub answered every
fetch with the legacy status and two --ref tests
broke. Restored, with its two explanatory comments.
install.sh is excluded by the script; its test needs
the same exemption and did not have it.
Go comments and strings naming docs/ and scripts/ paths were swept too: the
script's step 3 only rewrites module paths, so 'authbridge/docs/...' in a
comment survived it. cmd/ was deliberately left out of that pass, which is
what keeps cmd/abctl/tui/sessions_title_test.go's synthetic session titles
intact -- their length is load-bearing for a documented 119-column assertion.
The import rewrite is a one-segment prefix strip and cannot touch the install
URL: imports read cortex/authbridge/, the URL reads cortex/main/authbridge/.
install.sh is byte-identical to before; its --ref probe of the old path at
line 485 is untouched.
Adds a root .dockerignore, which is now load-bearing rather than hygiene. Four
images moved from context: ./authbridge to context: ., so .git (196MB) and
.worktrees (861MB on a dev machine) went from outside every build context to
inside one. Measured context after it: 32.8MB.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
Task 2's verification list omitted pytest, and ci.yaml:281 runs it. That is exactly how a dead parents[1]/"authbridge" path in tests/test_keycloak_sync.py survived the sweep: *.py was in neither the substitution globs nor the gates. The step now runs it, with a comment saying why it is easy to forget in a repo that is 95% Go. Task 3 gains a step for the eleven links the sweep retargeted from authbridge/README.md to the root README.md — two different documents, with three anchors that exist only in the former. Task 2's fix round restores them; Task 3 now points them at docs/architecture.md once the file lands there, so each commit is correct on its own rather than one carrying a link that only becomes right later. Task 3's link check also grew from five named files to every tracked .md. Naming five was how eleven broken links in other files went unnoticed. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Review round 1 on the flatten sweep. Four gaps, none of them disputes.
1. tests/test_keycloak_sync.py loaded keycloak_sync.py through the old path
(parents[1] / "authbridge" / "keycloak_sync.py"). That module is now at the
repo root, so exec_module raised FileNotFoundError at import and
`pytest tests/ -v -x --ignore=tests/e2e` died at collection — ci.yaml's
python-test job, red. The sweep fixed the docstring on line 1 and missed the
real path two lines below because *.py is not in its glob list, and the
plan's verification never ran pytest. Now 12 passed.
2. Four more fixed-depth upward paths, same class as the seven already fixed and
found the same way: the target did NOT move with the file, so each loses one
'../'. Two of them hid from the first audit's regex — one is a path inside a
Python snippet, the other a reference-style link definition:
scripts/readme-demo/README.md:42 3 -> 2 (docs/assets/)
proxy-init/README.md:189 2 -> 1 (.github/)
demos/session-budget/hitl-with-claude-code.md:14 3 -> 2 (root README)
docs/laptop-token-savings.md:8 2 -> 1 (root README)
3. Ten links silently retargeted to the wrong document. These are relative
links whose TEXT never changed: they climbed to authbridge/ and resolved to
authbridge/README.md, and now climb to the repo root and resolve to the root
README — a different document (87-line product page vs 532 lines of
Kubernetes architecture). Three anchors (#download-prebuilt-binaries,
#deployment-modes, #build-tag-plugin-selection) exist only in the former, so
those were dead. Restored to authbridge/README.md, which is correct AS OF
THIS COMMIT; Task 3 moves that file and retargets all of them. Pointing them
at docs/architecture.md here would be a link that only becomes right later.
This class was invisible to the first audit because the diff shows no change
on these lines — nothing was rewritten, the meaning moved underneath them.
A resolver over every relative reference in markdown now reports zero broken
links and exactly three that legitimately mean the root product page.
cmd/README.md:40 and docs/kubernetes.md:48 keep their ../CLAUDE.md retargets,
which are pre-emptively correct given Task 4.
4. .dockerignore was kept verbatim from the plan; that was the wrong call. Its
patterns are context-root-anchored — Docker matches the whole relative path,
the opposite of .gitignore's match-at-any-depth — so `venv`, `__pycache__`,
`.ruff_cache` and `*.test` only ever caught root-level hits and sailed past
tests/__pycache__. Those are now `**/`-prefixed. Also adds .superpowers
(1.2MB) and the compiled Go binaries, which .gitignore covers and Docker
cannot read: on a machine that has run `go build` they are ~95MB of stale
artifacts shipped into a context whose builder recompiles from source anyway.
Measured on this tree with the binaries present: 111.5MB before, 12.0MB
after. That also corrects the 32.8MB reported for the previous commit, which
was itself inflated by a 20MB scripts/readme-demo/readme-demo the old
patterns did not catch.
`cmd/*/authbridge-*` catches the in-package binaries without touching the
package directories (one segment shorter) or any source file — no tracked
file under cmd/*/ begins with "authbridge-". Verified by rebuilding the
image: the COPY of cmd/authbridge-proxy/entrypoint.sh still resolves.
Gates: pytest 12 passed; install_test.sh 113 passed 0 failed; podman build of
cmd/authbridge-proxy/Dockerfile succeeds and the image reports its version; all
12 modules tidy/build/vet clean; profile-tags guards ok; shellcheck clean at
error severity across all 48 scripts.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
Flattening authbridge/ collides its README.md with the repo's. They are not the same kind of document: the root one is the 87-line product front page, this is 532 lines of Kubernetes deployment architecture. The front page keeps the slot and the deep dive becomes docs/architecture.md, indexed from docs/README.md and linked from docs/kubernetes.md -- the 59-line orientation page it complements. Retargeted every inbound link that pointed at authbridge/README.md (root README, SECURITY.md, cmd/abctl/README.md, authlib/plugins/README.md, and five demo docs), preserving the three anchors specific to this document (#download-prebuilt-binaries, #deployment-modes, #build-tag-plugin-selection). Also fixed the document's own outbound links: they still assumed authbridge/'s pre-flatten layout (authlib/, cmd/, demos/, docs/ as siblings under authbridge/) even though Task 2 already moved those out to the repo root. docs/ and authbridge/ are both root-level, so moving the file to docs/ changes what its "./" and bare relative links resolve to; fixed by walking every link in the file and resolving it on disk rather than trusting the text. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The resolver I wrote tested the whole captured link target, including any #anchor suffix. A link like ](../README.md#quick-start) names a real file, so test -e on the full string reports it broken. Task 3's implementer found it emitting ~68 BROKEN lines on an unchanged tree, before and after its work. That is worse than having no check. A gate that always fails is a gate people learn to skip, and it would have masked the real breakage it exists to catch — in a task whose whole lesson was that link damage leaves nothing in the diff to see, so resolution is the only thing that finds it. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
…the root
Nine sections of the nested file have no root counterpart at all: Component
Details, Session Events API, the top-level mtls: block, Common Tasks for Code
Changes, Shared Volume Contract, Config Hot-Reload, Keycloak Setup Scripts,
Important Port Mapping and What AuthBridge Does. Inserted them into the root
file in place; no root content changes here.
Paths rewritten for the flattened tree as they landed: proxy-init/init-iptables.sh
rather than a bare init-iptables.sh, demos/mtls/ rather than authbridge/demos/mtls/,
and the podman build examples no longer cd into authbridge/ first. The
/v1/sessions/{id} row's cross-reference to "gotcha 11" became a pointer to the
section, since the merged gotcha list renumbers.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
Six sections existed in both files. Resolved each rather than appending, and checked every disputed claim against the tree instead of trusting either prose: - Directory tree: the root's was still rooted at authbridge/, describing a subdirectory that no longer exists. Replaced with the flattened layout, keeping the nested file's per-directory detail and the root-only entries (tests/, .github/, go.work, install.sh). - Binaries: kept the root's five-row table, added the nested file's opt-in plugin mechanics, the context-guru note, the Release binaries variants table, and links to cmd/README.md, cmd/abctl/README.md and authlib/README.md. go.work is at the root now, not authbridge/go.work. - Gotchas: merged to 14 items. The two pairs that overlapped (outbound passthrough, route host patterns) kept the nested file's fuller version with the root's wording folded in. - Build: the podman examples no longer cd into authbridge/ — the build context is the repo root. Added kind load / make load-image and the advanced verify script. Corrected the nested file's `make load-images`, which does not exist; the proxy-init target is `load-image`. - Code conventions: kept the root's gating breakdown, which the tree confirms (ci.yaml's authlib job does run go fmt and go vet, and vet gates 7 of 12 modules). Added slog / go-control-plane / jwx conventions. Corrected both files on shell strict mode: init-iptables.sh is `set -e`, not `set -euo pipefail`. Dropped the nested file's UID/GID 1000 bullet — it exists to match a client-registration container that no longer exists. - ConfigMaps: added the authbridge-runtime-config row and the routes.yaml format block; dropped the pointer to authbridge/CLAUDE.md. Also trimmed the duplicate shared-volume list under Cross-Component Relationships to a pointer, and corrected the pre-commit ruff hook description, which still claimed a `files: ^authbridge/` filter the config no longer has. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The nested file's content now lives in the root CLAUDE.md. Deleting it removes the last file under authbridge/, so the directory is gone. Four places still pointed at the deleted path and are retargeted at the root file: the mtls comment in cmd/authbridge-proxy/main.go, the trust-model comment in authlib/listener/reverseproxy/transparent_inbound_mtls_test.go, and demos/mtls/README.md; install.sh's local.go comment loses the stale segment too. README.md's "Code lives under authbridge/" link would have 404'd once the directory went away, so it now points at authlib/ and cmd/. The docs/superpowers/ archive keeps its authbridge/ strings — dated records, and still written to. install.sh keeps the legacy raw.githubusercontent URL under main/authbridge/install.sh, which is the pre-flatten bootstrap path old one-liners still fetch. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
PR rossoctl#1125's body claimed it added the demos missing from demos/README.md. It fixed CLAUDE.md's list and left the index alone, so context-guru, echo and mtls are still absent — the same three the original audit named. Task 4's implementer surfaced it while checking whether the nested CLAUDE.md's Demo Scenarios section was a true duplicate. It was not: the root file's coverage plus demos/README.md does not span all twelve, which is exactly why that section looked redundant and was not. Folded into Task 5 rather than a fourth PR for three lines. A merged PR asserting a fix it did not make is the worse problem. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Task 4's review graded these Minor, and minors normally skip the fix loop. These two go in anyway because they regress Task 4's own constraint — "one binaries list" — rather than merely inheriting clutter: the merge added a third binaries enumeration, and one of the three headings names 2 of the 5 binaries that now exist. CLAUDE.md is re-read at the start of every session, so redundancy there is a recurring cost rather than a one-off blemish. Folded into Task 5, which is already editing docs, instead of spending a dedicated fix round. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The canonical one-liner becomes raw.githubusercontent.com/rossoctl/cortex/main/install.sh. The old path is abandoned rather than shimmed: every reference to it across public GitHub is inside the rossoctl org, so there are no third parties to protect, and a permanent file at authbridge/install.sh would re-create the directory this series exists to delete with no falsifiable condition for ever removing it. Fixes install.sh's own header/--help usage lines to the new URL, and its abctl-service version-mismatch advice to suggest --ref=<tag> (which now resolves either layout) instead of guessing a path that is wrong for post-flatten tags. Leaves the --ref fallback probe at line 485 untouched -- it exists to find installers in pre-flatten releases. Regenerates docs/assets/cortex-demo.svg, which is required and not cosmetic: the asset renders the one-liner, and CIs readme-demo job regenerates it and compares, so a changed command fails that job until the asset follows. Also replaces install-demo.sh's promise to disappear once the old URL stops being fetched with a condition that can actually be checked, consolidates CLAUDE.md's three duplicated AuthBridge Binaries sections into one enumeration, and adds context-guru, echo and mtls to demos/README.md's index (PR rossoctl#1125 claimed this fix but only applied it to CLAUDE.md). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
It was committed so the 1,006-file rename could be reviewed by re-running it rather than read line by line. That job is done, and a one-shot script that rewrites module paths in a directory which no longer exists is only a hazard. Marks the design spec implemented. The spec has itself moved to docs/superpowers/specs/, by the change it describes. Points cmd/authbridge-praxis's "paused, see above" cross-reference in CLAUDE.md at cmd/README.md instead, since the section it used to point at is now itself a forward-pointer to this table. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Important Review skippedToo many files! This PR contains 1054 files, which is 954 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (13)
📒 Files selected for processing (1054)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
One Important finding plus several cheap minors the review offered to batch: - Four Dockerfile comments still named ./authbridge as the build context; the sweep's dollar-anchored rule matched build.yaml's YAML line but not these comments, which have trailing text. Point them at the repo root instead. - Spec section 5 (and the plan's Task 2 Step 3) wrongly told the sweep to shorten the "-r ../../../requirements.txt" hints in the github-issue rbac/aiac Makefiles -- requirements.txt moved up with those Makefiles, so the distance never changed. Removed those two rows, added the rule that decides it (shorten only where the target did not also move), and added six paths the table omitted: scripts/readme-demo/README.md, scripts/profile-tags/guards_test.go, install_test.sh's WORKFLOW, demos/session-budget's hitl-with-claude-code.md, docs/laptop-token-savings.md, and proxy-init/README.md. Eleven paths, not seven. - Spec section 9 said "three commits"; the branch landed nineteen. The core intent held (one sweep commit, one rehome commit, three prose-merge commits for CLAUDE.md) but this repo's convention of committing and revising dated design/plan docs in place supplies the rest. Prose now names all nineteen. - docs/framework-architecture.md pointed CHANGELOG.md at authbridge/, which no longer exists. - Makefile's fmt target claimed to match the ruff pre-commit hooks but excluded any tests/ directory rather than only the root one, missing sparc-service/tests. --exclude ./tests anchors it the same way the hook's ^tests/ does. - Two demo Makefile comments (echo, hr-cpex) still described climbing to authbridge/; the arithmetic was already correct for the repo root. Comments only -- AUTHBRIDGE_ROOT is not renamed. - CLAUDE.md cited plugins/opa/tool_parameters_rego_test.go; the real path is authlib/plugins/opa/tool_parameters_rego_test.go (wrong before the flatten too). Verified: grep for ./authbridge Dockerfile contexts is empty, sh install_test.sh reports 113 passed, and GOWORK=off go build ./... in authlib is clean. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The sweep matched `authbridge/` WITH a trailing slash, so every spelling of the
directory that lacks one survived the flatten. Three classes, each swept
repo-wide by shape before any edit; all three re-run clean afterwards.
STALE-PATH-DRIFT - 12 sites.
Swept: 1,283 raw `authbridge` mentions -> 376 where it reads as a path
segment -> 27 carrying a trailing slash (shape A) + 16 used as a bare
directory argument (shape B). Shape B is the one the original sweep's
pattern could not match.
- 9 bare `cd authbridge` lines became `# from the repo root`. There is no
directory left to enter, so the cwd is a precondition now rather than a
command, and a comment keeps each block copy-pasteable. Every one of
these blocks then does `pip install -r requirements.txt` or
`kubectl apply -f demos/...`, so they failed at step 1.
- `cd cortex/authbridge` -> `cd cortex`, matching the convention this
branch already applied in .claude/skills/demo/SKILL.md.
- 2 inline `cd authbridge && podman build ...` lost the prefix. In the cpex
README the line above left cwd in authlib/, so it becomes `go -C authlib`
(the spelling ci.yaml uses) and the block stops depending on cwd at all.
RENAME-DRIFT - 5 sites.
authbridge/README.md became docs/architecture.md, so link text calling it a
README names a file type the target no longer has. Swept for link text
mentioning README whose target is not a README: 5 found, 5 fixed. The two
labels reading "AuthBridge Overview" are left alone - that one is a
description, and it is still accurate.
DEAD-GUARD - 1 site.
security-scans.yaml's Bandit step looped `for dir in .` over a path that
always exists, so neither the loop nor the `[ -z "$PYTHON_DIRS" ]` check
below it could take either branch. Collapsed both to `PYTHON_DIRS="."`.
The four Dockerfile build-context comments and framework-architecture.md's
`authbridge/CHANGELOG.md` were in this commit until d8617f5 fixed them
independently; this rebase drops those hunks in favour of that wording.
RETRACTED, deliberately not fixed: the `UID/GID 1000 ... must match
runAsUser/runAsGroup` bullet that the CLAUDE.md merge dropped from
authbridge/CLAUDE.md:630. It constrains injection of the client-registration
container, and line 199 of that same base file already recorded that sidecar as
"removed entirely"; no client-registration image exists in the tree and no
Dockerfile uses UID/GID 1000. Dead content, correctly dropped - restoring it
would re-ship a stale claim. Swept the class anyway (448 source lines -> 53
similarity candidates, the sweep self-tested against this known instance):
nothing else was lost.
Verified: install_test.sh 113/113, pytest 12/12, the 7-mutation install.sh
suite unchanged at 6 killed / 1 survivor (that survivor is a pre-existing,
untouched guard, filed rather than fixed). pre-commit clean on the changed
files. Net -11 lines, no file outside the branch's existing set.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>
Targeted follow-up requested during PR review of the authbridge/ flatten: trim the wide root without adding or renaming any directory. - Delete uv.lock: 3 lines, locks zero packages, and asserts requires-python = ">=3.14" while pyproject.toml targets py312. - Delete install-demo.sh: a forwarding shim for a name that predates it; both its old and new URLs are dead now that authbridge/ is gone. docs/proposals/tool-prune.md keeps its three references untouched -- it is a dated, implemented design record. - Fold pyrightconfig.json into pyproject.toml's new [tool.pyright] section (pythonVersion + typeCheckingMode); pyright reads it natively. - Move local-build-and-test.sh and verify-spire-keycloak.sh into the existing scripts/, updating every prose/invocation reference (11 sites) plus the path arithmetic inside local-build-and-test.sh, which resolved ROSSOCTL_DIR and its Docker build-context cd calls relative to the script's own directory -- now REPO_ROOT (one level up) so both still land in the same places after the move. install.sh is untouched, including its --ref probe of an old release's authbridge/install.sh path for pre-flatten releases. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
esnible
left a comment
There was a problem hiding this comment.
Summary
An exceptionally careful mechanical refactor. 961 of the 970 renames are clean authbridge/ prefix strips, and the 9 that aren't are all intentional (README.md -> docs/architecture.md, two root scripts into scripts/) or git rename-detection artifacts. The inline comments explaining why each path change was made the way it was are what made this reviewable at 1067 files.
One must-fix, plus two questions about changes that aren't path flattening.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Go, Shell, CI/GitHub Actions, Docker, Helm-adjacent config, Python, Docs, Agent config
Agent/IDE config (.claude/.vscode): .claude/skills/demo/SKILL.md — inspected in full; pure markdown path-prefix removal, no hooks/commands/executables. No .vscode/ changes.
Commits: 22 commits, all signed-off: yes
CI status: all 24 checks passing
Two findings on deleted files (can't be inlined)
uv.lock (deleted) — suggestion. Deleting a lockfile is a behavior change, not a path flatten, so it doesn't really belong in this PR. It's defensible — pyproject.toml has no [project] table, so nothing here was ever uv-managed, and the real deps live in requirements.txt. But requires-python = ">=3.14" was recorded nowhere else, and dropping it leaves only the pythonVersion = "3.12" carried over from pyrightconfig.json, which disagrees with it. Could you confirm this is intentional, ideally as its own commit?
authbridge/install-demo.sh (deleted) — suggestion. This shim's stated purpose was that its URL had been published in release notes. Two live releases still carry a now-dead bootstrap URL in their notes:
v0.7.0-alpha.4main-latest(the rolling channel)
both pointing at https://raw.githubusercontent.com/rossoctl/cortex/main/authbridge/install.sh, which 404s once this merges. The new two-layout probe can't rescue this: it only runs after install.sh has been fetched, so a dead bootstrap URL fails before any of that logic is reached. Worth either keeping a root-level install-demo.sh shim or editing those two releases' notes as part of the merge.
Verified correct
- The two-layout probe itself is right. Fallback fires on a clean 404 only — a transport error (
000) or 5xx correctly reaches thedierather than silently dropping tomain, which is the security-relevant property. Mixed-layout resolution is structurally impossible since the installer script is the only path-dependent asset (release downloads use flat asset names). Both layouts are covered non-vacuously ininstall_test.sh, including the000 -> 200case that must not fall back. .gitignoreanchoring. Nice catch adding the leading slashes — a bareabctlorprofile-tagspost-flatten would have matched the package directories at any depth and silently ignored new source files under them. That's exactly the bug class a careless flatten introduces..dockerignore(new). The whole-path-vs-basename anchoring note is accurate. I verified the load-bearing claim: zero tracked blobs matchcmd/*/authbridge-*, and there are no top-levelbin/dist/abctl/profile-tagstrees that the bare entries would wrongly exclude.- Paths all resolve at HEAD:
go.work(all 9 modules incl../scripts/profile-tags), all 12go.modfiles, every dependabotdirectory:, and every CI-referenced file (CPEX_FFI_VERSION/CPEX_FFI_ABI, all five Dockerfiles,proxy-init/test-enforce-redirect.sh). scripts/profile-tags/guards_test.go:repoRootcorrectly rebased../../..->../..whilecmdDircorrectly stays../../cmd.- The 6
plugins_{contextguru,sessionbudget,sparcplugin}.go"swaps" betweenauthbridge-proxyandauthbridge-envoyare byte-identical files that git's rename detection paired arbitrarily — not real moves, nothing to fix. pyrightconfig.json->pyproject.tomlmigration is faithful (both keys preserved).tests/test_keycloak_sync.py'sparents[1]is correct now that bothtests/andkeycloak_sync.pyare at root.ci.yamlgo-tidy-check widening tofind . -name go.modgenuinely ran and passed, so all 12 modules includingdemos/*tidy clean.
Assisted-By: Claude Code
| in order to start Cortex. Either use the installer that shipped with it: | ||
| curl -fsSL https://raw.githubusercontent.com/${REPO}/${version}/authbridge/install.sh | sh | ||
| in order to start Cortex. Either re-run this installer pinned to that release, | ||
| which resolves its installer in either layout: |
There was a problem hiding this comment.
must-fix — this advisory sends the user into a loop on the path where they're most likely to hit it.
The text claims --ref=${version} "resolves its installer in either layout", but on the local-file path that isn't true. Line 428:
{ [ -f "$0" ] && [ -r "$0" ]; } && _reexec=""suppresses the re-exec entirely when the script is a readable local file (git clone then ./install.sh or sh install.sh). The two-layout probe block never executes, and line 432 then makes --ref=X pin binaries only:
[ -z "${_reexec}" ] && [ -z "${SCRIPT_REF}" ] && VERSION_REF="${WANT_REF}"So a user who hits "the ${version} abctl has no 'service' command" and follows this instruction verbatim re-runs the same local script, reinstalls the same too-old abctl, and dies with byte-identical output. The script's own comment at lines 430-431 already spells out this limitation ("--ref=X selects X's binaries even though this local script, not X's, is the one running").
On the pipe path the advice is merely circular rather than looping — the re-exec already happened, so the running script is ${version}'s installer.
Before this PR the message handed over a concrete URL that actually worked:
curl -fsSL https://raw.githubusercontent.com/${REPO}/${version}/authbridge/install.sh | sh
Suggest either restoring a concrete URL, or scoping the claim to the pipe form — e.g. curl -fsSL https://raw.githubusercontent.com/${REPO}/main/install.sh | sh -s -- --ref=${version}, noting that the flat-layout URL is only valid on main/post-flatten refs (which is exactly why the probe exists). Only the second suggestion in the current message (--ref=<newer tag>) actually resolves the user's situation.
There was a problem hiding this comment.
Confirmed and fixed in 87e9c01 — thank you, this was exactly right.
Verified the mechanism you named: :428 empties _reexec when $0 is a readable file, the probe block is guarded by if [ -n "${_reexec}" ], and :432 then pins binaries only. The comment at :429-431 already said so, which makes the advisory a self-contradiction inside one file.
Took your second suggestion — a concrete command scoped to the piped form:
curl -fsSL https://raw.githubusercontent.com/${REPO}/main/install.sh | sh -s -- --ref=${version}
with the reason stated inline ("a local copy of this script never re-execs, so --ref would pin only its binaries and land you back here"). Both eras were already covered non-vacuously, so the mechanism is measured rather than asserted: --ref=v0.8.0 falls back to the legacy path and re-execs (404 then 200) and --ref=v9.9.9 with /install.sh present (200) both reach REEXECED, and local file, --ref=v0.5.0: … no re-exec pins the $0 claim.
I swept the class rather than just this line — all 18 --ref mentions in install.sh plus CONTRIBUTING.md. Two other candidates say the same thing (usage():186 and CONTRIBUTING.md:117, both "--ref=X installs both the script and the binaries"), but each sits immediately inside a curl | sh context where it is true, so I left them rather than qualify them. Recorded in the commit message so a later round doesn't re-find them.
| # shellcheck disable=SC2016 # same. | ||
| printf ' [ -z "${_out}" ] || printf "#!/bin/sh\\nprintf \\"REEXECED\\\\n\\"\\nexit 0\\n" > "${_out}"\n' | ||
| printf ' printf "%%s" "%s"\n' "${_http}" | ||
| printf ' case "${_u}" in */authbridge/install.sh) _c="%s" ;; *) _c="%s" ;; esac\n' "${_httplegacy}" "${_http}" |
There was a problem hiding this comment.
nit — the stub discriminates by suffix, so it verifies which layout bucket was chosen but never that the URL was well-formed.
Everything that isn't */authbridge/install.sh — including a URL with a mis-interpolated ref, a stray double slash, or a truncated path — falls into the *) arm and returns the scenario's new-layout code. A regression in root-URL construction would still pass these tests.
Worth casing on the full expected URL (https://raw.githubusercontent.com/rossoctl/cortex/${_want}/install.sh) and making an unrecognized _u fail loudly rather than quietly returning the new-layout status.
Same vicinity: the mktemp stub returns a fixed boot.$$ and the non-200 branch never truncates it. I couldn't construct a false pass today (the real code rm -fs in every non-re-exec arm, and $$ differs per probe subshell), but a : > "${_out}" in the non-200 branch would make [ -s "${boot}" ] robust against a future refactor.
There was a problem hiding this comment.
Both applied in 87e9c01, and the first one turned out to be demonstrable rather than theoretical.
URL shape. The stub now pins the whole URL and returns BADURL for anything else, which is neither 200 nor 404 and so reaches install.sh's die. I couldn't case on the fully-expanded URL as suggested, because the stub doesn't know the resolved ref — --ref=<CHANNEL_TAG> maps to main and the no---ref case comes from newest_release, so an exact match would fail on its own fixtures. Pinned the shape instead (scheme, host, repo, layout) plus explicit rejection of // and a missing segment.
I measured the gap rather than assuming it. Mutation: drop the ref from the root URL, yielding .../cortex//install.sh.
| Stub | Verdict |
|---|---|
| old, suffix-only | SURVIVED — all 113 cases passed a malformed root URL |
| new, whole-shape | killed — 4 cases fail |
So your read was exactly right: a root-URL regression was invisible to the whole suite.
mktemp/truncation. Added : > "${_out}" on the non-200 path, so the stub matches real curl -o. Worth being precise that this does not close the related gap: [ -s "${boot}" ] in install.sh:489 still has no killing test — a mutation removing it survives all 113 cases, because no scenario produces a 200 with an empty body. That guard is pre-existing and untouched by this PR, so I've recorded it in the PR body as deferred rather than growing this diff. Happy to file it.
Two stale names survived both prior renames because neither is a path the sweeps could match — they are prose inside a docstring. The issue link named kagenti/kagenti-extensions. Issue 676 does still resolve there via GitHub's rename redirect, but it names a repository that no longer exists under that name; it now points at rossoctl/issues/676 directly. The debug hint said `kubectl logs -n kagenti-system`. That namespace is rossoctl-system in 40 other files, but the fix is not to substitute one literal for another: sparc-service/deploy/sparc-service.yaml says "any namespace; rossoctl-system by convention" and "No namespace is baked in — apply with `kubectl -n <namespace> apply -f`". A hardcoded namespace in a copy-pasteable hint is what went stale in the first place, so the hint now takes <namespace> and cannot rot again. Everything else matching kagenti or rossocortex is inside docs/superpowers/{plans,specs}, which keep their historical text by the same convention that leaves stale authbridge/ strings there. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Both from @esnible's review. Two classes, each swept before editing. GUARD-REACHABILITY - 3 candidates swept, 1 genuine, fixed. install.sh's version-mismatch die advised `--ref=${version}` and claimed it "resolves its installer in either layout". It cannot, on the path a user is most likely to be on: :428 empties _reexec when $0 is a readable file, the two-layout probe block is guarded by `if [ -n "${_reexec}" ]`, and :432 then makes --ref pin binaries only -- which the comment at :429-431 already says. So `git clone && ./install.sh` followed that advice, re-ran the same local script, reinstalled the same too-old abctl and died with identical output. Only the message's second suggestion ever helped. Restored a concrete command, which is what this message carried before the flatten, scoped to the piped form where the probe demonstrably does run. Both eras are already covered non-vacuously: install_test.sh's `--ref=v0.8.0 falls back to the legacy path and re-execs` (404 then 200) and `--ref=v9.9.9 with /install.sh present` (200) both reach REEXECED, and `local file, --ref=v0.5.0: ... no re-exec` pins the claim about $0. Swept every `--ref` advisory in install.sh (18 mentions) plus CONTRIBUTING.md and usage(). The other two candidates -- usage():186 and CONTRIBUTING.md:117, both "--ref=X installs both the script and the binaries" -- sit inside a `curl | sh` context where that is true, so they are left alone rather than qualified. Recorded so a later round does not re-find them as new. UNFAILABLE-ASSERTION - 1 site, fixed, plus one robustness gap. install_test.sh's curl stub cased on the URL *suffix*, so anything that was not `*/authbridge/install.sh` -- a mis-interpolated ref, a doubled slash, a truncated path -- fell into `*)` and returned the new-layout status. A regression in root-URL construction still passed all 113 cases. The stub now pins the whole URL shape and returns BADURL otherwise, which is neither 200 nor 404 and so reaches install.sh's die. Also made the stub faithful to `curl -o`, which truncates on a non-200; it did not, so `[ -s "${boot}" ]` was only ever met by an empty file left by luck. Forward-looking, per the review: no false pass was constructible today. Deferred, recorded in the PR body rather than fixed here: two live releases (v0.7.0-alpha.4, main-latest) carry a bootstrap URL in their *release notes* that 404s once this merges -- verified, 2 of 43 releases. Release notes are not files, so no tree sweep could have seen them, which is why the body's "every reference across public GitHub" measurement missed them. The remedy is editing those two releases' notes at merge; a root-level install-demo.sh shim would not serve the dead URL and so cannot fix it. install_test.sh 113/113 before and after. Mutation gate for this round's own new assertion (the stub's BADURL arm), with the delta measured rather than asserted -- M-URL drops the ref from the root URL, yielding .../cortex//install.sh: | Mutation | Stub | Verdict | |---|---|---| | M-URL | new whole-URL stub | killed -- 4 cases fail | | M-URL | old suffix-only stub | SURVIVED -- all 113 passed a malformed root URL | That second row is the gap this fixes. Re-ran both prior suites: the 7-mutation install.sh set is unchanged at 6 killed / 1 survivor, and the round-2 claim verifier is 13/13, so no earlier guard was deleted. The lone survivor is still `[ -s "${boot}" ]`: making the stub truncate did NOT close it, because no scenario produces a 200 with an empty body. It stays deferred, not fixed. shellcheck --severity=error clean; sh-mode notes unchanged at 14 before and after. pre-commit clean on both files. On the uv.lock question: all three CI Python setups pin python-version '3.12' (ci.yaml:34, ci.yaml:274, security-scans.yaml:145), so the deleted lockfile's requires-python = ">=3.14" excluded the interpreter CI actually runs. It was a false assertion rather than a floor worth keeping, the root pyproject.toml has no [project] table so it never declared a requirement, and sparc-service keeps its own ">=3.10". The surviving pythonVersion = "3.12" is the one that agrees with the build. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Replies to the two deleted-file findings, which couldn't be inlined. Both inline comments are addressed in 87e9c01.
|
esnible
left a comment
There was a problem hiding this comment.
Approving. Re-reviewed end to end after the last two commits; no must-fix, suggestion, or nit items remain.
Scale: 1067 files — 970 renames, 37 added, 22 modified, 38 removed. All 27 CI checks green, 24/24 commits signed off. CodeRabbit skipped itself (1054 files over its 100-file limit), so this pass is the only full review of the diff.
Verified independently rather than taken from the description
go-tidy-checkscope.find authbridge→find .reads like a widening. It isn't: all 12go.modfiles resolve under the root on this branch, so the set is identical. Same fordependabot-tidy.yml's**/go.modfilter..dockerignorebare-name entries. Cross-checkedabctl,bin,dist,profile-tags,readme-demoagainst all 1228 tracked paths — zero collisions. The anchoring comment's reasoning about whole-path matching holds..gitignoreleading slashes. Load-bearing exactly as the comment claims — a bareabctlwould have matched the package directorycmd/abctl/and silently ignored new source under it.- Makefile
--exclude ./tests.sparc-service/tests/does exist, so the root-anchored spelling is required and the three-way comment is accurate. scripts/local-build-and-test.sh.REPO_ROOT="$SCRIPT_DIR/.."resolves to the directory holdinggo.work; all four Docker contexts plusproxy-initre-anchored, no staleSCRIPT_DIRleft. This was the one change that could have broken silently, and it didn't.install.sh:475-486. The probe falls back only on a clean 404, never on a transport error —000correctly does not trigger the legacy path.- Retargeted doc links. Sampled targets all resolve on the head tree.
- Residual sweep. The only
authbridge/strings left in live files are intentional historical prose and/etc/authbridge/config.yaml, which is a runtime path unrelated to repo layout.
On the deliberate exclusions
Agreed on all of them, install.sh:485 especially — the legacy probe has to stay or --ref= breaks for every pre-flatten release, and the install_test.sh stub keying on the same string is the right way to pin that. The docs/superpowers/ precedent from #1125 is also right.
Merge-time action, not a code change
The two release notes (main-latest, v0.7.0-alpha.4) still print main/authbridge/install.sh, which this PR makes a 404. The bootstrap probe genuinely cannot rescue those — it lives inside the script that fails to fetch — so they need the manual rewrite called out in the description. Worth doing at merge rather than after, given the scripted-consumer failure mode (curl exit 56, then sh exits 0 having installed nothing).
The rossoctl/rossoctl docs pages and the downstream operator / rossoctl-cli module-path bumps are correctly scoped as coordinated follow-ups; both downstreams pin pre-flatten pseudo-versions, so neither breaks on this merge.
Supply-chain gate
.claude/skills/demo/SKILL.md tripped the agent-config gate. Read in full: five path-string updates in a markdown doc, no hooks, no command, no executables, no new files. Cleared by inspection.
The commit-order narrative and the "three things free / three things not free" framing made this reviewable at a scale where it otherwise wouldn't have been — the fixed-depth-path test (does the target also move?) is the part worth reusing on the next sweep of this kind.
Assisted-By: Claude Code
The flatten removed the vestigial authbridge/ level and exposed two things it had been hiding: the root does not describe the product (four of ten directories are implementation satellites), and the names are a product generation behind. authlib is the sharpest case, and not merely because of the AuthBridge->Cortex rename. Measured by non-test lines it is 1.7% auth: 65% framework, 22% cost, 10% observability. The docs compound it, calling it "the shared auth library" and enumerating the 1.7% first while omitting the 32%. Scope deliberately excludes every published contract — image names the operator selects by name, binary names on users' PATH, the x-authbridge-* wire headers injected by Helm-rendered Envoy config, the AUTHBRIDGE_* env vars install.sh accepts, the authbridge-* ConfigMaps, /etc/authbridge, authproxy-routes, the abph_ prefix, and install.sh's --ref probe. "Do not break anything" is written as twelve gates rather than an intention. Section 6 carries forward the class that cost #1134 a review round: its substitutions matched authbridge/ WITH a trailing slash, so sixteen bare-directory spellings survived. authlib has nineteen of the same shape, enumerated by count. Unlike #1134 the replace directives DO change, both sides, five of them. Self-review caught three errors of mine before commit: the module count is 12 not 13 (storage/redis is already one of them, so moving it adds none), there are five build profiles not four (cpex is image-only, needing cgo), and "build.yaml's six name: values" was a bad gate since a grep for '- name:' returns 15 including step names. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Six tasks, one per commit, so a rename touching 850 import sites can be reviewed piecewise: group the deployables under deploy/, consolidate the loose dev scripts, rename authlib to core, move the redis driver beside the interface it implements, rename five packages inside core/, then fix the prose and retire the script. Three lessons from #1134 are wired into the mechanics rather than left as advice. Every substitution matches the bare name without requiring a trailing slash — that omission is exactly what let sixteen spellings survive the flatten, nine of them cd lines whose blocks then failed at step 1. Verification decomposes by shape (raw mentions, then each spelling) instead of trusting the patterns. And pytest is in the gate set, which it was not last time, when a dead parents[1] path broke collection. Two hazards are named where they live. Task 2: the dev scripts compute REPO_ROOT from SCRIPT_DIR, so moving them one level deeper changes that arithmetic — the identical hazard was live in the previous PR. Task 5: the new package names `event` and `settle` are short common words, so a local variable can shadow the new package; only the build proves it. Unlike the flatten, the replace directives change on both sides, and storage/redis is the only directory that changes depth. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The three deployables moved one level deeper, so relative links out of their READMEs — to .github/, demos/, docs/ and authlib/ — now land in deploy/ and 404. Nothing in the diff showed it: the link text never changed, only the ground beneath the file. This is the class that cost #1134 a review round, and it is gate 11 of the design spec. The Task 1 brief named the prose-cd shape and not this one, so both the implementer's sweep and my own verification missed it. Grep-by-name cannot see it — a link's text does not mention the moved directory. Only resolving targets on disk finds it, checked against the base commit to tell a new break from a pre-existing one. deploy/sparc-service/deploy/README.md needed ../../../ for its three docs/ links while keeping ../README.md, which points at its own parent and already resolved. A blanket ../ -> ../../ would have broken it. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
install.sh, install_test.sh and keycloak_sync.py were the last loose files at the repository root; they now sit in scripts/ beside dev/, hooks/, profile-tags/ and readme-demo/. Git records all three as renames. THIS CHANGES A PUBLISHED URL. The one-liner becomes curl -fsSL https://raw.githubusercontent.com/rossoctl/cortex/main/scripts/install.sh | sh and is updated in README.md, CONTRIBUTING.md, the release-notes generator, the script's own header and --help, and the README demo storyboard. Older tags are unaffected because raw.githubusercontent serves per ref; what breaks is a copy of the previous URL pinned to main. This reverses the constraint recorded in docs/superpowers/plans/2026-09-26-repo-layout.md, which excluded install.sh from the layout work — a deliberate call, not an oversight. The bootstrap probe goes from two paths to three. `--ref=<tag>` re-downloads the installer from that ref, so it must still resolve every layout the script has had: scripts/install.sh, then the repository root (from the rossoctl#1134 flatten until now), then authbridge/install.sh (before it). Each fallback fires only on a clean 404 — a transport error still refuses to continue, which is the guarantee the block exists to give, and it now has to hold on two hops rather than one. install_test.sh's scenario matrix takes a status triple instead of a pair, and all eleven cases were re-derived rather than padded: what the old pair called "new" is now the middle hop. Two cases are new, because without them the change would have been untested in both directions: 404/404/200 -> REEXECED the third arm is otherwise never exercised, so deleting it would leave the suite green while dropping every pre-flatten tag 404/000/200 -> DIED "clean 404 only" otherwise holds on hop 1 and goes unchecked on hop 2 The fake-curl stub gained an arm for the new path, ordered ahead of the bare one because shell `*` matches `/` and `*/install.sh` would otherwise swallow `*/scripts/install.sh`. Its BADURL guard covers a ref dropped from the new path too. Also fixed, because the move would otherwise have made them false: `sh install_test.sh` in ci.yaml, the module path in tests/test_keycloak_sync.py, the runnable `python keycloak_sync.py` in docs/architecture.md, a second location-dependent path in install_test.sh that resolved the release workflow from the script's own directory (caught by the suite, not by the sweep), the repo tree in CLAUDE.md, and a bandit comment calling keycloak_sync.py root-level. demo.yaml's citation of install.sh line numbers is replaced with the grep that finds them; two of the four were already stale and every edit here shifts the rest. Left alone deliberately: thirteen Go comments and the Makefile/CONTRIBUTING prose name the script rather than its path, so they stay true; dated docs/superpowers/ records are archives; and two apparent hits are other projects' files (astral.sh's uv installer, ansible's run-install.sh). Verified: 115 install_test.sh cases, 12 pytest, shellcheck --severity=error, sh -n on both scripts, and the regenerated SVG against TestCommittedAssetIsCurrent. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
Three must-fix from a strict review of 699b05b, all of them statements that were true before the scripts/ move and false after it. Two live in the PR body and are fixed there. scripts/install.sh — the --ref fallback warned that a ref "has no install.sh at either path". The probe now tries three. The comment forty-six lines above was updated with the code; this line, the only user-visible statement of what was attempted, was not. Swept the class repo-wide across all filetypes: twenty-nine hits for either/both/two paths, one of them about this probe — every other is a different subject, from plugin code paths to quoted shell arguments. The arity is dropped rather than corrected to "three", because a count here is maintained in two places and has now drifted once. scripts/readme-demo/demo.yaml — round 3 replaced four stale line citations with an instruction to grep the quoted string instead, and that instruction resolves only two of the twelve strings in the shell act: the rest interpolate a variable at source, so the rendered line never appears in the tree. The conclusion was right and the method was not; it now says to grep a literal prefix. Two further citations twelve lines below (install.sh:1219, :1227-1233) are replaced the same way. Those were already stale at the base commit, so this removes an existing trap rather than one the move created. scripts/install_test.sh — the stub's case-arm order is load-bearing, because shell `*` matches `/` and the bare .../cortex/*/install.sh arm also matches .../main/scripts/install.sh. Only 699b05b's commit message said so. The constraint now sits beside the arms, and names the mutant that proves it: M37 reorders them and reds two scenarios. Guards added for both classes. G36 pins that the fallback warn makes no arity claim at all, with a positive control so a broken regex cannot read as a clean line. G37 covers a gap the round-4 review identified in G26: G26 pins only gh-derived counts, so it stayed green while "both edited YAML files re-parsed" went from true at ea3a338 to false at HEAD, the delta having grown that set from two files to six. M44 and M45 restore each defect and confirm the new guards red; M45 also demonstrates G26 staying green, which is the gap itself. Two corrections to 699b05b's message, which cannot be amended without rewriting pushed history. It called docs/superpowers/ a "dated archive" while CLAUDE.md, in the same file set, says those records are "STILL WRITTEN TO — not an inert archive"; the triage was right and repo-sanctioned, only the word collides. And it listed the sites updated for the new install URL without naming the duplicate that README.md's own comment points at, in rossoctl/rossoctl's laptop quickstart. That copy is still on the pre-rossoctl#1134 authbridge/ path, so it was already broken before this PR; it is now recorded in the body's deferred list instead of a commit message. Verified: 115 install_test.sh cases, shellcheck --severity=error, and the readme-demo suite including TestCommittedAssetIsCurrent — the demo.yaml edits are comments, so the generated SVG is unchanged. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
What
authbridge/held nearly every tracked file in the repo and separated nothing from nothing. It dates from when this repo waskagenti-extensionsand held several extensions; the only other one,client-registration, moved into the operator long ago. This flattens it into the repo root.There is no
authbridge/directory afterwards.The level was not merely cosmetic — it was carried by the public install URL, all 12 Go module paths, 36 workflow references, and 6 dependabot module directories. It also gets more expensive to remove over time: the same sweep was 326 files at the Kagenti→Rossoctl rename and 214 at rossocortex→cortex.
Read it in commit order
The commits are meant to be read individually rather than as one large diff:
install.shresolves--ref=against both layouts. Lands first because it is correct before and after the move..dockerignore.authbridge/README.md→docs/architecture.mdand 33 links retargeted.CLAUDE.mdfiles merged into one root file. Three commits: net-new sections, reconciled overlaps, deletion.Plus doc commits carrying the design spec, the plan, and corrections found along the way.
Three things this got for free
The subtree moved up together, so paths relative to it are unchanged. Verified, not assumed:
replacedirectives —cmd/abctl/go.mod's../../authlibresolves correctly before and after;cmd/abctlis two levels deep both times.go.work'suselist — relative togo.work, which moved with them.COPYpaths — relative to the build context, which moved too.Three things that were not free
Eleven fixed-depth paths climb out of the subtree, so no substitution could see them. The design spec listed seven; the real count was eleven, and two of the original seven turned out to need no change because their target moved with them. The test is one question: does the target also move?
requirements.txtdoes..venvandagent-examplesdon't.Thirty-three links broke with nothing in the diff to see. These are relative links whose text never changed while the file moved beneath them — 12 inbound to the architecture doc, 21 outbound from inside it. A diff-driven audit is structurally blind to this class; only resolving targets on disk finds it. That cost a review round before we worked it out.
A root
.dockerignorebecame load-bearing. Four images built fromcontext: ./authbridge, which excluded the repo root. They now build fromcontext: ., so without it Docker would ship.gitand.worktreesto the daemon. Measured with binaries present: 111.5 MB → 12.0 MB.Deliberate exclusions — please don't "fix" these
install.sh:485keeps probing the legacy path.${REPO}/${ref}/authbridge/install.shis supposed to be there: it locates installers inside pre-flatten releases, whose git trees still have the file at that path. The new installer tries${ref}/install.shfirst and falls back here on a clean 404 only. Rewriting this line makes both lookup paths identical and breaks--ref=for every existing release.install_test.sh's fake-curl stub keys on this string for the same reason.docs/superpowers/keeps its staleauthbridge/strings. Dated design records, per the precedent set in #1125.The old install URL 404s, deliberately
The canonical command becomes:
curl -fsSL https://raw.githubusercontent.com/rossoctl/cortex/main/install.sh | shNo shim at the old path. That was decided after measuring who references
main/authbridge/install.shin repository trees: 8 here, 2 inrossoctl/rossoctl's current docs, 3 inrossoctl/.github's versioned archives for 0.7/0.8 — all inside the rossoctl org, no third parties.That measurement read files, so it could not see release notes, and @esnible found two live ones that carry the URL:
The two-path probe cannot rescue those: it lives inside
install.sh, so a 404 on the bootstrap fetch happens before any of it runs. A root-levelinstall-demo.shwould not help either — it serves a different URL than the one in the notes. Merge-time action: rewrite the URL in those two releases' notes tomain/install.sh.The only casualty is a reader following the archived v0.7/v0.8 docs. Measured failure mode:
curl -fsSL <404> | shgives curl exit 56 with 49 bytes on stderr, thenshreads empty stdin and exits 0 — so an interactive user sees the 404, but anything scripted around the pipeline sees success having installed nothing. Accepted; a permanent file atauthbridge/install.shwould re-create the directory this PR deletes, with no checkable condition for ever removing it.Follow-up needed: the two release notes above, at merge. Separately,
rossoctl/rossoctl's two current docs pages (docs/get-started/laptop.md,docs/concepts/experiments/cost-control.md) want a coordinated update. The versioned archives are left alone by convention.Verification
All Go commands with
GOWORK=off, as CI runs them:go mod tidy -diffclean in all 12 modules — the gate thatbuild,vetandtestall pass while it failsauthlib: build, vet,go test -raceacross 60 packagescmd/abctl,authbridge-{proxy,envoy,praxis},storage/redis,scripts/{profile-tags,readme-demo}: build, vet, testinstall_test.sh113/113, including new cases for both--referaspytest tests/12/12 — this one caught a real break:tests/test_keycloak_sync.pyloadedparents[1]/"authbridge"/…, sopytestfailed at collection.*.pywas in neither the sweep's globs nor my original gate list.readme-demostaleness check — fails before regeneration, passes after, which is what proves the SVG was regenerated rather than patcheddocker buildof the proxy image, to prove the context changeExpected non-failures:
cmd/authbridge-cpexneeds cgo and a pinnedlibcpex_ffi.a, so it cannot vet locally —build.yamlcovers it via the image build.cmd/abctl'sTestRunExec_BeforeFirstStart…fails on the dev machine from an ambientSSL_CERT_FILE; reproduces on unmodified main.Downstream
rossoctl/operatorandrossoctl/rossoctl-clicompile against this module. They need:Confirmed empirically by cloning
rossoctl-cliwith a localreplace: it fails at "finding module for package …/authlib/…" across ~30 subpackages. Neither breaks when this merges — both pin pre-flatten pseudo-versions — but both break on their next cortex bump. Deliberate, and worth a coordinated pair of PRs.Two items folded in beyond the flatten
demos/README.mdgainedcontext-guru,echoandmtls. PR Docs: Correct the docs and repo config to match the tree #1125's body claimed it fixed this and only fixedCLAUDE.md. A merged PR asserting a fix it didn't make seemed worse than three lines of extra scope here.CLAUDE.md's binaries content was deduplicated. The merge left three same-named sections and three enumerations, one heading naming 2 of the 5 binaries that exist.Two more commits since the review
7ca364bd— three drift classes the sweep could not see. The substitutions all matchedauthbridge/with a trailing slash, so every spelling without one survived. Swept by shape: 1,283 raw mentions → 376 reading as a path segment → 27 with a slash (already caught) + 16 as a bare directory argument. Nine were barecd authbridgelines whose blocks then runpip install -r requirements.txtorkubectl apply -f demos/..., so those procedures failed at step 1; they now say# from the repo root, since there is no directory to enter and the cwd is a precondition rather than a command. Also five links whose text calleddocs/architecture.mda "README", andsecurity-scans.yaml's dead Bandit guard (for dir in .over a path that always exists, so neither it nor the[ -z "$PYTHON_DIRS" ]check below could branch).9c1f0c3a— root-file cleanup. The flatten traded one deep level for a wide root, so this trims it without adding directories or renaming anything:uv.lockdeleted (locked zero packages and declared a Python floor contradictingpyproject.toml),install-demo.shdeleted (a shim for a pre-rename name, guarding a URL this PR makes 404 anyway by removingauthbridge/, with no references on public GitHub),pyrightconfig.jsonfolded intopyproject.tomlas[tool.pyright], and the two dev scripts moved intoscripts/alongside the tooling already there.The script move was the only real risk and it was live:
local-build-and-test.shusedSCRIPT_DIRas both theROSSOCTL_DIRdefault base and thecdtarget for three Docker build contexts plusproxy-init. One level deeper would have broken all four silently — the text stays valid-looking while the depth changes. Now anchored onREPO_ROOT, verified to resolve to the directory holdinggo.work, with all eleven reference sites updated.Deferred, not fixed
From @esnible's review:
install.sh:489's[ -s "${boot}" ]guard still has no test — mutationm5survives all 113 cases. Making the curl stub truncate on a non-200 (his suggestion, applied) makes the stub faithful to realcurl -obut does not close that gap, because no scenario produces a 200 with an empty body. Pre-existing and untouched here.Recorded for triage rather than silently dropped:
make fmt's--exclude testsscope not matching the pre-commit hook's root-anchored one; stale "authbridge is the root" comments in two demo Makefiles; a staleplugins/opa/…test-path citation; partially disjoint port tables; and an unreconciled ConfigMap naming pair (authbridge-config-<agent>vsauthbridge-runtime-config, both real in-tree, never related to each other).From the last review round, also deferred rather than fixed here:
install.sh:489's[ -s "${boot}"]guard has no test — an HTTP 200 with an empty body would run an empty script and exit 0 — which is pre-existing and untouched by this PR; and eight docs citecmd/authbridge/, a directory that has never existed in either layout.Rollback
A pure rename:
git revertthe merge commit restores everything, and consumers are pinned so they're unaffected either way. The one hazard is cutting a release inside the window — a tag between flatten and revert would publish, then unpublish, a module path. So: don't tag until this has settled.Design spec:
docs/superpowers/specs/2026-09-24-flatten-authbridge-design.mdImplementation plan:
docs/superpowers/plans/2026-09-24-flatten-authbridge.mdAssisted-By: Claude (Anthropic AI) [email protected]