Repository navigation
fix(generator): derive ALB priorities, check them at plan, require name, validate compute - #181
Conversation
…me, validate compute routing.priority is now optional: without it the generator derives a stable priority from team/name in 1000-50000, in a slot that leaves room for the login rules. Explicit priorities (1-999) are kept, so live rules do not move. tf-plan checks planned listener rules against the live ones and fails with the holder's host and a free number instead of PriorityInUse at apply. name is required everywhere (detect, generator, CLI); the repo-name default in the generator is gone. compute.cpu/memory must be a Fargate task size, port 1-65535, desired_count >= 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Terraform Plan✅ No changes — infrastructure is up to date. Plan output |
…-name app fallback tf-plan now records the conflict, posts it at the top of the plan comment and fails the job in a final step. auth-doctor no longer falls back to the repository name for the app name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review follow-up (new commit on this branch): Changed
Not changed here
Verified: 🤖 Generated with Claude Code |
Terraform Plan✅ No changes — infrastructure is up to date. Plan output |
Both sides added a _validate_compute; keep main's (user, grace period, exec) and have it call this branch's size/port/count checks, now _validate_compute_sizes, so neither definition shadows the other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged origin/main (#178, #180, #184, #185, #186, #187) in 8c06348. Conflicts and how they were resolved:
The other files merged without conflicts. Checked: scripts/tests (209 OK), lambda-src/tests (249 OK), |
Terraform Plan🚧 Changes detected — Plan: 3 to add, 11 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🔴 HIGH Plan adds 3 resources and updates 11 in place (0 destroyed), but it widens GitHub OIDC trust on the CI deploy/plan/registry IAM roles to foreign-named repos (javaBin@95047/..., javaBin@95047/...) and expands ECS and Identity Center permissions.
|
Problem
routing.priority: 100, which cupcake (frosting) already holds. jz-watch run 40079243698 failed at apply withCreateRule PriorityInUse: Priority '100' is currently in use.routing.loginrules take the numbers directly belowrouting.priority, so nearby picks collide too. The docs said to "coordinate via the registry", but the registry has nothing for priorities, and nothing checked them before apply.namedefault was inconsistent (part of finding 13). Only the generator fell back to the repo name. detect.yml emittedapp_name="", the CLI rejects a missing name, and a repo name like2027.javazone.nofailsNAME_REanyway.Change
scripts/generate-modules.pyrouting.priorityis optional. When it is left out,derived_priority(team, name)takes sha256 ofteam/nameand maps it to one of 4454 slots of 11 in 1000-50000. The host rule sits at the top of its slot and up to 10 login rules sit below it, inside the same slot. The value is printed as a::notice.domain:no longer needs a priority.routing.prioritymust be 1-999, so it can never land in the derived range. Explicit values are passed through unchanged.nameis required, with a clear message. The message for a dotted name gives an example fix (2027.javazone.nobecomes e.g.javazone-2027). TheAPP_SERVICErepo-name fallback is removed.compute.cpuandcompute.memorymust be whole numbers and a valid Fargate task size; the error lists the memory values allowed for that cpu.portmust be 1-65535 anddesired_count0 or more.scripts/check-alb-priorities.py, run in tf-plan after the plan when it has changes, using the team's read-only plan credentials (ReadOnlyAccesscoverselbv2:DescribeRules). It takes everyaws_lb_listener_rulethe plan creates or moves and compares its priority with the live rules on that listener.::error, naming the host that holds the priority and suggesting the lowest free number that leaves 10 free below it.detect.ymlfails whenapp.yamlhas noname.expand-terraform.ymlno longer passesAPP_SERVICE.docs/app-yaml-reference.md(name, compute table, routing.priority, login priorities, domain),docs/reusable-workflows.mdandCLAUDE.md.No rule churn
These are the live rules on
javabin-platform-alb:443:Every app.yaml in the org (cupcake, frosting, jz-watch, 2027.javazone.no, platform-test-app, app-template) sets
nameand an explicit priority below 1000. Their generated priorities are unchanged; I checked by generating each app.yaml from GitHub with this branch.Verification
python3 -m unittest discover -s scripts/tests: 153 tests OK, including new tests for name, priority range, derived priority (stability, range, room for 10 login rules,domain:), compute validation, andtest_check_alb_priorities.py.python3 -m unittest discover -s terraform/lambda-src/tests: 219 tests OK.describe-rules):cupcake.javazone.no, with suggestion 21;actionlinton the changed workflows: the only finding is the existing SC2129 style note in detect.yml.Follow-ups (other repos)
priority: 100from the templateapp.yaml(merge after this PR).javabin init(noprioritywritten, so new apps take the derived one).docs/getting-started.mdin javaBin/docs still showspriority: 120.🤖 Generated with Claude Code