Skip to content

Conversation

@hrideshmg
Copy link
Member

@hrideshmg hrideshmg commented Oct 29, 2025

Sorry but im not even going to try and summarize everything that has been changed here. One major thing is the migration from discord based status updates to a mail based one. However:

Copilot Summary:

Replaces Discord channel-based status update tracking with Root's mail query system. This removes 200+ lines of Discord-specific mutation code in favor of direct Root API queries.

Core Changes

  • Status updates: Query Root directly for daily reports instead of tracking via Discord messages and reactions
  • GraphQL refactor: Split mutations into separate module, converted queries/mutations to client methods, introduced shared reqwest client
  • Tracing infrastructure: New trace.rs module with dynamic log level control and span instrumentation across main, scheduler, tasks, and commands
  • Config extraction: Bot configuration moved to dedicated config.rs with BotConfig struct

Breaking Changes

  • Status update system requires Root integration (no Discord channel fallback)
  • Environment variable OWNER_ID type changed

ivinjabraham and others added 30 commits August 13, 2025 20:08
Group all crate version and security updates into a single PR for
convenience.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Since the implementation of the track system, groups no longer exist and
therefore is no longer used anywhere.

Remove the unused field in the `Member` model.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Rust builds can be cached for faster builds in subsequent jobs. Use
`Swatinmen/rust-cache@v2` to automatically cache `target` and `.cargo`

Signed-off-by: Ivin Joel Abraham <[email protected]>
Signed-off-by: Ivin Joel Abraham <[email protected]>
A recent update to clippy introduced a new lint for strings that don't
interpolate variables. Fix any offending lines.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Bumps the version-updates group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.95` | `1.0.99` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.85` | `0.1.88` |
| [chrono](https://github.com/chronotope/chrono) | `0.4.39` | `0.4.41` |
| [chrono-tz](https://github.com/chronotope/chrono-tz) | `0.10.1` | `0.10.4` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.12` | `0.12.23` |
| [serde](https://github.com/serde-rs/serde) | `1.0.217` | `1.0.219` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.137` | `1.0.142` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.43.0` | `1.47.1` |


Updates `anyhow` from 1.0.95 to 1.0.99
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](dtolnay/anyhow@1.0.95...1.0.99)

Updates `async-trait` from 0.1.85 to 0.1.88
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](dtolnay/async-trait@0.1.85...0.1.88)

Updates `chrono` from 0.4.39 to 0.4.41
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](chronotope/chrono@v0.4.39...v0.4.41)

Updates `chrono-tz` from 0.10.1 to 0.10.4
- [Release notes](https://github.com/chronotope/chrono-tz/releases)
- [Commits](chronotope/chrono-tz@v0.10.1...v0.10.4)

Updates `reqwest` from 0.12.12 to 0.12.23
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](seanmonstar/reqwest@v0.12.12...v0.12.23)

Updates `serde` from 1.0.217 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.217...v1.0.219)

Updates `serde_json` from 1.0.137 to 1.0.142
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.137...v1.0.142)

Updates `tokio` from 1.43.0 to 1.47.1
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.43.0...tokio-1.47.1)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-version: 1.0.99
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: async-trait
  dependency-version: 0.1.88
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: chrono
  dependency-version: 0.4.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: chrono-tz
  dependency-version: 0.10.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: reqwest
  dependency-version: 0.12.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: serde
  dependency-version: 1.0.219
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: serde_json
  dependency-version: 1.0.142
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: tokio
  dependency-version: 1.47.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: version-updates
...

Signed-off-by: dependabot[bot] <[email protected]>
`setup_tracing` requires a few environment variables that can be
refactored into a standalone struct and accompanied function that can
load the required variables as well as provide sane defaults instead of
simply panicking when they are not found.

`crate_name` can be excluded as it is provided by Cargo.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The filter string is determined by the variables in TracingConfig and
can be extracted into a helper function.

Signed-off-by: Ivin Joel Abraham <[email protected]>
`setup_tracing` need not be concerned with how a subscriber is setup
given the required configuration. Extract the initialization into a
helper function that will allow for easier modification later.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The main module can be stripped of all the functionality related to
tracing and kept simple. Extract all functions and types that are
required for configuring tracing into it's own module.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The `AMD_RUST_ENV` is not an intuitive variable to set as it requires
the deployer to know the correct mode is "production". Change the type
and name to make it easier to get into development mode.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Entities defined in the crate root, `main.rs`, do not need to be marked
by `pub` in order to be visible to it's child modules.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Resources required for discord such as the DISCORD_TOKEN can be
encapsulated into it's own struct and have it's own helper function to
load it from the environment. This avoids cluttering main and allows
for easier future modification.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The prefix used to issue commands to the bot is part of the bot
configuration. Add it to the associated struct.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Building the Poise Framework is a long chain and can be pulled into a
helper.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The `Data` struct can be initialized using `impl` methods defined on it
and the existing `populate_data_with_reaction_roles` can be a similar
method as it only operates on the `Data` struct.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Functions that call a GraphQL mutation should be in a separate file from
queries.rs which as the name implies, is for GraphQL queries.

Fixes #69

Signed-off-by: Ivin Joel Abraham <[email protected]>
The `//!` notation can be used to denote the module documentation inside
the module. Documenting near the module definition in `main` would be
less visible.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Certain planned commands like toggling the status update checks and
changing tracks should only be accessible to certain senior roles. Add a
method that can authorize users.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The function that handles the set_log_level command can be more concise,
avoiding unnecessary pattern matching and returning if the level is
properly validated. Additionally, that function could also be broken
down into other functions.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The structure for commands needs to be scalable as it's the most common
addition to the bot. Move commands into it's own directory instead of
maintaining one file.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Turn off status update tracking for the fourth years as requested by
Harigovind.

Signed-off-by: Ivin Joel Abraham <[email protected]>
`load_tracing_config` should not be the name for a function that creates
a new `TracingConfig`. Rename as required to improve clarity.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Env. Variables should be dealt with once, during startup, to avoid
potential panics later on. Centralize the initialization and loading of
env. variables to one point and pass it to everything that needs it
later.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Debug mode should output traces, not info. This swap between debug and
production levels must have been a regression when this function was
first written.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Tracing is only initialized after loading in environment variables and
any code before must use basic stdout/stderr printing instead of tracing
macros.

Signed-off-by: Ivin Joel Abraham <[email protected]>
ivinjabraham and others added 21 commits September 30, 2025 01:37
Signed-off-by: Ivin Joel Abraham <[email protected]>
Extract the file and stdout layers to functions that can be easily
modified later.

This change might be a mistake, as it is less simple and a premature
optimization.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The close event seems unnecessary and clutters the log. New gives us the
required information.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Signed-off-by: Ivin Joel Abraham <[email protected]>
Signed-off-by: Ivin Joel Abraham <[email protected]>
Signed-off-by: Ivin Joel Abraham <[email protected]>
The motivation here is twofold. A) We don't have to access env. vars. at
runtime. B) This allows for debugging libraries without restarting with
changed env. vars.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The primary motivation for this change is to avoid unnecessarily
repeated calls to the env. var. ROOT_URL and more importantly, creating
new reqwest clients for each query and mutation. This has also resulted
in centralizing the ROOT_URL variable at the cost of introducing a new
struct to store in Data.

Signed-off-by: Ivin Joel Abraham <[email protected]>
The configuration logic can be kept in its own module. Main can then be
refactored to be more concise and contain less inline logic. Tracing
logs are the final cherry on top.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Following OOPS principles, it would be more convenient for the user and
developer to use the GraphQL interface if both data and methods were
encapsulated into the struct itself.

Signed-off-by: Ivin Joel Abraham <[email protected]>
Signed-off-by: Ivin Joel Abraham <[email protected]>
… updates

Bumps the version-updates group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.99` | `1.0.100` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.88` | `0.1.89` |
| [chrono](https://github.com/chronotope/chrono) | `0.4.41` | `0.4.42` |
| [serde](https://github.com/serde-rs/serde) | `1.0.219` | `1.0.228` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.142` | `1.0.145` |
| [tracing-subscriber](https://github.com/tokio-rs/tracing) | `0.3.19` | `0.3.20` |



Updates `anyhow` from 1.0.99 to 1.0.100
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](dtolnay/anyhow@1.0.99...1.0.100)

Updates `async-trait` from 0.1.88 to 0.1.89
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](dtolnay/async-trait@0.1.88...0.1.89)

Updates `chrono` from 0.4.41 to 0.4.42
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](chronotope/chrono@v0.4.41...v0.4.42)

Updates `serde` from 1.0.219 to 1.0.228
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.219...v1.0.228)

Updates `serde_json` from 1.0.142 to 1.0.145
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.142...v1.0.145)

Updates `tracing-subscriber` from 0.3.19 to 0.3.20
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](tokio-rs/tracing@tracing-subscriber-0.3.19...tracing-subscriber-0.3.20)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-version: 1.0.100
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: async-trait
  dependency-version: 0.1.89
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: chrono
  dependency-version: 0.4.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: serde
  dependency-version: 1.0.228
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: serde_json
  dependency-version: 1.0.145
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
- dependency-name: tracing-subscriber
  dependency-version: 0.3.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: version-updates
...

Signed-off-by: dependabot[bot] <[email protected]>
This commit removes the current discord based status update
functionality from amD and instead uses the updated root queries to
generate the status update report for the day.

Currently an MVP, the code needs some more cleanup for a full clean
migration.
@hrideshmg
Copy link
Member Author

@copilot can create PR description for this PR?

Copy link

Copilot AI commented Oct 29, 2025

@hrideshmg I've opened a new pull request, #91, to work on those changes. Once the pull request is ready, I'll request review from you.

@hrideshmg hrideshmg merged commit 07b56c4 into production Oct 29, 2025
2 checks passed
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.

3 participants