Repository navigation
Conversation
) image gen resolves to t2i, or i2i with --ref; video gen resolves to t2v, i2v with a frame, or r2v with --ref. The bridge reuses the mode verbs' own options and runs the resolved verb's callback with the user-supplied values, so options, output and exit codes are the mode verb's. An option the resolved verb does not take, or a frame together with --ref, is a usage error (exit 2) naming the mode verb. --json adds a top-level "mode". Parameter sources are carried into the mode verb's context, so default_project still sees an env-sourced --project-name. MCP parity maps both leaves to the existing generate tools.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
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. |
…1193) Review follow-ups on #1211: - the resolved verb parses the raw arguments itself (make_context + invoke), so envvars, callbacks, required checks, parameter sources and Click's own 'No such option' apply as on a direct call; the hand-built invoke and the private UNSET sentinel are gone - --end-frame without --initial-frame is a bridge usage error - json_output.emit adds the bridge's mode at one chokepoint - bridge help says defaults and limits are the resolved verb's, and rewrites --ref/--reference-entity/--ui-mode/--model help that only fit one verb - resolvers return (command, why); shared CLI fakes move to tests/cli/fakes.py - tests: documented usage-error examples, same-named option agreement guard, e2e gen variants in test_json_output_e2e.py
|
CI note: the only failing test is |
…ne database Ubuntu 24.04's tzdata 2026e moves backward links (Atlantic/Faeroe, Portugal, Eire, Iceland, Poland) into tzdata-legacy, which the CI runners do not install. ZoneInfo then refuses the alias, consent_region() fails closed, and the Atlantic/Faeroe row (expected False) went red on every PR, develop included; the three legacy rows expecting True passed for the wrong reason. The mapping test now stubs the zone lookup, so every row checks the name-to-region mapping on any machine. A separate test pins the fail-closed behaviour for an alias the installed zone database cannot load. (cherry picked from commit 9f356c9)
|
CI note: this branch now carries a cherry-pick ( |
Closes #1193
Part of #1191
Summary
gflow image genresolves toimage t2i, orimage i2iwhen--refis given.gflow video genresolves tovideo t2v,video i2vwith--initial-frame(and optional--end-frame), orvideo r2vwith--ref.A bridge verb is the mode verb it resolves to: after picking the mode it hands its raw arguments to that verb (
mode.make_context(...)+mode.invoke(...)), so the mode verb's own parser, envvars, callbacks, required checks, parameter sources, defaults, output and exit codes apply exactly as on a direct call.--jsonkeepscommandas the mode verb ("image t2i") and adds a top-level"mode": "<resolved>"on success and failure payloads; it is added once, injson_output.emit, from actx.metakey the bridge sets.Usage errors (exit 2), never a guess: a frame and
--refnamesvideo i2vandvideo r2v;--end-framewithout--initial-framesays "--end-frame needs --initial-frame"; an option the resolved verb doesn't take is that verb's own Click error plus a line naming the verb the bridge picked:Mode verbs unchanged, no deprecation. MCP unchanged:
gflow_generate_image/gflow_generate_videoalready take the mode. The parity gate mapsimage gen/video gento those tools;image gen:prompts/:continue_on_errorcarry the same exemption reason asimage t2i.Routing table
image gen PROMPT...image t2iimage gen PROMPT --ref IMGimage i2ivideo gen PROMPTvideo t2vvideo gen PROMPT --initial-frame F [--end-frame E]video i2vvideo gen PROMPT --ref IMGvideo r2v--refvideo i2v+video r2v--end-framewithout--initial-frameSpec deviation (disclosed)
#1193 says
--ref/--character→ r2v. The CLI has no--character, and CLIvideo r2vrequires--ref, sovideo gen --reference-entity Xwithout--refis passed tovideo t2vunchanged (on an account Flow serves from flow.google.com, a character on t2v exits 36). The migrated composer can serve r2v with only a character (migrated_composer.py), so this is follow-up #1213: let CLI r2v take a character without--ref, then routegen --reference-entityto it. r2v's required--refis unchanged here.Review
Two independent reviews (code-review xhigh, ponytail-review xhigh) found no wrong route and no dropped option. Fixed on this branch:
--end-framealone used to reach i2v and print advice that then failed; it is now a bridge usage error.test_documented_usage_errors_say_what_the_docs_sayruns each documented example and asserts the documented message (and that the example is still in the doc).--help: both bridges say the options' defaults and limits are the resolved verb's (see its--help). Help written for one verb is rewritten on the bridge's copy:--ref,--reference-entity,--ui-modeonimage gen,--modelonvideo gen.ParameterSource, privateclick.core.UNSET,sub.invoke(callback)). The env-sourced--project-nametest (test_video_gen_keeps_where_project_name_came_from) passes through the re-parse, and options are now rejected by the mode's own parser.test_same_named_options_agree_across_bridged_verbsguards the one place the bridge still parses with a single copy of an option (to read the routing inputs)."mode"is added at one chokepoint (json_output.emit), replacing five hand-wrapped emit sites. That file is touched by feat(errors): add charged, next_action and operation_id to the problem details #1208 too, but in a separate hunk (emit, notunexpected_payload).test_mode_verb_json_has_no_top_level_modeasserts exit 0.resolve_image_mode/resolve_video_modereturn(command, why); the parallel dicts are gone._make_generated_image,_make_t2i_client,FakeVideoRecorder) moved totests/cli/fakes.py; their old modules re-import them, so existing importers keep working.Not changed: CLI
r2v's required--ref(out of scope, #1213).Gates (Impeccable Routine, on HEAD,
PYTHONUTF8=1,UV_LINK_MODE=copy)src tests: cleansrc: 0 errors (run with--pythonpath .venv/Scripts/python.exe; bare pyright on this machine resolves the system Python 3.13 and reports unrelatedmcp/uierrors)-m "not live and not e2e and not smoke" -n 8 --dist worksteal --cov=gflow_cli: 6106 passed, 30 skipped, coverage 93%models/doctor: N/A. F. USAGE section + JSON section, website mirror regenerated, CHANGELOG[Unreleased] / Added.E2E
tests/e2e/test_json_output_e2e.py::test_e2e_image_t2i_json_shape[gen]runs the realgflow image gen ... --jsonagainst Flow and assertscommand == "image t2i"andmode == "t2i"(the[t2i]variant asserts the mode verb has nomode). Result on a verified profile:1 passed, 5 deselected in 63.53s(--collect-onlyfirst: 1/6 selected).tests/e2e/test_json_output_e2e.py::test_e2e_video_t2v_json_shape[gen]is added, not run. Blocker: it spends Veo credits and no paid generation is authorized tonight. Run withGFLOW_CLI_E2E_RUN_VIDEO=1 GFLOW_CLI_E2E_PROFILE=<p> uv run pytest -m e2e_video -k "test_e2e_video_t2v_json_shape and gen" tests/e2e/test_json_output_e2e.py.tests/cli/test_gen_bridge.pyruns the realpython -m gflow_clientrypoint in a subprocess for the exit-2 errors, and asserts with the runners stubbed that_run_t2i/_run_i2i/_run_t2v/_run_i2v/_run_r2vreceive identical arguments from the bridge and from the mode verb.Siblings
#1210 adds a
@spends_creditsmarker per command and #1206 adds capability entries per command: whichever lands second marksimage gen/video gen(both spend, via t2i/i2i/t2v/i2v/r2v).