-
Notifications
You must be signed in to change notification settings - Fork 0
fix: make rule meta explain itself, and route improve-rule off it
#238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
631f02b
fix(rules): report why rule meta has no data, and stop routing improv…
thecodedrift d1ca2f2
fix(rules): surface RULE_NOT_FOUND on a bad ticket id in rule improve
thecodedrift 602d186
fix(rules): read the canonical requestId, not the deprecated alias
thecodedrift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "@taskless/cli": patch | ||
| --- | ||
|
|
||
| `taskless rule meta` now says why it has no data, instead of reporting the rule as missing. | ||
|
|
||
| The `.taskless/rule-metadata/<id>.yml` sidecar is written from the `meta` block of a rule status response, and the rule service does not populate that block. No sidecar has ever been written, so `rule meta` failed with `RULE_NOT_FOUND` for every id, including rules plainly on disk. It now fails with the new `RULE_META_UNAVAILABLE` code and an explanation, and points at the ticket id that actually drives iteration. | ||
|
|
||
| `rule improve` now reports `RULE_NOT_FOUND` when the service has no such ticket id, instead of folding that 404 into `NETWORK_ERROR`. The two ask for different things: one says re-check the id, the other says retry. | ||
|
|
||
| The `improve-rule` recipe no longer routes through `rule meta`. It takes the ticket id from the `ruleId` field of `rule create --json`, which is the id the iterate endpoint is addressed by, and falls back to the local-only flow when nobody has it. `rule-meta`, `rule`, `delete-rule`, `create-remote-rule`, and `create-sg-rule` were corrected where they described the sidecar as something that exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,39 @@ | ||
| # Topic: rule-meta (CLI v%(CLI_VERSION)s / topic v2) | ||
| # Topic: rule-meta (CLI v%(CLI_VERSION)s / topic v3) | ||
|
|
||
| ## Goal | ||
| Read sidecar metadata for an API-generated rule. Used internally by | ||
| the `rule improve` recipe to fetch the `ticketId` needed for iteration. | ||
| Report what `%(TASKLESS_CLI)s rule meta` does today, so no recipe and no | ||
| agent builds a step on top of it. | ||
|
|
||
| ## Preconditions | ||
| - The rule was created via the API path (anonymous-mode rules have | ||
| no metadata sidecar). | ||
| - `.taskless/rule-metadata/<id>.yml` exists. | ||
| ## The sidecar does not exist | ||
|
|
||
| ## Steps | ||
| `.taskless/rule-metadata/<id>.yml` is written from the `meta` block of a | ||
| rule status response. The rule service does not populate that block, so | ||
| this CLI has never written a sidecar for any rule, under any tier, in | ||
| any mode. `rule meta <id>` therefore has nothing to read and exits 1 | ||
| with `RULE_META_UNAVAILABLE` for every id, including ids whose rule is | ||
| plainly on disk. | ||
|
|
||
| ``` | ||
| %(TASKLESS_CLI)s rule meta <id> --json | ||
| ``` | ||
| That code exists to keep the two cases apart. `RULE_NOT_FOUND` invites a | ||
| retry with a different id; there is no id that works. | ||
|
|
||
| Returns the metadata fields: `ticketId`, `generatedAt`, schema | ||
| version, etc. | ||
| ## What to do instead | ||
|
|
||
| `rule improve` needs the ticket id, and that id comes from the machine | ||
| that created the rule, not from disk: | ||
|
|
||
| - `%(TASKLESS_CLI)s rule create --json` prints it as `ruleId` on | ||
| success. Record it when you create a rule you expect to iterate on. | ||
| - If the id was not recorded, ask the user for it. | ||
| - If nobody has it, iterate locally: fetch | ||
| `%(TASKLESS_CLI)s agent improve-rule --anonymous`. | ||
|
|
||
| ## Errors | ||
|
|
||
| | code | meaning | fix | | ||
| |------------------|--------------------------|------------------------------------| | ||
| | `RULE_NOT_FOUND` | metadata sidecar missing | Use anonymous improve flow instead | | ||
| | `INVALID_INPUT` | metadata file malformed | File is corrupted; re-create rule | | ||
| | code | meaning | fix | | ||
| |-------------------------|------------------------------------------|---------------------------------------| | ||
| | `RULE_META_UNAVAILABLE` | no sidecar exists, and none is written | Use the ticket id from `rule create` | | ||
| | `INVALID_INPUT` | a sidecar exists and is malformed | Delete it; nothing here depends on it | | ||
|
|
||
| ## See Also | ||
|
|
||
| - `%(TASKLESS_CLI)s agent improve-rule`: the primary consumer of this command | ||
| - `%(TASKLESS_CLI)s agent improve-rule`: how the ticket id is actually sourced |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.