Skip to content

Make run-state courses optional in dev data and forward make flags#2790

Open
kernicPanel wants to merge 2 commits intobatch-orders-v2from
dev-data-run-state-courses-option
Open

Make run-state courses optional in dev data and forward make flags#2790
kernicPanel wants to merge 2 commits intobatch-orders-v2from
dev-data-run-state-courses-option

Conversation

@kernicPanel
Copy link
Copy Markdown
Member

Purpose

Make the creation of courses with explicit run states optional in
make dev-data to keep the default dev data generation lightweight.

Proposal

  • Add a --run-state-courses flag to create_dev_data so that the
    generation of the 24 test courses with explicit run states is opt-in
  • Forward trailing flags from make dev-data to the underlying command
    using the GNU make -- convention, allowing
    make dev-data -- --run-state-courses instead of the awkward
    make dev-data ARGS="..." form

Copilot AI review requested due to automatic review settings April 13, 2026 13:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the creation of “run-state” demo courses opt-in to keep default dev data generation lighter, and updates the make dev-data target to forward trailing CLI flags to the underlying Django management command.

Changes:

  • Add --run-state-courses flag to create_dev_data and gate run-state course creation behind it.
  • Update Makefile to forward extra tokens passed to make dev-data to create_dev_data.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/richie/apps/demo/management/commands/create_dev_data.py Adds an opt-in CLI flag and conditional block for creating run-state courses.
Makefile Introduces argument forwarding logic for make dev-data to pass flags through to create_dev_data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment on lines +219 to 232
ifeq (dev-data,$(firstword $(MAKECMDGOALS)))
DEV_DATA_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(DEV_DATA_ARGS):;@:)
endif

dev-data: ## create dev data if app container is running
@echo "Check app container is running..."
@if [ $(shell docker container inspect -f '{{.State.Running}}' "$(shell $(COMPOSE) ps -q app)") = "false" ] ; then\
echo "❌ App must be up and running to create dev data.";\
exit 1;\
fi
@$(MANAGE) flush --no-input
@$(COMPOSE_EXEC_APP) python sandbox/manage.py create_dev_data ${ARGS}
@$(COMPOSE_EXEC_APP) python sandbox/manage.py create_dev_data $(DEV_DATA_ARGS)
@${MAKE} search-index
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make dev-data -- --run-state-courses will result in DEV_DATA_ARGS containing the literal --, so the invoked command becomes create_dev_data -- --run-state-courses. In argparse, -- ends option parsing, which means --run-state-courses will be treated as a positional and the command will fail with an unrecognized argument error. Filter -- out of the forwarded arguments (while still creating a dummy rule for it so make doesn’t try to build it) before passing args to create_dev_data.

Copilot uses AI. Check for mistakes.
"--run-state-courses",
action="store_true",
default=False,
help="Create courses with explicit run states for ordering testing.",
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help text is grammatically awkward: "for ordering testing". Consider rephrasing to something like "to test ordering" or "for ordering tests" for clarity.

Suggested change
help="Create courses with explicit run states for ordering testing.",
help="Create courses with explicit run states to test ordering.",

Copilot uses AI. Check for mistakes.
@kernicPanel kernicPanel changed the base branch from master to batch-orders-v2 April 13, 2026 13:46
Make the creation of courses with explicit run states optional
to keep the default dev data generation lightweight and avoid
polluting the catalog with test courses unless needed.
Using the GNU make `--` convention stops make from parsing trailing
flags as its own options, letting us write:

    make dev-data -- --run-state-courses --credential

instead of the awkward ARGS="..." form.
@kernicPanel kernicPanel force-pushed the dev-data-run-state-courses-option branch from cf606f4 to 5764078 Compare April 13, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants